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 -rpath-link for sysroot'd Solaris builds


This patch makes --with-sysroot builds for Solaris 2.8 work
correctly.  We have to include -rpath-link so that references to
libdl.so (for example) are resolved correctly.

Tested by building --with-sysroot cross compilers and building small
test programs, applied on the mainline and on the 3.3 branch.

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2003-12-18  Mark Mitchell  <mark@codesourcery.com>

	* config/sol2.h (LINK_ARCH32_SPEC): Define in terms of ...
	(LINK_ARCH32_SPEC_BASE): ... this new macro.
	* config/sparc/sol2-bi.h (LINK_ARCH64_SPEC): Define in terms of
	...
	(LINK_ARCH64_SPEC_BASE): ... this new macro.
	* config/sparc/sol2-gld-bi.h (LINK_ARCH32_SPEC): New macro.
	(LINK_ARCH64_SPEC): Likewise.

Index: gcc/config/sol2.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sol2.h,v
retrieving revision 1.8
diff -c -5 -p -r1.8 sol2.h
*** gcc/config/sol2.h	3 Sep 2003 18:10:56 -0000	1.8
--- gcc/config/sol2.h	18 Dec 2003 18:12:10 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 117,138 ****
  			    %{!ansi:values-Xa.o%s}"
  
  #undef STARTFILE_ARCH_SPEC
  #define STARTFILE_ARCH_SPEC STARTFILE_ARCH32_SPEC
  
! #undef LINK_ARCH32_SPEC
! #define LINK_ARCH32_SPEC \
    "%{G:-G} \
     %{YP,*} \
     %{R*} \
     %{compat-bsd: \
       %{!YP,*:%{p|pg:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
               %{!p:%{!pg:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}}} \
               -R /usr/ucblib} \
     %{!compat-bsd: \
       %{!YP,*:%{p|pg:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
               %{!p:%{!pg:-Y P,/usr/ccs/lib:/usr/lib}}}}"
  
  #undef LINK_ARCH_SPEC
  #define LINK_ARCH_SPEC LINK_ARCH32_SPEC
  
  /* This should be the same as in svr4.h, except with -R added.  */
--- 117,141 ----
  			    %{!ansi:values-Xa.o%s}"
  
  #undef STARTFILE_ARCH_SPEC
  #define STARTFILE_ARCH_SPEC STARTFILE_ARCH32_SPEC
  
! #undef LINK_ARCH32_SPEC_BASE
! #define LINK_ARCH32_SPEC_BASE \
    "%{G:-G} \
     %{YP,*} \
     %{R*} \
     %{compat-bsd: \
       %{!YP,*:%{p|pg:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
               %{!p:%{!pg:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}}} \
               -R /usr/ucblib} \
     %{!compat-bsd: \
       %{!YP,*:%{p|pg:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
               %{!p:%{!pg:-Y P,/usr/ccs/lib:/usr/lib}}}}"
+ 
+ #undef LINK_ARCH32_SPEC
+ #define LINK_ARCH32_SPEC LINK_ARCH32_SPEC_BASE
  
  #undef LINK_ARCH_SPEC
  #define LINK_ARCH_SPEC LINK_ARCH32_SPEC
  
  /* This should be the same as in svr4.h, except with -R added.  */
Index: gcc/config/sparc/sol2-bi.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/sol2-bi.h,v
retrieving revision 1.12
diff -c -5 -p -r1.12 sol2-bi.h
*** gcc/config/sparc/sol2-bi.h	17 Jun 2003 01:00:43 -0000	1.12
--- gcc/config/sparc/sol2-bi.h	18 Dec 2003 18:12:10 -0000
***************
*** 131,141 ****
      
  /*
   * This should be the same as in sol2.h, except with "/sparcv9"
   * appended to the paths and /usr/ccs/lib is no longer necessary
   */
! #define LINK_ARCH64_SPEC \
    "%{mcmodel=medlow:-M /usr/lib/ld/sparcv9/map.below4G} \
     %{G:-G} \
     %{YP,*} \
     %{R*} \
     %{compat-bsd: \
--- 131,141 ----
      
  /*
   * This should be the same as in sol2.h, except with "/sparcv9"
   * appended to the paths and /usr/ccs/lib is no longer necessary
   */
! #define LINK_ARCH64_SPEC_BASE \
    "%{mcmodel=medlow:-M /usr/lib/ld/sparcv9/map.below4G} \
     %{G:-G} \
     %{YP,*} \
     %{R*} \
     %{compat-bsd: \
***************
*** 143,152 ****
--- 143,154 ----
         %{!p:%{!pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/sparcv9}}} \
       -R /usr/ucblib} \
     %{!compat-bsd: \
       %{!YP,*:%{p|pg:-Y P,/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
         %{!p:%{!pg:-Y P,/usr/lib/sparcv9}}}}"
+ 
+ #define LINK_ARCH64_SPEC LINK_ARCH64_SPEC_BASE
  
  #undef LINK_ARCH_SPEC
  #define LINK_ARCH_SPEC "\
  %{m32:%(link_arch32)} \
  %{m64:%(link_arch64)} \
Index: gcc/config/sparc/sol2-gld-bi.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/sol2-gld-bi.h,v
retrieving revision 1.3
diff -c -5 -p -r1.3 sol2-gld-bi.h
*** gcc/config/sparc/sol2-gld-bi.h	17 Jun 2003 01:00:43 -0000	1.3
--- gcc/config/sparc/sol2-gld-bi.h	18 Dec 2003 18:12:10 -0000
***************
*** 1,9 ****
--- 1,18 ----
  /* Definitions of target machine for GCC, for bi-arch SPARC
     running Solaris 2 using the GNU linker.  */
  
+ #undef LINK_ARCH32_SPEC
+ #define LINK_ARCH32_SPEC \
+   LINK_ARCH32_SPEC_BASE "%{!static: -rpath-link %R/usr/lib}"
+ 
+ #undef LINK_ARCH64_SPEC
+ #define LINK_ARCH64_SPEC \
+   LINK_ARCH64_SPEC_BASE "%{!static: -rpath-link %R/usr/lib/sparcv9}"
+ 
  #undef LINK_ARCH_SPEC
  #define LINK_ARCH_SPEC "\
  %{m32:-m elf32_sparc %(link_arch32)} \
  %{m64:-m elf64_sparc %(link_arch64)} \
  %{!m32:%{!m64:%(link_arch_default)}} \
  "
+ 


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