From 0d2ea3af92127a10961ca1d0332ec09bb20d5703 Mon Sep 17 00:00:00 2001 From: John Marino Date: Mon, 23 Mar 2015 09:32:54 +0100 Subject: [PATCH] gcc50: Switch final specs to set DT_RUNPATH tag The system dynamic binaries have always been built with DT_RPATH set by the linker. A few years ago the dynamic linker gained DT_RUNPATH capability but it hasn't been used in base. How it works is that when the linker is given the -rpath switch, it will always set DT_RPATH, but if the --enable-new-dtags switch is present, the linker will also set DT_RUNPATH tag. The dynamic linker reacts differently when DT_RUNPATH is present; it will check LD_LIBRARY_PATH before the rpath in that case. This change (to gcc50 only) builds the system with the -rpath flag alone by for the ctools compiler, but the final compiler's specs include the --enable-new-dtags switch as well, which affects the building of ports and all non-system use of the compiler. --- gnu/usr.bin/cc50/Makefile.inc | 4 ++++ gnu/usr.bin/cc50/cc_prep/config/dragonfly-native.h | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/gnu/usr.bin/cc50/Makefile.inc b/gnu/usr.bin/cc50/Makefile.inc index 5dfc4b3255..f1d518dc79 100644 --- a/gnu/usr.bin/cc50/Makefile.inc +++ b/gnu/usr.bin/cc50/Makefile.inc @@ -44,6 +44,10 @@ FLAGS+= -DIN_GCC -DHAVE_CONFIG_H FLAGS+= -DPREFIX1=\"${TOOLS_PREFIX}/usr\" FLAGS+= -DPREFIX2=\"${USRDATA_PREFIX}/usr\" +.if defined(BOOTSTRAPPING) +FLAGS+= -DCTOOLS +.endif + CFLAGS+= ${FLAGS} .include "Makefile.tgt" diff --git a/gnu/usr.bin/cc50/cc_prep/config/dragonfly-native.h b/gnu/usr.bin/cc50/cc_prep/config/dragonfly-native.h index d4861dffbc..a9cb942346 100644 --- a/gnu/usr.bin/cc50/cc_prep/config/dragonfly-native.h +++ b/gnu/usr.bin/cc50/cc_prep/config/dragonfly-native.h @@ -3,6 +3,11 @@ #ifndef PREFIX2 #define PREFIX2 PREFIX1 #endif +#ifdef CTOOLS +#define RUNPATH "-rpath" +#else +#define RUNPATH "--enable-new-dtags -rpath" +#endif #define LINK_LIBGCC_SPEC "" #define LIBGCC_SPEC \ @@ -19,14 +24,14 @@ #undef LINK_SPEC #define LINK_SPEC DFBSD_LINK_SPEC \ "%{pg: -L"PREFIX2"/lib/gcc"GCCSHORTVER"/profile \ - %{!static: -rpath /usr/lib/gcc"GCCSHORTVER"/profile} \ + %{!static: "RUNPATH" /usr/lib/gcc"GCCSHORTVER"/profile} \ } \ -L"PREFIX2"/lib/gcc"GCCSHORTVER" \ - %{!static: -rpath /usr/lib/gcc"GCCSHORTVER"} \ + %{!static: "RUNPATH" /usr/lib/gcc"GCCSHORTVER"} \ %{pg: \ %{!nostdlib: \ %{!nodefaultlibs: -L"PREFIX2"/lib/profile \ - %{!static: -rpath /usr/lib/profile} \ + %{!static: "RUNPATH" /usr/lib/profile} \ } \ } \ }" -- 2.41.0