This is the mail archive of the gcc-patches@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]

[PATCH] Add support for FreeBSD moved ld.so.


FreeBSD 5.2 and later moved ld.so from /usr/libexec to /libexec.
This patch brings GCC up to date with this changed, starting with FreeBSD
6.0.

OK to commit to mainline and 3.4 branch?

-- 
-- David  (obrien@FreeBSD.org)



2004-02-25  David O'Brien  <obrien@FreeBSD.org>

	* config/freebsd-spec.h (FBSD_DYNAMIC_LINKER): Add.
	* config/alpha/freebsd.h (SUBTARGET_EXTRA_SPECS): Define
	%(fbsd_dynamic_linker),
	(LINK_SPEC): Use %(fbsd_dynamic_linker), and sync style with
	config/i386/freebsd.h
	* config/arm/freebsd.h: Ditto.
	* config/i386/freebsd.h: Ditto.
	* config/i386/freebsd64.h: Ditto.
	* config/ia64/freebsd.h: Ditto.
	* config/rs6000/sysv4.h: Ditto.
	* config/sparc/freebsd.h: Ditto.


Index: config/freebsd-spec.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/freebsd-spec.h,v
retrieving revision 1.7
diff -u -r1.7 freebsd-spec.h
--- config/freebsd-spec.h	4 Feb 2004 20:00:52 -0000	1.7
+++ config/freebsd-spec.h	25 Feb 2004 17:41:16 -0000
@@ -147,3 +147,9 @@
   }"
 #endif
 #endif
+
+#if FBSD_MAJOR < 6
+#define FBSD_DYNAMIC_LINKER "/usr/libexec/ld-elf.so.1"
+#else
+#define FBSD_DYNAMIC_LINKER "/libexec/ld-elf.so.1"
+#endif

Index: config/alpha/freebsd.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/freebsd.h,v
retrieving revision 1.16
diff -u -r1.16 freebsd.h
--- config/alpha/freebsd.h	27 Sep 2003 04:48:12 -0000	1.16
+++ config/alpha/freebsd.h	25 Feb 2004 17:41:16 -0000
@@ -20,12 +20,15 @@
 Boston, MA 02111-1307, USA.  */
 
 
+#define SUBTARGET_EXTRA_SPECS \
+  { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }
+
 /* Provide a FBSD_TARGET_CPU_CPP_BUILTINS and CPP_SPEC appropriate for
    FreeBSD/alpha.  Besides the dealing with
    the GCC option `-posix', and PIC issues as on all FreeBSD platforms, we must
    deal with the Alpha's FP issues.  */
 
-#undef FBSD_TARGET_CPU_CPP_BUILTINS
+#undef  FBSD_TARGET_CPU_CPP_BUILTINS
 #define FBSD_TARGET_CPU_CPP_BUILTINS()		\
   do						\
     {						\
@@ -45,12 +48,12 @@
   %{Wl,*:%*}								\
   %{assert*} %{R*} %{rpath*} %{defsym*}					\
   %{shared:-Bshareable %{h*} %{soname*}}				\
-  %{symbolic:-Bsymbolic}						\
   %{!shared:								\
     %{!static:								\
       %{rdynamic:-export-dynamic}					\
-      %{!dynamic-linker:-dynamic-linker /usr/libexec/ld-elf.so.1}}	\
-    %{static:-Bstatic}}"
+      %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }}	\
+    %{static:-Bstatic}}							\
+  %{symbolic:-Bsymbolic}"
 
 
 /************************[  Target stuff  ]***********************************/

Index: config/arm/freebsd.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/freebsd.h,v
retrieving revision 1.4
diff -u -r1.4 freebsd.h
--- config/arm/freebsd.h	19 Jun 2003 21:47:06 -0000	1.4
+++ config/arm/freebsd.h	25 Feb 2004 17:41:16 -0000
@@ -20,8 +20,25 @@
    Boston, MA 02111-1307, USA.  */
 
 
+#define SUBTARGET_EXTRA_SPECS \
+  { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }
+
 #undef  SUBTARGET_CPP_SPEC
 #define SUBTARGET_CPP_SPEC FBSD_CPP_SPEC
+
+#undef	LINK_SPEC
+#define LINK_SPEC "							\
+  %{p:%nconsider using `-pg' instead of `-p' with gprof(1) }		\
+  %{Wl,*:%*}								\
+  %{v:-V}								\
+  %{assert*} %{R*} %{rpath*} %{defsym*}					\
+  %{shared:-Bshareable %{h*} %{soname*}}				\
+  %{!shared:								\
+    %{!static:								\
+      %{rdynamic:-export-dynamic}					\
+      %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }}	\
+    %{static:-Bstatic}}							\
+  %{symbolic:-Bsymbolic}"
 
 
 /************************[  Target stuff  ]***********************************/

Index: config/i386/freebsd.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/freebsd.h,v
retrieving revision 1.41
diff -u -r1.41 freebsd.h
--- config/i386/freebsd.h	6 Oct 2003 22:47:27 -0000	1.41
+++ config/i386/freebsd.h	25 Feb 2004 17:41:16 -0000
@@ -57,6 +57,10 @@
   
 #undef  WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE	(TARGET_64BIT ? 32 : BITS_PER_WORD)
+
+#undef  SUBTARGET_EXTRA_SPECS	/* i386.h bogusly defines it.  */
+#define SUBTARGET_EXTRA_SPECS \
+  { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }
     
 /* Provide a STARTFILE_SPEC appropriate for FreeBSD.  Here we add
    the magical crtbegin.o file (see crtstuff.c) which provides part 
@@ -105,7 +109,7 @@
     %{!shared: \
       %{!static: \
         %{rdynamic:-export-dynamic} \
-	%{!dynamic-linker:-dynamic-linker /usr/libexec/ld-elf.so.1}} \
+        %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \
     %{static:-Bstatic}} \
   %{symbolic:-Bsymbolic}"
 
Index: config/i386/freebsd64.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/freebsd64.h,v
retrieving revision 1.5
diff -u -r1.5 freebsd64.h
--- config/i386/freebsd64.h	26 Sep 2003 03:28:27 -0000	1.5
+++ config/i386/freebsd64.h	25 Feb 2004 17:41:17 -0000
@@ -23,6 +23,9 @@
 #undef  TARGET_VERSION
 #define TARGET_VERSION fprintf (stderr, " (FreeBSD/x86-64 ELF)");
 
+#define SUBTARGET_EXTRA_SPECS \
+  { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }
+
 /* Provide a LINK_SPEC appropriate for the FreeBSD/x86-64 ELF target.
    This is a copy of LINK_SPEC from <i386/freebsd.h> tweaked for
    the x86-64 target.  */
@@ -37,6 +40,6 @@
     %{!shared: \
       %{!static: \
         %{rdynamic:-export-dynamic} \
-	%{!dynamic-linker:-dynamic-linker /usr/libexec/ld-elf.so.1}} \
+	%{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \
     %{static:-Bstatic}} \
   %{symbolic:-Bsymbolic}"

Index: config/ia64/freebsd.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/freebsd.h,v
retrieving revision 1.7
diff -u -r1.7 freebsd.h
--- config/ia64/freebsd.h	13 Mar 2003 18:26:29 -0000	1.7
+++ config/ia64/freebsd.h	25 Feb 2004 17:41:17 -0000
@@ -18,9 +18,11 @@
 along with GCC; see the file COPYING.  If not, write to
 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
+#define SUBTARGET_EXTRA_SPECS \
+  { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }
 
 #define LINK_SPEC "							\
-  %{p:%nconsider using `-pg' instead of `-p' with gprof(1)}				\
+  %{p:%nconsider using `-pg' instead of `-p' with gprof(1)}		\
   %{Wl,*:%*}								\
   %{assert*} %{R*} %{rpath*} %{defsym*}					\
   %{shared:-Bshareable %{h*} %{soname*}}				\
@@ -28,7 +30,7 @@
   %{!shared:								\
     %{!static:								\
       %{rdynamic:-export-dynamic}					\
-      %{!dynamic-linker:-dynamic-linker /usr/libexec/ld-elf.so.1}}	\
+      %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }}	\
     %{static:-Bstatic}}"
 
 
Index: config/rs6000/sysv4.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/sysv4.h,v
retrieving revision 1.145
diff -u -r1.145 sysv4.h
--- config/rs6000/sysv4.h	20 Jan 2004 22:29:21 -0000	1.145
+++ config/rs6000/sysv4.h	25 Feb 2004 17:41:19 -0000
@@ -1092,16 +1092,16 @@
 
 #define LINK_OS_FREEBSD_SPEC "\
   %{p:%e`-p' not supported; use `-pg' and gprof(1)} \
-    %{Wl,*:%*} \
-    %{v:-V} \
-    %{assert*} %{R*} %{rpath*} %{defsym*} \
-    %{shared:-Bshareable %{h*} %{soname*}} \
-    %{!shared: \
-      %{!static: \
-	%{rdynamic: -export-dynamic} \
-	%{!dynamic-linker: -dynamic-linker /usr/libexec/ld-elf.so.1}} \
-      %{static:-Bstatic}} \
-    %{symbolic:-Bsymbolic}"
+  %{Wl,*:%*} \
+  %{v:-V} \
+  %{assert*} %{R*} %{rpath*} %{defsym*} \
+  %{shared:-Bshareable %{h*} %{soname*}} \
+  %{!shared: \
+    %{!static: \
+      %{rdynamic: -export-dynamic} \
+      %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \
+    %{static:-Bstatic}} \
+  %{symbolic:-Bsymbolic}"
 
 /* GNU/Linux support.  */
 #define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \
@@ -1314,6 +1314,7 @@
   { "cpp_os_openbsd",		CPP_OS_OPENBSD_SPEC },			\
   { "cpp_os_windiss",           CPP_OS_WINDISS_SPEC },                  \
   { "cpp_os_default",		CPP_OS_DEFAULT_SPEC },			\
+  { "fbsd_dynamic_linker",	FBSD_DYNAMIC_LINKER },			\
   SUBSUBTARGET_EXTRA_SPECS
 
 #define	SUBSUBTARGET_EXTRA_SPECS

Index: config/sparc/freebsd.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/freebsd.h,v
retrieving revision 1.24
diff -u -r1.24 freebsd.h
--- config/sparc/freebsd.h	7 Feb 2004 17:06:25 -0000	1.24
+++ config/sparc/freebsd.h	25 Feb 2004 17:41:19 -0000
@@ -18,6 +18,10 @@
 along with GCC; see the file COPYING.  If not, write to
 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
+
+#define SUBTARGET_EXTRA_SPECS \
+  { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }
+
 /* FreeBSD needs the platform name (sparc64) defined.
    Emacs needs to know if the arch is 64 or 32-bits.  */
 
@@ -35,7 +39,7 @@
   %{!shared:								\
     %{!static:								\
       %{rdynamic:-export-dynamic}					\
-      %{!dynamic-linker:-dynamic-linker /usr/libexec/ld-elf.so.1}}	\
+      %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }}	\
     %{static:-Bstatic}}"
 
 


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