public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* How do I prevent gcc from linking with GNU standard C library
@ 2002-04-26 17:02 Tanveer Ahmad
  2002-04-27  7:39 ` Daniel Jacobowitz
  2002-05-01 13:25 ` Jim Wilson
  0 siblings, 2 replies; 4+ messages in thread
From: Tanveer Ahmad @ 2002-04-26 17:02 UTC (permalink / raw)
  To: 'gcc@gcc.gnu.org'

Hi,
I want to link my program with a third party standard C library, instead of
the GNU standard C library. I used the "-nostdlib" option in gcc, however I
get the following warning during linking:

	/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to
080488d0

and, when I run "ldd" on the this binary, I still see that it requires
libc.so.6

Here's my gcc command line :
gcc -D__STDC_VERSION__=199901L -g -c t1.c -I /test/include
gcc -D__STDC_VERSION__=199901L  -fhonor-std  -fno-builtin -o  a.out t1.o
-lpthread -lgcc -nostdlib -nodefaultlibs /test/lib/sxlgcc2.a

Please advice.

thanks,
--Tanveer.

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

* Re: How do I prevent gcc from linking with GNU standard C library
  2002-04-26 17:02 How do I prevent gcc from linking with GNU standard C library Tanveer Ahmad
@ 2002-04-27  7:39 ` Daniel Jacobowitz
  2002-05-01 13:25 ` Jim Wilson
  1 sibling, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2002-04-27  7:39 UTC (permalink / raw)
  To: 'gcc@gcc.gnu.org'

On Fri, Apr 26, 2002 at 04:47:02PM -0700, Tanveer Ahmad wrote:
> Hi,
> I want to link my program with a third party standard C library, instead of
> the GNU standard C library. I used the "-nostdlib" option in gcc, however I
> get the following warning during linking:
> 
> 	/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to
> 080488d0
> 
> and, when I run "ldd" on the this binary, I still see that it requires
> libc.so.6
> 
> Here's my gcc command line :
> gcc -D__STDC_VERSION__=199901L -g -c t1.c -I /test/include
> gcc -D__STDC_VERSION__=199901L  -fhonor-std  -fno-builtin -o  a.out t1.o
> -lpthread -lgcc -nostdlib -nodefaultlibs /test/lib/sxlgcc2.a
> 
> Please advice.

libpthread.so presumably relies on the GNU standard library.  You'll
need a copy from your third party library vendor.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer

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

* Re: How do I prevent gcc from linking with GNU standard C library
  2002-04-26 17:02 How do I prevent gcc from linking with GNU standard C library Tanveer Ahmad
  2002-04-27  7:39 ` Daniel Jacobowitz
@ 2002-05-01 13:25 ` Jim Wilson
  1 sibling, 0 replies; 4+ messages in thread
From: Jim Wilson @ 2002-05-01 13:25 UTC (permalink / raw)
  To: Tanveer Ahmad; +Cc: 'gcc@gcc.gnu.org'

>I want to link my program with a third party standard C library, instead of
>the GNU standard C library. I used the "-nostdlib" option in gcc, however I
>get the following warning during linking:
>	/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 080488d0

-nostdlib does two things.  It disables linking against the default libraries
(i.e. libgcc and libc), and it disables linking against the startup files
(i.e. crt0.o).  _start is defined in one of the startup files.  Your program
will not work without the startup files.

If your third party library includes startup files, you could try linking
against them.  Probably, however, the right solution is to stop using
-nostdlib.  This is really only useful for embedded systems.  You are
already using -nodefaultlibs, which will avoid linking in the standard C
library.

See the documentation for -nostartfiles, -nostdlib, and -nodefaultlibs.

Jim



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

* Re: How do I prevent gcc from linking with GNU standard C library
@ 2002-04-26 19:08 Roger Sayle
  0 siblings, 0 replies; 4+ messages in thread
From: Roger Sayle @ 2002-04-26 19:08 UTC (permalink / raw)
  To: Tanveer Ahmad; +Cc: gcc


> Here's my gcc command line :
> gcc -D__STDC_VERSION__=199901L -g -c t1.c -I /test/include
> gcc -D__STDC_VERSION__=199901L  -fhonor-std  -fno-builtin -o  a.out t1.o
> -lpthread -lgcc -nostdlib -nodefaultlibs /test/lib/sxlgcc2.a

Probably unrelated to your problem, but -fno-builtin is a compile
time flag, not a link time flag.  In your example above, it should
be specified in the first gcc invocation not the second.  I guess
you'll also need -I- to disable the standard include paths, rather
than just use -I to append /test/include to the list.

Roger
--
Roger Sayle,                         E-mail: roger@eyesopen.com
OpenEye Scientific Software,         WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road,     Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507.         Fax: (+1) 505-473-0833

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

end of thread, other threads:[~2002-05-01 20:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-26 17:02 How do I prevent gcc from linking with GNU standard C library Tanveer Ahmad
2002-04-27  7:39 ` Daniel Jacobowitz
2002-05-01 13:25 ` Jim Wilson
2002-04-26 19:08 Roger Sayle

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