This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: How do I prevent gcc from linking with GNU standard C library


>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




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