From: Jerry Van Baren <gerald.vanbaren@ge.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] Question About how the CPU find the right string address in U-boot binary file ?
Date: Thu, 05 Jun 2008 08:31:54 -0400 [thread overview]
Message-ID: <4847DCBA.5020908@ge.com> (raw)
In-Reply-To: <1212659595.7271.14.camel@localhost.localdomain>
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
next prev parent reply other threads:[~2008-06-05 12:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-04 4:04 [U-Boot-Users] Question About how the CPU find the right string address in U-boot binary file ? wang baohua
2008-06-04 12:49 ` Jerry Van Baren
2008-06-05 2:07 ` wang baohua
2008-06-04 14:51 ` Kenneth Johansson
[not found] ` <1212589540.6922.26.camel@localhost.localdomain>
[not found] ` <6f6a960f0806041850l68abb1b3s31709aef8e76c70f@mail.gmail.com>
2008-06-05 9:53 ` Kenneth Johansson
2008-06-05 12:31 ` Jerry Van Baren [this message]
[not found] ` <6f6a960f0806050517x2418e5c0m4dd88f251e2d93f4@mail.gmail.com>
2008-06-05 15:39 ` Kenneth Johansson
2008-06-05 16:00 ` Wolfgang Denk
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=4847DCBA.5020908@ge.com \
--to=gerald.vanbaren@ge.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.