From: Jerry Van Baren <gerald.vanbaren@ge.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] Changing u-boot relocation scheme
Date: Fri, 25 Jul 2008 11:21:12 -0400 [thread overview]
Message-ID: <4889EF68.7090108@ge.com> (raw)
In-Reply-To: <f608b67d0807250751j137e70c0oe67affcf46399c8e@mail.gmail.com>
vb wrote:
> On Fri, Jul 25, 2008 at 7:33 AM, kenneth johansson <kenneth@southpole.se> wrote:
>
>> here is a patch to generate dynamic relocations in the elf file. What is
>> the next step? objcopy -j .rela.dyn -O binary u-boot dyn_reloc_table ??
>>
>> ----------------
>> --- config.mk
>> +++ config.mk
>> @@ -215,7 +215,8 @@
>>
>> AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS)
>>
>> -LDFLAGS += -Bstatic -T $(LDSCRIPT) $(PLATFORM_LDFLAGS)
>> +#LDFLAGS += -Bstatic -T $(LDSCRIPT) $(PLATFORM_LDFLAGS)
>> +LDFLAGS += -Bstatic -shared -T $(LDSCRIPT) $(PLATFORM_LDFLAGS)
>> ifneq ($(TEXT_BASE),)
>> LDFLAGS += -Ttext $(TEXT_BASE)
>> endif
>>
>
> Interesting, but after this step we have a file which can't be
> converted to a runnable binary without resolving the relocation
> information first, right? This is not good then, as we need something
> to run from reset.
>
> I think this discussion covers much more ground than needed: certainly
> the problem of running the same executable at different addresses has
> been solved many times over, for different architectures and file
> formats. The thing is that unless we want the loader be part of u-boot
> we can not use those standard solutions. And I don't think we want,
> because it would be an unnecessary complication.
>
> I still believe that my original suggestion of determining the
> addresses of pointers to relocate by comparing to stripped binaries is
> the simplest way to do it across architectures. Apparently the same
> could be achieved by using -mrelocatable on powerPc, this still
> remains to be seen.
>
> cheers,
> /vb
Well, to circle back around, Grant Likely *DID* ELF-based relocation
*SUCCESSFULLY* so it *CAN* be done the right way. He just didn't have a
full recipe that worked over all "popular" compiler versions, didn't
have the time to identify /why/ it didn't work on certain compiler
versions, and didn't try to run on architectures that he didn't have
physical access to.
Doing the relocation the right way will be much more future-proof than
doing it a different wrong way.
The relocation information is in the ELF file until and unless we remove
it. "Normal" ELF executables retain that relocation information... that
is exactly what the "L" (it) is for. The linux loader (elf loader)
loads an executable into an arbitrary memory location and relocates it
by fixing up addresses based on the relocation table.
To reiterate, Grant had a proof-of-concept (well beyond p-o-c, actually)
that did everything you are asking for, but the right way and even in
the same architecture that you are interested in. Despite the chest
beating that has gone on in this thread about supporting other
architectures, I'm 100% positive that they are also supported with fixup
tables, if only we knew enough to use them.
You can stand on the *shoulders* of giants or their toes.
Best regards,
gvb
next prev parent reply other threads:[~2008-07-25 15:21 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-23 17:39 [U-Boot-Users] Changing u-boot relocation scheme vb
2008-07-23 21:46 ` Jerry Van Baren
2008-07-23 22:46 ` vb
2008-07-24 3:18 ` Wolfgang Denk
2008-07-24 6:45 ` vb
2008-07-24 9:58 ` Haavard Skinnemoen
2008-07-24 13:47 ` vb
2008-07-24 12:23 ` Jerry Van Baren
2008-07-24 12:47 ` Kenneth Johansson
2008-07-24 13:50 ` vb
2008-07-24 13:01 ` Wolfgang Denk
2008-07-24 13:17 ` Kenneth Johansson
2008-07-24 16:57 ` Haavard Skinnemoen
2008-07-24 17:12 ` Kenneth Johansson
2008-07-25 9:16 ` Haavard Skinnemoen
2008-07-24 17:37 ` vb
2008-07-24 18:09 ` Kenneth Johansson
2008-07-24 18:26 ` vb
2008-07-24 18:32 ` Joakim Tjernlund
2008-07-24 18:41 ` Kenneth Johansson
2008-07-25 4:28 ` Wolfgang Denk
2008-07-26 5:48 ` Grant Likely
2008-07-26 7:53 ` kenneth johansson
2008-07-26 12:48 ` Grant Likely
2008-07-25 4:28 ` Wolfgang Denk
2008-07-25 9:10 ` Haavard Skinnemoen
2008-07-25 11:55 ` kenneth johansson
2008-07-25 12:19 ` Haavard Skinnemoen
2008-07-25 13:30 ` Joakim Tjernlund
2008-07-26 5:36 ` Wolfgang Denk
2008-07-25 14:33 ` kenneth johansson
2008-07-25 14:51 ` vb
2008-07-25 15:21 ` Jerry Van Baren [this message]
2008-07-25 18:50 ` Haavard Skinnemoen
2008-07-25 19:03 ` Jerry Van Baren
2008-07-26 5:36 ` Wolfgang Denk
2008-07-26 16:09 ` Haavard Skinnemoen
2008-07-26 6:06 ` Grant Likely
2008-07-26 6:11 ` Grant Likely
2008-07-26 12:49 ` Wolfgang Denk
2008-07-26 5:36 ` Wolfgang Denk
2008-07-26 5:51 ` vb
2008-07-25 15:23 ` Haavard Skinnemoen
2008-07-25 16:31 ` kenneth johansson
2008-07-25 17:02 ` Jerry Van Baren
2008-07-25 17:28 ` kenneth johansson
2008-07-25 18:35 ` Haavard Skinnemoen
2008-07-25 19:57 ` J. William Campbell
2008-07-25 20:51 ` kenneth johansson
2008-07-26 15:54 ` Haavard Skinnemoen
2008-07-26 21:29 ` J. William Campbell
2008-07-26 21:58 ` Haavard Skinnemoen
2008-07-27 0:15 ` J. William Campbell
2008-07-26 5:36 ` Wolfgang Denk
2008-07-26 7:41 ` kenneth johansson
2008-07-26 12:49 ` Wolfgang Denk
2008-07-26 5:57 ` Grant Likely
2008-07-26 14:03 ` Jean-Christophe PLAGNIOL-VILLARD
2008-07-26 14:29 ` Joakim Tjernlund
2008-07-25 16:48 ` J. William Campbell
2008-07-25 4:28 ` Wolfgang Denk
2008-07-24 13:45 ` Jon Loeliger
2008-07-24 13:52 ` vb
2008-07-26 5:43 ` Grant Likely
2008-07-26 5:54 ` vb
2008-07-26 6:20 ` Grant Likely
2008-07-24 3:18 ` Wolfgang Denk
2008-07-24 6:20 ` Robert Schwebel
2008-09-15 14:56 ` [U-Boot] " vb
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=4889EF68.7090108@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox