[U-Boot-Users] Question About how the CPU find the right string address in U-boot binary file ?

Jerry Van Baren gerald.vanbaren at ge.com
Thu Jun 5 14:31:54 CEST 2008


Kenneth Johansson wrote:
> On Thu, 2008-06-05 at 09:50 +0800, wang baohua wrote:
>> Dear Johansson,
>>  Thanks for your reply. Your reply is very clear, that's just my
>> question. In fact, I am study a
>> MIPS binary file, but I cannot find any resource, so I turn to PowerPC
>> platform and try to get
>> clear understand about the string loading process.
> 
> I'm not sure how similar MIPS is to ppc ABI.

...and why not install the Denx ELDK for MIPS instead of trying to 
cross-deduce MIPS from PPC disassemblies?  At the level of detail you 
are asking questions, you are likely to get wrong or misleading results 
by using a totally unrelated CPU architecture.

Note that finding strings and the got (Global Offset Table) are related 
to position independent code (PIC).  Look at gcc documentation and read 
up on the -fpic options (multiple!).  Note that PIC is very CPU 
architecture dependent.

>> I want to ask according to your reply:
>> 1. fff0358c: 80 7e 80 00     lwz r3,-32768(r30)
>>    Is the -32768 stand for  " entry 0 in the .got table" ?  Why such a
>> translate in objdump?
> 
> It's not objectdump that do this it's the compiler that generate the
> code like this. r30 is a pointer to the GOT table but the pointer is
> located so that it's possible to use the full range of the 16 bit signed
> offset. that is if the GOT table only have one entry the r30 value would
> be pointing outside of the table but since it's accessed with a singed
> offset it will still work. 

Just to tag on my 2 cents: You (Wang Baohua) are asking very low level 
detailed questions about how the compiler and linker work on a u-boot 
list.  We use the tools, we don't necessarily understand the gory 
details (as long as they work, we're happy...).  You should be asking 
these questions on a gcc compiler/binutils list.  In addition, if you 
want to know MIPS details, ask MIPS questions with MIPS examples of MIPS 
*compiler* experts.  Given the detail level of your questions, the 
answers *will* be different between MIPS and PowerPC.

>> 2. I found the .got2 section in the U-boot.map, can you tell me how to
>> calc the right string address (traps.o) ?
>>    .reloc          0xfff34000     0x1578
>>    *(.got)
>>                      0xfff34000                _GOT2_TABLE_ = .
>>   *(.got2)
>>  .got2          0xfff34000       0x24 cpu/mpc8260/start.o
>>  .got2          0xfff34024       0x4c cpu/mpc8260/libmpc8260.a(traps.o)
> 
> ?? I thought this was obvious. to get the entry from the code take the
> offset value used in the load and subtract -32768 to get the offset into
> the .got2 section. at that address will be a 32 bit address that is the
> address of the string. 

FWIIW, the offset of 0x8000 is curious.  This implies to me that either 
this particular string is the first one in the GOT or something is wrong.

HTH,
gvb




More information about the U-Boot mailing list