diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000000000000000000000000000000000..d87f5613ec4234f82f8eaeebc563711f587fdf88 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.xz filter=lfs diff=lfs merge=lfs -text diff --git a/.lfsconfig b/.lfsconfig new file mode 100644 index 0000000000000000000000000000000000000000..5b6e06d7af0a71c4ea3ad71bf224d065a0345659 --- /dev/null +++ b/.lfsconfig @@ -0,0 +1,2 @@ +[lfs] + url = https://artlfs.openeuler.openatom.cn/src-openEuler/binutils diff --git a/binutils-2.41.tar.xz b/binutils-2.41.tar.xz index 17cfb0cec609e1771ed867b2d005492329759e39..f74d6d6eccca3877945f2a66d30dbd6e2353a193 100644 Binary files a/binutils-2.41.tar.xz and b/binutils-2.41.tar.xz differ diff --git a/binutils-BPF-reloc-4.patch b/binutils-BPF-reloc-4.patch new file mode 100644 index 0000000000000000000000000000000000000000..a66451845b664cfc8cabc6bec7064ccc7795a6ad --- /dev/null +++ b/binutils-BPF-reloc-4.patch @@ -0,0 +1,38 @@ +diff -rup binutils.orig/bfd/bpf-reloc.def binutils-2.41/bfd/bpf-reloc.def +--- binutils.orig/bfd/bpf-reloc.def 2023-10-30 10:41:59.114273359 +0000 ++++ binutils-2.41/bfd/bpf-reloc.def 2023-10-30 11:09:41.316109162 +0000 +@@ -72,3 +72,20 @@ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + true) /* pcrel_offset */ ++ ++ /* R_BPF_64_NODYLD32 is not used by GNU tools - but it is generated by LLVM. ++ We provide an entry here so that tools like strip can safely handle BPF ++ binaries generated by other tools. */ ++ BPF_HOWTO (R_BPF_64_NODYLD32, /* type */ ++ 0, /* rightshift */ ++ 0, /* size */ ++ 0, /* bitsize */ ++ false, /* pc_relative */ ++ 0, /* bitpos */ ++ complain_overflow_dont, /* complain_on_overflow */ ++ bpf_elf_generic_reloc, /* special_function */ ++ "R_BPF_64_NODYLD32", /* name */ ++ false, /* partial_inplace */ ++ 0, /* src_mask */ ++ 0, /* dst_mask */ ++ false) /* pcrel_offset */ +diff -rup binutils.orig/include/elf/bpf.h binutils-2.41/include/elf/bpf.h +--- binutils.orig/include/elf/bpf.h 2023-10-30 10:41:59.332273599 +0000 ++++ binutils-2.41/include/elf/bpf.h 2023-10-30 10:59:44.475368448 +0000 +@@ -30,8 +30,8 @@ START_RELOC_NUMBERS (elf_bpf_reloc_type) + RELOC_NUMBER (R_BPF_64_64, 1) + RELOC_NUMBER (R_BPF_64_ABS64, 2) + RELOC_NUMBER (R_BPF_64_ABS32, 3) +-/* R_BPF_64_NODYLD32 is not used by GNU tools. +- * It is kept in this file to remind that the value is already taken. */ ++/* R_BPF_64_NODYLD32 is not used by GNU tools - but it is generated by LLVM. ++ It is kept in this file to remind that the value is already taken. */ + RELOC_NUMBER (R_BPF_64_NODYLD32, 4) + RELOC_NUMBER (R_BPF_64_32, 10) + END_RELOC_NUMBERS (R_BPF_max) diff --git a/binutils-gold-warn-unsupported.patch b/binutils-gold-warn-unsupported.patch new file mode 100644 index 0000000000000000000000000000000000000000..8e00aa3dedf3c023ca14acd5f01dbfd59cd20e04 --- /dev/null +++ b/binutils-gold-warn-unsupported.patch @@ -0,0 +1,66 @@ +Only in binutils-2.34/gold: autom4te.cache +diff -rup binutils.orig/gold/configure binutils-2.34/gold/configure +--- binutils.orig/gold/configure 2020-04-20 12:35:13.048297305 +0100 ++++ binutils-2.34/gold/configure 2020-04-20 14:02:06.743725696 +0100 +@@ -5180,7 +5180,8 @@ for targ in $target $canon_targets; do + . ${srcdir}/configure.tgt + + if test "$targ_obj" = "UNKNOWN"; then +- as_fn_error $? "\"unsupported target $targ\"" "$LINENO" 5 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"unsupported target $targ\"" >&5 ++$as_echo "$as_me: WARNING: \"unsupported target $targ\"" >&2;} + else + targetobjs="$targetobjs ${targ_obj}.\$(OBJEXT)" + if test "$targ_extra_obj" != ""; then +diff -rup binutils.orig/gold/configure.ac binutils-2.34/gold/configure.ac +--- binutils.orig/gold/configure.ac 2020-04-20 12:35:13.050297291 +0100 ++++ binutils-2.34/gold/configure.ac 2020-04-20 14:01:46.435868770 +0100 +@@ -181,7 +181,7 @@ for targ in $target $canon_targets; do + . ${srcdir}/configure.tgt + + if test "$targ_obj" = "UNKNOWN"; then +- AC_MSG_ERROR("unsupported target $targ") ++ AC_MSG_WARN("unsupported target $targ") + else + targetobjs="$targetobjs ${targ_obj}.\$(OBJEXT)" + if test "$targ_extra_obj" != ""; then +--- binutils.orig/ld/configure.tgt 2020-04-20 12:35:12.465301359 +0100 ++++ binutils-2.34/ld/configure.tgt 2020-04-20 14:17:52.123066333 +0100 +@@ -220,7 +220,7 @@ bfin-*-linux-uclibc*) targ_emul=elf32bfi + targ_extra_emuls="elf32bfin" + targ_extra_libpath=$targ_extra_emuls + ;; +-bpf-*-*) targ_emul=elf64bpf ++bpf-* | bpf-*-*) targ_emul=elf64bpf + ;; + cr16-*-elf*) targ_emul=elf32cr16 + ;; +@@ -1026,7 +1026,7 @@ z8k-*-coff) targ_emul=z8002 + targ_extra_ofiles= + ;; + *) +- echo 2>&1 "*** ld does not support target ${targ}" ++ echo 2>&1 "*** ld does not support target '${targ}' NO REALLY" + echo 2>&1 "*** see ld/configure.tgt for supported targets" + exit 1 + +--- binutils.orig/bfd/config.bfd 2020-04-20 12:35:13.038297375 +0100 ++++ binutils-2.34/bfd/config.bfd 2020-04-20 14:25:26.452869193 +0100 +@@ -473,7 +473,7 @@ case "${targ}" in + ;; + + #ifdef BFD64 +- bpf-*-none) ++ bpf-*-none | bpf-*) + targ_defvec=bpf_elf64_le_vec + targ_selvecs=bpf_elf64_be_vec + targ_underscore=yes +@@ -1427,7 +1427,7 @@ case "${targ}" in + ;; + + *) +- echo 1>&2 "*** BFD does not support target ${targ}." ++ echo 1>&2 "*** BFD does not support target '${targ}'. Honest." + echo 1>&2 "*** Look in bfd/config.bfd for supported targets." + exit 1 + ;; diff --git a/binutils.spec b/binutils.spec index e51e3b9ce9facb112cc07877d27e4ea2fb068761..cad71c7f2fc28bac6e381a14c60d94e2712bb156 100644 --- a/binutils.spec +++ b/binutils.spec @@ -2,7 +2,7 @@ Summary: A GNU collection of binary utilities Name: binutils%{?_with_debug:-debug} Version: 2.41 -Release: 13 +Release: 14 License: GPL-3.0-or-later AND (GPL-3.0-or-later WITH Bison-exception-2.2) AND (LGPL-2.0-or-later WITH GCC-exception-2.0) AND BSD-3-Clause AND GFDL-1.3-or-later AND GPL-2.0-or-later AND LGPL-2.1-or-later AND LGPL-2.0-or-later URL: https://sourceware.org/binutils @@ -129,7 +129,7 @@ URL: https://sourceware.org/binutils %define enable_shared 0 %endif -# GprofNG currenly onlly supports the x86 and AArch64 architectures. +# GprofNG currently only supports the x86 and AArch64 architectures. %ifnarch x86_64 aarch64 %undefine with_gprofng %endif @@ -355,8 +355,17 @@ Patch5008: binutils-gold-empty-dwp.patch # Purpose: Fix gold linker relocation offset. # Lifetime: Permanent -Patch5009: Fix-gold-linker-relocation-offset.patch +Patch5009: Fix-gold-linker-relocation-offset.patch +# Purpose: Accept and ignore R_BPF_64_NODYLD32 relocations +# Lifetime: Fixed in 2.42 +Patch5010: binutils-BPF-reloc-4.patch + +# Purpose: Change the gold configuration script to only warn about +# unsupported targets. This allows the binutils to be built with +# BPF support enabled. +# Lifetime: Permanent. +Patch5011: binutils-gold-warn-unsupported.patch #---------------------------------------------------------------------------- Provides: bundled(libiberty) @@ -785,6 +794,8 @@ run_target_configuration() # BZ 1920373: Enable PEP support for all targets as the PERF package's # testsuite expects to be able to read PE format files ragrdless of # the host's architecture. + # + # Also enable the BPF target so that strip will work on BPF files. case $target in s390*) # Note - The s390-linux target is there so that the GOLD linker will @@ -803,7 +814,7 @@ run_target_configuration() TARGS="--enable-targets=powerpc-linux,x86_64-pep" ;; *) - TARGS="--enable-targets=x86_64-pep" + TARGS="--enable-targets=x86_64-pep,bpf-unknown-none" ;; esac @@ -1153,6 +1164,9 @@ EOH # This one comes from gcc rm -f $local_infodir/dir + %if %{enable_shared} + %{?delete_la} + %endif %find_lang binutils %find_lang opcodes @@ -1312,9 +1326,6 @@ exit 0 %{_libdir}/lib*.a %{_libdir}/libbfd.so %{_libdir}/libopcodes.so -%if %{enable_shared} -%exclude %{_libdir}/lib*.la -%endif %if %{with docs} %files help @@ -1371,6 +1382,10 @@ exit 0 #---------------------------------------------------------------------------- %changelog +* Mon Jan 20 2025 Funda Wang - 2.41-14 +- Add support for the BPF target (rh#1825193) +- Accept and ignore R_BPF_64_NODYLD32 relocations (rh#2245296) + * Tue Dec 17 2024 wangxin - 2.41-13 - LoongArch: keep compatible with older gcc diff --git a/binutils.yaml b/binutils.yaml index 19ef7d192d2bc255689b5edc27efabb6262431ff..e3639bea7461ff97be8203c12e6cff3eafb1bd18 100644 --- a/binutils.yaml +++ b/binutils.yaml @@ -1,4 +1,4 @@ version_control: git src_repo: https://sourceware.org/git/binutils-gdb.git tag_prefix: "^binutils-" -seperator: "_" +separator: "_"