public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* Re: [ECOS] Library Circularity Question
@ 1999-07-07 15:49 Timothy Konkle
  0 siblings, 0 replies; 3+ messages in thread
From: Timothy Konkle @ 1999-07-07 15:49 UTC (permalink / raw)
  To: Jmills; +Cc: ecos-discuss

John,

I believe the need for multiple -lgcc arguments is due to the single pass 
linker nature. To deduce further, try adding in one library at a time in the
link and then use nm to list undefined references (the "U" symbol in second
column). The first -lgcc resolved some symbols but left others undefined,
the -lc resolved some of the previous -lgcc symbols but then now requires
some OTHER symbols that were really defined in the -lgcc (libgcc.a) library.
(I refer generically to gnu "nm", where it may be sh-hms-nm or such, following
the platform-architecture-name convention.)

--Tim Konkle
System Software and Tools
Cisco Systems, Inc.

> From Jmills@TGA.com Wed Jul  7 15:36:20 1999
> X-SMAP-Received-From: outside
> Mailing-List: contact ecos-discuss-help@sourceware.cygnus.com; run by ezmlm
> Delivered-To: mailing list ecos-discuss@sourceware.cygnus.com
> From: John Mills <Jmills@TGA.com>
> To: "'eCos Discussion'" <ecos-discuss@sourceware.cygnus.com>
> Cc: John Mills <Jmills@TGA.com>
> Date: Wed, 7 Jul 1999 18:40:46 -0400
> MIME-Version: 1.0
> Subject: [ECOS] Library Circularity Question
> 
> I ran into something I don't understand while linking a "toy" C++ example as
> a sh-elf executable. I am using sh-hms libraries built out of
> 'ecosSWtools-990319', and targeting the Hitachi EDK7045F development board.
> 
> Originally I provided a dummy 'delete' operator to satisfy linkage of a
> pro-forma C++ destructor. The problem came up when I tried to find a linkage
> sequence which would actually implement some dynamic storage allocation and
> deallocation. Linking with "-lgcc"
> [from "<tooldir>/lib/gcc-lib/sh-hms/2.9-ecosSWtools-990310/libgcc.a"] left
> unresolved symbols; adding a trailing link command "-lc" didn't resolve all;
> but adding a _second_ "-lgcc" after "-lc" resolved all symbols:
>     $(XLD) $(LDFLAGS) -o $@ ${OBJS} -lgcc -lc -lgcc
> 
> Any suggestions what is happening here?
> 
> Thanks -
> 
>   John Mills, Sr. Software Engineer
>   TGA Technologies, Inc.
>   100 Pinnacle Way, Suite 140
>   Norcross, GA 30071-3633
>   e-mail: jmills@tga.com
>   Phone: 770-421-2100 ext.124 (voice)
>          770-449-7740 (FAX)

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

* Re: [ECOS] Library Circularity Question
  1999-07-07 15:34 John Mills
@ 1999-07-07 15:49 ` Erik Horstkotte
  0 siblings, 0 replies; 3+ messages in thread
From: Erik Horstkotte @ 1999-07-07 15:49 UTC (permalink / raw)
  To: 'eCos Discussion'; +Cc: John Mills

> Originally I provided a dummy 'delete' operator to satisfy linkage of a
> pro-forma C++ destructor. The problem came up when I tried to find a linkage
> sequence which would actually implement some dynamic storage allocation and
> deallocation. Linking with "-lgcc"
> [from "<tooldir>/lib/gcc-lib/sh-hms/2.9-ecosSWtools-990310/libgcc.a"] left
> unresolved symbols; adding a trailing link command "-lc" didn't resolve all;
> but adding a _second_ "-lgcc" after "-lc" resolved all symbols:
>     $(XLD) $(LDFLAGS) -o $@ ${OBJS} -lgcc -lc -lgcc

It's a characteristic of the GNU linker, and the older Unix "ld" linkers. By default,
they only look externals up in each library once, from left to right. If a library on the
right externs something that's public in a library to its left, it won't find it.

Either specify the libraries more than once, as you did, or use the -( and -)
linker options to force the linker to check the libraries repeatedly, like the linkers
you're probably familiar with.

-- Erik


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

* [ECOS] Library Circularity Question
@ 1999-07-07 15:34 John Mills
  1999-07-07 15:49 ` Erik Horstkotte
  0 siblings, 1 reply; 3+ messages in thread
From: John Mills @ 1999-07-07 15:34 UTC (permalink / raw)
  To: 'eCos Discussion'; +Cc: John Mills

I ran into something I don't understand while linking a "toy" C++ example as
a sh-elf executable. I am using sh-hms libraries built out of
'ecosSWtools-990319', and targeting the Hitachi EDK7045F development board.

Originally I provided a dummy 'delete' operator to satisfy linkage of a
pro-forma C++ destructor. The problem came up when I tried to find a linkage
sequence which would actually implement some dynamic storage allocation and
deallocation. Linking with "-lgcc"
[from "<tooldir>/lib/gcc-lib/sh-hms/2.9-ecosSWtools-990310/libgcc.a"] left
unresolved symbols; adding a trailing link command "-lc" didn't resolve all;
but adding a _second_ "-lgcc" after "-lc" resolved all symbols:
    $(XLD) $(LDFLAGS) -o $@ ${OBJS} -lgcc -lc -lgcc

Any suggestions what is happening here?

Thanks -

  John Mills, Sr. Software Engineer
  TGA Technologies, Inc.
  100 Pinnacle Way, Suite 140
  Norcross, GA 30071-3633
  e-mail: jmills@tga.com
  Phone: 770-421-2100 ext.124 (voice)
         770-449-7740 (FAX)

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

end of thread, other threads:[~1999-07-07 15:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-07 15:49 [ECOS] Library Circularity Question Timothy Konkle
  -- strict thread matches above, loose matches on Subject: below --
1999-07-07 15:34 John Mills
1999-07-07 15:49 ` Erik Horstkotte

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).