Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 1 | From 8e9d6efecdc8c42f47e3a012dee764b13c3dad59 Mon Sep 17 00:00:00 2001 |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Fri, 29 Mar 2013 09:24:50 +0400 |
Andrew Geissler | c182c62 | 2020-05-15 14:13:32 -0500 | [diff] [blame] | 4 | Subject: [PATCH] Define GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 5 | relative to SYSTEMLIBS_DIR |
| 6 | |
| 7 | This patch defines GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER |
| 8 | relative to SYSTEMLIBS_DIR which can be set in generated headers |
| 9 | This breaks the assumption of hardcoded multilib in gcc |
| 10 | Change is only for the supported architectures in OE including |
| 11 | SH, sparc, alpha for possible future support (if any) |
| 12 | |
| 13 | Removes the do_headerfix task in metadata |
| 14 | |
| 15 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 16 | |
| 17 | Upstream-Status: Inappropriate [OE configuration] |
| 18 | --- |
| 19 | gcc/config/alpha/linux-elf.h | 4 ++-- |
| 20 | gcc/config/arm/linux-eabi.h | 4 ++-- |
| 21 | gcc/config/arm/linux-elf.h | 2 +- |
| 22 | gcc/config/i386/linux.h | 2 +- |
| 23 | gcc/config/i386/linux64.h | 6 +++--- |
| 24 | gcc/config/linux.h | 8 ++++---- |
| 25 | gcc/config/mips/linux.h | 12 ++++++------ |
| 26 | gcc/config/riscv/linux.h | 2 +- |
| 27 | gcc/config/rs6000/linux64.h | 15 +++++---------- |
| 28 | gcc/config/sh/linux.h | 2 +- |
| 29 | gcc/config/sparc/linux.h | 2 +- |
| 30 | gcc/config/sparc/linux64.h | 4 ++-- |
| 31 | 12 files changed, 29 insertions(+), 34 deletions(-) |
| 32 | |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame^] | 33 | unchanged: |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 34 | --- a/gcc/config/alpha/linux-elf.h |
| 35 | +++ b/gcc/config/alpha/linux-elf.h |
| 36 | @@ -23,8 +23,8 @@ along with GCC; see the file COPYING3. If not see |
| 37 | #define EXTRA_SPECS \ |
| 38 | { "elf_dynamic_linker", ELF_DYNAMIC_LINKER }, |
| 39 | |
| 40 | -#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" |
| 41 | -#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" |
| 42 | +#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2" |
| 43 | +#define UCLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-uClibc.so.0" |
| 44 | #if DEFAULT_LIBC == LIBC_UCLIBC |
| 45 | #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}" |
| 46 | #elif DEFAULT_LIBC == LIBC_GLIBC |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame^] | 47 | unchanged: |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 48 | --- a/gcc/config/arm/linux-eabi.h |
| 49 | +++ b/gcc/config/arm/linux-eabi.h |
| 50 | @@ -65,8 +65,8 @@ |
| 51 | GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI. */ |
| 52 | |
| 53 | #undef GLIBC_DYNAMIC_LINKER |
| 54 | -#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3" |
| 55 | -#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3" |
| 56 | +#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT SYSTEMLIBS_DIR "ld-linux.so.3" |
| 57 | +#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT SYSTEMLIBS_DIR "ld-linux-armhf.so.3" |
| 58 | #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT |
| 59 | |
| 60 | #define GLIBC_DYNAMIC_LINKER \ |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame^] | 61 | unchanged: |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 62 | --- a/gcc/config/arm/linux-elf.h |
| 63 | +++ b/gcc/config/arm/linux-elf.h |
| 64 | @@ -60,7 +60,7 @@ |
| 65 | |
| 66 | #define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc" |
| 67 | |
| 68 | -#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" |
| 69 | +#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2" |
| 70 | |
| 71 | #define LINUX_TARGET_LINK_SPEC "%{h*} \ |
| 72 | %{static:-Bstatic} \ |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame^] | 73 | unchanged: |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 74 | --- a/gcc/config/i386/linux.h |
| 75 | +++ b/gcc/config/i386/linux.h |
| 76 | @@ -20,7 +20,7 @@ along with GCC; see the file COPYING3. If not see |
| 77 | <http://www.gnu.org/licenses/>. */ |
| 78 | |
| 79 | #define GNU_USER_LINK_EMULATION "elf_i386" |
| 80 | -#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" |
| 81 | +#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2" |
| 82 | |
| 83 | #undef MUSL_DYNAMIC_LINKER |
| 84 | #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1" |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame^] | 85 | unchanged: |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 86 | --- a/gcc/config/i386/linux64.h |
| 87 | +++ b/gcc/config/i386/linux64.h |
| 88 | @@ -27,9 +27,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
| 89 | #define GNU_USER_LINK_EMULATION64 "elf_x86_64" |
| 90 | #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64" |
| 91 | |
| 92 | -#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2" |
| 93 | -#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2" |
| 94 | -#define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2" |
| 95 | +#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2" |
| 96 | +#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux-x86-64.so.2" |
| 97 | +#define GLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-linux-x32.so.2" |
| 98 | |
| 99 | #undef MUSL_DYNAMIC_LINKER32 |
| 100 | #define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1" |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame^] | 101 | unchanged: |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 102 | --- a/gcc/config/linux.h |
| 103 | +++ b/gcc/config/linux.h |
| 104 | @@ -94,10 +94,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
| 105 | GLIBC_DYNAMIC_LINKER must be defined for each target using them, or |
| 106 | GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets |
| 107 | supporting both 32-bit and 64-bit compilation. */ |
| 108 | -#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" |
| 109 | -#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0" |
| 110 | -#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0" |
| 111 | -#define UCLIBC_DYNAMIC_LINKERX32 "/lib/ldx32-uClibc.so.0" |
| 112 | +#define UCLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-uClibc.so.0" |
| 113 | +#define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0" |
| 114 | +#define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0" |
| 115 | +#define UCLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ldx32-uClibc.so.0" |
| 116 | #define BIONIC_DYNAMIC_LINKER "/system/bin/linker" |
| 117 | #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker" |
| 118 | #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64" |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame^] | 119 | unchanged: |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 120 | --- a/gcc/config/mips/linux.h |
| 121 | +++ b/gcc/config/mips/linux.h |
| 122 | @@ -22,20 +22,20 @@ along with GCC; see the file COPYING3. If not see |
| 123 | #define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32" |
| 124 | |
| 125 | #define GLIBC_DYNAMIC_LINKER32 \ |
| 126 | - "%{mnan=2008:/lib/ld-linux-mipsn8.so.1;:/lib/ld.so.1}" |
| 127 | + "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}" |
| 128 | #define GLIBC_DYNAMIC_LINKER64 \ |
| 129 | - "%{mnan=2008:/lib64/ld-linux-mipsn8.so.1;:/lib64/ld.so.1}" |
| 130 | + "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}" |
| 131 | #define GLIBC_DYNAMIC_LINKERN32 \ |
| 132 | - "%{mnan=2008:/lib32/ld-linux-mipsn8.so.1;:/lib32/ld.so.1}" |
| 133 | + "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}" |
| 134 | |
| 135 | #undef UCLIBC_DYNAMIC_LINKER32 |
| 136 | #define UCLIBC_DYNAMIC_LINKER32 \ |
| 137 | - "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}" |
| 138 | + "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}" |
| 139 | #undef UCLIBC_DYNAMIC_LINKER64 |
| 140 | #define UCLIBC_DYNAMIC_LINKER64 \ |
| 141 | - "%{mnan=2008:/lib/ld64-uClibc-mipsn8.so.0;:/lib/ld64-uClibc.so.0}" |
| 142 | + "%{mnan=2008:" SYSTEMLIBS_DIR "ld64-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld64-uClibc.so.0}" |
| 143 | #define UCLIBC_DYNAMIC_LINKERN32 \ |
| 144 | - "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}" |
| 145 | + "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}" |
| 146 | |
| 147 | #undef MUSL_DYNAMIC_LINKER32 |
| 148 | #define MUSL_DYNAMIC_LINKER32 \ |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame^] | 149 | unchanged: |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 150 | --- a/gcc/config/riscv/linux.h |
| 151 | +++ b/gcc/config/riscv/linux.h |
| 152 | @@ -22,7 +22,7 @@ along with GCC; see the file COPYING3. If not see |
| 153 | GNU_USER_TARGET_OS_CPP_BUILTINS(); \ |
| 154 | } while (0) |
| 155 | |
| 156 | -#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-riscv" XLEN_SPEC "-" ABI_SPEC ".so.1" |
| 157 | +#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-riscv" XLEN_SPEC "-" ABI_SPEC ".so.1" |
| 158 | |
| 159 | #define MUSL_ABI_SUFFIX \ |
| 160 | "%{mabi=ilp32:-sf}" \ |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame^] | 161 | unchanged: |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 162 | --- a/gcc/config/rs6000/linux64.h |
| 163 | +++ b/gcc/config/rs6000/linux64.h |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 164 | @@ -336,24 +336,19 @@ extern int dot_symbols; |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 165 | #undef LINK_OS_DEFAULT_SPEC |
| 166 | #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)" |
| 167 | |
| 168 | -#define GLIBC_DYNAMIC_LINKER32 "%(dynamic_linker_prefix)/lib/ld.so.1" |
| 169 | - |
| 170 | +#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld.so.1" |
| 171 | #ifdef LINUX64_DEFAULT_ABI_ELFv2 |
| 172 | -#define GLIBC_DYNAMIC_LINKER64 \ |
| 173 | -"%{mabi=elfv1:%(dynamic_linker_prefix)/lib64/ld64.so.1;" \ |
| 174 | -":%(dynamic_linker_prefix)/lib64/ld64.so.2}" |
| 175 | +#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:" SYSTEMLIBS_DIR "ld64.so.1;:" SYSTEMLIBS_DIR "ld64.so.2}" |
| 176 | #else |
| 177 | -#define GLIBC_DYNAMIC_LINKER64 \ |
| 178 | -"%{mabi=elfv2:%(dynamic_linker_prefix)/lib64/ld64.so.2;" \ |
| 179 | -":%(dynamic_linker_prefix)/lib64/ld64.so.1}" |
| 180 | +#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:" SYSTEMLIBS_DIR "ld64.so.2;:" SYSTEMLIBS_DIR "ld64.so.1}" |
| 181 | #endif |
| 182 | |
| 183 | #undef MUSL_DYNAMIC_LINKER32 |
| 184 | #define MUSL_DYNAMIC_LINKER32 \ |
| 185 | - "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1" |
| 186 | + SYSTEMLIBS_DIR "ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1" |
| 187 | #undef MUSL_DYNAMIC_LINKER64 |
| 188 | #define MUSL_DYNAMIC_LINKER64 \ |
| 189 | - "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1" |
| 190 | + SYSTEMLIBS_DIR "ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1" |
| 191 | |
| 192 | #undef DEFAULT_ASM_ENDIAN |
| 193 | #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN) |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame^] | 194 | unchanged: |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 195 | --- a/gcc/config/sh/linux.h |
| 196 | +++ b/gcc/config/sh/linux.h |
| 197 | @@ -64,7 +64,7 @@ along with GCC; see the file COPYING3. If not see |
| 198 | "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E MUSL_DYNAMIC_LINKER_FP \ |
| 199 | "%{mfdpic:-fdpic}.so.1" |
| 200 | |
| 201 | -#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" |
| 202 | +#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2" |
| 203 | |
| 204 | #undef SUBTARGET_LINK_EMUL_SUFFIX |
| 205 | #define SUBTARGET_LINK_EMUL_SUFFIX "%{mfdpic:_fd;:_linux}" |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame^] | 206 | unchanged: |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 207 | --- a/gcc/config/sparc/linux.h |
| 208 | +++ b/gcc/config/sparc/linux.h |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 209 | @@ -78,7 +78,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 210 | When the -shared link option is used a final link is not being |
| 211 | done. */ |
| 212 | |
| 213 | -#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" |
| 214 | +#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2" |
| 215 | |
| 216 | #undef LINK_SPEC |
| 217 | #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \ |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame^] | 218 | unchanged: |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 219 | --- a/gcc/config/sparc/linux64.h |
| 220 | +++ b/gcc/config/sparc/linux64.h |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 221 | @@ -78,8 +78,8 @@ along with GCC; see the file COPYING3. If not see |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 222 | When the -shared link option is used a final link is not being |
| 223 | done. */ |
| 224 | |
| 225 | -#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2" |
| 226 | -#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2" |
| 227 | +#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2" |
| 228 | +#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux.so.2" |
| 229 | |
| 230 | #ifdef SPARC_BI_ARCH |
| 231 | |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame^] | 232 | diff -u b/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h |
| 233 | --- b/gcc/config/aarch64/aarch64-linux.h |
| 234 | +++ b/gcc/config/aarch64/aarch64-linux.h |
| 235 | @@ -21,10 +21,10 @@ |
| 236 | #ifndef GCC_AARCH64_LINUX_H |
| 237 | #define GCC_AARCH64_LINUX_H |
| 238 | |
| 239 | -#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" |
| 240 | +#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" |
| 241 | |
| 242 | #undef MUSL_DYNAMIC_LINKER |
| 243 | -#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" |
| 244 | +#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" |
| 245 | |
| 246 | #undef ASAN_CC1_SPEC |
| 247 | #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}" |