[VxWorks] Use -l:crt0.o instead of crt0.o%s

Richard Sandiford richard@codesourcery.com
Wed Apr 11 18:33:00 GMT 2007


The VxWorks version of the GNU linker has long supported the -l:foo
option, which searches the -L path for a filename called "foo" rather
than "libfoo.a" or "libfoo.so".  The extension was accepted into FSF
binutils last month (thanks Nick!).

I think VxWorks targets should use this extension to search for crt0.o.
crt0.o is provided the operating system vendor rather than GCC itself,
and GCC has no knowledge of where the canonical crt0.o is.  The current
specs nevertheless search for it using "crt0.o%s" (i.e. "look for crt0.o
in the compiler's own directories"), so you often need to add a -Bfoo/
option when linking.  Using -Bfoo/ for this purpose seems less than ideal,
since it also adds foo/ to the host paths.  (I've always been a bit queasy
about treating -B as a user option.)

If we use -l:crt0.o instead, the user can just use normal -L options,
like they can for the C library.  Tested on i586-wrs-vxworks.
OK to install?

Richard


gcc/
	* config/vxworks.h (VXWORKS_STARTFILE_SPEC): Use -lcrt0.o instead
	of crt0.o%s.

Index: gcc/config/vxworks.h
===================================================================
--- gcc/config/vxworks.h	(revision 123712)
+++ gcc/config/vxworks.h	(working copy)
@@ -78,7 +78,7 @@ #define VXWORKS_LIBGCC_SPEC \
   "-lgcc %{mrtp:--exclude-libs=libc_internal,libgcc -lc_internal}"
 
 #undef VXWORKS_STARTFILE_SPEC
-#define	VXWORKS_STARTFILE_SPEC "%{mrtp:%{!shared:crt0.o%s}}"
+#define	VXWORKS_STARTFILE_SPEC "%{mrtp:%{!shared:-l:crt0.o}}"
 #define VXWORKS_ENDFILE_SPEC ""
 
 /* Do VxWorks-specific parts of OVERRIDE_OPTIONS.  */



More information about the Gcc-patches mailing list