public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Txema Lopez <tlopez@aotek.es>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] fixup section problem.
Date: Thu, 02 Nov 2006 10:21:07 +0100	[thread overview]
Message-ID: <4549B883.7050309@aotek.es> (raw)

Hi,

We are working in a MPC5200B based custom board and we are developping a 
tool to relocate a U-Boot (1.1.4 version) binary file to a different 
address in flash that it was linked. So, we have to change  the GOT and 
FIXUP entries in the original file to point at the new address. Doing 
this work, we have found that, surprisingly, the FIXUP section in U-Boot 
is empty. When U-Boot is relocated from flash to sdram these lines in 
the file start.S have no effect:
    /*
     * Now adjust the fixups and the pointers to the fixups
     * in case we need to move ourselves again.
     */
2:    li    r0,__fixup_entries at sectoff@l
    lwz    r3,GOT(_FIXUP_TABLE_)
    cmpwi    r0,0
    mtctr    r0
    addi    r3,r3,-4
    beq    4f
3:    lwzu    r4,4(r3)
    lwzux    r0,r4,r11
    add    r0,r0,r11
    stw    r10,0(r3)
    stw    r0,0(r4)
    bdnz    3b
4:
Looking into the sources we have found some places where the fixup 
elements seem to be relocated manually, i.e.:
void malloc_bin_reloc (void)
{
    DECLARE_GLOBAL_DATA_PTR;

    unsigned long *p = (unsigned long *)(&av_[2]);
    int i;
   
    for (i=2; i<(sizeof(av_)/sizeof(mbinptr)); ++i) {
        *p++ += gd->reloc_off;
    }
}
Is there any reason to leave the FIXUP section empty in U-Boot? Is it a 
bug?.

Checking the u-boot.lds file for the IceCube board we have found that 
fhe fixup section is included in the TEXT section and in the RELOC 
section, but the linker generate code only for the TEXT section. If we 
put it only in the RELOC section the FIXUP is not empty, the pointers 
adjustement in the start.S seems to work properly and the 
malloc_bin_reloc() function would be not necessary. Does anynone know if 
I'am missing something?

Any clue will be welcomed.
Best regards,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: tlopez.vcf
Type: text/x-vcard
Size: 324 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20061102/6d27a20a/attachment.vcf 

             reply	other threads:[~2006-11-02  9:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-02  9:21 Txema Lopez [this message]
2006-11-02 11:31 ` [U-Boot-Users] fixup section problem Wolfgang Denk
2006-11-03  7:15   ` Txema Lopez
2006-11-03  8:16     ` Wolfgang Denk
2006-11-03 11:18       ` Txema Lopez
2007-02-12  4:45         ` Grant Likely
  -- strict thread matches above, loose matches on Subject: below --
2007-02-12  7:53 TXEMA LOPEZ
2007-02-12 19:26 ` Grant Likely
2007-02-12 19:40   ` Stefan Roese

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4549B883.7050309@aotek.es \
    --to=tlopez@aotek.es \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox