diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2014-01-15 12:53:04 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2014-01-15 20:09:09 -0800 |
commit | f6f6c6790a0f3704575b9e9c87cf55baf215eef3 (patch) | |
tree | 003e7123e7d69b64273fef9ee173633f04f3e31f /ld/genscripts.sh | |
parent | 6fcc66ab70d67efb1a8b96532b5eb96883caa727 (diff) | |
download | binutils-gdb-f6f6c6790a0f3704575b9e9c87cf55baf215eef3.tar.gz |
Skip directories with LIBPATH_SUFFIX_SKIP suffix
On Linux/x86-64, when binutils is configured with --libdir=/usr/lib64,
genscripts.sh treats /usr/lib64 as the default search directory. It
puts /usr/lib64 in linker scripts for all emulations, like
---
/* Script for -z combreloc: combine and sort reloc sections */
OUTPUT_FORMAT("elf32-i386", "elf32-i386",
"elf32-i386")
OUTPUT_ARCH(i386)
ENTRY(_start)
SEARCH_DIR("/usr/x86_64-redhat-linux/lib32");
SEARCH_DIR("/usr/i386-redhat-linux/lib32"); SEARCH_DIR("/usr/lib6432");
SEARCH_DIR("/usr/local/lib32"); SEARCH_DIR("/lib32");
SEARCH_DIR("/usr/lib32"); SEARCH_DIR("/usr/i386-redhat-linux/lib");
SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/usr/local/lib");
SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
---
/usr/lib6432 is odd and /usr/lib64 is wrong. This patch changes
genscripts.sh to check LIBPATH_SUFFIX_SKIP if it is defined. It
skips directories with LIBPATH_SUFFIX_SKIP suffix.
PR ld/16456
* genscripts.sh: Don't search directory with LIBPATH_SUFFIX_SKIP
suffix.
* emulparams/elf32_x86_64.sh (LIBPATH_SUFFIX_SKIP): Set to 64
for elf32_x86_64 emulation.
* emulparams/elf_i386.sh (LIBPATH_SUFFIX_SKIP): Set to 64
for elf_i386 emulation.
Diffstat (limited to 'ld/genscripts.sh')
-rwxr-xr-x | ld/genscripts.sh | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/ld/genscripts.sh b/ld/genscripts.sh index a4da92d2d0c..eeb6d73b31e 100755 --- a/ld/genscripts.sh +++ b/ld/genscripts.sh @@ -160,6 +160,7 @@ append_to_lib_path() if [ "x${use_sysroot}" = "xyes" ] ; then lib="=${lib}" fi + skip_lib=no if test -n "${LIBPATH_SUFFIX}"; then case "${lib}" in *${LIBPATH_SUFFIX}) @@ -169,18 +170,27 @@ append_to_lib_path() *) lib_path1=${lib_path1}:${lib} ;; esac ;; *) - case :${lib_path1}: in - *:${lib}${LIBPATH_SUFFIX}:*) ;; - ::) lib_path1=${lib}${LIBPATH_SUFFIX} ;; - *) lib_path1=${lib_path1}:${lib}${LIBPATH_SUFFIX} ;; - esac ;; + if test -n "${LIBPATH_SUFFIX_SKIP}"; then + case "${lib}" in + *${LIBPATH_SUFFIX_SKIP}) skip_lib=yes ;; + esac + fi + if test "${skip_lib}" = "no"; then + case :${lib_path1}: in + *:${lib}${LIBPATH_SUFFIX}:*) ;; + ::) lib_path1=${lib}${LIBPATH_SUFFIX} ;; + *) lib_path1=${lib_path1}:${lib}${LIBPATH_SUFFIX} ;; + esac + fi ;; + esac + fi + if test "${skip_lib}" = "no"; then + case :${lib_path1}:${lib_path2}: in + *:${lib}:*) ;; + *::) lib_path2=${lib} ;; + *) lib_path2=${lib_path2}:${lib} ;; esac fi - case :${lib_path1}:${lib_path2}: in - *:${lib}:*) ;; - *::) lib_path2=${lib} ;; - *) lib_path2=${lib_path2}:${lib} ;; - esac done fi } |