Complete Yocto mirror with license table for TQMa6UL (2038-compliance)
- 264 license table entries with exact download URLs (224/264 resolved) - Complete sources/ directory with all BitBake recipes - Build configuration: tqma6ul-multi-mba6ulx, spaetzle (musl) - Full traceability for Softwarefreigabeantrag - GCC 13.4.0, Linux 6.6.102, U-Boot 2023.04, musl 1.2.4 - License distribution: GPL-2.0 (24), MIT (23), GPL-2.0+ (18), BSD-3 (16)
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
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.42, please make sure there is no trailing .0, so
|
||||
# that upstream version check can work correctly.
|
||||
PV = "2.42"
|
||||
CVE_VERSION = "2.42"
|
||||
SRCBRANCH ?= "binutils-2_42-branch"
|
||||
|
||||
UPSTREAM_CHECK_GITTAGREGEX = "binutils-(?P<pver>\d+_(\d_?)*)"
|
||||
|
||||
CVE_STATUS[CVE-2023-25584] = "cpe-incorrect: Applies only for version 2.40 and earlier"
|
||||
CVE_STATUS[CVE-2025-1180] = "patched: fixed by patch for CVE-2025-1176"
|
||||
|
||||
SRCREV ?= "f9488b0d92b591bdf3ff8cce485cb0e1b3727cc0"
|
||||
BINUTILS_GIT_URI ?= "git://sourceware.org/git/binutils-gdb.git;branch=${SRCBRANCH};protocol=https"
|
||||
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 \
|
||||
file://0013-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch \
|
||||
file://0014-Remove-duplicate-pe-dll.o-entry-deom-targ_extra_ofil.patch \
|
||||
file://0015-gprofng-change-use-of-bignum-to-bigint.patch \
|
||||
file://0016-CVE-2024-53589.patch \
|
||||
file://0017-dlltool-file-name-too-long.patch \
|
||||
file://0018-CVE-2025-0840.patch \
|
||||
file://CVE-2025-1176.patch \
|
||||
file://CVE-2025-1178.patch \
|
||||
file://CVE-2024-57360.patch \
|
||||
file://CVE-2025-1181-pre.patch \
|
||||
file://CVE-2025-1181.patch \
|
||||
file://CVE-2025-1182.patch \
|
||||
file://0019-CVE-2025-1153-1.patch \
|
||||
file://0020-CVE-2025-1153-2.patch \
|
||||
file://0021-CVE-2025-1153-3.patch \
|
||||
file://CVE-2025-1179-pre.patch \
|
||||
file://CVE-2025-1179.patch \
|
||||
file://0022-CVE-2025-5245.patch \
|
||||
file://0022-CVE-2025-5244.patch \
|
||||
file://0023-CVE-2025-7546.patch \
|
||||
file://0023-CVE-2025-7545.patch \
|
||||
"
|
||||
S = "${WORKDIR}/git"
|
||||
@@ -0,0 +1,32 @@
|
||||
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 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
|
||||
rm -f ${D}${sysconfdir}/gprofng.rc
|
||||
rmdir ${D}${sysconfdir} || :
|
||||
|
||||
cross_canadian_bindirlinks
|
||||
}
|
||||
|
||||
BBCLASSEXTEND = ""
|
||||
@@ -0,0 +1,3 @@
|
||||
require binutils.inc
|
||||
require binutils-${PV}.inc
|
||||
require binutils-cross-canadian.inc
|
||||
@@ -0,0 +1,83 @@
|
||||
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/${TARGET_PREFIX}binutils"
|
||||
DEPENDS += "virtual/${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}"'))
|
||||
content.append(d.expand('set LD "${TARGET_PREFIX}ld ${TUNE_LDARGS}"'))
|
||||
content.append(d.expand('set LDFLAGS_FOR_TARGET "${TUNE_LDARGS}"'))
|
||||
|
||||
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
|
||||
@@ -0,0 +1,39 @@
|
||||
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} || :
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
require binutils.inc
|
||||
require binutils-${PV}.inc
|
||||
require binutils-cross.inc
|
||||
@@ -0,0 +1,11 @@
|
||||
require binutils-cross_${PV}.bb
|
||||
|
||||
inherit crosssdk
|
||||
|
||||
PN = "binutils-crosssdk-${SDK_SYS}"
|
||||
|
||||
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
|
||||
}
|
||||
207
sources/poky/meta/recipes-devtools/binutils/binutils.inc
Normal file
207
sources/poky/meta/recipes-devtools/binutils/binutils.inc
Normal file
@@ -0,0 +1,207 @@
|
||||
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"
|
||||
|
||||
FILES:${PN}-staticdev += "${libdir}/gprofng/*.a"
|
||||
|
||||
# Rather than duplicating multiple entries for these, make one
|
||||
# list and reuse it.
|
||||
|
||||
GPROFNGS = " \
|
||||
gp-archive \
|
||||
gp-collect-app \
|
||||
gp-display-html \
|
||||
gp-display-src \
|
||||
gp-display-text \
|
||||
gprofng \
|
||||
"
|
||||
|
||||
# it disables gprofng for clang and musl in the bb file
|
||||
GPROFNGS:toolchain-clang = ""
|
||||
GPROFNGS:libc-musl = ""
|
||||
|
||||
GPROFNG_ALTS ?= ""
|
||||
GPROFNG_ALTS:x86 = "${GPROFNGS}"
|
||||
GPROFNG_ALTS:x86-64 = "${GPROFNGS}"
|
||||
GPROFNG_ALTS:aarch64 = "${GPROFNGS}"
|
||||
|
||||
LDGOLD_ALTS ?= "ld.gold dwp"
|
||||
LDGOLD_ALTS:riscv64 = ""
|
||||
LDGOLD_ALTS:riscv32 = ""
|
||||
LDGOLD_ALTS:loongarch64 = ""
|
||||
LDGOLD_ALTS:libc-glibc:mipsarch = ""
|
||||
|
||||
USE_ALTERNATIVES_FOR = " \
|
||||
addr2line \
|
||||
ar \
|
||||
as \
|
||||
c++filt \
|
||||
elfedit \
|
||||
gprof \
|
||||
${GPROFNG_ALTS} \
|
||||
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 \
|
||||
--enable-new-dtags \
|
||||
--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 loongarch64', True, False, d):
|
||||
bb.fatal("Gold linker does not _yet_ support RISC-V and LoongArch architecture please remove ld-is-gold from DISTRO_FEATURES")
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
From 089ee95b342e79af09258b45c888a13b35fadf26 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 b43ae841a6c..6101a95195b 100644
|
||||
--- a/gold/layout.cc
|
||||
+++ b/gold/layout.cc
|
||||
@@ -5102,7 +5102,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 d6ceb3fe4f5..365c0e778cc 100755
|
||||
--- a/ld/genscripts.sh
|
||||
+++ b/ld/genscripts.sh
|
||||
@@ -298,6 +298,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
|
||||
@@ -306,10 +307,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 fae7c2ad71c..7fe37eb1874 100644
|
||||
--- a/ld/scripttempl/elf.sc
|
||||
+++ b/ld/scripttempl/elf.sc
|
||||
@@ -150,8 +150,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) }"
|
||||
@@ -0,0 +1,59 @@
|
||||
From 6fae7afeb713a60755e17443964e46190bb97ede 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 365c0e778cc..b0893fda3c5 100755
|
||||
--- a/ld/genscripts.sh
|
||||
+++ b/ld/genscripts.sh
|
||||
@@ -229,31 +229,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
|
||||
@@ -0,0 +1,95 @@
|
||||
From 1fe9aa3f25e09281cb018b29081db4cc44bdc01f 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 f9ee05b1400..07801c2c3ac 100644
|
||||
--- a/ld/Makefile.am
|
||||
+++ b/ld/Makefile.am
|
||||
@@ -42,7 +42,8 @@ ZLIBINC = @zlibinc@
|
||||
|
||||
ELF_CFLAGS=-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_CFLAGS) $(JANSSON_CFLAGS) $(ZSTD_CFLAGS)
|
||||
diff --git a/ld/Makefile.in b/ld/Makefile.in
|
||||
index abb0565718f..6329a12a0d6 100644
|
||||
--- a/ld/Makefile.in
|
||||
+++ b/ld/Makefile.in
|
||||
@@ -576,7 +576,8 @@ ZLIB = @zlibdir@ -lz
|
||||
ZLIBINC = @zlibinc@
|
||||
ELF_CFLAGS = -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_CFLAGS) $(JANSSON_CFLAGS) $(ZSTD_CFLAGS)
|
||||
|
||||
diff --git a/ld/ldelf.c b/ld/ldelf.c
|
||||
index 2852851dcd5..187b359af86 100644
|
||||
--- a/ld/ldelf.c
|
||||
+++ b/ld/ldelf.c
|
||||
@@ -939,7 +939,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, "/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 e90c2021b33..01b306e58a1 100644
|
||||
--- a/ld/ldmain.c
|
||||
+++ b/ld/ldmain.c
|
||||
@@ -69,6 +69,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 0238aed0ebd..2dd00db13b3 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;
|
||||
@@ -0,0 +1,39 @@
|
||||
From 780109902b00652dfdc080607c614f210e96ae9b 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 07801c2c3ac..a2bcffecf73 100644
|
||||
--- a/ld/Makefile.am
|
||||
+++ b/ld/Makefile.am
|
||||
@@ -51,7 +51,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CFLAGS) $(JANSSON_CFLAGS) $(ZSTD_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 6329a12a0d6..15311048855 100644
|
||||
--- a/ld/Makefile.in
|
||||
+++ b/ld/Makefile.in
|
||||
@@ -584,7 +584,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CFLAGS) $(JANSSON_CFLAGS) $(ZSTD_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
|
||||
@@ -0,0 +1,32 @@
|
||||
From c8cca8d2364c9f233d6e771136a4d4ff7f405c21 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 85c4b6b6ef8..cb6e91c8f9b 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); \
|
||||
@@ -0,0 +1,287 @@
|
||||
From a92c46e3703d038d7d810bdc91e8540ad9d9150a 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 | 15 +++++++++++++++
|
||||
9 files changed, 87 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/ld/config.in b/ld/config.in
|
||||
index 52d62f06ff0..b5944e7ba55 100644
|
||||
--- a/ld/config.in
|
||||
+++ b/ld/config.in
|
||||
@@ -70,6 +70,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 6f8a05c3b6c..98a76d6da7f 100755
|
||||
--- a/ld/configure
|
||||
+++ b/ld/configure
|
||||
@@ -844,6 +844,7 @@ with_lib_path
|
||||
enable_targets
|
||||
enable_64_bit_bfd
|
||||
with_sysroot
|
||||
+enable_poison_system_directories
|
||||
enable_gold
|
||||
enable_got
|
||||
enable_compressed_debug_sections
|
||||
@@ -1534,6 +1535,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)
|
||||
@@ -15566,6 +15569,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 4a11787ae71..104a531fb0f 100644
|
||||
--- a/ld/configure.ac
|
||||
+++ b/ld/configure.ac
|
||||
@@ -103,6 +103,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 54d9079678c..9f0163b2911 100644
|
||||
--- a/ld/ld.h
|
||||
+++ b/ld/ld.h
|
||||
@@ -166,6 +166,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 4fda259a552..22685f5f1dd 100644
|
||||
--- a/ld/ld.texi
|
||||
+++ b/ld/ld.texi
|
||||
@@ -3119,6 +3119,18 @@ creation of the metadata note, if one had been enabled by an earlier
|
||||
occurrence of the --package-metadata 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 dc9875d8813..49d899ee49d 100644
|
||||
--- a/ld/ldfile.c
|
||||
+++ b/ld/ldfile.c
|
||||
@@ -327,6 +327,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 161a9d4d8dc..757fe2f7650 100644
|
||||
--- a/ld/ldlex.h
|
||||
+++ b/ld/ldlex.h
|
||||
@@ -147,6 +147,8 @@ enum option_values
|
||||
OPTION_PLUGIN,
|
||||
OPTION_PLUGIN_OPT,
|
||||
#endif /* BFD_SUPPORTS_PLUGINS */
|
||||
+ OPTION_NO_POISON_SYSTEM_DIRECTORIES,
|
||||
+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES,
|
||||
OPTION_DEFAULT_SCRIPT,
|
||||
OPTION_PRINT_OUTPUT_FORMAT,
|
||||
OPTION_PRINT_SYSROOT,
|
||||
diff --git a/ld/ldmain.c b/ld/ldmain.c
|
||||
index 01b306e58a1..eddefc24332 100644
|
||||
--- a/ld/ldmain.c
|
||||
+++ b/ld/ldmain.c
|
||||
@@ -326,6 +326,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
|
||||
@@ -1458,7 +1460,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]);
|
||||
@@ -1479,7 +1481,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 099dff8ecde..e9939000b2e 100644
|
||||
--- a/ld/lexsup.c
|
||||
+++ b/ld/lexsup.c
|
||||
@@ -642,6 +642,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)
|
||||
@@ -1818,6 +1826,13 @@ parse_args (unsigned argc, char **argv)
|
||||
|
||||
case OPTION_PRINT_MAP_LOCALS:
|
||||
config.print_map_locals = true;
|
||||
+
|
||||
+ 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:
|
||||
@@ -0,0 +1,37 @@
|
||||
From d35fd95eee9930ab41d9ad637eacb35aa9fe6f44 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 e55bfe846cd..66b37e36e6f 100644
|
||||
--- a/opcodes/ppc-opc.c
|
||||
+++ b/opcodes/ppc-opc.c
|
||||
@@ -7138,8 +7138,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}},
|
||||
|
||||
@@ -7193,7 +7191,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}},
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,49 @@
|
||||
From c9e810840d95554046b7132e3e2c98bf99cb2d89 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 7f7104ffc82..f59eb4aa631 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"
|
||||
@@ -0,0 +1,86 @@
|
||||
From befc176c209bbb4c32b57c2068e813c88b1ab6b1 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 f59eb4aa631..ce97db42ce7 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
|
||||
@@ -0,0 +1,45 @@
|
||||
From cad852e0ed46a1c26607f9e7d17cc5974b05e38a 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 670684d83d1..f9ba1c0a4f7 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -5432,7 +5432,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 88b4800e298..6cd4530db56 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -1410,7 +1410,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() {}])],
|
||||
@@ -0,0 +1,38 @@
|
||||
From 47e53916e3112391d8bff2b2257dcec0a2426d66 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 187b359af86..ad792f02d63 100644
|
||||
--- a/ld/ldelf.c
|
||||
+++ b/ld/ldelf.c
|
||||
@@ -1130,6 +1130,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))
|
||||
@@ -1805,6 +1808,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,0 +1,48 @@
|
||||
From d479020609329cdc7fa3675bc3daf072401fefae Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Sun, 15 Jan 2023 00:16:25 -0800
|
||||
Subject: [PATCH] Define alignof using _Alignof when using C11 or newer
|
||||
|
||||
WG14 N2350 made very clear that it is an UB having type definitions
|
||||
within "offsetof" [1]. This patch enhances the implementation of macro
|
||||
alignof to use builtin "_Alignof" to avoid undefined behavior on
|
||||
when using std=c11 or newer
|
||||
|
||||
clang 16+ has started to flag this [2]
|
||||
|
||||
Fixes build when using -std >= gnu11 and using clang16+
|
||||
|
||||
Older compilers gcc < 4.9 or clang < 8 has buggy _Alignof even though it
|
||||
may support C11, exclude those compilers too
|
||||
|
||||
[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm
|
||||
[2] https://reviews.llvm.org/D133574
|
||||
|
||||
Upstream-Status: Pending
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
libiberty/sha1.c | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/libiberty/sha1.c b/libiberty/sha1.c
|
||||
index 49e8e0b6c2b..72de5cc8ad6 100644
|
||||
--- a/libiberty/sha1.c
|
||||
+++ b/libiberty/sha1.c
|
||||
@@ -234,7 +234,17 @@ sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx)
|
||||
if (len >= 64)
|
||||
{
|
||||
#if !_STRING_ARCH_unaligned
|
||||
+/* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023
|
||||
+ <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>.
|
||||
+ clang versions < 8.0.0 have the same bug. */
|
||||
+#if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \
|
||||
+ || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \
|
||||
+ && !defined __clang__) \
|
||||
+ || (defined __clang__ && __clang_major__ < 8))
|
||||
# define alignof(type) offsetof (struct { char c; type x; }, x)
|
||||
+#else
|
||||
+# define alignof(type) _Alignof(type)
|
||||
+#endif
|
||||
# define UNALIGNED_P(p) (((size_t) p) % alignof (sha1_uint32) != 0)
|
||||
if (UNALIGNED_P (buffer))
|
||||
while (len > 64)
|
||||
@@ -0,0 +1,32 @@
|
||||
From ddd941856582a82171626cbe609325b11e223704 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Wed, 18 Jan 2023 19:35:07 -0800
|
||||
Subject: [PATCH] Remove duplicate pe-dll.o entry deom targ_extra_ofiles
|
||||
|
||||
Commit c60b3806799abf1d7f6cf5108a1b0e733a950b13 added support for
|
||||
aarch64-pe which introduced wrapper over pep-dll.c for x86_64 as well as
|
||||
aarch64, on x86_64 it was added but the old object pe-dll.o needs to be
|
||||
removed too, otherwise build fails with duplicate symbols from pe-dll.o
|
||||
and pep-dll-x86_64.o
|
||||
|
||||
Upstream-Status: Submitted [https://sourceware.org/pipermail/binutils/2023-January/125739.html]
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
Cc: Jedidiah Thompson <wej22007@outlook.com>
|
||||
Cc: Zac Walker <zac.walker@linaro.org>
|
||||
---
|
||||
ld/configure.tgt | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/ld/configure.tgt b/ld/configure.tgt
|
||||
index f937f78b876..830613744c2 100644
|
||||
--- a/ld/configure.tgt
|
||||
+++ b/ld/configure.tgt
|
||||
@@ -1067,7 +1067,7 @@ x86_64-*-cygwin) targ_emul=i386pep ;
|
||||
;;
|
||||
x86_64-*-mingw*) targ_emul=i386pep ;
|
||||
targ_extra_emuls=i386pe
|
||||
- targ_extra_ofiles="deffilep.o pdb.o pep-dll.o pe-dll.o"
|
||||
+ targ_extra_ofiles="deffilep.o pdb.o pe-dll.o"
|
||||
;;
|
||||
x86_64-*-gnu*) targ_emul=elf_x86_64
|
||||
targ_extra_emuls="elf32_x86_64 elf_iamcu elf_i386"
|
||||
@@ -0,0 +1,17 @@
|
||||
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=3243d790ee32aa8eda69226d81b1e79dbd1dcd87]
|
||||
|
||||
Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
|
||||
|
||||
diff --git a/gprofng/gp-display-html/gp-display-html.in b/gprofng/gp-display-html/gp-display-html.in
|
||||
index 6f37ca282e7..306c99a0ec3 100644
|
||||
--- a/gprofng/gp-display-html/gp-display-html.in
|
||||
+++ b/gprofng/gp-display-html/gp-display-html.in
|
||||
@@ -25,7 +25,7 @@ use warnings;
|
||||
# Disable before release
|
||||
# use Perl::Critic;
|
||||
|
||||
-use bignum;
|
||||
+use bigint;
|
||||
use List::Util qw (max);
|
||||
use Cwd qw (abs_path cwd);
|
||||
use File::Basename;
|
||||
@@ -0,0 +1,92 @@
|
||||
Author: Alan Modra <amodra@gmail.com>
|
||||
Date: Mon Nov 11 10:24:09 2024 +1030
|
||||
|
||||
Re: tekhex object file output fixes
|
||||
|
||||
Commit 8b5a212495 supported *ABS* symbols by allowing "section" to be
|
||||
bfd_abs_section, but bfd_abs_section needs to be treated specially.
|
||||
In particular, bfd_get_next_section_by_name (.., bfd_abs_section_ptr)
|
||||
is invalid.
|
||||
|
||||
PR 32347
|
||||
* tekhex.c (first_phase): Guard against modification of
|
||||
_bfd_std_section[] entries.
|
||||
|
||||
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=e0323071916878e0634a6e24d8250e4faff67e88]
|
||||
CVE: CVE-2024-53589
|
||||
|
||||
Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
|
||||
|
||||
diff --git a/bfd/tekhex.c b/bfd/tekhex.c
|
||||
index aea2ebb23df..b305c1f96f1 100644
|
||||
--- a/bfd/tekhex.c
|
||||
+++ b/bfd/tekhex.c
|
||||
@@ -361,6 +361,7 @@ first_phase (bfd *abfd, int type, char *src, char * src_end)
|
||||
{
|
||||
asection *section, *alt_section;
|
||||
unsigned int len;
|
||||
+ bfd_vma addr;
|
||||
bfd_vma val;
|
||||
char sym[17]; /* A symbol can only be 16chars long. */
|
||||
|
||||
@@ -368,20 +369,16 @@ first_phase (bfd *abfd, int type, char *src, char * src_end)
|
||||
{
|
||||
case '6':
|
||||
/* Data record - read it and store it. */
|
||||
- {
|
||||
- bfd_vma addr;
|
||||
-
|
||||
- if (!getvalue (&src, &addr, src_end))
|
||||
- return false;
|
||||
-
|
||||
- while (*src && src < src_end - 1)
|
||||
- {
|
||||
- insert_byte (abfd, HEX (src), addr);
|
||||
- src += 2;
|
||||
- addr++;
|
||||
- }
|
||||
- return true;
|
||||
- }
|
||||
+ if (!getvalue (&src, &addr, src_end))
|
||||
+ return false;
|
||||
+
|
||||
+ while (*src && src < src_end - 1)
|
||||
+ {
|
||||
+ insert_byte (abfd, HEX (src), addr);
|
||||
+ src += 2;
|
||||
+ addr++;
|
||||
+ }
|
||||
+ return true;
|
||||
|
||||
case '3':
|
||||
/* Symbol record, read the segment. */
|
||||
@@ -406,13 +403,16 @@ first_phase (bfd *abfd, int type, char *src, char * src_end)
|
||||
{
|
||||
case '1': /* Section range. */
|
||||
src++;
|
||||
- if (!getvalue (&src, §ion->vma, src_end))
|
||||
+ if (!getvalue (&src, &addr, src_end))
|
||||
return false;
|
||||
if (!getvalue (&src, &val, src_end))
|
||||
return false;
|
||||
- if (val < section->vma)
|
||||
- val = section->vma;
|
||||
- section->size = val - section->vma;
|
||||
+ if (bfd_is_const_section (section))
|
||||
+ break;
|
||||
+ section->vma = addr;
|
||||
+ if (val < addr)
|
||||
+ val = addr;
|
||||
+ section->size = val - addr;
|
||||
/* PR 17512: file: objdump-s-endless-loop.tekhex.
|
||||
Check for overlarge section sizes. */
|
||||
if (section->size & 0x80000000)
|
||||
@@ -455,6 +455,8 @@ first_phase (bfd *abfd, int type, char *src, char * src_end)
|
||||
new_symbol->symbol.flags = BSF_LOCAL;
|
||||
if (stype == '2' || stype == '6')
|
||||
new_symbol->symbol.section = bfd_abs_section_ptr;
|
||||
+ else if (bfd_is_const_section (section))
|
||||
+ ;
|
||||
else if (stype == '3' || stype == '7')
|
||||
{
|
||||
if ((section->flags & SEC_DATA) == 0)
|
||||
@@ -0,0 +1,208 @@
|
||||
From d95d8395b3a533461f46e8b7e55fef540fc2621b Mon Sep 17 00:00:00 2001
|
||||
From: Jiaying Song <jiaying.song.cn@windriver.com>
|
||||
Date: Tue, 13 Aug 2024 10:31:21 +0800
|
||||
Subject: [PATCH] dlltool: file name too long
|
||||
|
||||
During the execution of the command: i686-w64-mingw32-dlltool
|
||||
--input-def $def_filepath --output-delaylib $filepath --dllname qemu.exe
|
||||
An error occurred:
|
||||
i686-w64-mingw32-dlltool: failed to open temporary head file: ..._w64_mingw32_nativesdk_qemu_8_2_2_build_plugins_libqemu_plugin_api_a_h.s
|
||||
|
||||
Due to the path length exceeding the Linux system's file name length
|
||||
limit (NAME_MAX=255), the temporary file name generated by the
|
||||
i686-w64-mingw32-dlltool command becomes too long to open. To address
|
||||
this, a new temporary file name prefix is generated using tmp_prefix =
|
||||
prefix_encode ("d", getpid()), ensuring that the file name does not
|
||||
exceed the system's length limit.
|
||||
|
||||
Upstream-Status: Backport
|
||||
[https://github.com/bminor/binutils-gdb/commit/a253bea8995323201b016fe477280c1782688ab4]
|
||||
|
||||
Signed-off-by: Jiaying Song <jiaying.song.cn@windriver.com>
|
||||
Reviewed-by: Alan Modra <amodra@gmail.com>
|
||||
|
||||
Allow for "snnnnn.o" suffix when testing against NAME_MAX, and tidy
|
||||
TMP_STUB handling by overwriting a prior nnnnn.o string rather than
|
||||
copying the entire name.
|
||||
|
||||
* dlltool.c (TMP_STUB): Add "nnnnn.o" to format.
|
||||
(make_one_lib_file): Localise variables. Don't copy TMP_STUB,
|
||||
overwrite suffix instead.
|
||||
(gen_lib_file): Similarly.
|
||||
(main): Allow for max suffix when testing against NAME_MAX.
|
||||
|
||||
Upstream-Status: Backport
|
||||
[https://github.com/bminor/binutils-gdb/commit/d0285cdf58adf04e861cd1687f7ecec65937c99d]
|
||||
|
||||
Signed-off-by: Jiaying Song <jiaying.song.cn@windriver.com>
|
||||
---
|
||||
binutils/dlltool.c | 64 +++++++++++++++++-----------------------------
|
||||
1 file changed, 24 insertions(+), 40 deletions(-)
|
||||
|
||||
diff --git a/binutils/dlltool.c b/binutils/dlltool.c
|
||||
index 066c99a4..94f6c34b 100644
|
||||
--- a/binutils/dlltool.c
|
||||
+++ b/binutils/dlltool.c
|
||||
@@ -498,7 +498,7 @@ char *tmp_stub_buf;
|
||||
#define TMP_HEAD_O dlltmp (&tmp_head_o_buf, "%sh.o")
|
||||
#define TMP_TAIL_S dlltmp (&tmp_tail_s_buf, "%st.s")
|
||||
#define TMP_TAIL_O dlltmp (&tmp_tail_o_buf, "%st.o")
|
||||
-#define TMP_STUB dlltmp (&tmp_stub_buf, "%ss")
|
||||
+#define TMP_STUB dlltmp (&tmp_stub_buf, "%ssnnnnn.o")
|
||||
|
||||
/* This bit of assembly does jmp * .... */
|
||||
static const unsigned char i386_jtab[] =
|
||||
@@ -2401,26 +2401,11 @@ make_imp_label (const char *prefix, const char *name)
|
||||
static bfd *
|
||||
make_one_lib_file (export_type *exp, int i, int delay)
|
||||
{
|
||||
- bfd * abfd;
|
||||
- asymbol * exp_label;
|
||||
- asymbol * iname = 0;
|
||||
- asymbol * iname2;
|
||||
- asymbol * iname_lab;
|
||||
- asymbol ** iname_lab_pp;
|
||||
- asymbol ** iname_pp;
|
||||
-#ifndef EXTRA
|
||||
-#define EXTRA 0
|
||||
-#endif
|
||||
- asymbol * ptrs[NSECS + 4 + EXTRA + 1];
|
||||
- flagword applicable;
|
||||
- char * outname = xmalloc (strlen (TMP_STUB) + 10);
|
||||
- int oidx = 0;
|
||||
-
|
||||
-
|
||||
- sprintf (outname, "%s%05d.o", TMP_STUB, i);
|
||||
-
|
||||
- abfd = bfd_openw (outname, HOW_BFD_WRITE_TARGET);
|
||||
+ char *outname = TMP_STUB;
|
||||
+ size_t name_len = strlen (outname);
|
||||
+ sprintf (outname + name_len - 7, "%05d.o", i);
|
||||
|
||||
+ bfd *abfd = bfd_openw (outname, HOW_BFD_WRITE_TARGET);
|
||||
if (!abfd)
|
||||
/* xgettext:c-format */
|
||||
fatal (_("bfd_open failed open stub file: %s: %s"),
|
||||
@@ -2437,9 +2422,13 @@ make_one_lib_file (export_type *exp, int i, int delay)
|
||||
bfd_set_private_flags (abfd, F_INTERWORK);
|
||||
#endif
|
||||
|
||||
- applicable = bfd_applicable_section_flags (abfd);
|
||||
-
|
||||
/* First make symbols for the sections. */
|
||||
+ flagword applicable = bfd_applicable_section_flags (abfd);
|
||||
+#ifndef EXTRA
|
||||
+#define EXTRA 0
|
||||
+#endif
|
||||
+ asymbol *ptrs[NSECS + 4 + EXTRA + 1];
|
||||
+ int oidx = 0;
|
||||
for (i = 0; i < NSECS; i++)
|
||||
{
|
||||
sinfo *si = secdata + i;
|
||||
@@ -2466,7 +2455,7 @@ make_one_lib_file (export_type *exp, int i, int delay)
|
||||
|
||||
if (! exp->data)
|
||||
{
|
||||
- exp_label = bfd_make_empty_symbol (abfd);
|
||||
+ asymbol *exp_label = bfd_make_empty_symbol (abfd);
|
||||
exp_label->name = make_imp_label ("", exp->name);
|
||||
exp_label->section = secdata[TEXT].sec;
|
||||
exp_label->flags = BSF_GLOBAL;
|
||||
@@ -2482,6 +2471,7 @@ make_one_lib_file (export_type *exp, int i, int delay)
|
||||
/* Generate imp symbols with one underscore for Microsoft
|
||||
compatibility, and with two underscores for backward
|
||||
compatibility with old versions of cygwin. */
|
||||
+ asymbol *iname = NULL;
|
||||
if (create_compat_implib)
|
||||
{
|
||||
iname = bfd_make_empty_symbol (abfd);
|
||||
@@ -2491,25 +2481,24 @@ make_one_lib_file (export_type *exp, int i, int delay)
|
||||
iname->value = 0;
|
||||
}
|
||||
|
||||
- iname2 = bfd_make_empty_symbol (abfd);
|
||||
+ asymbol *iname2 = bfd_make_empty_symbol (abfd);
|
||||
iname2->name = make_imp_label ("__imp_", exp->name);
|
||||
iname2->section = secdata[IDATA5].sec;
|
||||
iname2->flags = BSF_GLOBAL;
|
||||
iname2->value = 0;
|
||||
|
||||
- iname_lab = bfd_make_empty_symbol (abfd);
|
||||
-
|
||||
+ asymbol *iname_lab = bfd_make_empty_symbol (abfd);
|
||||
iname_lab->name = head_label;
|
||||
iname_lab->section = bfd_und_section_ptr;
|
||||
iname_lab->flags = 0;
|
||||
iname_lab->value = 0;
|
||||
|
||||
- iname_pp = ptrs + oidx;
|
||||
+ asymbol **iname_pp = ptrs + oidx;
|
||||
if (create_compat_implib)
|
||||
ptrs[oidx++] = iname;
|
||||
ptrs[oidx++] = iname2;
|
||||
|
||||
- iname_lab_pp = ptrs + oidx;
|
||||
+ asymbol **iname_lab_pp = ptrs + oidx;
|
||||
ptrs[oidx++] = iname_lab;
|
||||
|
||||
ptrs[oidx] = 0;
|
||||
@@ -3089,29 +3078,26 @@ gen_lib_file (int delay)
|
||||
|
||||
if (dontdeltemps < 2)
|
||||
{
|
||||
- char *name;
|
||||
- size_t stub_len = strlen (TMP_STUB);
|
||||
+ char *name = TMP_STUB;
|
||||
+ size_t name_len = strlen (name);
|
||||
|
||||
- name = xmalloc (stub_len + 10);
|
||||
- memcpy (name, TMP_STUB, stub_len);
|
||||
for (i = 0; (exp = d_exports_lexically[i]); i++)
|
||||
{
|
||||
/* Don't delete non-existent stubs for PRIVATE entries. */
|
||||
if (exp->private)
|
||||
continue;
|
||||
- sprintf (name + stub_len, "%05d.o", i);
|
||||
+ sprintf (name + name_len - 7, "%05d.o", i);
|
||||
if (unlink (name) < 0)
|
||||
/* xgettext:c-format */
|
||||
non_fatal (_("cannot delete %s: %s"), name, strerror (errno));
|
||||
if (ext_prefix_alias)
|
||||
{
|
||||
- sprintf (name + stub_len, "%05d.o", i + PREFIX_ALIAS_BASE);
|
||||
+ sprintf (name + name_len - 7, "%05d.o", i + PREFIX_ALIAS_BASE);
|
||||
if (unlink (name) < 0)
|
||||
/* xgettext:c-format */
|
||||
non_fatal (_("cannot delete %s: %s"), name, strerror (errno));
|
||||
}
|
||||
}
|
||||
- free (name);
|
||||
}
|
||||
|
||||
inform (_("Created lib file"));
|
||||
@@ -4096,9 +4082,9 @@ main (int ac, char **av)
|
||||
if (tmp_prefix == NULL)
|
||||
{
|
||||
/* If possible use a deterministic prefix. */
|
||||
- if (imp_name || delayimp_name)
|
||||
+ const char *input = imp_name ? imp_name : delayimp_name;
|
||||
+ if (input && strlen (input) + sizeof ("_snnnnn.o") - 1 <= NAME_MAX)
|
||||
{
|
||||
- const char *input = imp_name ? imp_name : delayimp_name;
|
||||
tmp_prefix = xmalloc (strlen (input) + 2);
|
||||
sprintf (tmp_prefix, "%s_", input);
|
||||
for (i = 0; tmp_prefix[i]; i++)
|
||||
@@ -4106,9 +4092,7 @@ main (int ac, char **av)
|
||||
tmp_prefix[i] = '_';
|
||||
}
|
||||
else
|
||||
- {
|
||||
- tmp_prefix = prefix_encode ("d", getpid ());
|
||||
- }
|
||||
+ tmp_prefix = prefix_encode ("d", getpid ());
|
||||
}
|
||||
|
||||
mangle_defs ();
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
Author: Alan Modra <amodra@gmail.com>
|
||||
Date: Wed, 15 Jan 2025 19:13:43 +1030
|
||||
|
||||
PR32560 stack-buffer-overflow at objdump disassemble_bytes
|
||||
|
||||
There's always someone pushing the boundaries.
|
||||
|
||||
PR 32560
|
||||
* objdump.c (MAX_INSN_WIDTH): Define.
|
||||
(insn_width): Make it an unsigned long.
|
||||
(disassemble_bytes): Use MAX_INSN_WIDTH to size buffer.
|
||||
(main <OPTION_INSN_WIDTH>): Restrict size of insn_width.
|
||||
|
||||
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=baac6c221e9d69335bf41366a1c7d87d8ab2f893]
|
||||
CVE: CVE-2025-0840
|
||||
|
||||
Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
|
||||
|
||||
diff --git a/binutils/objdump.c b/binutils/objdump.c
|
||||
index 49e944b1..dba726e3 100644
|
||||
--- a/binutils/objdump.c
|
||||
+++ b/binutils/objdump.c
|
||||
@@ -116,7 +116,8 @@ static bool disassemble_all; /* -D */
|
||||
static int disassemble_zeroes; /* --disassemble-zeroes */
|
||||
static bool formats_info; /* -i */
|
||||
int wide_output; /* -w */
|
||||
-static int insn_width; /* --insn-width */
|
||||
+#define MAX_INSN_WIDTH 49
|
||||
+static unsigned long insn_width; /* --insn-width */
|
||||
static bfd_vma start_address = (bfd_vma) -1; /* --start-address */
|
||||
static bfd_vma stop_address = (bfd_vma) -1; /* --stop-address */
|
||||
static int dump_debugging; /* --debugging */
|
||||
@@ -3327,7 +3328,7 @@ disassemble_bytes (struct disassemble_info *inf,
|
||||
}
|
||||
else
|
||||
{
|
||||
- char buf[50];
|
||||
+ char buf[MAX_INSN_WIDTH + 1];
|
||||
unsigned int bpc = 0;
|
||||
unsigned int pb = 0;
|
||||
|
||||
@@ -5995,8 +5996,9 @@ main (int argc, char **argv)
|
||||
break;
|
||||
case OPTION_INSN_WIDTH:
|
||||
insn_width = strtoul (optarg, NULL, 0);
|
||||
- if (insn_width <= 0)
|
||||
- fatal (_("error: instruction width must be positive"));
|
||||
+ if (insn_width - 1 >= MAX_INSN_WIDTH)
|
||||
+ fatal (_("error: instruction width must be in the range 1 to "
|
||||
+ XSTRING (MAX_INSN_WIDTH)));
|
||||
break;
|
||||
case OPTION_INLINES:
|
||||
unwind_inlines = true;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,840 @@
|
||||
From 31e9e2e8d1090da0c1da97a70005d8841fff8ddd Mon Sep 17 00:00:00 2001
|
||||
From: Alan Modra <amodra@gmail.com>
|
||||
Date: Sun, 16 Feb 2025 23:34:55 +1030
|
||||
Subject: [PATCH] PR 32603, more ld -w misbehaviour
|
||||
|
||||
Commit 8d97c1a53f3d claimed to replace all einfo calls using %F with
|
||||
a call to fatal. It did so only for the ld/ directory. This patch
|
||||
adds a "fatal" to linker callbacks, and replaces those calls in bfd/
|
||||
too.
|
||||
|
||||
Upstream-Status: Backport [https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=31e9e2e8d1090da0c1da97a70005d8841fff8ddd]
|
||||
CVE: CVE-2025-1153
|
||||
|
||||
Signed-off-by: Sunil Dora <sunilkumar.dora@windriver.com>
|
||||
---
|
||||
bfd/archive.c | 4 ++--
|
||||
bfd/coff-aarch64.c | 4 +---
|
||||
bfd/coffgen.c | 2 +-
|
||||
bfd/elf-ifunc.c | 4 ++--
|
||||
bfd/elf-m10300.c | 4 ++--
|
||||
bfd/elf-properties.c | 4 ++--
|
||||
bfd/elf.c | 4 ++--
|
||||
bfd/elf32-arm.c | 2 +-
|
||||
bfd/elf32-avr.c | 4 ++--
|
||||
bfd/elf32-csky.c | 2 +-
|
||||
bfd/elf32-frv.c | 4 ++--
|
||||
bfd/elf32-hppa.c | 6 ++---
|
||||
bfd/elf32-i386.c | 4 ++--
|
||||
bfd/elf32-m68hc11.c | 2 +-
|
||||
bfd/elf32-m68hc12.c | 2 +-
|
||||
bfd/elf32-metag.c | 2 +-
|
||||
bfd/elf32-spu.c | 5 ++--
|
||||
bfd/elf64-ia64-vms.c | 4 ++--
|
||||
bfd/elf64-ppc.c | 4 ++--
|
||||
bfd/elf64-x86-64.c | 14 +++++------
|
||||
bfd/elflink.c | 8 +++----
|
||||
bfd/elfnn-aarch64.c | 6 ++---
|
||||
bfd/elfnn-ia64.c | 4 ++--
|
||||
bfd/elfnn-kvx.c | 2 +-
|
||||
bfd/elfnn-loongarch.c | 4 ++--
|
||||
bfd/elfxx-aarch64.c | 6 ++---
|
||||
bfd/elfxx-sparc.c | 4 ++--
|
||||
bfd/elfxx-x86.c | 56 +++++++++++++++++++++----------------------
|
||||
bfd/linker.c | 2 +-
|
||||
bfd/reloc.c | 4 ++--
|
||||
bfd/reloc16.c | 4 ++--
|
||||
bfd/xcofflink.c | 2 +-
|
||||
include/bfdlink.h | 3 +++
|
||||
ld/ldmain.c | 1 +
|
||||
34 files changed, 94 insertions(+), 93 deletions(-)
|
||||
|
||||
diff --git a/bfd/archive.c b/bfd/archive.c
|
||||
index 9f3fbce9..0f617276 100644
|
||||
--- a/bfd/archive.c
|
||||
+++ b/bfd/archive.c
|
||||
@@ -749,8 +749,8 @@ _bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos,
|
||||
case bfd_error_system_call:
|
||||
if (info != NULL)
|
||||
{
|
||||
- info->callbacks->einfo
|
||||
- (_("%F%P: %pB(%s): error opening thin archive member: %E\n"),
|
||||
+ info->callbacks->fatal
|
||||
+ (_("%P: %pB(%s): error opening thin archive member: %E\n"),
|
||||
archive, filename);
|
||||
break;
|
||||
}
|
||||
diff --git a/bfd/coff-aarch64.c b/bfd/coff-aarch64.c
|
||||
index 825963c0..53f539e0 100644
|
||||
--- a/bfd/coff-aarch64.c
|
||||
+++ b/bfd/coff-aarch64.c
|
||||
@@ -876,10 +876,8 @@ coff_pe_aarch64_relocate_section (bfd *output_bfd,
|
||||
}
|
||||
|
||||
default:
|
||||
- info->callbacks->einfo (_("%F%P: Unhandled relocation type %u\n"),
|
||||
+ info->callbacks->fatal (_("%P: Unhandled relocation type %u\n"),
|
||||
rel->r_type);
|
||||
- BFD_FAIL ();
|
||||
- return false;
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
|
||||
index cc1c6557..3270cd2f 100644
|
||||
--- a/bfd/coffgen.c
|
||||
+++ b/bfd/coffgen.c
|
||||
@@ -2793,7 +2793,7 @@ _bfd_coff_section_already_linked (bfd *abfd,
|
||||
|
||||
/* This is the first section with this name. Record it. */
|
||||
if (!bfd_section_already_linked_table_insert (already_linked_list, sec))
|
||||
- info->callbacks->einfo (_("%F%P: already_linked_table: %E\n"));
|
||||
+ info->callbacks->fatal (_("%P: already_linked_table: %E\n"));
|
||||
return false;
|
||||
}
|
||||
|
||||
diff --git a/bfd/elf-ifunc.c b/bfd/elf-ifunc.c
|
||||
index 42a3bcdf..58a1ca5e 100644
|
||||
--- a/bfd/elf-ifunc.c
|
||||
+++ b/bfd/elf-ifunc.c
|
||||
@@ -139,9 +139,9 @@ _bfd_elf_allocate_ifunc_dyn_relocs (struct bfd_link_info *info,
|
||||
|| info->export_dynamic)
|
||||
&& h->pointer_equality_needed)
|
||||
{
|
||||
- info->callbacks->einfo
|
||||
+ info->callbacks->fatal
|
||||
/* xgettext:c-format */
|
||||
- (_("%F%P: dynamic STT_GNU_IFUNC symbol `%s' with pointer "
|
||||
+ (_("%P: dynamic STT_GNU_IFUNC symbol `%s' with pointer "
|
||||
"equality in `%pB' can not be used when making an "
|
||||
"executable; recompile with -fPIE and relink with -pie\n"),
|
||||
h->root.root.string,
|
||||
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
|
||||
index 24ea43a7..cf6bb13b 100644
|
||||
--- a/bfd/elf-m10300.c
|
||||
+++ b/bfd/elf-m10300.c
|
||||
@@ -2646,8 +2646,8 @@ mn10300_elf_relax_section (bfd *abfd,
|
||||
bfd_vma align_gap_adjustment;
|
||||
|
||||
if (bfd_link_relocatable (link_info))
|
||||
- (*link_info->callbacks->einfo)
|
||||
- (_("%P%F: --relax and -r may not be used together\n"));
|
||||
+ link_info->callbacks->fatal
|
||||
+ (_("%P: --relax and -r may not be used together\n"));
|
||||
|
||||
/* Assume nothing changes. */
|
||||
*again = false;
|
||||
diff --git a/bfd/elf-properties.c b/bfd/elf-properties.c
|
||||
index ee8bd37f..a4591472 100644
|
||||
--- a/bfd/elf-properties.c
|
||||
+++ b/bfd/elf-properties.c
|
||||
@@ -665,11 +665,11 @@ _bfd_elf_link_setup_gnu_properties (struct bfd_link_info *info)
|
||||
| SEC_HAS_CONTENTS
|
||||
| SEC_DATA));
|
||||
if (sec == NULL)
|
||||
- info->callbacks->einfo (_("%F%P: failed to create GNU property section\n"));
|
||||
+ info->callbacks->fatal (_("%P: failed to create GNU property section\n"));
|
||||
|
||||
if (!bfd_set_section_alignment (sec,
|
||||
elfclass == ELFCLASS64 ? 3 : 2))
|
||||
- info->callbacks->einfo (_("%F%pA: failed to align section\n"),
|
||||
+ info->callbacks->fatal (_("%pA: failed to align section\n"),
|
||||
sec);
|
||||
|
||||
elf_section_type (sec) = SHT_NOTE;
|
||||
diff --git a/bfd/elf.c b/bfd/elf.c
|
||||
index 8bffd3c5..8e4e1e7f 100644
|
||||
--- a/bfd/elf.c
|
||||
+++ b/bfd/elf.c
|
||||
@@ -5188,8 +5188,8 @@ _bfd_elf_map_sections_to_segments (bfd *abfd,
|
||||
&& need_layout != NULL
|
||||
&& bed->size_relative_relocs
|
||||
&& !bed->size_relative_relocs (info, need_layout))
|
||||
- info->callbacks->einfo
|
||||
- (_("%F%P: failed to size relative relocations\n"));
|
||||
+ info->callbacks->fatal
|
||||
+ (_("%P: failed to size relative relocations\n"));
|
||||
}
|
||||
|
||||
if (no_user_phdrs && bfd_count_sections (abfd) != 0)
|
||||
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
|
||||
index 4ad7c354..b4a822f1 100644
|
||||
--- a/bfd/elf32-arm.c
|
||||
+++ b/bfd/elf32-arm.c
|
||||
@@ -5053,7 +5053,7 @@ arm_build_one_stub (struct bfd_hash_entry *gen_entry,
|
||||
section. The user should fix his linker script. */
|
||||
if (stub_entry->target_section->output_section == NULL
|
||||
&& info->non_contiguous_regions)
|
||||
- info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
|
||||
+ info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
|
||||
"Retry without --enable-non-contiguous-regions.\n"),
|
||||
stub_entry->target_section);
|
||||
|
||||
diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c
|
||||
index 20e03bd7..912f7533 100644
|
||||
--- a/bfd/elf32-avr.c
|
||||
+++ b/bfd/elf32-avr.c
|
||||
@@ -2484,8 +2484,8 @@ elf32_avr_relax_section (bfd *abfd,
|
||||
shrinkable = false;
|
||||
|
||||
if (bfd_link_relocatable (link_info))
|
||||
- (*link_info->callbacks->einfo)
|
||||
- (_("%P%F: --relax and -r may not be used together\n"));
|
||||
+ link_info->callbacks->fatal
|
||||
+ (_("%P: --relax and -r may not be used together\n"));
|
||||
|
||||
htab = avr_link_hash_table (link_info);
|
||||
if (htab == NULL)
|
||||
diff --git a/bfd/elf32-csky.c b/bfd/elf32-csky.c
|
||||
index 9479705d..edff65a9 100644
|
||||
--- a/bfd/elf32-csky.c
|
||||
+++ b/bfd/elf32-csky.c
|
||||
@@ -3728,7 +3728,7 @@ csky_build_one_stub (struct bfd_hash_entry *gen_entry,
|
||||
section. The user should fix his linker script. */
|
||||
if (stub_entry->target_section->output_section == NULL
|
||||
&& info->non_contiguous_regions)
|
||||
- info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
|
||||
+ info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
|
||||
"Retry without --enable-non-contiguous-regions.\n"),
|
||||
stub_entry->target_section);
|
||||
|
||||
diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c
|
||||
index 5b66b074..245db7c2 100644
|
||||
--- a/bfd/elf32-frv.c
|
||||
+++ b/bfd/elf32-frv.c
|
||||
@@ -5617,8 +5617,8 @@ elf32_frvfdpic_relax_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec,
|
||||
struct _frvfdpic_dynamic_got_plt_info gpinfo;
|
||||
|
||||
if (bfd_link_relocatable (info))
|
||||
- (*info->callbacks->einfo)
|
||||
- (_("%P%F: --relax and -r may not be used together\n"));
|
||||
+ info->callbacks->fatal
|
||||
+ (_("%P: --relax and -r may not be used together\n"));
|
||||
|
||||
/* If we return early, we didn't change anything. */
|
||||
*again = false;
|
||||
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
|
||||
index c2a7ad98..f1e67a06 100644
|
||||
--- a/bfd/elf32-hppa.c
|
||||
+++ b/bfd/elf32-hppa.c
|
||||
@@ -729,7 +729,7 @@ hppa_build_one_stub (struct bfd_hash_entry *bh, void *in_arg)
|
||||
section. The user should fix his linker script. */
|
||||
if (hsh->target_section->output_section == NULL
|
||||
&& info->non_contiguous_regions)
|
||||
- info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output "
|
||||
+ info->callbacks->fatal (_("%P: Could not assign `%pA' to an output "
|
||||
"section. Retry without "
|
||||
"--enable-non-contiguous-regions.\n"),
|
||||
hsh->target_section);
|
||||
@@ -758,7 +758,7 @@ hppa_build_one_stub (struct bfd_hash_entry *bh, void *in_arg)
|
||||
section. The user should fix his linker script. */
|
||||
if (hsh->target_section->output_section == NULL
|
||||
&& info->non_contiguous_regions)
|
||||
- info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output "
|
||||
+ info->callbacks->fatal (_("%P: Could not assign `%pA' to an output "
|
||||
"section. Retry without "
|
||||
"--enable-non-contiguous-regions.\n"),
|
||||
hsh->target_section);
|
||||
@@ -839,7 +839,7 @@ hppa_build_one_stub (struct bfd_hash_entry *bh, void *in_arg)
|
||||
section. The user should fix his linker script. */
|
||||
if (hsh->target_section->output_section == NULL
|
||||
&& info->non_contiguous_regions)
|
||||
- info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output "
|
||||
+ info->callbacks->fatal (_("%P: Could not assign `%pA' to an output "
|
||||
"section. Retry without "
|
||||
"--enable-non-contiguous-regions.\n"),
|
||||
hsh->target_section);
|
||||
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
|
||||
index e2f88a11..1637e39f 100644
|
||||
--- a/bfd/elf32-i386.c
|
||||
+++ b/bfd/elf32-i386.c
|
||||
@@ -4092,8 +4092,8 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
|
||||
{
|
||||
if (bfd_is_abs_section (htab->elf.splt->output_section))
|
||||
{
|
||||
- info->callbacks->einfo
|
||||
- (_("%F%P: discarded output section: `%pA'\n"),
|
||||
+ info->callbacks->fatal
|
||||
+ (_("%P: discarded output section: `%pA'\n"),
|
||||
htab->elf.splt);
|
||||
return false;
|
||||
}
|
||||
diff --git a/bfd/elf32-m68hc11.c b/bfd/elf32-m68hc11.c
|
||||
index 5fc611f5..6f705718 100644
|
||||
--- a/bfd/elf32-m68hc11.c
|
||||
+++ b/bfd/elf32-m68hc11.c
|
||||
@@ -419,7 +419,7 @@ m68hc11_elf_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
|
||||
section. The user should fix his linker script. */
|
||||
if (stub_entry->target_section->output_section == NULL
|
||||
&& info->non_contiguous_regions)
|
||||
- info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
|
||||
+ info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
|
||||
"Retry without --enable-non-contiguous-regions.\n"),
|
||||
stub_entry->target_section);
|
||||
|
||||
diff --git a/bfd/elf32-m68hc12.c b/bfd/elf32-m68hc12.c
|
||||
index 1be174c0..bdfb9ca5 100644
|
||||
--- a/bfd/elf32-m68hc12.c
|
||||
+++ b/bfd/elf32-m68hc12.c
|
||||
@@ -539,7 +539,7 @@ m68hc12_elf_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
|
||||
section. The user should fix his linker script. */
|
||||
if (stub_entry->target_section->output_section == NULL
|
||||
&& info->non_contiguous_regions)
|
||||
- info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
|
||||
+ info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
|
||||
"Retry without --enable-non-contiguous-regions.\n"),
|
||||
stub_entry->target_section);
|
||||
|
||||
diff --git a/bfd/elf32-metag.c b/bfd/elf32-metag.c
|
||||
index de14dfe5..49f93cc7 100644
|
||||
--- a/bfd/elf32-metag.c
|
||||
+++ b/bfd/elf32-metag.c
|
||||
@@ -3342,7 +3342,7 @@ metag_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
|
||||
section. The user should fix his linker script. */
|
||||
if (hsh->target_section->output_section == NULL
|
||||
&& info->non_contiguous_regions)
|
||||
- info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
|
||||
+ info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
|
||||
"Retry without --enable-non-contiguous-regions.\n"),
|
||||
hsh->target_section);
|
||||
|
||||
diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c
|
||||
index 881d4d8e..dd5d5fbe 100644
|
||||
--- a/bfd/elf32-spu.c
|
||||
+++ b/bfd/elf32-spu.c
|
||||
@@ -4689,8 +4689,7 @@ spu_elf_auto_overlay (struct bfd_link_info *info)
|
||||
file_err:
|
||||
bfd_set_error (bfd_error_system_call);
|
||||
err_exit:
|
||||
- info->callbacks->einfo (_("%F%P: auto overlay error: %E\n"));
|
||||
- xexit (1);
|
||||
+ info->callbacks->fatal (_("%P: auto overlay error: %E\n"));
|
||||
}
|
||||
|
||||
/* Provide an estimate of total stack required. */
|
||||
@@ -4743,7 +4742,7 @@ spu_elf_final_link (bfd *output_bfd, struct bfd_link_info *info)
|
||||
info->callbacks->einfo (_("%X%P: stack/lrlive analysis error: %E\n"));
|
||||
|
||||
if (!spu_elf_build_stubs (info))
|
||||
- info->callbacks->einfo (_("%F%P: can not build overlay stubs: %E\n"));
|
||||
+ info->callbacks->fatal (_("%P: can not build overlay stubs: %E\n"));
|
||||
|
||||
return bfd_elf_final_link (output_bfd, info);
|
||||
}
|
||||
diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c
|
||||
index 2f37e90c..b1eaaac0 100644
|
||||
--- a/bfd/elf64-ia64-vms.c
|
||||
+++ b/bfd/elf64-ia64-vms.c
|
||||
@@ -361,8 +361,8 @@ elf64_ia64_relax_section (bfd *abfd, asection *sec,
|
||||
*again = false;
|
||||
|
||||
if (bfd_link_relocatable (link_info))
|
||||
- (*link_info->callbacks->einfo)
|
||||
- (_("%P%F: --relax and -r may not be used together\n"));
|
||||
+ link_info->callbacks->fatal
|
||||
+ (_("%P: --relax and -r may not be used together\n"));
|
||||
|
||||
/* Don't even try to relax for non-ELF outputs. */
|
||||
if (!is_elf_hash_table (link_info->hash))
|
||||
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
|
||||
index 720d6ac9..7b798732 100644
|
||||
--- a/bfd/elf64-ppc.c
|
||||
+++ b/bfd/elf64-ppc.c
|
||||
@@ -12289,7 +12289,7 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
|
||||
if (stub_entry->target_section != NULL
|
||||
&& stub_entry->target_section->output_section == NULL
|
||||
&& info->non_contiguous_regions)
|
||||
- info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
|
||||
+ info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
|
||||
"Retry without --enable-non-contiguous-regions.\n"),
|
||||
stub_entry->target_section);
|
||||
|
||||
@@ -12297,7 +12297,7 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
|
||||
if (stub_entry->group->stub_sec != NULL
|
||||
&& stub_entry->group->stub_sec->output_section == NULL
|
||||
&& info->non_contiguous_regions)
|
||||
- info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
|
||||
+ info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
|
||||
"Retry without --enable-non-contiguous-regions.\n"),
|
||||
stub_entry->group->stub_sec);
|
||||
|
||||
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
|
||||
index c3fb375c..a22d57d7 100644
|
||||
--- a/bfd/elf64-x86-64.c
|
||||
+++ b/bfd/elf64-x86-64.c
|
||||
@@ -3706,8 +3706,8 @@ elf_x86_64_relocate_section (bfd *output_bfd,
|
||||
|| (roff - 3 + 22) > input_section->size)
|
||||
{
|
||||
corrupt_input:
|
||||
- info->callbacks->einfo
|
||||
- (_("%F%P: corrupt input: %pB\n"),
|
||||
+ info->callbacks->fatal
|
||||
+ (_("%P: corrupt input: %pB\n"),
|
||||
input_bfd);
|
||||
return false;
|
||||
}
|
||||
@@ -4679,7 +4679,7 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd,
|
||||
/* Check PC-relative offset overflow in PLT entry. */
|
||||
if ((plt_got_pcrel_offset + 0x80000000) > 0xffffffff)
|
||||
/* xgettext:c-format */
|
||||
- info->callbacks->einfo (_("%F%pB: PC-relative offset overflow in PLT entry for `%s'\n"),
|
||||
+ info->callbacks->fatal (_("%pB: PC-relative offset overflow in PLT entry for `%s'\n"),
|
||||
output_bfd, h->root.root.string);
|
||||
|
||||
bfd_put_32 (output_bfd, plt_got_pcrel_offset,
|
||||
@@ -4752,7 +4752,7 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd,
|
||||
will overflow first. */
|
||||
if (plt0_offset > 0x80000000)
|
||||
/* xgettext:c-format */
|
||||
- info->callbacks->einfo (_("%F%pB: branch displacement overflow in PLT entry for `%s'\n"),
|
||||
+ info->callbacks->fatal (_("%pB: branch displacement overflow in PLT entry for `%s'\n"),
|
||||
output_bfd, h->root.root.string);
|
||||
bfd_put_32 (output_bfd, - plt0_offset,
|
||||
(plt->contents + h->plt.offset
|
||||
@@ -4805,7 +4805,7 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd,
|
||||
if ((got_after_plt && got_pcrel_offset < 0)
|
||||
|| (!got_after_plt && got_pcrel_offset > 0))
|
||||
/* xgettext:c-format */
|
||||
- info->callbacks->einfo (_("%F%pB: PC-relative offset overflow in GOT PLT entry for `%s'\n"),
|
||||
+ info->callbacks->fatal (_("%pB: PC-relative offset overflow in GOT PLT entry for `%s'\n"),
|
||||
output_bfd, h->root.root.string);
|
||||
|
||||
bfd_put_32 (output_bfd, got_pcrel_offset,
|
||||
@@ -5092,8 +5092,8 @@ elf_x86_64_finish_dynamic_sections (bfd *output_bfd,
|
||||
{
|
||||
if (bfd_is_abs_section (htab->elf.splt->output_section))
|
||||
{
|
||||
- info->callbacks->einfo
|
||||
- (_("%F%P: discarded output section: `%pA'\n"),
|
||||
+ info->callbacks->fatal
|
||||
+ (_("%P: discarded output section: `%pA'\n"),
|
||||
htab->elf.splt);
|
||||
return false;
|
||||
}
|
||||
diff --git a/bfd/elflink.c b/bfd/elflink.c
|
||||
index 8af6898a..dba176cc 100644
|
||||
--- a/bfd/elflink.c
|
||||
+++ b/bfd/elflink.c
|
||||
@@ -12891,8 +12891,8 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
|
||||
if (info->enable_dt_relr
|
||||
&& bed->finish_relative_relocs
|
||||
&& !bed->finish_relative_relocs (info))
|
||||
- info->callbacks->einfo
|
||||
- (_("%F%P: %pB: failed to finish relative relocations\n"), abfd);
|
||||
+ info->callbacks->fatal
|
||||
+ (_("%P: %pB: failed to finish relative relocations\n"), abfd);
|
||||
|
||||
/* Since ELF permits relocations to be against local symbols, we
|
||||
must have the local symbols available when we do the relocations.
|
||||
@@ -14087,7 +14087,7 @@ _bfd_elf_gc_mark_extra_sections (struct bfd_link_info *info,
|
||||
else if (strcmp (bfd_section_name (isec),
|
||||
"__patchable_function_entries") == 0
|
||||
&& elf_linked_to_section (isec) == NULL)
|
||||
- info->callbacks->einfo (_("%F%P: %pB(%pA): error: "
|
||||
+ info->callbacks->fatal (_("%P: %pB(%pA): error: "
|
||||
"need linked-to section "
|
||||
"for --gc-sections\n"),
|
||||
isec->owner, isec);
|
||||
@@ -15264,7 +15264,7 @@ _bfd_elf_section_already_linked (bfd *abfd,
|
||||
|
||||
/* This is the first section with this name. Record it. */
|
||||
if (!bfd_section_already_linked_table_insert (already_linked_list, sec))
|
||||
- info->callbacks->einfo (_("%F%P: already_linked_table: %E\n"));
|
||||
+ info->callbacks->fatal (_("%P: already_linked_table: %E\n"));
|
||||
return sec->output_section == bfd_abs_section_ptr;
|
||||
}
|
||||
|
||||
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
|
||||
index 109517db..0f454d23 100644
|
||||
--- a/bfd/elfnn-aarch64.c
|
||||
+++ b/bfd/elfnn-aarch64.c
|
||||
@@ -3272,7 +3272,7 @@ aarch64_build_one_stub (struct bfd_hash_entry *gen_entry,
|
||||
section. The user should fix his linker script. */
|
||||
if (stub_entry->target_section->output_section == NULL
|
||||
&& info->non_contiguous_regions)
|
||||
- info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
|
||||
+ info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
|
||||
"Retry without "
|
||||
"--enable-non-contiguous-regions.\n"),
|
||||
stub_entry->target_section);
|
||||
@@ -9008,9 +9008,9 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
asection *s = p->sec->output_section;
|
||||
if (s != NULL && (s->flags & SEC_READONLY) != 0)
|
||||
{
|
||||
- info->callbacks->einfo
|
||||
+ info->callbacks->fatal
|
||||
/* xgettext:c-format */
|
||||
- (_ ("%F%P: %pB: copy relocation against non-copyable "
|
||||
+ (_ ("%P: %pB: copy relocation against non-copyable "
|
||||
"protected symbol `%s'\n"),
|
||||
p->sec->owner, h->root.root.string);
|
||||
return false;
|
||||
diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c
|
||||
index 7081ba1b..41d9e6fe 100644
|
||||
--- a/bfd/elfnn-ia64.c
|
||||
+++ b/bfd/elfnn-ia64.c
|
||||
@@ -361,8 +361,8 @@ elfNN_ia64_relax_section (bfd *abfd, asection *sec,
|
||||
*again = false;
|
||||
|
||||
if (bfd_link_relocatable (link_info))
|
||||
- (*link_info->callbacks->einfo)
|
||||
- (_("%P%F: --relax and -r may not be used together\n"));
|
||||
+ link_info->callbacks->fatal
|
||||
+ (_("%P: --relax and -r may not be used together\n"));
|
||||
|
||||
/* Don't even try to relax for non-ELF outputs. */
|
||||
if (!is_elf_hash_table (link_info->hash))
|
||||
diff --git a/bfd/elfnn-kvx.c b/bfd/elfnn-kvx.c
|
||||
index ae5ed6bf..b752891b 100644
|
||||
--- a/bfd/elfnn-kvx.c
|
||||
+++ b/bfd/elfnn-kvx.c
|
||||
@@ -927,7 +927,7 @@ kvx_build_one_stub (struct bfd_hash_entry *gen_entry,
|
||||
section. The user should fix his linker script. */
|
||||
if (stub_entry->target_section->output_section == NULL
|
||||
&& info->non_contiguous_regions)
|
||||
- info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
|
||||
+ info->callbacks->fatal (_("%P: Could not assign '%pA' to an output section. "
|
||||
"Retry without "
|
||||
"--enable-non-contiguous-regions.\n"),
|
||||
stub_entry->target_section);
|
||||
diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
|
||||
index a7daea67..a8c4226d 100644
|
||||
--- a/bfd/elfnn-loongarch.c
|
||||
+++ b/bfd/elfnn-loongarch.c
|
||||
@@ -1445,9 +1445,9 @@ local_allocate_ifunc_dyn_relocs (struct bfd_link_info *info,
|
||||
|| info->export_dynamic)
|
||||
&& h->pointer_equality_needed)
|
||||
{
|
||||
- info->callbacks->einfo
|
||||
+ info->callbacks->fatal
|
||||
/* xgettext:c-format. */
|
||||
- (_("%F%P: dynamic STT_GNU_IFUNC symbol `%s' with pointer "
|
||||
+ (_("%P: dynamic STT_GNU_IFUNC symbol `%s' with pointer "
|
||||
"equality in `%pB' can not be used when making an "
|
||||
"executable; recompile with -fPIE and relink with -pie\n"),
|
||||
h->root.root.string,
|
||||
diff --git a/bfd/elfxx-aarch64.c b/bfd/elfxx-aarch64.c
|
||||
index d1279adc..161c8a52 100644
|
||||
--- a/bfd/elfxx-aarch64.c
|
||||
+++ b/bfd/elfxx-aarch64.c
|
||||
@@ -754,12 +754,12 @@ _bfd_aarch64_elf_link_setup_gnu_properties (struct bfd_link_info *info,
|
||||
| SEC_HAS_CONTENTS
|
||||
| SEC_DATA));
|
||||
if (sec == NULL)
|
||||
- info->callbacks->einfo (
|
||||
- _("%F%P: failed to create GNU property section\n"));
|
||||
+ info->callbacks->fatal (
|
||||
+ _("%P: failed to create GNU property section\n"));
|
||||
|
||||
align = (bfd_get_mach (ebfd) & bfd_mach_aarch64_ilp32) ? 2 : 3;
|
||||
if (!bfd_set_section_alignment (sec, align))
|
||||
- info->callbacks->einfo (_("%F%pA: failed to align section\n"),
|
||||
+ info->callbacks->fatal (_("%pA: failed to align section\n"),
|
||||
sec);
|
||||
|
||||
elf_section_type (sec) = SHT_NOTE;
|
||||
diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c
|
||||
index 6f5062bb..95b1928d 100644
|
||||
--- a/bfd/elfxx-sparc.c
|
||||
+++ b/bfd/elfxx-sparc.c
|
||||
@@ -2680,8 +2680,8 @@ _bfd_sparc_elf_relax_section (bfd *abfd ATTRIBUTE_UNUSED,
|
||||
bool *again)
|
||||
{
|
||||
if (bfd_link_relocatable (link_info))
|
||||
- (*link_info->callbacks->einfo)
|
||||
- (_("%P%F: --relax and -r may not be used together\n"));
|
||||
+ link_info->callbacks->fatal
|
||||
+ (_("%P: --relax and -r may not be used together\n"));
|
||||
|
||||
*again = false;
|
||||
sec_do_relax (section) = 1;
|
||||
diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c
|
||||
index 8c261cf8..606c8905 100644
|
||||
--- a/bfd/elfxx-x86.c
|
||||
+++ b/bfd/elfxx-x86.c
|
||||
@@ -531,9 +531,9 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
asection *s = p->sec->output_section;
|
||||
if (s != NULL && (s->flags & SEC_READONLY) != 0)
|
||||
{
|
||||
- info->callbacks->einfo
|
||||
+ info->callbacks->fatal
|
||||
/* xgettext:c-format */
|
||||
- (_("%F%P: %pB: copy relocation against non-copyable "
|
||||
+ (_("%P: %pB: copy relocation against non-copyable "
|
||||
"protected symbol `%s' in %pB\n"),
|
||||
p->sec->owner, h->root.root.string,
|
||||
h->root.u.def.section->owner);
|
||||
@@ -1030,9 +1030,9 @@ elf_x86_relative_reloc_record_add
|
||||
|
||||
if (relative_reloc->data == NULL)
|
||||
{
|
||||
- info->callbacks->einfo
|
||||
+ info->callbacks->fatal
|
||||
/* xgettext:c-format */
|
||||
- (_("%F%P: %pB: failed to allocate relative reloc record\n"),
|
||||
+ (_("%P: %pB: failed to allocate relative reloc record\n"),
|
||||
info->output_bfd);
|
||||
return false;
|
||||
}
|
||||
@@ -1388,9 +1388,9 @@ elf64_dt_relr_bitmap_add
|
||||
|
||||
if (bitmap->u.elf64 == NULL)
|
||||
{
|
||||
- info->callbacks->einfo
|
||||
+ info->callbacks->fatal
|
||||
/* xgettext:c-format */
|
||||
- (_("%F%P: %pB: failed to allocate 64-bit DT_RELR bitmap\n"),
|
||||
+ (_("%P: %pB: failed to allocate 64-bit DT_RELR bitmap\n"),
|
||||
info->output_bfd);
|
||||
}
|
||||
|
||||
@@ -1424,9 +1424,9 @@ elf32_dt_relr_bitmap_add
|
||||
|
||||
if (bitmap->u.elf32 == NULL)
|
||||
{
|
||||
- info->callbacks->einfo
|
||||
+ info->callbacks->fatal
|
||||
/* xgettext:c-format */
|
||||
- (_("%F%P: %pB: failed to allocate 32-bit DT_RELR bitmap\n"),
|
||||
+ (_("%P: %pB: failed to allocate 32-bit DT_RELR bitmap\n"),
|
||||
info->output_bfd);
|
||||
}
|
||||
|
||||
@@ -1750,9 +1750,9 @@ elf_x86_compute_dl_relr_bitmap
|
||||
*need_layout = true;
|
||||
}
|
||||
else
|
||||
- info->callbacks->einfo
|
||||
+ info->callbacks->fatal
|
||||
/* xgettext:c-format */
|
||||
- (_("%F%P: %pB: size of compact relative reloc section is "
|
||||
+ (_("%P: %pB: size of compact relative reloc section is "
|
||||
"changed: new (%lu) != old (%lu)\n"),
|
||||
info->output_bfd, htab->dt_relr_bitmap.count,
|
||||
dt_relr_bitmap_count);
|
||||
@@ -1772,9 +1772,9 @@ elf_x86_write_dl_relr_bitmap (struct bfd_link_info *info,
|
||||
|
||||
contents = (unsigned char *) bfd_alloc (sec->owner, size);
|
||||
if (contents == NULL)
|
||||
- info->callbacks->einfo
|
||||
+ info->callbacks->fatal
|
||||
/* xgettext:c-format */
|
||||
- (_("%F%P: %pB: failed to allocate compact relative reloc section\n"),
|
||||
+ (_("%P: %pB: failed to allocate compact relative reloc section\n"),
|
||||
info->output_bfd);
|
||||
|
||||
/* Cache the section contents for elf_link_input_bfd. */
|
||||
@@ -2219,9 +2219,9 @@ _bfd_elf_x86_valid_reloc_p (asection *input_section,
|
||||
else
|
||||
name = bfd_elf_sym_name (input_section->owner, symtab_hdr,
|
||||
sym, NULL);
|
||||
- info->callbacks->einfo
|
||||
+ info->callbacks->fatal
|
||||
/* xgettext:c-format */
|
||||
- (_("%F%P: %pB: relocation %s against absolute symbol "
|
||||
+ (_("%P: %pB: relocation %s against absolute symbol "
|
||||
"`%s' in section `%pA' is disallowed\n"),
|
||||
input_section->owner, internal_reloc.howto->name, name,
|
||||
input_section);
|
||||
@@ -3429,9 +3429,9 @@ _bfd_x86_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
|
||||
s = p->sec->output_section;
|
||||
if (s != NULL && (s->flags & SEC_READONLY) != 0)
|
||||
{
|
||||
- info->callbacks->einfo
|
||||
+ info->callbacks->fatal
|
||||
/* xgettext:c-format */
|
||||
- (_("%F%P: %pB: copy relocation against non-copyable "
|
||||
+ (_("%P: %pB: copy relocation against non-copyable "
|
||||
"protected symbol `%s' in %pB\n"),
|
||||
p->sec->owner, h->root.root.string,
|
||||
h->root.u.def.section->owner);
|
||||
@@ -4138,12 +4138,12 @@ _bfd_x86_elf_link_setup_gnu_properties
|
||||
| SEC_HAS_CONTENTS
|
||||
| SEC_DATA));
|
||||
if (sec == NULL)
|
||||
- info->callbacks->einfo (_("%F%P: failed to create GNU property section\n"));
|
||||
+ info->callbacks->fatal (_("%P: failed to create GNU property section\n"));
|
||||
|
||||
if (!bfd_set_section_alignment (sec, class_align))
|
||||
{
|
||||
error_alignment:
|
||||
- info->callbacks->einfo (_("%F%pA: failed to align section\n"),
|
||||
+ info->callbacks->fatal (_("%pA: failed to align section\n"),
|
||||
sec);
|
||||
}
|
||||
|
||||
@@ -4404,7 +4404,7 @@ _bfd_x86_elf_link_setup_gnu_properties
|
||||
&& !elf_vxworks_create_dynamic_sections (dynobj, info,
|
||||
&htab->srelplt2))
|
||||
{
|
||||
- info->callbacks->einfo (_("%F%P: failed to create VxWorks dynamic sections\n"));
|
||||
+ info->callbacks->fatal (_("%P: failed to create VxWorks dynamic sections\n"));
|
||||
return pbfd;
|
||||
}
|
||||
|
||||
@@ -4413,7 +4413,7 @@ _bfd_x86_elf_link_setup_gnu_properties
|
||||
don't need to do it in check_relocs. */
|
||||
if (htab->elf.sgot == NULL
|
||||
&& !_bfd_elf_create_got_section (dynobj, info))
|
||||
- info->callbacks->einfo (_("%F%P: failed to create GOT sections\n"));
|
||||
+ info->callbacks->fatal (_("%P: failed to create GOT sections\n"));
|
||||
|
||||
got_align = (bed->target_id == X86_64_ELF_DATA) ? 3 : 2;
|
||||
|
||||
@@ -4431,7 +4431,7 @@ _bfd_x86_elf_link_setup_gnu_properties
|
||||
/* Create the ifunc sections here so that check_relocs can be
|
||||
simplified. */
|
||||
if (!_bfd_elf_create_ifunc_sections (dynobj, info))
|
||||
- info->callbacks->einfo (_("%F%P: failed to create ifunc sections\n"));
|
||||
+ info->callbacks->fatal (_("%P: failed to create ifunc sections\n"));
|
||||
|
||||
plt_alignment = bfd_log2 (htab->plt.plt_entry_size);
|
||||
|
||||
@@ -4468,7 +4468,7 @@ _bfd_x86_elf_link_setup_gnu_properties
|
||||
".plt.got",
|
||||
pltflags);
|
||||
if (sec == NULL)
|
||||
- info->callbacks->einfo (_("%F%P: failed to create GOT PLT section\n"));
|
||||
+ info->callbacks->fatal (_("%P: failed to create GOT PLT section\n"));
|
||||
|
||||
if (!bfd_set_section_alignment (sec, non_lazy_plt_alignment))
|
||||
goto error_alignment;
|
||||
@@ -4487,7 +4487,7 @@ _bfd_x86_elf_link_setup_gnu_properties
|
||||
".plt.sec",
|
||||
pltflags);
|
||||
if (sec == NULL)
|
||||
- info->callbacks->einfo (_("%F%P: failed to create IBT-enabled PLT section\n"));
|
||||
+ info->callbacks->fatal (_("%P: failed to create IBT-enabled PLT section\n"));
|
||||
|
||||
if (!bfd_set_section_alignment (sec, plt_alignment))
|
||||
goto error_alignment;
|
||||
@@ -4507,7 +4507,7 @@ _bfd_x86_elf_link_setup_gnu_properties
|
||||
".eh_frame",
|
||||
flags);
|
||||
if (sec == NULL)
|
||||
- info->callbacks->einfo (_("%F%P: failed to create PLT .eh_frame section\n"));
|
||||
+ info->callbacks->fatal (_("%P: failed to create PLT .eh_frame section\n"));
|
||||
|
||||
if (!bfd_set_section_alignment (sec, class_align))
|
||||
goto error_alignment;
|
||||
@@ -4520,7 +4520,7 @@ _bfd_x86_elf_link_setup_gnu_properties
|
||||
".eh_frame",
|
||||
flags);
|
||||
if (sec == NULL)
|
||||
- info->callbacks->einfo (_("%F%P: failed to create GOT PLT .eh_frame section\n"));
|
||||
+ info->callbacks->fatal (_("%P: failed to create GOT PLT .eh_frame section\n"));
|
||||
|
||||
if (!bfd_set_section_alignment (sec, class_align))
|
||||
goto error_alignment;
|
||||
@@ -4534,7 +4534,7 @@ _bfd_x86_elf_link_setup_gnu_properties
|
||||
".eh_frame",
|
||||
flags);
|
||||
if (sec == NULL)
|
||||
- info->callbacks->einfo (_("%F%P: failed to create the second PLT .eh_frame section\n"));
|
||||
+ info->callbacks->fatal (_("%P: failed to create the second PLT .eh_frame section\n"));
|
||||
|
||||
if (!bfd_set_section_alignment (sec, class_align))
|
||||
goto error_alignment;
|
||||
@@ -4554,7 +4554,7 @@ _bfd_x86_elf_link_setup_gnu_properties
|
||||
".sframe",
|
||||
flags);
|
||||
if (sec == NULL)
|
||||
- info->callbacks->einfo (_("%F%P: failed to create PLT .sframe section\n"));
|
||||
+ info->callbacks->fatal (_("%P: failed to create PLT .sframe section\n"));
|
||||
|
||||
// FIXME check this
|
||||
// if (!bfd_set_section_alignment (sec, class_align))
|
||||
@@ -4569,7 +4569,7 @@ _bfd_x86_elf_link_setup_gnu_properties
|
||||
".sframe",
|
||||
flags);
|
||||
if (sec == NULL)
|
||||
- info->callbacks->einfo (_("%F%P: failed to create second PLT .sframe section\n"));
|
||||
+ info->callbacks->fatal (_("%P: failed to create second PLT .sframe section\n"));
|
||||
|
||||
htab->plt_second_sframe = sec;
|
||||
}
|
||||
diff --git a/bfd/linker.c b/bfd/linker.c
|
||||
index 0821db55..5b912221 100644
|
||||
--- a/bfd/linker.c
|
||||
+++ b/bfd/linker.c
|
||||
@@ -2982,7 +2982,7 @@ _bfd_generic_section_already_linked (bfd *abfd ATTRIBUTE_UNUSED,
|
||||
|
||||
/* This is the first section with this name. Record it. */
|
||||
if (!bfd_section_already_linked_table_insert (already_linked_list, sec))
|
||||
- info->callbacks->einfo (_("%F%P: already_linked_table: %E\n"));
|
||||
+ info->callbacks->fatal (_("%P: already_linked_table: %E\n"));
|
||||
return false;
|
||||
}
|
||||
|
||||
diff --git a/bfd/reloc.c b/bfd/reloc.c
|
||||
index 7583b7fd..1fee86f1 100644
|
||||
--- a/bfd/reloc.c
|
||||
+++ b/bfd/reloc.c
|
||||
@@ -8465,8 +8465,8 @@ bfd_generic_relax_section (bfd *abfd ATTRIBUTE_UNUSED,
|
||||
bool *again)
|
||||
{
|
||||
if (bfd_link_relocatable (link_info))
|
||||
- (*link_info->callbacks->einfo)
|
||||
- (_("%P%F: --relax and -r may not be used together\n"));
|
||||
+ link_info->callbacks->fatal
|
||||
+ (_("%P: --relax and -r may not be used together\n"));
|
||||
|
||||
*again = false;
|
||||
return true;
|
||||
diff --git a/bfd/reloc16.c b/bfd/reloc16.c
|
||||
index ff5412dc..a16d6b20 100644
|
||||
--- a/bfd/reloc16.c
|
||||
+++ b/bfd/reloc16.c
|
||||
@@ -151,8 +151,8 @@ bfd_coff_reloc16_relax_section (bfd *abfd,
|
||||
long reloc_count;
|
||||
|
||||
if (bfd_link_relocatable (link_info))
|
||||
- (*link_info->callbacks->einfo)
|
||||
- (_("%P%F: --relax and -r may not be used together\n"));
|
||||
+ link_info->callbacks->fatal
|
||||
+ (_("%P: --relax and -r may not be used together\n"));
|
||||
|
||||
/* We only do global relaxation once. It is not safe to do it multiple
|
||||
times (see discussion of the "shrinks" array below). */
|
||||
diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c
|
||||
index 6ef9abcd..9b01cc37 100644
|
||||
--- a/bfd/xcofflink.c
|
||||
+++ b/bfd/xcofflink.c
|
||||
@@ -4681,7 +4681,7 @@ xcoff_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
|
||||
if (hstub->target_section != NULL
|
||||
&& hstub->target_section->output_section == NULL
|
||||
&& info->non_contiguous_regions)
|
||||
- info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
|
||||
+ info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
|
||||
"Retry without --enable-non-contiguous-regions.\n"),
|
||||
hstub->target_section);
|
||||
|
||||
diff --git a/include/bfdlink.h b/include/bfdlink.h
|
||||
index eac07d78..0d03fa70 100644
|
||||
--- a/include/bfdlink.h
|
||||
+++ b/include/bfdlink.h
|
||||
@@ -868,6 +868,9 @@ struct bfd_link_callbacks
|
||||
(struct bfd_link_info *, struct bfd_link_hash_entry *h,
|
||||
struct bfd_link_hash_entry *inh,
|
||||
bfd *abfd, asection *section, bfd_vma address, flagword flags);
|
||||
+ /* Fatal error. */
|
||||
+ void (*fatal)
|
||||
+ (const char *fmt, ...) ATTRIBUTE_NORETURN;
|
||||
/* Error or warning link info message. */
|
||||
void (*einfo)
|
||||
(const char *fmt, ...);
|
||||
diff --git a/ld/ldmain.c b/ld/ldmain.c
|
||||
index 878d9536..a61086c3 100644
|
||||
--- a/ld/ldmain.c
|
||||
+++ b/ld/ldmain.c
|
||||
@@ -146,6 +146,7 @@ static struct bfd_link_callbacks link_callbacks =
|
||||
reloc_dangerous,
|
||||
unattached_reloc,
|
||||
notice,
|
||||
+ fatal,
|
||||
einfo,
|
||||
info_msg,
|
||||
minfo,
|
||||
--
|
||||
2.43.0
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,25 @@
|
||||
From: Alan Modra <amodra@gmail.com>
|
||||
Date: Thu, 10 Apr 2025 19:41:49 +0930
|
||||
|
||||
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=d1458933830456e54223d9fc61f0d9b3a19256f5]
|
||||
CVE: CVE-2025-5244
|
||||
|
||||
PR32858 ld segfault on fuzzed object
|
||||
We missed one place where it is necessary to check for empty groups.
|
||||
|
||||
Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
|
||||
|
||||
diff --git a/bfd/elflink.c b/bfd/elflink.c
|
||||
index a76e8e38da7..549b7b7dd92 100644
|
||||
--- a/bfd/elflink.c
|
||||
+++ b/bfd/elflink.c
|
||||
@@ -14408,7 +14408,8 @@ elf_gc_sweep (bfd *abfd, struct bfd_link_info *info)
|
||||
if (o->flags & SEC_GROUP)
|
||||
{
|
||||
asection *first = elf_next_in_group (o);
|
||||
- o->gc_mark = first->gc_mark;
|
||||
+ if (first != NULL)
|
||||
+ o->gc_mark = first->gc_mark;
|
||||
}
|
||||
|
||||
if (o->gc_mark)
|
||||
@@ -0,0 +1,38 @@
|
||||
From: Alan Modra <amodra@gmail.com>
|
||||
Date: Tue, 1 Apr 2025 22:36:54 +1030
|
||||
|
||||
PR32829, SEGV on objdump function debug_type_samep
|
||||
u.kenum is always non-NULL, see debug_make_enum_type.
|
||||
|
||||
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=6c3458a8b7ee7d39f070c7b2350851cb2110c65a]
|
||||
CVE: CVE-2025-5245
|
||||
|
||||
Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
|
||||
|
||||
diff --git a/binutils/debug.c b/binutils/debug.c
|
||||
index dcc8ccde..465b18e7 100644
|
||||
--- a/binutils/debug.c
|
||||
+++ b/binutils/debug.c
|
||||
@@ -2554,9 +2554,6 @@ debug_write_type (struct debug_handle *info,
|
||||
case DEBUG_KIND_UNION_CLASS:
|
||||
return debug_write_class_type (info, fns, fhandle, type, tag);
|
||||
case DEBUG_KIND_ENUM:
|
||||
- if (type->u.kenum == NULL)
|
||||
- return (*fns->enum_type) (fhandle, tag, (const char **) NULL,
|
||||
- (bfd_signed_vma *) NULL);
|
||||
return (*fns->enum_type) (fhandle, tag, type->u.kenum->names,
|
||||
type->u.kenum->values);
|
||||
case DEBUG_KIND_POINTER:
|
||||
@@ -3097,9 +3094,9 @@ debug_type_samep (struct debug_handle *info, struct debug_type_s *t1,
|
||||
break;
|
||||
|
||||
case DEBUG_KIND_ENUM:
|
||||
- if (t1->u.kenum == NULL)
|
||||
- ret = t2->u.kenum == NULL;
|
||||
- else if (t2->u.kenum == NULL)
|
||||
+ if (t1->u.kenum->names == NULL)
|
||||
+ ret = t2->u.kenum->names == NULL;
|
||||
+ else if (t2->u.kenum->names == NULL)
|
||||
ret = false;
|
||||
else
|
||||
{
|
||||
@@ -0,0 +1,39 @@
|
||||
From: "H.J. Lu" <hjl.tools@gmail.com>
|
||||
Date: Sat, 21 Jun 2025 06:36:56 +0800
|
||||
|
||||
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h08c3cbe5926e4d355b5cb70bbec2b1eeb40c2944]
|
||||
CVE: CVE-2025-7545
|
||||
|
||||
Since the output section contents are copied from the input, don't
|
||||
extend the output section size beyond the input section size.
|
||||
|
||||
PR binutils/33049
|
||||
* objcopy.c (copy_section): Don't extend the output section
|
||||
size beyond the input section size.
|
||||
|
||||
Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
|
||||
|
||||
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
|
||||
index a85d2620..18cd1bfd 100644
|
||||
--- a/binutils/objcopy.c
|
||||
+++ b/binutils/objcopy.c
|
||||
@@ -4547,6 +4547,7 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
|
||||
char *to = (char *) memhunk;
|
||||
char *end = (char *) memhunk + size;
|
||||
int i;
|
||||
+ bfd_size_type memhunk_size = size;
|
||||
|
||||
/* If the section address is not exactly divisible by the interleave,
|
||||
then we must bias the from address. If the copy_byte is less than
|
||||
@@ -4566,6 +4567,11 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
|
||||
}
|
||||
|
||||
size = (size + interleave - 1 - copy_byte) / interleave * copy_width;
|
||||
+
|
||||
+ /* Don't extend the output section size. */
|
||||
+ if (size > memhunk_size)
|
||||
+ size = memhunk_size;
|
||||
+
|
||||
osection->lma /= interleave;
|
||||
if (copy_byte < extra)
|
||||
osection->lma++;
|
||||
@@ -0,0 +1,58 @@
|
||||
From 41461010eb7c79fee7a9d5f6209accdaac66cc6b Mon Sep 17 00:00:00 2001
|
||||
From: "H.J. Lu" <hjl.tools@gmail.com>
|
||||
Date: Sat, 21 Jun 2025 06:52:00 +0800
|
||||
Subject: [PATCH] elf: Report corrupted group section
|
||||
|
||||
Report corrupted group section instead of trying to recover.
|
||||
|
||||
PR binutils/33050
|
||||
* elf.c (bfd_elf_set_group_contents): Report corrupted group
|
||||
section.
|
||||
|
||||
Upstream-Status: Backport [https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=41461010eb7c79fee7a9d5f6209accdaac66cc6b]
|
||||
CVE: CVE-2025-7546
|
||||
|
||||
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
|
||||
---
|
||||
bfd/elf.c | 23 ++++++++++-------------
|
||||
1 file changed, 10 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/bfd/elf.c b/bfd/elf.c
|
||||
index 14ce15c7254..ee894eb05f2 100644
|
||||
--- a/bfd/elf.c
|
||||
+++ b/bfd/elf.c
|
||||
@@ -3971,20 +3971,17 @@ bfd_elf_set_group_contents (bfd *abfd, asection *sec, void *failedptrarg)
|
||||
break;
|
||||
}
|
||||
|
||||
- /* We should always get here with loc == sec->contents + 4, but it is
|
||||
- possible to craft bogus SHT_GROUP sections that will cause segfaults
|
||||
- in objcopy without checking loc here and in the loop above. */
|
||||
- if (loc == sec->contents)
|
||||
- BFD_ASSERT (0);
|
||||
- else
|
||||
+ /* We should always get here with loc == sec->contents + 4. Return
|
||||
+ an error for bogus SHT_GROUP sections. */
|
||||
+ loc -= 4;
|
||||
+ if (loc != sec->contents)
|
||||
{
|
||||
- loc -= 4;
|
||||
- if (loc != sec->contents)
|
||||
- {
|
||||
- BFD_ASSERT (0);
|
||||
- memset (sec->contents + 4, 0, loc - sec->contents);
|
||||
- loc = sec->contents;
|
||||
- }
|
||||
+ /* xgettext:c-format */
|
||||
+ _bfd_error_handler (_("%pB: corrupted group section: `%pA'"),
|
||||
+ abfd, sec);
|
||||
+ bfd_set_error (bfd_error_bad_value);
|
||||
+ *failedptr = true;
|
||||
+ return;
|
||||
}
|
||||
|
||||
H_PUT_32 (abfd, sec->flags & SEC_LINK_ONCE ? GRP_COMDAT : 0, loc);
|
||||
--
|
||||
2.43.5
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
From 5f8987d3999edb26e757115fe87be55787d510b9 Mon Sep 17 00:00:00 2001
|
||||
From: Nick Clifton <nickc@redhat.com>
|
||||
Date: Tue, 17 Dec 2024 09:18:57 +0000
|
||||
Subject: [PATCH] nm: Avoid potential segmentation fault when displaying
|
||||
symbols without version info.
|
||||
|
||||
PR 32467
|
||||
|
||||
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=75086e9de1707281172cc77f178e7949a4414ed0]
|
||||
CVE: CVE-2024-57360
|
||||
Signed-off-by: Ashish Sharma <asharma@mvista.com>
|
||||
|
||||
binutils/nm.c | 24 ++++++++++++++++--------
|
||||
1 file changed, 16 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/binutils/nm.c b/binutils/nm.c
|
||||
index faf27c59b4d..0ba7604d34f 100644
|
||||
--- a/binutils/nm.c
|
||||
+++ b/binutils/nm.c
|
||||
@@ -682,7 +682,7 @@ print_symname (const char *form, struct extended_symbol_info *info,
|
||||
const char *name, bfd *abfd)
|
||||
{
|
||||
char *alloc = NULL;
|
||||
- char *atver = NULL;
|
||||
+ char *atname = NULL;
|
||||
|
||||
if (name == NULL)
|
||||
name = info->sinfo->name;
|
||||
@@ -690,9 +690,19 @@ print_symname (const char *form, struct extended_symbol_info *info,
|
||||
if (!with_symbol_versions
|
||||
&& bfd_get_flavour (abfd) == bfd_target_elf_flavour)
|
||||
{
|
||||
- atver = strchr (name, '@');
|
||||
+ char *atver = strchr (name, '@');
|
||||
+
|
||||
if (atver)
|
||||
- *atver = 0;
|
||||
+ {
|
||||
+ /* PR 32467 - Corrupt binaries might include an @ character in a
|
||||
+ symbol name. Since non-versioned symbol names can be in
|
||||
+ read-only memory (via memory mapping of a file's contents) we
|
||||
+ cannot just replace the @ character with a NUL. Instead we
|
||||
+ create a truncated copy of the name. */
|
||||
+ atname = xstrdup (name);
|
||||
+ atname [atver - name] = 0;
|
||||
+ name = atname;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (do_demangle && *name)
|
||||
@@ -703,9 +713,7 @@ print_symname (const char *form, struct extended_symbol_info *info,
|
||||
}
|
||||
|
||||
if (unicode_display != unicode_default)
|
||||
- {
|
||||
- name = convert_utf8 (name);
|
||||
- }
|
||||
+ name = convert_utf8 (name);
|
||||
|
||||
if (info != NULL && info->elfinfo && with_symbol_versions)
|
||||
{
|
||||
@@ -726,8 +734,8 @@ print_symname (const char *form, struct extended_symbol_info *info,
|
||||
}
|
||||
}
|
||||
printf (form, name);
|
||||
- if (atver)
|
||||
- *atver = '@';
|
||||
+
|
||||
+ free (atname);
|
||||
free (alloc);
|
||||
}
|
||||
|
||||
--
|
||||
2.43.5
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
From f9978defb6fab0bd8583942d97c112b0932ac814 Mon Sep 17 00:00:00 2001
|
||||
From: Nick Clifton <nickc@redhat.com>
|
||||
Date: Wed, 5 Feb 2025 11:15:11 +0000
|
||||
Subject: [PATCH] Prevent illegal memory access when indexing into the
|
||||
sym_hashes array of the elf bfd cookie structure.
|
||||
|
||||
PR 32636
|
||||
|
||||
Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/binutils/plain/debian/patches/CVE-2025-1176.patch?h=applied/ubuntu/jammy-security&id=62a5cc5a49f4be036cf98d2b8fc7d618620ba672
|
||||
Upstream commit https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=f9978defb6fab0bd8583942d97c112b0932ac814]
|
||||
CVE: CVE-2025-1176
|
||||
Signed-off-by: Ashish Sharma <asharma@mvista.com>
|
||||
|
||||
Index: binutils-2.38/bfd/elflink.c
|
||||
===================================================================
|
||||
--- binutils-2.38.orig/bfd/elflink.c
|
||||
+++ binutils-2.38/bfd/elflink.c
|
||||
@@ -62,15 +62,16 @@ struct elf_find_verdep_info
|
||||
static bool _bfd_elf_fix_symbol_flags
|
||||
(struct elf_link_hash_entry *, struct elf_info_failed *);
|
||||
|
||||
-asection *
|
||||
-_bfd_elf_section_for_symbol (struct elf_reloc_cookie *cookie,
|
||||
- unsigned long r_symndx,
|
||||
- bool discard)
|
||||
+static struct elf_link_hash_entry *
|
||||
+get_ext_sym_hash (struct elf_reloc_cookie *cookie, unsigned long r_symndx)
|
||||
{
|
||||
- if (r_symndx >= cookie->locsymcount
|
||||
- || ELF_ST_BIND (cookie->locsyms[r_symndx].st_info) != STB_LOCAL)
|
||||
+ struct elf_link_hash_entry *h = NULL;
|
||||
+
|
||||
+ if ((r_symndx >= cookie->locsymcount
|
||||
+ || ELF_ST_BIND (cookie->locsyms[r_symndx].st_info) != STB_LOCAL)
|
||||
+ /* Guard against corrupt input. See PR 32636 for an example. */
|
||||
+ && r_symndx >= cookie->extsymoff)
|
||||
{
|
||||
- struct elf_link_hash_entry *h;
|
||||
|
||||
h = cookie->sym_hashes[r_symndx - cookie->extsymoff];
|
||||
|
||||
@@ -78,6 +79,22 @@ _bfd_elf_section_for_symbol (struct elf_
|
||||
|| h->root.type == bfd_link_hash_warning)
|
||||
h = (struct elf_link_hash_entry *) h->root.u.i.link;
|
||||
|
||||
+ }
|
||||
+
|
||||
+ return h;
|
||||
+}
|
||||
+
|
||||
+asection *
|
||||
+_bfd_elf_section_for_symbol (struct elf_reloc_cookie *cookie,
|
||||
+ unsigned long r_symndx,
|
||||
+ bool discard)
|
||||
+{
|
||||
+ struct elf_link_hash_entry *h;
|
||||
+
|
||||
+ h = get_ext_sym_hash (cookie, r_symndx);
|
||||
+
|
||||
+ if (h != NULL)
|
||||
+ {
|
||||
if ((h->root.type == bfd_link_hash_defined
|
||||
|| h->root.type == bfd_link_hash_defweak)
|
||||
&& discarded_section (h->root.u.def.section))
|
||||
@@ -85,21 +102,20 @@ _bfd_elf_section_for_symbol (struct elf_
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
- else
|
||||
- {
|
||||
- /* It's not a relocation against a global symbol,
|
||||
- but it could be a relocation against a local
|
||||
- symbol for a discarded section. */
|
||||
- asection *isec;
|
||||
- Elf_Internal_Sym *isym;
|
||||
|
||||
- /* Need to: get the symbol; get the section. */
|
||||
- isym = &cookie->locsyms[r_symndx];
|
||||
- isec = bfd_section_from_elf_index (cookie->abfd, isym->st_shndx);
|
||||
- if (isec != NULL
|
||||
- && discard ? discarded_section (isec) : 1)
|
||||
- return isec;
|
||||
- }
|
||||
+ /* It's not a relocation against a global symbol,
|
||||
+ but it could be a relocation against a local
|
||||
+ symbol for a discarded section. */
|
||||
+ asection *isec;
|
||||
+ Elf_Internal_Sym *isym;
|
||||
+
|
||||
+ /* Need to: get the symbol; get the section. */
|
||||
+ isym = &cookie->locsyms[r_symndx];
|
||||
+ isec = bfd_section_from_elf_index (cookie->abfd, isym->st_shndx);
|
||||
+ if (isec != NULL
|
||||
+ && discard ? discarded_section (isec) : 1)
|
||||
+ return isec;
|
||||
+
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -13642,22 +13658,12 @@ _bfd_elf_gc_mark_rsec (struct bfd_link_i
|
||||
if (r_symndx == STN_UNDEF)
|
||||
return NULL;
|
||||
|
||||
- if (r_symndx >= cookie->locsymcount
|
||||
- || ELF_ST_BIND (cookie->locsyms[r_symndx].st_info) != STB_LOCAL)
|
||||
+ h = get_ext_sym_hash (cookie, r_symndx);
|
||||
+
|
||||
+ if (h != NULL)
|
||||
{
|
||||
bool was_marked;
|
||||
|
||||
- h = cookie->sym_hashes[r_symndx - cookie->extsymoff];
|
||||
- if (h == NULL)
|
||||
- {
|
||||
- info->callbacks->einfo (_("%F%P: corrupt input: %pB\n"),
|
||||
- sec->owner);
|
||||
- return NULL;
|
||||
- }
|
||||
- while (h->root.type == bfd_link_hash_indirect
|
||||
- || h->root.type == bfd_link_hash_warning)
|
||||
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
|
||||
-
|
||||
was_marked = h->mark;
|
||||
h->mark = 1;
|
||||
/* Keep all aliases of the symbol too. If an object symbol
|
||||
@@ -14703,17 +14709,12 @@ bfd_elf_reloc_symbol_deleted_p (bfd_vma
|
||||
if (r_symndx == STN_UNDEF)
|
||||
return true;
|
||||
|
||||
- if (r_symndx >= rcookie->locsymcount
|
||||
- || ELF_ST_BIND (rcookie->locsyms[r_symndx].st_info) != STB_LOCAL)
|
||||
- {
|
||||
- struct elf_link_hash_entry *h;
|
||||
-
|
||||
- h = rcookie->sym_hashes[r_symndx - rcookie->extsymoff];
|
||||
-
|
||||
- while (h->root.type == bfd_link_hash_indirect
|
||||
- || h->root.type == bfd_link_hash_warning)
|
||||
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
|
||||
+ struct elf_link_hash_entry *h;
|
||||
|
||||
+ h = get_ext_sym_hash (rcookie, r_symndx);
|
||||
+
|
||||
+ if (h != NULL)
|
||||
+ {
|
||||
if ((h->root.type == bfd_link_hash_defined
|
||||
|| h->root.type == bfd_link_hash_defweak)
|
||||
&& (h->root.u.def.section->owner != rcookie->abfd
|
||||
@@ -14737,6 +14738,7 @@ bfd_elf_reloc_symbol_deleted_p (bfd_vma
|
||||
|| discarded_section (isec)))
|
||||
return true;
|
||||
}
|
||||
+
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
@@ -0,0 +1,38 @@
|
||||
From 75086e9de1707281172cc77f178e7949a4414ed0 Mon Sep 17 00:00:00 2001
|
||||
From: Nick Clifton <nickc@redhat.com>
|
||||
Date: Wed, 5 Feb 2025 13:26:51 +0000
|
||||
Subject: [PATCH] Prevent an abort in the bfd linker when attempting to
|
||||
generate dynamic relocs for a corrupt input file.
|
||||
|
||||
PR 32638
|
||||
|
||||
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=75086e9de1707281172cc77f178e7949a4414ed0]
|
||||
CVE: CVE-2025-1178
|
||||
Signed-off-by: Ashish Sharma <asharma@mvista.com>
|
||||
|
||||
bfd/elf64-x86-64.c | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
|
||||
index 61334c3ab04..32db254ba6c 100644
|
||||
--- a/bfd/elf64-x86-64.c
|
||||
+++ b/bfd/elf64-x86-64.c
|
||||
@@ -5303,6 +5303,15 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd,
|
||||
|
||||
if (generate_dynamic_reloc)
|
||||
{
|
||||
+ /* If the relgot section has not been created, then
|
||||
+ generate an error instead of a reloc. cf PR 32638. */
|
||||
+ if (relgot == NULL || relgot->size == 0)
|
||||
+ {
|
||||
+ info->callbacks->einfo (_("%F%pB: Unable to generate dynamic relocs because a suitable section does not exist\n"),
|
||||
+ output_bfd);
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
if (relative_reloc_name != NULL
|
||||
&& htab->params->report_relative_reloc)
|
||||
_bfd_x86_elf_link_report_relative_reloc
|
||||
--
|
||||
2.43.5
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,269 @@
|
||||
From 67e30b15212adc1502b898a1ca224fdf65dc110d Mon Sep 17 00:00:00 2001
|
||||
From: "H.J. Lu" <hjl.tools@gmail.com>
|
||||
Date: Thu, 29 Aug 2024 08:47:00 -0700
|
||||
Subject: [PATCH] x86: Check invalid TLS descriptor call TLS descriptor
|
||||
call,
|
||||
|
||||
call *x@tlsdesc(%rax)
|
||||
|
||||
or
|
||||
|
||||
call *x@tlsdesc(%eax)
|
||||
|
||||
calls _dl_tlsdesc_return which expects that RAX/EAX points to the TLS
|
||||
descriptor. Update x86 linker to issue an error with or without TLS
|
||||
transition.
|
||||
|
||||
bfd/
|
||||
|
||||
PR ld/32123
|
||||
* elf32-i386.c (elf_i386_check_tls_transition): Move
|
||||
R_386_TLS_DESC_CALL to ...
|
||||
(elf_i386_tls_transition): Here.
|
||||
* elf64-x86-64.c (elf_x86_64_check_tls_transition): Move.
|
||||
R_X86_64_TLSDESC_CALL check to ...
|
||||
(elf_x86_64_tls_transition): Here.
|
||||
|
||||
ld/
|
||||
|
||||
PR ld/32123
|
||||
* testsuite/ld-i386/i386.exp: Run tlsgdesc3.
|
||||
* testsuite/ld-i386/tlsgdesc3.d: New file.
|
||||
* testsuite/ld-x86-64/tlsdesc5.d: Likewise.
|
||||
* testsuite/ld-x86-64/x86-64.exp: Run tlsdesc5.
|
||||
|
||||
(cherry picked from commit:67e30b15212adc1502b898a1ca224fdf65dc110d)
|
||||
Upstream-Status: Submitted [https://sourceware.org/pipermail/binutils/2025-May/141321.html]
|
||||
CVE: CVE-2025-1179
|
||||
|
||||
Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
|
||||
---
|
||||
bfd/elf32-i386.c | 44 +++++++++++++------
|
||||
bfd/elf64-x86-64.c | 71 +++++++++++++++++++------------
|
||||
ld/testsuite/ld-i386/i386.exp | 1 +
|
||||
ld/testsuite/ld-i386/tlsgdesc3.d | 5 +++
|
||||
ld/testsuite/ld-x86-64/tlsdesc5.d | 5 +++
|
||||
ld/testsuite/ld-x86-64/x86-64.exp | 1 +
|
||||
6 files changed, 86 insertions(+), 41 deletions(-)
|
||||
create mode 100644 ld/testsuite/ld-i386/tlsgdesc3.d
|
||||
create mode 100644 ld/testsuite/ld-x86-64/tlsdesc5.d
|
||||
|
||||
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
|
||||
index 18a28d2491c..9dea465f721 100644
|
||||
--- a/bfd/elf32-i386.c
|
||||
+++ b/bfd/elf32-i386.c
|
||||
@@ -1039,19 +1039,8 @@ elf_i386_check_tls_transition (asection *sec,
|
||||
: elf_x86_tls_error_yes);
|
||||
|
||||
case R_386_TLS_DESC_CALL:
|
||||
- /* Check transition from GDesc access model:
|
||||
- call *x@tlsdesc(%eax)
|
||||
- */
|
||||
- if (offset + 2 <= sec->size)
|
||||
- {
|
||||
- /* Make sure that it's a call *x@tlsdesc(%eax). */
|
||||
- call = contents + offset;
|
||||
- return (call[0] == 0xff && call[1] == 0x10
|
||||
- ? elf_x86_tls_error_none
|
||||
- : elf_x86_tls_error_indirect_call);
|
||||
- }
|
||||
-
|
||||
- return elf_x86_tls_error_yes;
|
||||
+ /* It has been checked in elf_i386_tls_transition. */
|
||||
+ return elf_x86_tls_error_none;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
@@ -1077,6 +1066,8 @@ elf_i386_tls_transition (struct bfd_link_info *info, bfd *abfd,
|
||||
unsigned int to_type = from_type;
|
||||
bool check = true;
|
||||
unsigned int to_le_type, to_ie_type;
|
||||
+ bfd_vma offset;
|
||||
+ bfd_byte *call;
|
||||
|
||||
/* Skip TLS transition for functions. */
|
||||
if (h != NULL
|
||||
@@ -1098,9 +1089,34 @@ elf_i386_tls_transition (struct bfd_link_info *info, bfd *abfd,
|
||||
|
||||
switch (from_type)
|
||||
{
|
||||
+ case R_386_TLS_DESC_CALL:
|
||||
+ /* Check valid GDesc call:
|
||||
+ call *x@tlsdesc(%eax)
|
||||
+ */
|
||||
+ offset = rel->r_offset;
|
||||
+ call = NULL;
|
||||
+ if (offset + 2 <= sec->size)
|
||||
+ {
|
||||
+ /* Make sure that it's a call *x@tlsdesc(%eax). */
|
||||
+ call = contents + offset;
|
||||
+ if (call[0] != 0xff || call[1] != 0x10)
|
||||
+ call = NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (call == NULL)
|
||||
+ {
|
||||
+ _bfd_x86_elf_link_report_tls_transition_error
|
||||
+ (info, abfd, sec, symtab_hdr, h, sym, rel,
|
||||
+ "R_386_TLS_DESC_CALL", NULL,
|
||||
+ elf_x86_tls_error_indirect_call);
|
||||
+
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ /* Fall through. */
|
||||
+
|
||||
case R_386_TLS_GD:
|
||||
case R_386_TLS_GOTDESC:
|
||||
- case R_386_TLS_DESC_CALL:
|
||||
case R_386_TLS_IE_32:
|
||||
case R_386_TLS_IE:
|
||||
case R_386_TLS_GOTIE:
|
||||
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
|
||||
index f116e423f61..7af2e607b02 100644
|
||||
--- a/bfd/elf64-x86-64.c
|
||||
+++ b/bfd/elf64-x86-64.c
|
||||
@@ -1409,32 +1409,8 @@ elf_x86_64_check_tls_transition (bfd *abfd,
|
||||
: elf_x86_tls_error_yes);
|
||||
|
||||
case R_X86_64_TLSDESC_CALL:
|
||||
- /* Check transition from GDesc access model:
|
||||
- call *x@tlsdesc(%rax) <--- LP64 mode.
|
||||
- call *x@tlsdesc(%eax) <--- X32 mode.
|
||||
- */
|
||||
- if (offset + 2 <= sec->size)
|
||||
- {
|
||||
- unsigned int prefix;
|
||||
- call = contents + offset;
|
||||
- prefix = 0;
|
||||
- if (!ABI_64_P (abfd))
|
||||
- {
|
||||
- /* Check for call *x@tlsdesc(%eax). */
|
||||
- if (call[0] == 0x67)
|
||||
- {
|
||||
- prefix = 1;
|
||||
- if (offset + 3 > sec->size)
|
||||
- return elf_x86_tls_error_yes;
|
||||
- }
|
||||
- }
|
||||
- /* Make sure that it's a call *x@tlsdesc(%rax). */
|
||||
- return (call[prefix] == 0xff && call[1 + prefix] == 0x10
|
||||
- ? elf_x86_tls_error_none
|
||||
- : elf_x86_tls_error_indirect_call);
|
||||
- }
|
||||
-
|
||||
- return elf_x86_tls_error_yes;
|
||||
+ /* It has been checked in elf_x86_64_tls_transition. */
|
||||
+ return elf_x86_tls_error_none;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
@@ -1459,6 +1435,8 @@ elf_x86_64_tls_transition (struct bfd_link_info *info, bfd *abfd,
|
||||
unsigned int from_type = *r_type;
|
||||
unsigned int to_type = from_type;
|
||||
bool check = true;
|
||||
+ bfd_vma offset;
|
||||
+ bfd_byte *call;
|
||||
|
||||
/* Skip TLS transition for functions. */
|
||||
if (h != NULL
|
||||
@@ -1468,10 +1446,49 @@ elf_x86_64_tls_transition (struct bfd_link_info *info, bfd *abfd,
|
||||
|
||||
switch (from_type)
|
||||
{
|
||||
+ case R_X86_64_TLSDESC_CALL:
|
||||
+ /* Check valid GDesc call:
|
||||
+ call *x@tlsdesc(%rax) <--- LP64 mode.
|
||||
+ call *x@tlsdesc(%eax) <--- X32 mode.
|
||||
+ */
|
||||
+ offset = rel->r_offset;
|
||||
+ call = NULL;
|
||||
+ if (offset + 2 <= sec->size)
|
||||
+ {
|
||||
+ unsigned int prefix;
|
||||
+ call = contents + offset;
|
||||
+ prefix = 0;
|
||||
+ if (!ABI_64_P (abfd))
|
||||
+ {
|
||||
+ /* Check for call *x@tlsdesc(%eax). */
|
||||
+ if (call[0] == 0x67)
|
||||
+ {
|
||||
+ prefix = 1;
|
||||
+ if (offset + 3 > sec->size)
|
||||
+ call = NULL;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* Make sure that it's a call *x@tlsdesc(%rax). */
|
||||
+ if (call != NULL
|
||||
+ && (call[prefix] != 0xff || call[1 + prefix] != 0x10))
|
||||
+ call = NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (call == NULL)
|
||||
+ {
|
||||
+ _bfd_x86_elf_link_report_tls_transition_error
|
||||
+ (info, abfd, sec, symtab_hdr, h, sym, rel,
|
||||
+ "R_X86_64_TLSDESC_CALL", NULL,
|
||||
+ elf_x86_tls_error_indirect_call);
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ /* Fall through. */
|
||||
+
|
||||
case R_X86_64_TLSGD:
|
||||
case R_X86_64_GOTPC32_TLSDESC:
|
||||
case R_X86_64_CODE_4_GOTPC32_TLSDESC:
|
||||
- case R_X86_64_TLSDESC_CALL:
|
||||
case R_X86_64_GOTTPOFF:
|
||||
case R_X86_64_CODE_4_GOTTPOFF:
|
||||
case R_X86_64_CODE_6_GOTTPOFF:
|
||||
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
|
||||
index a8db2c713f3..41e8725d059 100644
|
||||
--- a/ld/testsuite/ld-i386/i386.exp
|
||||
+++ b/ld/testsuite/ld-i386/i386.exp
|
||||
@@ -543,6 +543,7 @@ run_dump_test "pr27998a"
|
||||
run_dump_test "pr27998b"
|
||||
run_dump_test "tlsgdesc1"
|
||||
run_dump_test "tlsgdesc2"
|
||||
+run_dump_test "tlsgdesc3"
|
||||
|
||||
proc undefined_weak {cflags ldflags} {
|
||||
set testname "Undefined weak symbol"
|
||||
diff --git a/ld/testsuite/ld-i386/tlsgdesc3.d b/ld/testsuite/ld-i386/tlsgdesc3.d
|
||||
new file mode 100644
|
||||
index 00000000000..f2c29d880f2
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-i386/tlsgdesc3.d
|
||||
@@ -0,0 +1,5 @@
|
||||
+#source: tlsgdesc2.s
|
||||
+#name: TLS GDesc call (indirect CALL)
|
||||
+#as: --32
|
||||
+#ld: -shared -melf_i386
|
||||
+#error: .*: relocation R_386_TLS_DESC_CALL against `foo' must be used in indirect CALL with EAX register only
|
||||
diff --git a/ld/testsuite/ld-x86-64/tlsdesc5.d b/ld/testsuite/ld-x86-64/tlsdesc5.d
|
||||
new file mode 100644
|
||||
index 00000000000..6a0158b44b7
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-x86-64/tlsdesc5.d
|
||||
@@ -0,0 +1,5 @@
|
||||
+#source: tlsdesc4.s
|
||||
+#name: TLS GDesc call (indirect CALL)
|
||||
+#as: --64
|
||||
+#ld: -shared -melf_x86_64
|
||||
+#error: .*: relocation R_X86_64_TLSDESC_CALL against `foo' must be used in indirect CALL with RAX register only
|
||||
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
|
||||
index 811813466f8..82b0520c52a 100644
|
||||
--- a/ld/testsuite/ld-x86-64/x86-64.exp
|
||||
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
|
||||
@@ -744,6 +744,7 @@ run_dump_test "pr29820"
|
||||
run_dump_test "tlsie5"
|
||||
run_dump_test "tlsdesc3"
|
||||
run_dump_test "tlsdesc4"
|
||||
+run_dump_test "tlsdesc5"
|
||||
|
||||
proc undefined_weak {cflags ldflags} {
|
||||
set testname "Undefined weak symbol"
|
||||
--
|
||||
2.49.0
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
Backported of:
|
||||
|
||||
From 18cc11a2771d9e40180485da9a4fb660c03efac3 Mon Sep 17 00:00:00 2001
|
||||
From: Nick Clifton <nickc@redhat.com>
|
||||
Date: Wed, 5 Feb 2025 14:31:10 +0000
|
||||
Subject: [PATCH] Prevent illegal memory access when checking relocs in a
|
||||
corrupt ELF binary.
|
||||
|
||||
PR 32641
|
||||
|
||||
Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/binutils/plain/debian/patches/CVE-2025-1181-pre.patch?h=applied/ubuntu/noble-security&id=d6b5bf57cf048c42e4bcd3a4ab32116d0b809774]
|
||||
Upstream commit [https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=931494c9a89558acb36a03a340c01726545eef24]
|
||||
|
||||
CVE: CVE-2025-1181
|
||||
|
||||
Signed-off-by: Ashish Sharma <asharma@mvista.com>
|
||||
|
||||
bfd/elf-bfd.h | 3 +++
|
||||
bfd/elf64-x86-64.c | 10 +++++-----
|
||||
bfd/elflink.c | 24 ++++++++++++++++++++++++
|
||||
bfd/elfxx-x86.c | 20 +++++++-------------
|
||||
4 files changed, 39 insertions(+), 18 deletions(-)
|
||||
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
|
||||
index 3ed22fa6..07add7d0 100644
|
||||
--- a/bfd/elf-bfd.h
|
||||
+++ b/bfd/elf-bfd.h
|
||||
@@ -3126,6 +3126,9 @@ extern bool _bfd_elf_maybe_set_textrel
|
||||
extern bool _bfd_elf_add_dynamic_tags
|
||||
(bfd *, struct bfd_link_info *, bool);
|
||||
|
||||
+extern struct elf_link_hash_entry * _bfd_elf_get_link_hash_entry
|
||||
+ (struct elf_link_hash_entry **, unsigned int, Elf_Internal_Shdr *);
|
||||
+
|
||||
/* Large common section. */
|
||||
extern asection _bfd_elf_large_com_section;
|
||||
|
||||
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
|
||||
index d0d3b0e5..c3fb375c 100644
|
||||
--- a/bfd/elf64-x86-64.c
|
||||
+++ b/bfd/elf64-x86-64.c
|
||||
@@ -1665,7 +1665,7 @@ elf_x86_64_convert_load_reloc (bfd *abfd,
|
||||
bool to_reloc_pc32;
|
||||
bool abs_symbol;
|
||||
bool local_ref;
|
||||
- asection *tsec;
|
||||
+ asection *tsec = NULL;
|
||||
bfd_signed_vma raddend;
|
||||
unsigned int opcode;
|
||||
unsigned int modrm;
|
||||
@@ -1831,6 +1831,9 @@ elf_x86_64_convert_load_reloc (bfd *abfd,
|
||||
return true;
|
||||
}
|
||||
|
||||
+ if (tsec == NULL)
|
||||
+ return false;
|
||||
+
|
||||
/* Don't convert GOTPCREL relocation against large section. */
|
||||
if (elf_section_data (tsec) != NULL
|
||||
&& (elf_section_flags (tsec) & SHF_X86_64_LARGE) != 0)
|
||||
@@ -2127,10 +2130,7 @@ elf_x86_64_scan_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
else
|
||||
{
|
||||
isym = NULL;
|
||||
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
|
||||
- while (h->root.type == bfd_link_hash_indirect
|
||||
- || h->root.type == bfd_link_hash_warning)
|
||||
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
|
||||
+ h = _bfd_elf_get_link_hash_entry (sym_hashes, r_symndx, symtab_hdr);
|
||||
}
|
||||
|
||||
/* Check invalid x32 relocations. */
|
||||
diff --git a/bfd/elflink.c b/bfd/elflink.c
|
||||
index 11ec6bd9..e5521d7b 100644
|
||||
--- a/bfd/elflink.c
|
||||
+++ b/bfd/elflink.c
|
||||
@@ -49,6 +49,27 @@ struct elf_info_failed
|
||||
static bool _bfd_elf_fix_symbol_flags
|
||||
(struct elf_link_hash_entry *, struct elf_info_failed *);
|
||||
|
||||
+struct elf_link_hash_entry *
|
||||
+_bfd_elf_get_link_hash_entry (struct elf_link_hash_entry ** sym_hashes,
|
||||
+ unsigned int symndx,
|
||||
+ Elf_Internal_Shdr * symtab_hdr)
|
||||
+{
|
||||
+ if (symndx < symtab_hdr->sh_info)
|
||||
+ return NULL;
|
||||
+
|
||||
+ struct elf_link_hash_entry *h = sym_hashes[symndx - symtab_hdr->sh_info];
|
||||
+
|
||||
+ /* The hash might be empty. See PR 32641 for an example of this. */
|
||||
+ if (h == NULL)
|
||||
+ return NULL;
|
||||
+
|
||||
+ while (h->root.type == bfd_link_hash_indirect
|
||||
+ || h->root.type == bfd_link_hash_warning)
|
||||
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
|
||||
+
|
||||
+ return h;
|
||||
+}
|
||||
+
|
||||
static struct elf_link_hash_entry *
|
||||
get_ext_sym_hash (struct elf_reloc_cookie *cookie, unsigned long r_symndx)
|
||||
{
|
||||
@@ -62,6 +83,9 @@ get_ext_sym_hash (struct elf_reloc_cookie *cookie, unsigned long r_symndx)
|
||||
|
||||
h = cookie->sym_hashes[r_symndx - cookie->extsymoff];
|
||||
|
||||
+ if (h == NULL)
|
||||
+ return NULL;
|
||||
+
|
||||
while (h->root.type == bfd_link_hash_indirect
|
||||
|| h->root.type == bfd_link_hash_warning)
|
||||
h = (struct elf_link_hash_entry *) h->root.u.i.link;
|
||||
diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c
|
||||
index 508fd771..8c261cf8 100644
|
||||
--- a/bfd/elfxx-x86.c
|
||||
+++ b/bfd/elfxx-x86.c
|
||||
@@ -972,15 +972,7 @@ _bfd_x86_elf_check_relocs (bfd *abfd,
|
||||
goto error_return;
|
||||
}
|
||||
|
||||
- if (r_symndx < symtab_hdr->sh_info)
|
||||
- h = NULL;
|
||||
- else
|
||||
- {
|
||||
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
|
||||
- while (h->root.type == bfd_link_hash_indirect
|
||||
- || h->root.type == bfd_link_hash_warning)
|
||||
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
|
||||
- }
|
||||
+ h = _bfd_elf_get_link_hash_entry (sym_hashes, r_symndx, symtab_hdr);
|
||||
|
||||
if (X86_NEED_DYNAMIC_RELOC_TYPE_P (is_x86_64, r_type)
|
||||
&& NEED_DYNAMIC_RELOCATION_P (is_x86_64, info, true, h, sec,
|
||||
@@ -1205,10 +1197,12 @@ _bfd_x86_elf_link_relax_section (bfd *abfd ATTRIBUTE_UNUSED,
|
||||
else
|
||||
{
|
||||
/* Get H and SEC for GENERATE_DYNAMIC_RELOCATION_P below. */
|
||||
- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
|
||||
- while (h->root.type == bfd_link_hash_indirect
|
||||
- || h->root.type == bfd_link_hash_warning)
|
||||
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
|
||||
+ h = _bfd_elf_get_link_hash_entry (sym_hashes, r_symndx, symtab_hdr);
|
||||
+ if (h == NULL)
|
||||
+ {
|
||||
+ /* FIXMEL: Issue an error message ? */
|
||||
+ continue;
|
||||
+ }
|
||||
|
||||
if (h->root.type == bfd_link_hash_defined
|
||||
|| h->root.type == bfd_link_hash_defweak)
|
||||
@@ -0,0 +1,345 @@
|
||||
Backported of:
|
||||
|
||||
From 931494c9a89558acb36a03a340c01726545eef24 Mon Sep 17 00:00:00 2001
|
||||
From: Nick Clifton <nickc@redhat.com>
|
||||
Date: Wed, 5 Feb 2025 15:43:04 +0000
|
||||
Subject: [PATCH] Add even more checks for corrupt input when processing
|
||||
relocations for ELF files.
|
||||
|
||||
PR 32643
|
||||
|
||||
Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/binutils/plain/debian/patches/CVE-2025-1181.patch?h=applied/ubuntu/noble-security&id=d6b5bf57cf048c42e4bcd3a4ab32116d0b809774]
|
||||
Upstream commit [https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=931494c9a89558acb36a03a340c01726545eef24]
|
||||
|
||||
CVE: CVE-2025-1181
|
||||
|
||||
Signed-off-by: Ashish Sharma <asharma@mvista.com>
|
||||
|
||||
|
||||
diff --git a/bfd/elflink.c b/bfd/elflink.c
|
||||
index e5521d7b..ff84229c 100644
|
||||
--- a/bfd/elflink.c
|
||||
+++ b/bfd/elflink.c
|
||||
@@ -49,15 +49,17 @@ struct elf_info_failed
|
||||
static bool _bfd_elf_fix_symbol_flags
|
||||
(struct elf_link_hash_entry *, struct elf_info_failed *);
|
||||
|
||||
-struct elf_link_hash_entry *
|
||||
-_bfd_elf_get_link_hash_entry (struct elf_link_hash_entry ** sym_hashes,
|
||||
- unsigned int symndx,
|
||||
- Elf_Internal_Shdr * symtab_hdr)
|
||||
+static struct elf_link_hash_entry *
|
||||
+get_link_hash_entry (struct elf_link_hash_entry ** sym_hashes,
|
||||
+ unsigned int symndx,
|
||||
+ unsigned int ext_sym_start)
|
||||
{
|
||||
- if (symndx < symtab_hdr->sh_info)
|
||||
+ if (sym_hashes == NULL
|
||||
+ /* Guard against corrupt input. See PR 32636 for an example. */
|
||||
+ || symndx < ext_sym_start)
|
||||
return NULL;
|
||||
|
||||
- struct elf_link_hash_entry *h = sym_hashes[symndx - symtab_hdr->sh_info];
|
||||
+ struct elf_link_hash_entry *h = sym_hashes[symndx - ext_sym_start];
|
||||
|
||||
/* The hash might be empty. See PR 32641 for an example of this. */
|
||||
if (h == NULL)
|
||||
@@ -70,29 +72,28 @@ _bfd_elf_get_link_hash_entry (struct elf_link_hash_entry ** sym_hashes,
|
||||
return h;
|
||||
}
|
||||
|
||||
-static struct elf_link_hash_entry *
|
||||
-get_ext_sym_hash (struct elf_reloc_cookie *cookie, unsigned long r_symndx)
|
||||
+struct elf_link_hash_entry *
|
||||
+_bfd_elf_get_link_hash_entry (struct elf_link_hash_entry ** sym_hashes,
|
||||
+ unsigned int symndx,
|
||||
+ Elf_Internal_Shdr * symtab_hdr)
|
||||
{
|
||||
- struct elf_link_hash_entry *h = NULL;
|
||||
-
|
||||
- if ((r_symndx >= cookie->locsymcount
|
||||
- || ELF_ST_BIND (cookie->locsyms[r_symndx].st_info) != STB_LOCAL)
|
||||
- /* Guard against corrupt input. See PR 32636 for an example. */
|
||||
- && r_symndx >= cookie->extsymoff)
|
||||
- {
|
||||
-
|
||||
- h = cookie->sym_hashes[r_symndx - cookie->extsymoff];
|
||||
-
|
||||
- if (h == NULL)
|
||||
- return NULL;
|
||||
+ if (symtab_hdr == NULL)
|
||||
+ return NULL;
|
||||
|
||||
- while (h->root.type == bfd_link_hash_indirect
|
||||
- || h->root.type == bfd_link_hash_warning)
|
||||
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
|
||||
+ return get_link_hash_entry (sym_hashes, symndx, symtab_hdr->sh_info);
|
||||
+}
|
||||
|
||||
- }
|
||||
+static struct elf_link_hash_entry *
|
||||
+get_ext_sym_hash_from_cookie (struct elf_reloc_cookie *cookie, unsigned long r_symndx)
|
||||
+{
|
||||
+ if (cookie == NULL || cookie->sym_hashes == NULL)
|
||||
+ return NULL;
|
||||
+
|
||||
+ if (r_symndx >= cookie->locsymcount
|
||||
+ || ELF_ST_BIND (cookie->locsyms[r_symndx].st_info) != STB_LOCAL)
|
||||
+ return get_link_hash_entry (cookie->sym_hashes, r_symndx, cookie->extsymoff);
|
||||
|
||||
- return h;
|
||||
+ return NULL;
|
||||
}
|
||||
|
||||
asection *
|
||||
@@ -102,7 +103,7 @@ _bfd_elf_section_for_symbol (struct elf_reloc_cookie *cookie,
|
||||
{
|
||||
struct elf_link_hash_entry *h;
|
||||
|
||||
- h = get_ext_sym_hash (cookie, r_symndx);
|
||||
+ h = get_ext_sym_hash_from_cookie (cookie, r_symndx);
|
||||
|
||||
if (h != NULL)
|
||||
{
|
||||
@@ -8906,7 +8907,6 @@ set_symbol_value (bfd *bfd_with_globals,
|
||||
size_t symidx,
|
||||
bfd_vma val)
|
||||
{
|
||||
- struct elf_link_hash_entry **sym_hashes;
|
||||
struct elf_link_hash_entry *h;
|
||||
size_t extsymoff = locsymcount;
|
||||
|
||||
@@ -8929,12 +8929,12 @@ set_symbol_value (bfd *bfd_with_globals,
|
||||
|
||||
/* It is a global symbol: set its link type
|
||||
to "defined" and give it a value. */
|
||||
-
|
||||
- sym_hashes = elf_sym_hashes (bfd_with_globals);
|
||||
- h = sym_hashes [symidx - extsymoff];
|
||||
- while (h->root.type == bfd_link_hash_indirect
|
||||
- || h->root.type == bfd_link_hash_warning)
|
||||
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
|
||||
+ h = get_link_hash_entry (elf_sym_hashes (bfd_with_globals), symidx, extsymoff);
|
||||
+ if (h == NULL)
|
||||
+ {
|
||||
+ /* FIXMEL What should we do ? */
|
||||
+ return;
|
||||
+ }
|
||||
h->root.type = bfd_link_hash_defined;
|
||||
h->root.u.def.value = val;
|
||||
h->root.u.def.section = bfd_abs_section_ptr;
|
||||
@@ -11405,10 +11405,19 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
|
||||
|| (elf_bad_symtab (input_bfd)
|
||||
&& flinfo->sections[symndx] == NULL))
|
||||
{
|
||||
- struct elf_link_hash_entry *h = sym_hashes[symndx - extsymoff];
|
||||
- while (h->root.type == bfd_link_hash_indirect
|
||||
- || h->root.type == bfd_link_hash_warning)
|
||||
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
|
||||
+ struct elf_link_hash_entry *h;
|
||||
+
|
||||
+ h = get_link_hash_entry (sym_hashes, symndx, extsymoff);
|
||||
+ if (h == NULL)
|
||||
+ {
|
||||
+ _bfd_error_handler
|
||||
+ /* xgettext:c-format */
|
||||
+ (_("error: %pB: unable to create group section symbol"),
|
||||
+ input_bfd);
|
||||
+ bfd_set_error (bfd_error_bad_value);
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
/* Arrange for symbol to be output. */
|
||||
h->indx = -2;
|
||||
elf_section_data (osec)->this_hdr.sh_info = -2;
|
||||
@@ -11542,7 +11551,7 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
|
||||
|| (elf_bad_symtab (input_bfd)
|
||||
&& flinfo->sections[r_symndx] == NULL))
|
||||
{
|
||||
- h = sym_hashes[r_symndx - extsymoff];
|
||||
+ h = get_link_hash_entry (sym_hashes, r_symndx, extsymoff);
|
||||
|
||||
/* Badly formatted input files can contain relocs that
|
||||
reference non-existant symbols. Check here so that
|
||||
@@ -11551,17 +11560,13 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
|
||||
{
|
||||
_bfd_error_handler
|
||||
/* xgettext:c-format */
|
||||
- (_("error: %pB contains a reloc (%#" PRIx64 ") for section %pA "
|
||||
+ (_("error: %pB contains a reloc (%#" PRIx64 ") for section '%pA' "
|
||||
"that references a non-existent global symbol"),
|
||||
input_bfd, (uint64_t) rel->r_info, o);
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return false;
|
||||
}
|
||||
|
||||
- while (h->root.type == bfd_link_hash_indirect
|
||||
- || h->root.type == bfd_link_hash_warning)
|
||||
- h = (struct elf_link_hash_entry *) h->root.u.i.link;
|
||||
-
|
||||
s_type = h->type;
|
||||
|
||||
/* If a plugin symbol is referenced from a non-IR file,
|
||||
@@ -11777,7 +11782,6 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
|
||||
&& flinfo->sections[r_symndx] == NULL))
|
||||
{
|
||||
struct elf_link_hash_entry *rh;
|
||||
- unsigned long indx;
|
||||
|
||||
/* This is a reloc against a global symbol. We
|
||||
have not yet output all the local symbols, so
|
||||
@@ -11786,15 +11790,16 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
|
||||
reloc to point to the global hash table entry
|
||||
for this symbol. The symbol index is then
|
||||
set at the end of bfd_elf_final_link. */
|
||||
- indx = r_symndx - extsymoff;
|
||||
- rh = elf_sym_hashes (input_bfd)[indx];
|
||||
- while (rh->root.type == bfd_link_hash_indirect
|
||||
- || rh->root.type == bfd_link_hash_warning)
|
||||
- rh = (struct elf_link_hash_entry *) rh->root.u.i.link;
|
||||
-
|
||||
- /* Setting the index to -2 tells
|
||||
- elf_link_output_extsym that this symbol is
|
||||
- used by a reloc. */
|
||||
+ rh = get_link_hash_entry (elf_sym_hashes (input_bfd),
|
||||
+ r_symndx, extsymoff);
|
||||
+ if (rh == NULL)
|
||||
+ {
|
||||
+ /* FIXME: Generate an error ? */
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ /* Setting the index to -2 tells elf_link_output_extsym
|
||||
+ that this symbol is used by a reloc. */
|
||||
BFD_ASSERT (rh->indx < 0);
|
||||
rh->indx = -2;
|
||||
*rel_hash = rh;
|
||||
@@ -13758,25 +13763,21 @@ _bfd_elf_gc_mark_hook (asection *sec,
|
||||
struct elf_link_hash_entry *h,
|
||||
Elf_Internal_Sym *sym)
|
||||
{
|
||||
- if (h != NULL)
|
||||
+ if (h == NULL)
|
||||
+ return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
|
||||
+
|
||||
+ switch (h->root.type)
|
||||
{
|
||||
- switch (h->root.type)
|
||||
- {
|
||||
- case bfd_link_hash_defined:
|
||||
- case bfd_link_hash_defweak:
|
||||
- return h->root.u.def.section;
|
||||
+ case bfd_link_hash_defined:
|
||||
+ case bfd_link_hash_defweak:
|
||||
+ return h->root.u.def.section;
|
||||
|
||||
- case bfd_link_hash_common:
|
||||
- return h->root.u.c.p->section;
|
||||
+ case bfd_link_hash_common:
|
||||
+ return h->root.u.c.p->section;
|
||||
|
||||
- default:
|
||||
- break;
|
||||
- }
|
||||
+ default:
|
||||
+ return NULL;
|
||||
}
|
||||
- else
|
||||
- return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
|
||||
-
|
||||
- return NULL;
|
||||
}
|
||||
|
||||
/* Return the debug definition section. */
|
||||
@@ -13825,46 +13826,49 @@ _bfd_elf_gc_mark_rsec (struct bfd_link_info *info, asection *sec,
|
||||
if (r_symndx == STN_UNDEF)
|
||||
return NULL;
|
||||
|
||||
- h = get_ext_sym_hash (cookie, r_symndx);
|
||||
-
|
||||
- if (h != NULL)
|
||||
+ h = get_ext_sym_hash_from_cookie (cookie, r_symndx);
|
||||
+ if (h == NULL)
|
||||
{
|
||||
- bool was_marked;
|
||||
+ /* A corrup tinput file can lead to a situation where the index
|
||||
+ does not reference either a local or an external symbol. */
|
||||
+ if (r_symndx >= cookie->locsymcount)
|
||||
+ return NULL;
|
||||
|
||||
- was_marked = h->mark;
|
||||
- h->mark = 1;
|
||||
- /* Keep all aliases of the symbol too. If an object symbol
|
||||
- needs to be copied into .dynbss then all of its aliases
|
||||
- should be present as dynamic symbols, not just the one used
|
||||
- on the copy relocation. */
|
||||
- hw = h;
|
||||
- while (hw->is_weakalias)
|
||||
- {
|
||||
- hw = hw->u.alias;
|
||||
- hw->mark = 1;
|
||||
- }
|
||||
+ return (*gc_mark_hook) (sec, info, cookie->rel, NULL,
|
||||
+ &cookie->locsyms[r_symndx]);
|
||||
+ }
|
||||
|
||||
- if (!was_marked && h->start_stop && !h->root.ldscript_def)
|
||||
- {
|
||||
- if (info->start_stop_gc)
|
||||
- return NULL;
|
||||
+ bool was_marked = h->mark;
|
||||
|
||||
- /* To work around a glibc bug, mark XXX input sections
|
||||
- when there is a reference to __start_XXX or __stop_XXX
|
||||
- symbols. */
|
||||
- else if (start_stop != NULL)
|
||||
- {
|
||||
- asection *s = h->u2.start_stop_section;
|
||||
- *start_stop = true;
|
||||
- return s;
|
||||
- }
|
||||
- }
|
||||
+ h->mark = 1;
|
||||
+ /* Keep all aliases of the symbol too. If an object symbol
|
||||
+ needs to be copied into .dynbss then all of its aliases
|
||||
+ should be present as dynamic symbols, not just the one used
|
||||
+ on the copy relocation. */
|
||||
+ hw = h;
|
||||
+ while (hw->is_weakalias)
|
||||
+ {
|
||||
+ hw = hw->u.alias;
|
||||
+ hw->mark = 1;
|
||||
+ }
|
||||
|
||||
- return (*gc_mark_hook) (sec, info, cookie->rel, h, NULL);
|
||||
+ if (!was_marked && h->start_stop && !h->root.ldscript_def)
|
||||
+ {
|
||||
+ if (info->start_stop_gc)
|
||||
+ return NULL;
|
||||
+
|
||||
+ /* To work around a glibc bug, mark XXX input sections
|
||||
+ when there is a reference to __start_XXX or __stop_XXX
|
||||
+ symbols. */
|
||||
+ else if (start_stop != NULL)
|
||||
+ {
|
||||
+ asection *s = h->u2.start_stop_section;
|
||||
+ *start_stop = true;
|
||||
+ return s;
|
||||
+ }
|
||||
}
|
||||
|
||||
- return (*gc_mark_hook) (sec, info, cookie->rel, NULL,
|
||||
- &cookie->locsyms[r_symndx]);
|
||||
+ return (*gc_mark_hook) (sec, info, cookie->rel, h, NULL);
|
||||
}
|
||||
|
||||
/* COOKIE->rel describes a relocation against section SEC, which is
|
||||
@@ -14878,7 +14882,7 @@ bfd_elf_reloc_symbol_deleted_p (bfd_vma offset, void *cookie)
|
||||
|
||||
struct elf_link_hash_entry *h;
|
||||
|
||||
- h = get_ext_sym_hash (rcookie, r_symndx);
|
||||
+ h = get_ext_sym_hash_from_cookie (rcookie, r_symndx);
|
||||
|
||||
if (h != NULL)
|
||||
{
|
||||
@@ -0,0 +1,33 @@
|
||||
From b425859021d17adf62f06fb904797cf8642986ad Mon Sep 17 00:00:00 2001
|
||||
From: Nick Clifton <nickc@redhat.com>
|
||||
Date: Wed, 5 Feb 2025 16:27:38 +0000
|
||||
Subject: [PATCH] Fix another illegal memory access triggered by corrupt ELF
|
||||
input files.
|
||||
|
||||
PR 32644
|
||||
|
||||
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=b425859021d17adf62f06fb904797cf8642986ad]
|
||||
CVE: CVE-2025-1182
|
||||
Signed-off-by: Ashish Sharma <asharma@mvista.com>
|
||||
|
||||
bfd/elflink.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/bfd/elflink.c b/bfd/elflink.c
|
||||
index bf940942ec3..df6eb250961 100644
|
||||
--- a/bfd/elflink.c
|
||||
+++ b/bfd/elflink.c
|
||||
@@ -15116,6 +15116,10 @@ bfd_elf_reloc_symbol_deleted_p (bfd_vma offset, void *cookie)
|
||||
}
|
||||
else
|
||||
{
|
||||
+ if (r_symndx >= rcookie->locsymcount)
|
||||
+ /* This can happen with corrupt input. */
|
||||
+ return false;
|
||||
+
|
||||
/* It's not a relocation against a global symbol,
|
||||
but it could be a relocation against a local
|
||||
symbol for a discarded section. */
|
||||
--
|
||||
2.43.5
|
||||
|
||||
80
sources/poky/meta/recipes-devtools/binutils/binutils_2.42.bb
Normal file
80
sources/poky/meta/recipes-devtools/binutils/binutils_2.42.bb
Normal file
@@ -0,0 +1,80 @@
|
||||
require binutils.inc
|
||||
require binutils-${PV}.inc
|
||||
|
||||
# perl-native for pod2man for man page generation
|
||||
DEPENDS += "zlib perl-native"
|
||||
|
||||
EXTRA_OECONF += "--with-sysroot=/ \
|
||||
--enable-install-libbfd \
|
||||
--enable-install-libiberty \
|
||||
--enable-shared \
|
||||
--with-system-zlib \
|
||||
"
|
||||
|
||||
EXTRA_OEMAKE:append:libc-musl = "\
|
||||
gt_cv_func_gnugettext1_libc=yes \
|
||||
gt_cv_func_gnugettext2_libc=yes \
|
||||
"
|
||||
# libcollector/collector.c:547:15: error: no member named '__fprintf_chk' in 'struct CollectorUtilFuncs'
|
||||
EXTRA_OECONF:append:toolchain-clang = " --disable-gprofng"
|
||||
# | ../../../gprofng/libcollector/../src/collector_module.h:78:13: error: duplicate member 'pwrite'
|
||||
# | ../../../gprofng/libcollector/dispatcher.c:578:8: error: 'struct sigevent' has no member named '_sigev_un'
|
||||
EXTRA_OECONF:append:libc-musl = " --disable-gprofng"
|
||||
|
||||
EXTRA_OECONF:class-native = "--enable-targets=all \
|
||||
--enable-64-bit-bfd \
|
||||
--enable-install-libiberty \
|
||||
--enable-install-libbfd \
|
||||
--disable-gdb \
|
||||
--disable-gdbserver \
|
||||
--disable-libdecnumber \
|
||||
--disable-readline \
|
||||
--disable-sim \
|
||||
--disable-werror"
|
||||
|
||||
PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'debuginfod', d)}"
|
||||
PACKAGECONFIG[debuginfod] = "--with-debuginfod, --without-debuginfod, elfutils"
|
||||
|
||||
do_install:class-native () {
|
||||
autotools_do_install
|
||||
|
||||
# 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}
|
||||
|
||||
# We only want libiberty, libbfd and libopcodes
|
||||
rm -rf ${D}${bindir}
|
||||
rm -rf ${D}${prefix}/${TARGET_SYS}
|
||||
rm -rf ${D}${prefix}/lib/ldscripts
|
||||
rm -rf ${D}${prefix}/share/info
|
||||
rm -rf ${D}${prefix}/share/locale
|
||||
rm -rf ${D}${prefix}/share/man
|
||||
rmdir ${D}${prefix}/share || :
|
||||
rmdir ${D}/${libdir}/gcc-lib || :
|
||||
rmdir ${D}/${libdir}64/gcc-lib || :
|
||||
rmdir ${D}/${libdir} || :
|
||||
rmdir ${D}/${libdir}64 || :
|
||||
}
|
||||
|
||||
# libctf races with libbfd
|
||||
PARALLEL_MAKEINST:class-target = ""
|
||||
PARALLEL_MAKEINST:class-nativesdk = ""
|
||||
|
||||
# Split out libbfd-*.so and libopcodes-*.so so including perf doesn't include
|
||||
# extra stuff
|
||||
PACKAGE_BEFORE_PN += "libbfd libopcodes gprofng"
|
||||
FILES:libbfd = "${libdir}/libbfd-*.so.* ${libdir}/libbfd-*.so"
|
||||
FILES:libopcodes = "${libdir}/libopcodes-*.so.* ${libdir}/libopcodes-*.so"
|
||||
FILES:gprofng = "${sysconfdir}/gprofng.rc ${libdir}/gprofng/libgp-*.so ${libdir}/gprofng/libgprofng.so.* ${bindir}/gp-* ${bindir}/gprofng"
|
||||
FILES:${PN}-dev += "${libdir}/libgprofng.so ${libdir}/libsframe.so"
|
||||
SRC_URI:append:class-nativesdk = " file://0003-binutils-nativesdk-Search-for-alternative-ld.so.conf.patch "
|
||||
|
||||
USE_ALTERNATIVES_FOR:class-nativesdk = ""
|
||||
FILES:${PN}:append:class-nativesdk = " ${bindir}"
|
||||
RDEPENDS:gprofng:class-nativesdk = " nativesdk-perl-module-bignum \
|
||||
nativesdk-perl-module-bigint \
|
||||
nativesdk-perl-module-math-bigint \
|
||||
"
|
||||
|
||||
BBCLASSEXTEND = "native nativesdk"
|
||||
Reference in New Issue
Block a user