Skip to content
Snippets Groups Projects
Commit be2b984b authored by Bernhard Rosenkränzer's avatar Bernhard Rosenkränzer
Browse files

binutils: Update to 2.39


Update binutils to 2.39

This is in sync with upstream openembedded-core
commit 30e902f42d4a0205d2a75bf9b2a9cc5e8db582be

Signed-off-by: default avatarBernhard Rosenkränzer <bernhard.rosenkraenzer.ext@huawei.com>
parent 149931fc
No related branches found
No related tags found
1 merge request!280binutils: Update to 2.39
Showing
with 32974 additions and 0 deletions
LIC_FILES_CHKSUM="\
file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552\
file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674\
file://COPYING3;md5=d32239bcb673463ab874e80d47fae504\
file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6\
file://gas/COPYING;md5=d32239bcb673463ab874e80d47fae504\
file://include/COPYING;md5=59530bdf33659b29e73d4adb9f9f6552\
file://include/COPYING3;md5=d32239bcb673463ab874e80d47fae504\
file://libiberty/COPYING.LIB;md5=a916467b91076e631dd8edb7424769c7\
file://bfd/COPYING;md5=d32239bcb673463ab874e80d47fae504\
"
# When upgrading to 2.39, please make sure there is no trailing .0, so
# that upstream version check can work correctly.
PV = "2.39"
CVE_VERSION = "2.39"
SRCBRANCH ?= "binutils-2_39-branch"
UPSTREAM_CHECK_GITTAGREGEX = "binutils-(?P<pver>\d+_(\d_?)*)"
SRCREV ?= "f89058434f13382c85b8729464192bc7763d88a4"
BINUTILS_GIT_URI ?= "git://sourceware.org/git/binutils-gdb.git;branch=${SRCBRANCH};protocol=git"
SRC_URI = "\
${BINUTILS_GIT_URI} \
file://0004-Point-scripts-location-to-libdir.patch \
file://0005-don-t-let-the-distro-compiler-point-to-the-wrong-ins.patch \
file://0006-warn-for-uses-of-system-directories-when-cross-linki.patch \
file://0007-fix-the-incorrect-assembling-for-ppc-wait-mnemonic.patch \
file://0008-Use-libtool-2.4.patch \
file://0009-Fix-rpath-in-libtool-when-sysroot-is-enabled.patch \
file://0010-sync-with-OE-libtool-changes.patch \
file://0011-Check-for-clang-before-checking-gcc-version.patch \
file://0012-Only-generate-an-RPATH-entry-if-LD_RUN_PATH-is-not-e.patch \
"
S = "${WORKDIR}/git"
inherit cross-canadian
SUMMARY = "GNU binary utilities (cross-canadian for ${TARGET_ARCH} target)"
PN = "binutils-cross-canadian-${TRANSLATED_TARGET_ARCH}"
BPN = "binutils"
DEPENDS = "flex-native bison-native virtual/${HOST_PREFIX}gcc-crosssdk virtual/nativesdk-libc nativesdk-zlib nativesdk-gettext nativesdk-flex"
EXTRA_OECONF += "--with-sysroot=${SDKPATH}/sysroots/${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS} \
--enable-poison-system-directories \
"
# We have to point binutils at a sysroot but we don't need to rebuild if this changes
# e.g. we switch between different machines with different tunes.
EXTRA_OECONF[vardepsexclude] = "TUNE_PKGARCH"
do_install () {
autotools_do_install
# We're not interested in the libs or headers, these would come from the
# nativesdk or target version of the binutils recipe
rm -rf ${D}${prefix}/${TARGET_SYS}
rm -f ${D}${libdir}/libbfd*
rm -f ${D}${libdir}/libiberty*
rm -f ${D}${libdir}/libopcodes*
rm -f ${D}${includedir}/*.h
cross_canadian_bindirlinks
}
FILES:${PN} += "${sysconfdir}/gprofng.rc"
BBCLASSEXTEND = ""
require binutils.inc
require binutils-${PV}.inc
require binutils-cross-canadian.inc
require binutils.inc
require binutils-${PV}.inc
BPN = "binutils"
DEPENDS += "dejagnu-native expect-native"
DEPENDS += "binutils-native"
deltask do_compile
deltask do_install
inherit nopackages
do_configure[dirs] += "${B}/ld ${B}/bfd"
do_configure() {
# create config.h, oe enables initfini-array by default
echo "#define HAVE_INITFINI_ARRAY" > ${B}/ld/config.h
}
# target depends
DEPENDS += "virtual/${MLPREFIX}${TARGET_PREFIX}binutils"
DEPENDS += "virtual/${MLPREFIX}${TARGET_PREFIX}gcc"
DEPENDS += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs"
DEPENDS += "virtual/${MLPREFIX}libc"
python check_prepare() {
def suffix_sys(sys):
if sys.endswith("-linux"):
return sys + "-gnu"
return sys
def generate_site_exp(d, suite):
content = []
content.append('set srcdir "{0}/{1}"'.format(d.getVar("S"), suite))
content.append('set objdir "{0}/{1}"'.format(d.getVar("B"), suite))
content.append('set build_alias "{0}"'.format(d.getVar("BUILD_SYS")))
content.append('set build_triplet {0}'.format(d.getVar("BUILD_SYS")))
# use BUILD here since HOST=TARGET
content.append('set host_alias "{0}"'.format(d.getVar("BUILD_SYS")))
content.append('set host_triplet {0}'.format(d.getVar("BUILD_SYS")))
content.append('set target_alias "{0}"'.format(d.getVar("TARGET_SYS")))
content.append('set target_triplet {0}'.format(suffix_sys(d.getVar("TARGET_SYS"))))
content.append("set development true")
content.append("set experimental false")
content.append(d.expand('set CXXFILT "${TARGET_PREFIX}c++filt"'))
content.append(d.expand('set CC "${TARGET_PREFIX}gcc --sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"'))
content.append(d.expand('set CXX "${TARGET_PREFIX}g++ --sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"'))
content.append(d.expand('set CFLAGS_FOR_TARGET "--sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"'))
if suite == "ld" and d.getVar("TUNE_ARCH") == "mips64":
# oe patches binutils to have the default mips64 abi as 64bit, but
# skips gas causing issues with the ld test suite (which uses gas)
content.append('set ASFLAGS "-64"')
return "\n".join(content)
for i in ["binutils", "gas", "ld"]:
builddir = os.path.join(d.getVar("B"), i)
if not os.path.isdir(builddir):
os.makedirs(builddir)
with open(os.path.join(builddir, "site.exp"), "w") as f:
f.write(generate_site_exp(d, i))
}
CHECK_TARGETS ??= "binutils gas ld"
do_check[dirs] = "${B} ${B}/binutils ${B}/gas ${B}/ld"
do_check[prefuncs] += "check_prepare"
do_check[nostamp] = "1"
do_check() {
export LC_ALL=C
for i in ${CHECK_TARGETS}; do
(cd ${B}/$i; runtest \
--tool $i \
--srcdir ${S}/$i/testsuite \
--ignore 'plugin.exp' \
|| true)
done
}
addtask check after do_configure
inherit cross
PROVIDES = "virtual/${TARGET_PREFIX}binutils"
PN = "binutils-cross-${TARGET_ARCH}"
BPN = "binutils"
# Ignore how TARGET_ARCH is computed.
TARGET_ARCH[vardepvalue] = "${TARGET_ARCH}"
INHIBIT_DEFAULT_DEPS = "1"
INHIBIT_AUTOTOOLS_DEPS = "1"
SRC_URI += "file://0002-binutils-cross-Do-not-generate-linker-script-directo.patch"
# Specify lib-path else we use a load of search dirs which we don't use
# and mean the linker scripts have to be relocated.
EXTRA_OECONF += "--with-sysroot=${STAGING_DIR_TARGET} \
--disable-install-libbfd \
--disable-gprofng \
--enable-poison-system-directories \
--with-lib-path==${target_base_libdir}:=${target_libdir} \
"
do_install () {
oe_runmake 'DESTDIR=${D}' install
# We don't really need these, so we'll remove them...
rm -rf ${D}${STAGING_DIR_NATIVE}${libdir_native}/libiberty.a
rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/${TARGET_SYS}
rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/lib/ldscripts
rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/share/info
rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/share/locale
rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/share/man
rmdir ${D}${STAGING_DIR_NATIVE}${prefix_native}/share || :
rmdir ${D}${STAGING_DIR_NATIVE}${prefix_native}/${libdir}/gcc-lib || :
rmdir ${D}${STAGING_DIR_NATIVE}${prefix_native}/${libdir}64/gcc-lib || :
rmdir ${D}${STAGING_DIR_NATIVE}${prefix_native}/${libdir} || :
rmdir ${D}${STAGING_DIR_NATIVE}${prefix_native}/${libdir}64 || :
rmdir ${D}${STAGING_DIR_NATIVE}${prefix_native}/${prefix} || :
}
require binutils.inc
require binutils-${PV}.inc
require binutils-cross.inc
require binutils-cross_${PV}.bb
inherit crosssdk
PN = "binutils-crosssdk-${SDK_SYS}"
PROVIDES = "virtual/${TARGET_PREFIX}binutils-crosssdk"
SRC_URI += "file://0001-binutils-crosssdk-Generate-relocatable-SDKs.patch"
do_configure:prepend () {
sed -i 's#/usr/local/lib /lib /usr/lib#${SDKPATHNATIVE}/lib ${SDKPATHNATIVE}/usr/lib /usr/local/lib /lib /usr/lib#' ${S}/ld/configure.tgt
}
SUMMARY = "GNU binary utilities"
DESCRIPTION = "The GNU Binutils are a collection of binary tools. \
The main ones are ld (GNU Linker), and as (GNU Assembler). This \
package also includes addition tools such as addr2line (Converts \
addresses into filenames and line numbers), ar (utility for creating, \
modifying and extracting archives), nm (list symbols in object \
files), objcopy (copy and translate object files), objdump (Display \
object information), and other tools and related libraries."
HOMEPAGE = "http://www.gnu.org/software/binutils/"
BUGTRACKER = "http://sourceware.org/bugzilla/"
SECTION = "devel"
LICENSE = "GPL-3.0-only"
DEPENDS = "flex-native bison-native zlib-native gnu-config-native autoconf-native"
inherit autotools gettext multilib_header pkgconfig texinfo
FILES:${PN} = " \
${bindir}/${TARGET_PREFIX}* \
${libdir}/lib*.so.* \
${libdir}/bfd-plugins/lib*.so \
${libdir}/lib*-${PV}*.so \
${prefix}/${TARGET_SYS}/bin/* \
${bindir}/embedspu"
RPROVIDES:${PN} += "${PN}-symlinks"
FILES:${PN}-dev = " \
${includedir} \
${libdir}/*.la \
${libdir}/libbfd.so \
${libdir}/libctf.so \
${libdir}/libctf-nobfd.so \
${libdir}/libopcodes.so"
# Rather than duplicating multiple entries for these, make one
# list and reuse it.
LDGOLD_ALTS ?= "ld.gold dwp"
LDGOLD_ALTS:riscv64 = ""
LDGOLD_ALTS:riscv32 = ""
LDGOLD_ALTS:libc-glibc:mipsarch = ""
USE_ALTERNATIVES_FOR = " \
addr2line \
ar \
as \
c++filt \
elfedit \
gprof \
ld \
ld.bfd \
${LDGOLD_ALTS} \
nm \
objcopy \
objdump \
ranlib \
readelf \
size \
strings \
strip \
"
python do_package:prepend() {
make_alts = d.getVar("USE_ALTERNATIVES_FOR") or ""
prefix = d.getVar("TARGET_PREFIX")
bindir = d.getVar("bindir")
for alt in make_alts.split():
d.setVarFlag('ALTERNATIVE_TARGET', alt, bindir + "/" + prefix + alt)
d.setVarFlag('ALTERNATIVE_LINK_NAME', alt, bindir + "/" + alt)
}
B = "${S}/build.${HOST_SYS}.${TARGET_SYS}"
EXTRA_OECONF = "--program-prefix=${TARGET_PREFIX} \
--disable-werror \
--enable-deterministic-archives \
--enable-plugins \
--disable-gdb \
--disable-gdbserver \
--disable-libdecnumber \
--disable-readline \
--disable-sim \
${LDGOLD} \
${EXTRA_TARGETS} \
${@bb.utils.contains('DISTRO_FEATURES', 'multiarch', '--enable-64-bit-bfd', '', d)}"
EXTRA_TARGETS = ""
EXTRA_TARGETS:x86-64 = " --enable-targets=x86_64-pe,x86_64-pep "
EXTRA_TARGETS:class-native = ""
LDGOLD:class-native = ""
LDGOLD:class-crosssdk = ""
LDGOLD:libc-glibc:mipsarch = ""
LDGOLD ?= "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', '--enable-gold=default --enable-threads', '--enable-gold --enable-ld=default --enable-threads', d)}"
# This is necessary due to a bug in the binutils Makefiles
# EXTRA_OEMAKE = "configure-build-libiberty all"
export AR = "${HOST_PREFIX}ar"
export AS = "${HOST_PREFIX}as"
export LD = "${HOST_PREFIX}ld"
export NM = "${HOST_PREFIX}nm"
export RANLIB = "${HOST_PREFIX}ranlib"
export OBJCOPY = "${HOST_PREFIX}objcopy"
export OBJDUMP = "${HOST_PREFIX}objdump"
export AR_FOR_TARGET = "${TARGET_PREFIX}ar"
export AS_FOR_TARGET = "${TARGET_PREFIX}as"
export LD_FOR_TARGET = "${TARGET_PREFIX}ld"
export NM_FOR_TARGET = "${TARGET_PREFIX}nm"
export RANLIB_FOR_TARGET = "${TARGET_PREFIX}ranlib"
export CC_FOR_HOST = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}"
export CXX_FOR_HOST = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}"
# autotools.bbclass sets the _FOR_BUILD variables, but for some reason we need
# to unset LD_LIBRARY_PATH.
export CC_FOR_BUILD = "LD_LIBRARY_PATH= ${BUILD_CC}"
MULTIARCH := "${@bb.utils.contains("DISTRO_FEATURES", "multiarch", "yes", "no", d)}"
do_configure[vardeps] += "MULTIARCH"
do_configure () {
(cd ${S} && gnu-configize)
oe_runconf
#
# must prime config.cache to ensure the build of libiberty
#
mkdir -p ${B}/build-${BUILD_SYS}
for i in ${CONFIG_SITE}; do
cat $i >> ${B}/build-${BUILD_SYS}/config.cache || true
done
}
do_install () {
autotools_do_install
# We don't really need these, so we'll remove them...
rm -rf ${D}${libdir}/ldscripts
bindir_rel=${@os.path.relpath('${bindir}', '${prefix}/${TARGET_SYS}/bin')}
# Fix the /usr/${TARGET_SYS}/bin/* links
for l in ${D}${prefix}/${TARGET_SYS}/bin/*; do
rm -f $l
ln -sf $bindir_rel/${TARGET_PREFIX}`basename $l` $l
done
# Install the libiberty header
install -d ${D}${includedir}
install -m 644 ${S}/include/ansidecl.h ${D}${includedir}
install -m 644 ${S}/include/libiberty.h ${D}${includedir}
# insall pic version of libiberty if available
if [ -e ${B}/libiberty/pic/libiberty.a ]; then
install -Dm 0644 ${B}/libiberty/pic/libiberty.a ${D}${libdir}/libiberty.a
fi
cd ${D}${bindir}
# Symlinks for ease of running these on the native target
for p in ${TARGET_PREFIX}* ; do
ln -sf $p `echo $p | sed -e s,${TARGET_PREFIX},,`
done
for alt in ${USE_ALTERNATIVES_FOR}; do
rm -f ${D}${bindir}/$alt
done
oe_multilib_header bfd.h
}
inherit update-alternatives
ALTERNATIVE_PRIORITY = "100"
ALTERNATIVE:${PN}:class-target = "${USE_ALTERNATIVES_FOR}"
python () {
if bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', True, False, d) and bb.utils.contains_any('TARGET_ARCH', 'riscv32 riscv64', True, False, d):
bb.fatal("Gold linker does not _yet_ support RISC-V architecture please remove ld-is-gold from DISTRO_FEATURES")
}
From a0ac147aec127c66c9e38292faa50bb56d3c2a19 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 2 Mar 2015 01:58:54 +0000
Subject: [PATCH] binutils-crosssdk: Generate relocatable SDKs
This patch will modify the ELF linker scripts so that the crosssdk
linker will generate binaries with a 4096 bytes PT_INTERP section. When the binaries
will be relocated, at SDK install time, the interpreter path can be easily
changed by the relocating script.
generate larger .interp section for gold linker as well
Upstream-Status: Inappropriate [SDK specific]
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
gold/layout.cc | 2 +-
ld/genscripts.sh | 3 +++
ld/scripttempl/elf.sc | 4 ++--
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/gold/layout.cc b/gold/layout.cc
index 3efe8d98ae9..9cc389664a6 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -5033,7 +5033,7 @@ Layout::create_interp(const Target* target)
gold_assert(interp != NULL);
}
- size_t len = strlen(interp) + 1;
+ size_t len = 4096;
Output_section_data* odata = new Output_data_const(interp, len, 1);
diff --git a/ld/genscripts.sh b/ld/genscripts.sh
index 278f212bdad..0c52ebee4d0 100755
--- a/ld/genscripts.sh
+++ b/ld/genscripts.sh
@@ -304,6 +304,7 @@ DATA_ALIGNMENT_u="${DATA_ALIGNMENT_u-${DATA_ALIGNMENT_r}}"
LD_FLAG=r
DATA_ALIGNMENT=${DATA_ALIGNMENT_r}
DEFAULT_DATA_ALIGNMENT="ALIGN(${SEGMENT_SIZE})"
+PARTIAL_LINKING=" "
( echo "/* Script for -r */"
source_sh ${CUSTOMIZER_SCRIPT}
source_sh ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
@@ -312,10 +313,12 @@ DEFAULT_DATA_ALIGNMENT="ALIGN(${SEGMENT_SIZE})"
LD_FLAG=u
DATA_ALIGNMENT=${DATA_ALIGNMENT_u}
CONSTRUCTING=" "
+PARTIAL_LINKING=" "
( echo "/* Script for -Ur */"
source_sh ${CUSTOMIZER_SCRIPT}
source_sh ${srcdir}/scripttempl/${SCRIPT_NAME}.sc
) | sed -e '/^ *$/d;s/[ ]*$//' > ldscripts/${EMULATION_NAME}.xu
+unset PARTIAL_LINKING
DATA_ALIGNMENT=${DATA_ALIGNMENT_}
RELOCATING=" "
diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc
index bf2268bb0ad..b1811ef130f 100644
--- a/ld/scripttempl/elf.sc
+++ b/ld/scripttempl/elf.sc
@@ -148,8 +148,8 @@ if test -z "$DATA_SEGMENT_ALIGN"; then
DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT-0}, .);"
fi
fi
-if test -z "${INITIAL_READONLY_SECTIONS}${CREATE_SHLIB}"; then
- INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp) }"
+if test -z "${INITIAL_READONLY_SECTIONS}${CREATE_SHLIB}${PARTIAL_LINKING}"; then
+ INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp); . = 0x1000; }"
fi
if test -z "$PLT"; then
IPLT=".iplt ${RELOCATING-0} : { *(.iplt) }"
From fd7065bfd20364679e3c3f329b19059bbc51ab02 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 6 Mar 2017 23:37:05 -0800
Subject: [PATCH] binutils-cross: Do not generate linker script directories
We don't place target libraries within ${exec_prefix}, we'd always place these
within the target sysroot within the standard library directories. Worse, the
append_to_lib_path code prefixes these paths with the sysroot which makes even
less sense.
These directories therefore don't make sense in our case and mean we have to
relocate all the linker scripts if they're present. Dropping them
gives a reasonable performance improvement/simplification.
Upstream-Status: Inappropriate
RP 2017/01/30
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
ld/genscripts.sh | 25 -------------------------
1 file changed, 25 deletions(-)
diff --git a/ld/genscripts.sh b/ld/genscripts.sh
index 0c52ebee4d0..1acbe66bd2e 100755
--- a/ld/genscripts.sh
+++ b/ld/genscripts.sh
@@ -235,31 +235,6 @@ append_to_lib_path()
fi
}
-# Always search $(tooldir)/lib, aka /usr/local/TARGET/lib when native
-# except when LIBPATH=":".
-if [ "${LIB_PATH}" != ":" ] ; then
- libs=
- if [ "x${TOOL_LIB}" = "x" ] ; then
- if [ "x${NATIVE}" = "xyes" ] ; then
- libs="${exec_prefix}/${target_alias}/lib"
- fi
- else
- # For multilib'ed targets, ensure both ${target_alias}/lib${LIBPATH_SUFFIX}
- # and ${TOOL_LIB}/lib${LIBPATH_SUFFIX} are in the default search path,
- # because 64bit libraries may be in both places, depending on
- # cross-development setup method (e.g.: /usr/s390x-linux/lib64
- # vs. /usr/s390-linux/lib64)
- for libpath_suffix in ${LIBPATH_SUFFIX}; do
- case "${NATIVE}:${libpath_suffix}:${TOOL_LIB}" in
- :* | *::* | *:*:*${libpath_suffix}) ;;
- *) libs="${exec_prefix}/${target_alias}/lib${libpath_suffix}" ;;
- esac
- done
- libs="${exec_prefix}/${TOOL_LIB}/lib ${libs}"
- fi
- append_to_lib_path ${libs}
-fi
-
if [ "x${LIB_PATH}" = "x" ] && [ "x${USE_LIBPATH}" = xyes ] ; then
libs=${NATIVE_LIB_DIRS}
if [ "x${NATIVE}" = "xyes" ] ; then
From 67735b3647f98ce0f010ff8b4f9b5c5da576cb17 Mon Sep 17 00:00:00 2001
From: Richard Purdie <richard.purdie@linuxfoundation.org>
Date: Wed, 19 Feb 2020 09:51:16 -0800
Subject: [PATCH] binutils-nativesdk: Search for alternative ld.so.conf in SDK
installation
We need binutils to look at our ld.so.conf file within the SDK to ensure
we search the SDK's libdirs as well as those from the host system.
We therefore pass in the directory to the code using a define, then add
it to a section we relocate in a similar way to the way we relocate the
gcc internal paths. This ensures that ld works correctly in our buildtools
tarball.
Standard sysroot relocation doesn't work since we're not in a sysroot,
we want to use both the host system and SDK libs.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020/1/17
Upstream-Status: Inappropriate [OE specific tweak]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
ld/Makefile.am | 3 ++-
ld/Makefile.in | 3 ++-
ld/ldelf.c | 2 +-
ld/ldmain.c | 1 +
ld/ldmain.h | 1 +
5 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/ld/Makefile.am b/ld/Makefile.am
index d31021c13e2..29782385ca4 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -42,7 +42,8 @@ ZLIBINC = @zlibinc@
ELF_CLFAGS=-DELF_LIST_OPTIONS=@elf_list_options@ \
-DELF_SHLIB_LIST_OPTIONS=@elf_shlib_list_options@ \
- -DELF_PLT_UNWIND_LIST_OPTIONS=@elf_plt_unwind_list_options@
+ -DELF_PLT_UNWIND_LIST_OPTIONS=@elf_plt_unwind_list_options@ \
+ -DSYSCONFDIR="\"$(sysconfdir)\""
WARN_CFLAGS = @WARN_CFLAGS@
NO_WERROR = @NO_WERROR@
AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) $(JANSSON_CFLAGS)
diff --git a/ld/Makefile.in b/ld/Makefile.in
index ee0c98f65b0..04ee68a2c67 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -562,7 +562,8 @@ ZLIB = @zlibdir@ -lz
ZLIBINC = @zlibinc@
ELF_CLFAGS = -DELF_LIST_OPTIONS=@elf_list_options@ \
-DELF_SHLIB_LIST_OPTIONS=@elf_shlib_list_options@ \
- -DELF_PLT_UNWIND_LIST_OPTIONS=@elf_plt_unwind_list_options@
+ -DELF_PLT_UNWIND_LIST_OPTIONS=@elf_plt_unwind_list_options@ \
+ -DSYSCONFDIR="\"$(sysconfdir)\""
AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) $(JANSSON_CFLAGS)
diff --git a/ld/ldelf.c b/ld/ldelf.c
index bfa0d54753a..0d61a3209ec 100644
--- a/ld/ldelf.c
+++ b/ld/ldelf.c
@@ -936,7 +936,7 @@ ldelf_check_ld_so_conf (const struct bfd_link_needed_list *l, int force,
info.path = NULL;
info.len = info.alloc = 0;
- tmppath = concat (ld_sysroot, prefix, "/etc/ld.so.conf",
+ tmppath = concat (ld_sysconfdir, "/etc/ld.so.conf",
(const char *) NULL);
if (!ldelf_parse_ld_so_conf (&info, tmppath))
{
diff --git a/ld/ldmain.c b/ld/ldmain.c
index ea72b14a301..1ae90a77749 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -70,6 +70,7 @@ char *program_name;
/* The prefix for system library directories. */
const char *ld_sysroot;
+char ld_sysconfdir[4096] __attribute__ ((section (".gccrelocprefix"))) = SYSCONFDIR;
/* The canonical representation of ld_sysroot. */
char *ld_canon_sysroot;
diff --git a/ld/ldmain.h b/ld/ldmain.h
index f6d05a02f59..e60292cd522 100644
--- a/ld/ldmain.h
+++ b/ld/ldmain.h
@@ -23,6 +23,7 @@
extern char *program_name;
extern const char *ld_sysroot;
+extern char ld_sysconfdir[4096];
extern char *ld_canon_sysroot;
extern int ld_canon_sysroot_len;
extern FILE *saved_script_handle;
From 2158e5bd4c6ea4db89e33d46ef25428e37bfc3a6 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 2 Mar 2015 01:09:58 +0000
Subject: [PATCH] Point scripts location to libdir
Upstream-Status: Inappropriate [debian patch]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
ld/Makefile.am | 2 +-
ld/Makefile.in | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 29782385ca4..062e6b6814b 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -51,7 +51,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) $(JANSSON_CFLAGS)
# We put the scripts in the directory $(scriptdir)/ldscripts.
# We can't put the scripts in $(datadir) because the SEARCH_DIR
# directives need to be different for native and cross linkers.
-scriptdir = $(tooldir)/lib
+scriptdir = $(libdir)
EMUL = @EMUL@
EMULATION_OFILES = @EMULATION_OFILES@
diff --git a/ld/Makefile.in b/ld/Makefile.in
index 04ee68a2c67..782d4017a60 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -570,7 +570,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) $(JANSSON_CFLAGS)
# We put the scripts in the directory $(scriptdir)/ldscripts.
# We can't put the scripts in $(datadir) because the SEARCH_DIR
# directives need to be different for native and cross linkers.
-scriptdir = $(tooldir)/lib
+scriptdir = $(libdir)
BASEDIR = $(srcdir)/..
BFDDIR = $(BASEDIR)/bfd
INCDIR = $(BASEDIR)/include
From e74d765a1a95253c9247228bd7ccbcabecdd8f7e Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 2 Mar 2015 01:39:01 +0000
Subject: [PATCH] don't let the distro compiler point to the wrong installation
location
Thanks to RP for helping find the source code causing the issue.
2010/08/13
Nitin A Kamble <nitin.a.kamble@intel.com>
Upstream-Status: Inappropriate [embedded specific]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
libiberty/Makefile.in | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index abef3c4601b..880c8826482 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -385,7 +385,8 @@ install-strip: install
# multilib-specific flags, it's overridden by FLAGS_TO_PASS from the
# default multilib, so we have to take CFLAGS into account as well,
# since it will be passed the multilib flags.
-MULTIOSDIR = `$(CC) $(CFLAGS) -print-multi-os-directory`
+#MULTIOSDIR = `$(CC) $(CFLAGS) -print-multi-os-directory`
+MULTIOSDIR = ""
install_to_libdir: all
if test -n "${target_header_dir}"; then \
${mkinstalldirs} $(DESTDIR)$(libdir)/$(MULTIOSDIR); \
From 2c43b1357db6b09d1645704afd3f45be6de0cf4d Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 15 Jan 2016 06:31:09 +0000
Subject: [PATCH] warn for uses of system directories when cross linking
2008-07-02 Joseph Myers <joseph@codesourcery.com>
ld/
* ld.h (args_type): Add error_poison_system_directories.
* ld.texinfo (--error-poison-system-directories): Document.
* ldfile.c (ldfile_add_library_path): Check
command_line.error_poison_system_directories.
* ldmain.c (main): Initialize
command_line.error_poison_system_directories.
* lexsup.c (enum option_values): Add
OPTION_ERROR_POISON_SYSTEM_DIRECTORIES.
(ld_options): Add --error-poison-system-directories.
(parse_args): Handle new option.
2007-06-13 Joseph Myers <joseph@codesourcery.com>
ld/
* config.in: Regenerate.
* ld.h (args_type): Add poison_system_directories.
* ld.texinfo (--no-poison-system-directories): Document.
* ldfile.c (ldfile_add_library_path): Check
command_line.poison_system_directories.
* ldmain.c (main): Initialize
command_line.poison_system_directories.
* lexsup.c (enum option_values): Add
OPTION_NO_POISON_SYSTEM_DIRECTORIES.
(ld_options): Add --no-poison-system-directories.
(parse_args): Handle new option.
2007-04-20 Joseph Myers <joseph@codesourcery.com>
Merge from Sourcery G++ binutils 2.17:
2007-03-20 Joseph Myers <joseph@codesourcery.com>
Based on patch by Mark Hatle <mark.hatle@windriver.com>.
ld/
* configure.in (--enable-poison-system-directories): New option.
* configure, config.in: Regenerate.
* ldfile.c (ldfile_add_library_path): If
ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of /lib,
/usr/lib, /usr/local/lib or /usr/X11R6/lib.
Upstream-Status: Pending
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
ld/config.in | 3 +++
ld/configure | 16 ++++++++++++++++
ld/configure.ac | 10 ++++++++++
ld/ld.h | 8 ++++++++
ld/ld.texi | 12 ++++++++++++
ld/ldfile.c | 17 +++++++++++++++++
ld/ldlex.h | 2 ++
ld/ldmain.c | 6 ++++--
ld/lexsup.c | 16 ++++++++++++++++
9 files changed, 88 insertions(+), 2 deletions(-)
diff --git a/ld/config.in b/ld/config.in
index d4c1fc420b5..1aece0b2c29 100644
--- a/ld/config.in
+++ b/ld/config.in
@@ -55,6 +55,9 @@
language is requested. */
#undef ENABLE_NLS
+/* Define to warn for use of native system library directories */
+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
+
/* Additional extension a shared object might have. */
#undef EXTRA_SHLIB_EXTENSION
diff --git a/ld/configure b/ld/configure
index e58fb7f3a35..d0a467ac101 100755
--- a/ld/configure
+++ b/ld/configure
@@ -836,6 +836,7 @@ with_lib_path
enable_targets
enable_64_bit_bfd
with_sysroot
+enable_poison_system_directories
enable_gold
enable_got
enable_compressed_debug_sections
@@ -1514,6 +1515,8 @@ Optional Features:
--enable-checking enable run-time checks
--enable-targets alternative target configurations
--enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)
+ --enable-poison-system-directories
+ warn for use of native system library directories
--enable-gold[=ARG] build gold [ARG={default,yes,no}]
--enable-got=<type> GOT handling scheme (target, single, negative,
multigot)
@@ -15349,6 +15352,19 @@ fi
+# Check whether --enable-poison-system-directories was given.
+if test "${enable_poison_system_directories+set}" = set; then :
+ enableval=$enable_poison_system_directories;
+else
+ enable_poison_system_directories=no
+fi
+
+if test "x${enable_poison_system_directories}" = "xyes"; then
+
+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
+
+fi
+
# Check whether --enable-gold was given.
if test "${enable_gold+set}" = set; then :
enableval=$enable_gold; case "${enableval}" in
diff --git a/ld/configure.ac b/ld/configure.ac
index 4331d6b1302..e2976bc2926 100644
--- a/ld/configure.ac
+++ b/ld/configure.ac
@@ -102,6 +102,16 @@ AC_SUBST(use_sysroot)
AC_SUBST(TARGET_SYSTEM_ROOT)
AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
+AC_ARG_ENABLE([poison-system-directories],
+ AS_HELP_STRING([--enable-poison-system-directories],
+ [warn for use of native system library directories]),,
+ [enable_poison_system_directories=no])
+if test "x${enable_poison_system_directories}" = "xyes"; then
+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
+ [1],
+ [Define to warn for use of native system library directories])
+fi
+
dnl Use --enable-gold to decide if this linker should be the default.
dnl "install_as_default" is set to false if gold is the default linker.
dnl "installed_linker" is the installed BFD linker name.
diff --git a/ld/ld.h b/ld/ld.h
index f3086bf30de..db5064243c7 100644
--- a/ld/ld.h
+++ b/ld/ld.h
@@ -162,6 +162,14 @@ typedef struct
in the linker script. */
bool force_group_allocation;
+ /* If TRUE (the default) warn for uses of system directories when
+ cross linking. */
+ bool poison_system_directories;
+
+ /* If TRUE (default FALSE) give an error for uses of system
+ directories when cross linking instead of a warning. */
+ bool error_poison_system_directories;
+
/* Big or little endian as set on command line. */
enum endian_enum endian;
diff --git a/ld/ld.texi b/ld/ld.texi
index eabbec8faa9..c4680e4947e 100644
--- a/ld/ld.texi
+++ b/ld/ld.texi
@@ -2947,6 +2947,18 @@ creation of the metadata note, if one had been enabled by an earlier
occurrence of the --package-metdata option.
If the linker has been built with libjansson, then the JSON string
will be validated.
+
+@kindex --no-poison-system-directories
+@item --no-poison-system-directories
+Do not warn for @option{-L} options using system directories such as
+@file{/usr/lib} when cross linking. This option is intended for use
+in chroot environments when such directories contain the correct
+libraries for the target system rather than the host.
+
+@kindex --error-poison-system-directories
+@item --error-poison-system-directories
+Give an error instead of a warning for @option{-L} options using
+system directories when cross linking.
@end table
@c man end
diff --git a/ld/ldfile.c b/ld/ldfile.c
index 731ae5f7aed..dd8f03fd960 100644
--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -117,6 +117,23 @@ ldfile_add_library_path (const char *name, bool cmdline)
new_dirs->name = concat (ld_sysroot, name + strlen ("$SYSROOT"), (const char *) NULL);
else
new_dirs->name = xstrdup (name);
+
+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
+ if (command_line.poison_system_directories
+ && ((!strncmp (name, "/lib", 4))
+ || (!strncmp (name, "/usr/lib", 8))
+ || (!strncmp (name, "/usr/local/lib", 14))
+ || (!strncmp (name, "/usr/X11R6/lib", 14))))
+ {
+ if (command_line.error_poison_system_directories)
+ einfo (_("%X%P: error: library search path \"%s\" is unsafe for "
+ "cross-compilation\n"), name);
+ else
+ einfo (_("%P: warning: library search path \"%s\" is unsafe for "
+ "cross-compilation\n"), name);
+ }
+#endif
+
}
/* Try to open a BFD for a lang_input_statement. */
diff --git a/ld/ldlex.h b/ld/ldlex.h
index 57ade1f754b..64007ff8684 100644
--- a/ld/ldlex.h
+++ b/ld/ldlex.h
@@ -168,6 +168,8 @@ enum option_values
OPTION_NO_WARN_EXECSTACK,
OPTION_WARN_RWX_SEGMENTS,
OPTION_NO_WARN_RWX_SEGMENTS,
+ OPTION_NO_POISON_SYSTEM_DIRECTORIES,
+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES,
};
/* The initial parser states. */
diff --git a/ld/ldmain.c b/ld/ldmain.c
index 1ae90a77749..f40750fd816 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -322,6 +322,8 @@ main (int argc, char **argv)
command_line.warn_mismatch = true;
command_line.warn_search_mismatch = true;
command_line.check_section_addresses = -1;
+ command_line.poison_system_directories = true;
+ command_line.error_poison_system_directories = false;
/* We initialize DEMANGLING based on the environment variable
COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the
@@ -1447,7 +1449,7 @@ undefined_symbol (struct bfd_link_info *info,
argv[1] = "undefined-symbol";
argv[2] = (char *) name;
argv[3] = NULL;
-
+
if (verbose)
einfo (_("%P: About to run error handling script '%s' with arguments: '%s' '%s'\n"),
argv[0], argv[1], argv[2]);
@@ -1468,7 +1470,7 @@ undefined_symbol (struct bfd_link_info *info,
carry on to issue the normal error message. */
}
#endif /* SUPPORT_ERROR_HANDLING_SCRIPT */
-
+
if (section != NULL)
{
if (error_count < MAX_ERRORS_IN_A_ROW)
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 9225f71b3ce..92fb66f1fa2 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -608,6 +608,14 @@ static const struct ld_option ld_options[] =
" <method> is: share-unconflicted (default),\n"
" share-duplicated"),
TWO_DASHES },
+ { {"no-poison-system-directories", no_argument, NULL,
+ OPTION_NO_POISON_SYSTEM_DIRECTORIES},
+ '\0', NULL, N_("Do not warn for -L options using system directories"),
+ TWO_DASHES },
+ { {"error-poison-system-directories", no_argument, NULL,
+ + OPTION_ERROR_POISON_SYSTEM_DIRECTORIES},
+ '\0', NULL, N_("Give an error for -L options using system directories"),
+ TWO_DASHES },
};
#define OPTION_COUNT ARRAY_SIZE (ld_options)
@@ -1722,6 +1730,14 @@ parse_args (unsigned argc, char **argv)
config.print_map_discarded = true;
break;
+ case OPTION_NO_POISON_SYSTEM_DIRECTORIES:
+ command_line.poison_system_directories = false;
+ break;
+
+ case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES:
+ command_line.error_poison_system_directories = true;
+ break;
+
case OPTION_DEPENDENCY_FILE:
config.dependency_file = optarg;
break;
From 883b6c0930410f8553b3bce0dd98131bc1694fa6 Mon Sep 17 00:00:00 2001
From: Zhenhua Luo <zhenhua.luo@nxp.com>
Date: Sat, 11 Jun 2016 22:08:29 -0500
Subject: [PATCH] fix the incorrect assembling for ppc wait mnemonic
The wait mnemonic for ppc targets is incorrectly assembled into 0x7c00003c due
to duplicated address definition with waitasec instruction. The issue causes
kernel boot calltrace for ppc targets when wait instruction is executed.
Upstream-Status: Pending
Signed-off-by: Zhenhua Luo <zhenhua.luo@nxp.com>
---
opcodes/ppc-opc.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/opcodes/ppc-opc.c b/opcodes/ppc-opc.c
index 7637d3e349e..8e074e13208 100644
--- a/opcodes/ppc-opc.c
+++ b/opcodes/ppc-opc.c
@@ -6947,8 +6947,6 @@ const struct powerpc_opcode powerpc_opcodes[] = {
{"waitasec", X(31,30), XRTRARB_MASK, POWER8, POWER9, {0}},
{"waitrsv", XWCPL(31,30,1,0),0xffffffff, POWER10, EXT, {0}},
{"pause_short", XWCPL(31,30,2,0),0xffffffff, POWER10, EXT, {0}},
-{"wait", X(31,30), XWCPL_MASK, POWER10, 0, {WC, PL}},
-{"wait", X(31,30), XWC_MASK, POWER9, POWER10, {WC}},
{"lwepx", X(31,31), X_MASK, E500MC|PPCA2, 0, {RT, RA0, RB}},
@@ -7002,7 +7000,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
{"waitrsv", X(31,62)|(1<<21), 0xffffffff, E500MC|PPCA2, EXT, {0}},
{"waitimpl", X(31,62)|(2<<21), 0xffffffff, E500MC|PPCA2, EXT, {0}},
-{"wait", X(31,62), XWC_MASK, E500MC|PPCA2, 0, {WC}},
+{"wait", X(31,62), XWC_MASK, E500MC|PPCA2|POWER9|POWER10, 0, {WC}},
{"dcbstep", XRT(31,63,0), XRT_MASK, E500MC|PPCA2, 0, {RA0, RB}},
source diff could not be displayed: it is too large. Options to address this: view the blob.
From 98410efc334e31ccfbdc0080fb293b0e06885454 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 2 Mar 2015 01:42:38 +0000
Subject: [PATCH] Fix rpath in libtool when sysroot is enabled
Enabling sysroot support in libtool exposed a bug where the final
library had an RPATH encoded into it which still pointed to the
sysroot. This works around the issue until it gets sorted out
upstream.
Fix suggested by Richard Purdie <richard.purdie@linuxfoundation.org>
Upstream-Status: Inappropriate [embedded specific]
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
ltmain.sh | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/ltmain.sh b/ltmain.sh
index 70e856e0659..11ee684cccf 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -8035,9 +8035,11 @@ EOF
test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
for libdir in $rpath; do
if test -n "$hardcode_libdir_flag_spec"; then
+ func_replace_sysroot "$libdir"
+ libdir=$func_replace_sysroot_result
+ func_stripname '=' '' "$libdir"
+ libdir=$func_stripname_result
if test -n "$hardcode_libdir_separator"; then
- func_replace_sysroot "$libdir"
- libdir=$func_replace_sysroot_result
if test -z "$hardcode_libdirs"; then
hardcode_libdirs="$libdir"
else
@@ -8770,6 +8772,10 @@ EOF
hardcode_libdirs=
for libdir in $compile_rpath $finalize_rpath; do
if test -n "$hardcode_libdir_flag_spec"; then
+ func_replace_sysroot "$libdir"
+ libdir=$func_replace_sysroot_result
+ func_stripname '=' '' "$libdir"
+ libdir=$func_stripname_result
if test -n "$hardcode_libdir_separator"; then
if test -z "$hardcode_libdirs"; then
hardcode_libdirs="$libdir"
From 84fc4ceafcbfad4c6ddc9d65f6a425bd62dd062e Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton@intel.com>
Date: Mon, 6 Mar 2017 23:33:27 -0800
Subject: [PATCH] sync with OE libtool changes
Apply these patches from our libtool patches as not only are redundant RPATHs a
waste of space but they can cause incorrect linking when native packages are
restored from sstate.
fix-rpath.patch:
We don't want to add RPATHS which match default linker
search paths, they're a waste of space. This patch
filters libtools list and removes the ones we don't need.
norm-rpath.patch:
Libtool may be passed link paths of the form "/usr/lib/../lib", which
fool its detection code into thinking it should be included as an
RPATH in the generated binary. Normalize before comparision.
Upstream-Status: Inappropriate
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
ltmain.sh | 34 ++++++++++++++++++++++++++++------
1 file changed, 28 insertions(+), 6 deletions(-)
diff --git a/ltmain.sh b/ltmain.sh
index 11ee684cccf..3b19ac15328 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -8053,8 +8053,16 @@ EOF
esac
fi
else
- eval flag=\"$hardcode_libdir_flag_spec\"
- func_append dep_rpath " $flag"
+ # We only want to hardcode in an rpath if it isn't in the
+ # default dlsearch path.
+ func_normal_abspath "$libdir"
+ libdir_norm=$func_normal_abspath_result
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir_norm "*) ;;
+ *) eval flag=\"$hardcode_libdir_flag_spec\"
+ func_append dep_rpath " $flag"
+ ;;
+ esac
fi
elif test -n "$runpath_var"; then
case "$perm_rpath " in
@@ -8790,8 +8798,16 @@ EOF
esac
fi
else
- eval flag=\"$hardcode_libdir_flag_spec\"
- func_append rpath " $flag"
+ # We only want to hardcode in an rpath if it isn't in the
+ # default dlsearch path.
+ func_normal_abspath "$libdir"
+ libdir_norm=$func_normal_abspath_result
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir_norm "*) ;;
+ *) eval flag=\"$hardcode_libdir_flag_spec\"
+ rpath+=" $flag"
+ ;;
+ esac
fi
elif test -n "$runpath_var"; then
case "$perm_rpath " in
@@ -8841,8 +8857,14 @@ EOF
esac
fi
else
- eval flag=\"$hardcode_libdir_flag_spec\"
- func_append rpath " $flag"
+ # We only want to hardcode in an rpath if it isn't in the
+ # default dlsearch path.
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *) eval flag=\"$hardcode_libdir_flag_spec\"
+ func_append rpath " $flag"
+ ;;
+ esac
fi
elif test -n "$runpath_var"; then
case "$finalize_perm_rpath " in
From 628c10087e6e11a7bc748437c5b695835b704aaf Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 15 Apr 2020 14:17:20 -0700
Subject: [PATCH] Check for clang before checking gcc version
Clang advertises itself to be gcc 4.2.1, so when compiling this test
here fails since gcc < 4.4.5 did not support -static-libstdc++ but thats
not true for clang, so its better to make an additional check for clang
before resorting to gcc version check. This should let clang enable
static libstdc++ linking
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
configure | 2 +-
configure.ac | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index be433ef6d5d..7494fbd2f06 100755
--- a/configure
+++ b/configure
@@ -5294,7 +5294,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
+#if !defined(__clang__) && ((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5))
#error -static-libstdc++ not implemented
#endif
int main() {}
diff --git a/configure.ac b/configure.ac
index 1651cbf3b02..2e2ecc47542 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1323,7 +1323,7 @@ if test "$GCC" = yes; then
AC_MSG_CHECKING([whether g++ accepts -static-libstdc++ -static-libgcc])
AC_LANG_PUSH(C++)
AC_LINK_IFELSE([AC_LANG_SOURCE([
-#if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
+#if !defined(__clang__) && ((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5))
#error -static-libstdc++ not implemented
#endif
int main() {}])],
From 63157cb403b6aa13147840c036a8555c4ea9c166 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 10 Mar 2022 21:21:33 -0800
Subject: [PATCH] Only generate an RPATH entry if LD_RUN_PATH is not empty
for cases where -rpath isn't specified. debian (#151024)
Upstream-Status: Pending
Signed-off-by: Chris Chimelis <chris@debian.org>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
ld/ldelf.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/ld/ldelf.c b/ld/ldelf.c
index 0d61a3209ec..cd0da2013e2 100644
--- a/ld/ldelf.c
+++ b/ld/ldelf.c
@@ -1127,6 +1127,9 @@ ldelf_handle_dt_needed (struct elf_link_hash_table *htab,
&& command_line.rpath == NULL)
{
path = (const char *) getenv ("LD_RUN_PATH");
+ if ((path) && (strlen (path) == 0))
+ path = NULL;
+
if (path
&& ldelf_search_needed (path, &n, force,
is_linux, elfsize))
@@ -1801,6 +1804,8 @@ ldelf_before_allocation (char *audit, char *depaudit,
rpath = command_line.rpath;
if (rpath == NULL)
rpath = (const char *) getenv ("LD_RUN_PATH");
+ if ((rpath) && (strlen (rpath) == 0))
+ rpath = NULL;
for (abfd = link_info.input_bfds; abfd; abfd = abfd->link.next)
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment