public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] Changing u-boot relocation scheme
Date: Thu, 24 Jul 2008 05:18:26 +0200	[thread overview]
Message-ID: <20080724031826.ECD9B248B9@gemini.denx.de> (raw)
In-Reply-To: Your message of "Wed, 23 Jul 2008 15:46:54 PDT." <f608b67d0807231546t44ef5a6ak68d98b26beb5d8fc@mail.gmail.com>

In message <f608b67d0807231546t44ef5a6ak68d98b26beb5d8fc@mail.gmail.com> you wrote:
> 
> > What is a module?
> 
> for the purposes of this discussion any .o file or any library of .o files.

Neither of these is executable - you either have to link these with
the U-Boot code or into a standalone application - and in both cases
none of the problems you describe happens.

> > How does a it relate to u-boot?
> 
> I need to extend u-boot with certain functionality available from those modules.

OK - as mentioned: either statically linked or as standalone app.

> > Why does it need to be relocated?
> 
> because the  modules are now part of u-boot, they need to be relocated
> along with the rest of the image.

U-Boot does this (if statically linked) the very same way like all
other U-Boot code gets relocated.

> > Why isn't it written in position independent manner?
> 
> because they come from different sources, not concerned with u-boot,
> and just work and need to be ported as is.

If you want to link against U-Boot, you have to use at least
compatible compiler options and the U-Boot linker script.

> > How is your relocation methodology going to fixup a module's data
> > structures?
> 
> The relocation will adjust only pointers to absolute addresses stored
> in text/data segments.

No.

> > What pointers are in your data structures?  Why do they need to be
> > relocated?
> 
> in some cases data structures include pointers to other data
> structures, etc. (This is called  'tree' btw, sorry couldn't resist
> :-)

This should get sorted out correctly when linking.

> > Gcc supports "proper" relocation, if only we knew how to make it work for
> > all "reasonable" versions of gcc (and Grant's conclusion is that many
> > versions of gcc in use today do *not* support the relocation).
> >  <http://article.gmane.org/gmane.comp.boot-loaders.u-boot/36343/>
> 
> well, if there is a pointer to a data element or to a function stored
> in a data structure, the .bin image is built and fixed using actual
> addresses set by the linker. How can gcc help here?

By adding the respective entries to the GOT.

> I am sure it is doable, I am just trying to understand if this would
> be accepted in general, because it can be done differently depending
> if one needs to push it upstream or not.

If you invest time in solving such problems, than your time willbe
much better iinvested if you try to help solving the remaining issues
with  Grant's code.

What Grant suggests is the way to go. I do not think your approach has
chances for mainline.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Nothing in progression can rest on its original plan. We may as  well
think  of  rocking  a grown man in the cradle of an infant.
- Edmund Burke

  reply	other threads:[~2008-07-24  3:18 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 [this message]
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
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=20080724031826.ECD9B248B9@gemini.denx.de \
    --to=wd@denx.de \
    --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