On 02/18/15 13:41, Ondřej Čertík wrote:
> Do you have experience with this --- i.e. where should this be put?
Yes I do. It is all under gcc/config/ where you have files in various
architecture directory here is an example from the cluster I manage
(there is some extra stuff because I have also use an external glibc)
diff -Naur gcc-4.9.1/gcc/config//rs6000/linux64.h
gcc-4.9.1_at/gcc/config//rs6000/linux64.h
--- gcc-4.9.1/gcc/config//rs6000/linux64.h 2014-01-03
11:23:26.000000000 +1300
+++ gcc-4.9.1_at/gcc/config//rs6000/linux64.h 2014-10-09
13:13:58.291446000 +1300
@@ -367,11 +367,11 @@
#undef LINK_OS_DEFAULT_SPEC
#define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
+#define GLIBC_DYNAMIC_LINKER32 "/opt/at7.0/lib/ld.so.1"
#ifdef LINUX64_DEFAULT_ABI_ELFv2
-#define GLIBC_DYNAMIC_LINKER64
"%{mabi=elfv1:/lib64/ld64.so.1;:/lib64/ld64.so.2}"
+#define GLIBC_DYNAMIC_LINKER64
"/opt/at7.0%{mabi=elfv1:/lib64/ld64.so.1;:/lib64/ld64.so.2}"
#else
-#define GLIBC_DYNAMIC_LINKER64
"%{mabi=elfv2:/lib64/ld64.so.2;:/lib64/ld64.so.1}"
+#define GLIBC_DYNAMIC_LINKER64
"/opt/at7.0%{mabi=elfv2:/lib64/ld64.so.2;:/lib64/ld64.so.1}"
#endif
#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
@@ -406,13 +406,13 @@
" -m elf64ppc")
#endif
-#define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \
+#define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!static: %{!shared: \
%{rdynamic:-export-dynamic} \
- -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}}"
+ -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}} --enable-new-dtags
-rpath /usr/local/pkg/gcc/4.9/lib64:/opt/at7.0/lib"
-#define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " %{!shared: %{!static: \
+#define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " %{!static: %{!shared: \
%{rdynamic:-export-dynamic} \
- -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}"
+ -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}} --enable-new-dtags
-rpath /usr/local/pkg/gcc/4.9/lib64:/opt/at7.0/lib64"
#undef TOC_SECTION_ASM_OP
#define TOC_SECTION_ASM_OP \
diff -Naur gcc-4.9.1/gcc/config//rs6000/sysv4.h
gcc-4.9.1_at/gcc/config//rs6000/sysv4.h
--- gcc-4.9.1/gcc/config//rs6000/sysv4.h 2014-02-11
03:46:24.000000000 +1300
+++ gcc-4.9.1_at/gcc/config//rs6000/sysv4.h 2014-10-09
13:14:28.170615000 +1300
@@ -761,7 +761,7 @@
#define LINK_START_LINUX_SPEC ""
-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
+#define GLIBC_DYNAMIC_LINKER "/opt/at7.0/lib/ld.so.1"
#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
#if DEFAULT_LIBC == LIBC_UCLIBC
#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
@@ -773,9 +773,9 @@
#define GNU_USER_DYNAMIC_LINKER \
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
-#define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
+#define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!static: %{!shared: \
%{rdynamic:-export-dynamic} \
- -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"
+ -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} --enable-new-dtags
-rpath /usr/local/pkg/gcc/4.9/lib:/opt/at7.0/lib"
#if defined(HAVE_LD_EH_FRAME_HDR)
# define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
@@ -804,7 +804,7 @@
"
#define LINK_OS_NETBSD_SPEC "\
-%{!shared: %{!static: \
+%{!static: %{!shared: \
%{rdynamic:-export-dynamic} \
-dynamic-linker /usr/libexec/ld.elf_so}}"
You would be only concerned by the bits added that have rpath in it.
/opt/at7.0/lib{64} is where my glibc is located. This is the rs6000
folder because I am dealing with ppc64 on x86(_64) you'll want
gcc/config/i386. If you want to generalize you have to correct all
file called linux.h, linux64.h and sysv4.h in the subdirectories of
gcc/config.
I don't know how to apply this to darwin, furthermore not all version
of OS X have an ld that accept rpath.
Francois