This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Another redboot compile issue (resolved)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]