public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Another redboot compile issue
@ 2003-10-24 18:18 John Newlin
  2003-10-24 18:37 ` Gary Thomas
  0 siblings, 1 reply; 7+ messages in thread
From: John Newlin @ 2003-10-24 18:18 UTC (permalink / raw)
  To: ecos-discuss


I see that Redboot is using a linker list to add commands to be linked
into the system.

The problem I am having is that when the .o files for redboot are added to
libtarget.a, that list is not fully populated.  If I put the redboot_*.o
files directly on the link line, everything is great

Any suggestions?  Should I just change the final link line to do this, or
is there a different preferred mechanism?

Thanks,

-John


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ECOS] Another redboot compile issue
  2003-10-24 18:18 [ECOS] Another redboot compile issue John Newlin
@ 2003-10-24 18:37 ` Gary Thomas
       [not found]   ` <20031024113822.M70391@shell.rawbw.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Gary Thomas @ 2003-10-24 18:37 UTC (permalink / raw)
  To: John Newlin; +Cc: ecos-discuss

On Fri, 2003-10-24 at 12:18, John Newlin wrote:
> I see that Redboot is using a linker list to add commands to be linked
> into the system.
> 

That's not really true.

> The problem I am having is that when the .o files for redboot are added to
> libtarget.a, that list is not fully populated.  If I put the redboot_*.o
> files directly on the link line, everything is great
> 
> Any suggestions?  Should I just change the final link line to do this, or
> is there a different preferred mechanism?

If you want to add new commands, make sure that they are put into
libextras.a, otherwise they won't end up in the final image.  Changing
the way RedBoot is built/linked should not be necessary at all.

-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ECOS] Another redboot compile issue
       [not found]   ` <20031024113822.M70391@shell.rawbw.com>
@ 2003-10-24 18:52     ` Gary Thomas
  2003-10-24 19:05       ` John Newlin
  0 siblings, 1 reply; 7+ messages in thread
From: Gary Thomas @ 2003-10-24 18:52 UTC (permalink / raw)
  To: John Newlin; +Cc: eCos Discussion

Please copy responses to the mailing list so that all may benefit.
Private email support is only available under contract.

On Fri, 2003-10-24 at 12:48, John Newlin wrote:
> Hi Gary,
> 
> Thanks for the reply.
> 
> The object files are all in libtarget.a (redboot_mfill.o for example).
> However they are not being included in the final .elf file unless I
> explicitly add the redboot_mfill.o to the link line.
> 

Look at the RedBoot CDL - it puts those files into libextras.a.  The
linking process won't work unless this happens, as you are seeing.

> It might just be a bug in the binutils that I have, the architecture
> vendor has ports of some rather old tools. (in this case ld is 2.11.2)
> 
> I may have a bug in my target.ld file as well, but I'm not sure
> what it could be.
> 
> Thanks for your help,
> 
> -john
> 
> 
> 
> On Fri, 24 Oct 2003, Gary Thomas wrote:
> 
> > On Fri, 2003-10-24 at 12:18, John Newlin wrote:
> > > I see that Redboot is using a linker list to add commands to be linked
> > > into the system.
> > >
> >
> > That's not really true.
> >
> > > The problem I am having is that when the .o files for redboot are added to
> > > libtarget.a, that list is not fully populated.  If I put the redboot_*.o
> > > files directly on the link line, everything is great
> > >
> > > Any suggestions?  Should I just change the final link line to do this, or
> > > is there a different preferred mechanism?
> >
> > If you want to add new commands, make sure that they are put into
> > libextras.a, otherwise they won't end up in the final image.  Changing
> > the way RedBoot is built/linked should not be necessary at all.
> >
> > --
> > Gary Thomas <gary@mlbassoc.com>
> > MLB Associates
> >
-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ECOS] Another redboot compile issue
  2003-10-24 18:52     ` Gary Thomas
@ 2003-10-24 19:05       ` John Newlin
  2003-10-24 19:09         ` Gary Thomas
  0 siblings, 1 reply; 7+ messages in thread
From: John Newlin @ 2003-10-24 19:05 UTC (permalink / raw)
  To: Gary Thomas; +Cc: eCos Discussion


I mispoke, libextras.a has the redboot_*.o files in it.
But do not get linked in, unless the files are specified on the link
line.

in the hal/common/.../hal.cdl there is a compile line that attempts to
compile everything in libextras.a into extras.o.  However, my extras.o is
ending up empty.

Something like:
$(CC) $(CFLAGS) -nostdlib -Wl,-r -Wl,--whole-archive -o $@ $<

Then extras.o is in my target.ld file.

Thanks again for the help!

-john


On Fri, 24 Oct 2003, Gary Thomas wrote:

> Please copy responses to the mailing list so that all may benefit.
> Private email support is only available under contract.
>
> On Fri, 2003-10-24 at 12:48, John Newlin wrote:
> > Hi Gary,
> >
> > Thanks for the reply.
> >
> > The object files are all in libtarget.a (redboot_mfill.o for example).
> > However they are not being included in the final .elf file unless I
> > explicitly add the redboot_mfill.o to the link line.
> >
>
> Look at the RedBoot CDL - it puts those files into libextras.a.  The
> linking process won't work unless this happens, as you are seeing.
>
> > It might just be a bug in the binutils that I have, the architecture
> > vendor has ports of some rather old tools. (in this case ld is 2.11.2)
> >
> > I may have a bug in my target.ld file as well, but I'm not sure
> > what it could be.
> >
> > Thanks for your help,
> >
> > -john
> >
> >
> >
> > On Fri, 24 Oct 2003, Gary Thomas wrote:
> >
> > > On Fri, 2003-10-24 at 12:18, John Newlin wrote:
> > > > I see that Redboot is using a linker list to add commands to be linked
> > > > into the system.
> > > >
> > >
> > > That's not really true.
> > >
> > > > The problem I am having is that when the .o files for redboot are added to
> > > > libtarget.a, that list is not fully populated.  If I put the redboot_*.o
> > > > files directly on the link line, everything is great
> > > >
> > > > Any suggestions?  Should I just change the final link line to do this, or
> > > > is there a different preferred mechanism?
> > >
> > > If you want to add new commands, make sure that they are put into
> > > libextras.a, otherwise they won't end up in the final image.  Changing
> > > the way RedBoot is built/linked should not be necessary at all.
> > >
> > > --
> > > Gary Thomas <gary@mlbassoc.com>
> > > MLB Associates
> > >
> --
> Gary Thomas <gary@mlbassoc.com>
> MLB Associates
>

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ECOS] Another redboot compile issue
  2003-10-24 19:05       ` John Newlin
@ 2003-10-24 19:09         ` Gary Thomas
  2003-10-24 19:59           ` John Newlin
  0 siblings, 1 reply; 7+ messages in thread
From: Gary Thomas @ 2003-10-24 19:09 UTC (permalink / raw)
  To: John Newlin; +Cc: eCos Discussion

On Fri, 2003-10-24 at 13:05, John Newlin wrote:
> I mispoke, libextras.a has the redboot_*.o files in it.
> But do not get linked in, unless the files are specified on the link
> line.
> 
> in the hal/common/.../hal.cdl there is a compile line that attempts to
> compile everything in libextras.a into extras.o.  However, my extras.o is
> ending up empty.
> 

This is your problem then.  We use libextras.a to hold everything that
we know a priori will be required in the link.  The library libtarget.a
gets everything else - stuff that *might* be needed.  However, because
of the way linking works, we need to munge libextras.a into a single
object file (extras.o) so that all of that code ends up in the final
result.

> Something like:
> $(CC) $(CFLAGS) -nostdlib -Wl,-r -Wl,--whole-archive -o $@ $<
> 
> Then extras.o is in my target.ld file.

I'm confused what you are saying here.  Are you indicating that if you
manually rebuild extras.o, it works, but the automatic build does not?

> 
> Thanks again for the help!
> 
> -john
> 
> 
> On Fri, 24 Oct 2003, Gary Thomas wrote:
> 
> > Please copy responses to the mailing list so that all may benefit.
> > Private email support is only available under contract.
> >
> > On Fri, 2003-10-24 at 12:48, John Newlin wrote:
> > > Hi Gary,
> > >
> > > Thanks for the reply.
> > >
> > > The object files are all in libtarget.a (redboot_mfill.o for example).
> > > However they are not being included in the final .elf file unless I
> > > explicitly add the redboot_mfill.o to the link line.
> > >
> >
> > Look at the RedBoot CDL - it puts those files into libextras.a.  The
> > linking process won't work unless this happens, as you are seeing.
> >
> > > It might just be a bug in the binutils that I have, the architecture
> > > vendor has ports of some rather old tools. (in this case ld is 2.11.2)
> > >
> > > I may have a bug in my target.ld file as well, but I'm not sure
> > > what it could be.
> > >
> > > Thanks for your help,
> > >
> > > -john
> > >
> > >
> > >
> > > On Fri, 24 Oct 2003, Gary Thomas wrote:
> > >
> > > > On Fri, 2003-10-24 at 12:18, John Newlin wrote:
> > > > > I see that Redboot is using a linker list to add commands to be linked
> > > > > into the system.
> > > > >
> > > >
> > > > That's not really true.
> > > >
> > > > > The problem I am having is that when the .o files for redboot are added to
> > > > > libtarget.a, that list is not fully populated.  If I put the redboot_*.o
> > > > > files directly on the link line, everything is great
> > > > >
> > > > > Any suggestions?  Should I just change the final link line to do this, or
> > > > > is there a different preferred mechanism?
> > > >
> > > > If you want to add new commands, make sure that they are put into
> > > > libextras.a, otherwise they won't end up in the final image.  Changing
> > > > the way RedBoot is built/linked should not be necessary at all.
> > > >
> > > > --
> > > > Gary Thomas <gary@mlbassoc.com>
> > > > MLB Associates
> > > >
> > --
> > Gary Thomas <gary@mlbassoc.com>
> > MLB Associates
> >
-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ECOS] Another redboot compile issue
  2003-10-24 19:09         ` Gary Thomas
@ 2003-10-24 19:59           ` John Newlin
  2003-10-24 20:47             ` [ECOS] Another redboot compile issue (resolved) John Newlin
  0 siblings, 1 reply; 7+ messages in thread
From: John Newlin @ 2003-10-24 19:59 UTC (permalink / raw)
  To: Gary Thomas; +Cc: eCos Discussion

> On Fri, 2003-10-24 at 13:05, John Newlin wrote:
> > I mispoke, libextras.a has the redboot_*.o files in it.
> > But do not get linked in, unless the files are specified on the link
> > line.
> >
> > in the hal/common/.../hal.cdl there is a compile line that attempts to
> > compile everything in libextras.a into extras.o.  However, my extras.o is
> > ending up empty.
> >
>
> This is your problem then.  We use libextras.a to hold everything that
> we know a priori will be required in the link.  The library libtarget.a
> gets everything else - stuff that *might* be needed.  However, because
> of the way linking works, we need to munge libextras.a into a single
> object file (extras.o) so that all of that code ends up in the final
> result.
>
> > Something like:
> > $(CC) $(CFLAGS) -nostdlib -Wl,-r -Wl,--whole-archive -o $@ $<
> >
> > Then extras.o is in my target.ld file.
>
> I'm confused what you are saying here.  Are you indicating that if you
> manually rebuild extras.o, it works, but the automatic build does not?

No, I'm saying that the above line creates a .o file that is empty.  I
believe that is the part of the process that is broken.  Probably a linker
bug in my version of ld.


Thanks,

-John



>
> >
> > Thanks again for the help!
> >
> > -john
> >
> >
> > On Fri, 24 Oct 2003, Gary Thomas wrote:
> >
> > > Please copy responses to the mailing list so that all may benefit.
> > > Private email support is only available under contract.
> > >
> > > On Fri, 2003-10-24 at 12:48, John Newlin wrote:
> > > > Hi Gary,
> > > >
> > > > Thanks for the reply.
> > > >
> > > > The object files are all in libtarget.a (redboot_mfill.o for example).
> > > > However they are not being included in the final .elf file unless I
> > > > explicitly add the redboot_mfill.o to the link line.
> > > >
> > >
> > > Look at the RedBoot CDL - it puts those files into libextras.a.  The
> > > linking process won't work unless this happens, as you are seeing.
> > >
> > > > It might just be a bug in the binutils that I have, the architecture
> > > > vendor has ports of some rather old tools. (in this case ld is 2.11.2)
> > > >
> > > > I may have a bug in my target.ld file as well, but I'm not sure
> > > > what it could be.
> > > >
> > > > Thanks for your help,
> > > >
> > > > -john
> > > >
> > > >
> > > >
> > > > On Fri, 24 Oct 2003, Gary Thomas wrote:
> > > >
> > > > > On Fri, 2003-10-24 at 12:18, John Newlin wrote:
> > > > > > I see that Redboot is using a linker list to add commands to be linked
> > > > > > into the system.
> > > > > >
> > > > >
> > > > > That's not really true.
> > > > >
> > > > > > The problem I am having is that when the .o files for redboot are added to
> > > > > > libtarget.a, that list is not fully populated.  If I put the redboot_*.o
> > > > > > files directly on the link line, everything is great
> > > > > >
> > > > > > Any suggestions?  Should I just change the final link line to do this, or
> > > > > > is there a different preferred mechanism?
> > > > >
> > > > > If you want to add new commands, make sure that they are put into
> > > > > libextras.a, otherwise they won't end up in the final image.  Changing
> > > > > the way RedBoot is built/linked should not be necessary at all.
> > > > >
> > > > > --
> > > > > Gary Thomas <gary@mlbassoc.com>
> > > > > MLB Associates
> > > > >
> > > --
> > > Gary Thomas <gary@mlbassoc.com>
> > > MLB Associates
> > >
> --
> Gary Thomas <gary@mlbassoc.com>
> MLB Associates
>
>
> --
> Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
> and search the list archive: http://sources.redhat.com/ml/ecos-discuss
>

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ECOS] Another redboot compile issue (resolved)
  2003-10-24 19:59           ` John Newlin
@ 2003-10-24 20:47             ` John Newlin
  0 siblings, 0 replies; 7+ messages in thread
From: John Newlin @ 2003-10-24 20:47 UTC (permalink / raw)
  To: Gary Thomas; +Cc: eCos Discussion


I figured out the problem...

The compile line looks like below, but when ld is invoked, it is invoked
with the --whole-archive at the end of the command.  This switch has to be
before the lib that you want to link in wholely.

So clearly there's a bug in my toolchain, that moves this option around.

To workaround the problem, I changed the compile to this:

$(CC) $(CFLAGS) -nostdlib -Wl,-r -Wl,--whole-archive -ltarget
-Wl,--no-whole-target -o $@ $<


Oh, and redboot is up and happy now  :)

Thanks for you help Gary  :)

-john




 On Fri, 24 Oct 2003, John Newlin wrote:

> > On Fri, 2003-10-24 at 13:05, John Newlin wrote:
> > > I mispoke, libextras.a has the redboot_*.o files in it.
> > > But do not get linked in, unless the files are specified on the link
> > > line.
> > >
> > > in the hal/common/.../hal.cdl there is a compile line that attempts to
> > > compile everything in libextras.a into extras.o.  However, my extras.o is
> > > ending up empty.
> > >
> >
> > This is your problem then.  We use libextras.a to hold everything that
> > we know a priori will be required in the link.  The library libtarget.a
> > gets everything else - stuff that *might* be needed.  However, because
> > of the way linking works, we need to munge libextras.a into a single
> > object file (extras.o) so that all of that code ends up in the final
> > result.
> >
> > > Something like:
> > > $(CC) $(CFLAGS) -nostdlib -Wl,-r -Wl,--whole-archive -o $@ $<
> > >
> > > Then extras.o is in my target.ld file.
> >
> > I'm confused what you are saying here.  Are you indicating that if you
> > manually rebuild extras.o, it works, but the automatic build does not?
>
> No, I'm saying that the above line creates a .o file that is empty.  I
> believe that is the part of the process that is broken.  Probably a linker
> bug in my version of ld.
>
>
> Thanks,
>
> -John
>
>
>
> >
> > >
> > > Thanks again for the help!
> > >
> > > -john
> > >
> > >
> > > On Fri, 24 Oct 2003, Gary Thomas wrote:
> > >
> > > > Please copy responses to the mailing list so that all may benefit.
> > > > Private email support is only available under contract.
> > > >
> > > > On Fri, 2003-10-24 at 12:48, John Newlin wrote:
> > > > > Hi Gary,
> > > > >
> > > > > Thanks for the reply.
> > > > >
> > > > > The object files are all in libtarget.a (redboot_mfill.o for example).
> > > > > However they are not being included in the final .elf file unless I
> > > > > explicitly add the redboot_mfill.o to the link line.
> > > > >
> > > >
> > > > Look at the RedBoot CDL - it puts those files into libextras.a.  The
> > > > linking process won't work unless this happens, as you are seeing.
> > > >
> > > > > It might just be a bug in the binutils that I have, the architecture
> > > > > vendor has ports of some rather old tools. (in this case ld is 2.11.2)
> > > > >
> > > > > I may have a bug in my target.ld file as well, but I'm not sure
> > > > > what it could be.
> > > > >
> > > > > Thanks for your help,
> > > > >
> > > > > -john
> > > > >
> > > > >
> > > > >
> > > > > On Fri, 24 Oct 2003, Gary Thomas wrote:
> > > > >
> > > > > > On Fri, 2003-10-24 at 12:18, John Newlin wrote:
> > > > > > > I see that Redboot is using a linker list to add commands to be linked
> > > > > > > into the system.
> > > > > > >
> > > > > >
> > > > > > That's not really true.
> > > > > >
> > > > > > > The problem I am having is that when the .o files for redboot are added to
> > > > > > > libtarget.a, that list is not fully populated.  If I put the redboot_*.o
> > > > > > > files directly on the link line, everything is great
> > > > > > >
> > > > > > > Any suggestions?  Should I just change the final link line to do this, or
> > > > > > > is there a different preferred mechanism?
> > > > > >
> > > > > > If you want to add new commands, make sure that they are put into
> > > > > > libextras.a, otherwise they won't end up in the final image.  Changing
> > > > > > the way RedBoot is built/linked should not be necessary at all.
> > > > > >
> > > > > > --
> > > > > > Gary Thomas <gary@mlbassoc.com>
> > > > > > MLB Associates
> > > > > >
> > > > --
> > > > Gary Thomas <gary@mlbassoc.com>
> > > > MLB Associates
> > > >
> > --
> > Gary Thomas <gary@mlbassoc.com>
> > MLB Associates
> >
> >
> > --
> > Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
> > and search the list archive: http://sources.redhat.com/ml/ecos-discuss
> >
>
> --
> Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
> and search the list archive: http://sources.redhat.com/ml/ecos-discuss
>

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-10-24 20:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-24 18:18 [ECOS] Another redboot compile issue John Newlin
2003-10-24 18:37 ` Gary Thomas
     [not found]   ` <20031024113822.M70391@shell.rawbw.com>
2003-10-24 18:52     ` Gary Thomas
2003-10-24 19:05       ` John Newlin
2003-10-24 19:09         ` Gary Thomas
2003-10-24 19:59           ` John Newlin
2003-10-24 20:47             ` [ECOS] Another redboot compile issue (resolved) John Newlin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).