From 9483b7904aa07ea78fa5f58f5e0cf467ff8e8349 Mon Sep 17 00:00:00 2001 From: Matthias Klose Date: Sun, 25 Aug 2024 17:32:28 +0200 Subject: [PATCH] branch-updates # DP: updates from the binutils-2.43 branch # DP: updates from the binutils-2.43 branch # git diff beb2cdbcda911764b2bed5e57921fe90493260bd 2d37b890e569330a29181ec3bd34b5cc1c354cbc Gbp-Pq: Name branch-updates.diff --- bfd/development.sh | 2 +- bfd/version.h | 2 +- ld/testsuite/ld-plugin/common-1.c | 11 ++++++ ld/testsuite/ld-plugin/common-2a.c | 11 ++++++ ld/testsuite/ld-plugin/common-2b.c | 6 +++ ld/testsuite/ld-plugin/definition-1.c | 1 + ld/testsuite/ld-plugin/lto.exp | 55 +++++++++++++++++++++++++++ 7 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 ld/testsuite/ld-plugin/common-1.c create mode 100644 ld/testsuite/ld-plugin/common-2a.c create mode 100644 ld/testsuite/ld-plugin/common-2b.c create mode 100644 ld/testsuite/ld-plugin/definition-1.c diff --git a/bfd/development.sh b/bfd/development.sh index ad74927b5..850391489 100644 --- a/bfd/development.sh +++ b/bfd/development.sh @@ -16,7 +16,7 @@ # along with this program. If not, see . # Controls whether to enable development-mode features by default. -development=false +development=true # Indicate whether this is a release branch. experimental=false diff --git a/bfd/version.h b/bfd/version.h index c9a311b12..cf2676cf1 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -16,7 +16,7 @@ In releases, the date is not included in either version strings or sonames. */ -#define BFD_VERSION_DATE 20240817 +#define BFD_VERSION_DATE 20240822 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@ #define REPORT_BUGS_TO @report_bugs_to@ diff --git a/ld/testsuite/ld-plugin/common-1.c b/ld/testsuite/ld-plugin/common-1.c new file mode 100644 index 000000000..b4f616aee --- /dev/null +++ b/ld/testsuite/ld-plugin/common-1.c @@ -0,0 +1,11 @@ +#include + +int foo; + +int main() +{ + if (foo == 1) + printf ("PASS\n"); + + return 0; +} diff --git a/ld/testsuite/ld-plugin/common-2a.c b/ld/testsuite/ld-plugin/common-2a.c new file mode 100644 index 000000000..fccfca728 --- /dev/null +++ b/ld/testsuite/ld-plugin/common-2a.c @@ -0,0 +1,11 @@ +#include + +int foo; + +int main() +{ + if (foo == 0) + printf ("PASS\n"); + + return 0; +} diff --git a/ld/testsuite/ld-plugin/common-2b.c b/ld/testsuite/ld-plugin/common-2b.c new file mode 100644 index 000000000..c014c673f --- /dev/null +++ b/ld/testsuite/ld-plugin/common-2b.c @@ -0,0 +1,6 @@ +int foo; + +void +func (void) +{ +} diff --git a/ld/testsuite/ld-plugin/definition-1.c b/ld/testsuite/ld-plugin/definition-1.c new file mode 100644 index 000000000..a244740a3 --- /dev/null +++ b/ld/testsuite/ld-plugin/definition-1.c @@ -0,0 +1 @@ +int foo = 1; diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp index 604dc8c28..602d94ed7 100644 --- a/ld/testsuite/ld-plugin/lto.exp +++ b/ld/testsuite/ld-plugin/lto.exp @@ -231,6 +231,30 @@ set lto_link_tests [list \ "$plug_opt" "-flto $lto_no_fat -fcommon" \ {pr26389.c} \ [list [list "nm" "$plug_opt" "pr26389.d"]]] \ + [list "Build libdefinition-1.a" \ + "$plug_opt" \ + "-O2 -fcommon -flto $lto_no_fat" \ + {definition-1.c} \ + {} \ + "libdefinition-1.a" \ + ] \ + [list \ + "Build common-2a.o" \ + "" \ + "-O2 -fcommon -flto $lto_no_fat" \ + {common-2a.c} \ + {} \ + "" \ + "c" \ + ] \ + [list \ + "Build libcommon-2.a" \ + "$plug_opt" \ + "-O2 -fcommon -flto $lto_no_fat" \ + {common-2b.c} \ + {} \ + "libcommon-2.a" \ + ] \ ] if { [at_least_gcc_version 10 0] && [check_lto_shared_available] } { @@ -763,6 +787,17 @@ set lto_run_tests [list \ {pr26262a.c} "pr26262b" "pass.out" \ "-flto -O2" "c" "" \ ""] \ + [list "Run common-1" \ + "-O2 -flto" \ + "" \ + {common-1.c} \ + "common-1" \ + "pass.out" \ + "-O2 -fcommon -flto $lto_no_fat" \ + "c" \ + "" \ + "tmpdir/libdefinition-1.a" \ + ] \ ] if { [at_least_gcc_version 4 7] } { @@ -862,6 +897,26 @@ run_cc_link_tests $lto_link_tests # by some elf tests besides shared libs tests. So, always compile them. run_cc_link_tests $lto_compile_elf_tests +# Xfail PR ld/32083 test for GCC without the fix: +# +# commit a98dd536b1017c2b814a3465206c6c01b2890998 +# Author: H.J. Lu +# Date: Wed Aug 21 07:25:25 2024 -0700 +# +# Update LDPT_REGISTER_CLAIM_FILE_HOOK_V2 linker plugin hook +# +set exec_output [run_host_cmd "$CC_FOR_TARGET" \ + "-O2 -fcommon -flto -o tmpdir/common-2 \ + tmpdir/common-2a.o tmpdir/libcommon-2.a \ + tmpdir/libcommon-2.a"] +if [string match "" $exec_output] then { + pass "PR ld/32083" +} elseif { [ regexp "lto1: fatal error: multiple prevailing defs for 'func'" $exec_output ] } { + xfail "PR ld/32083" +} else { + fail "PR ld/32083" +} + # Restrict these to ELF targets that support shared libs and PIC. if { [is_elf_format] && [check_lto_shared_available] } { run_cc_link_tests $lto_link_elf_tests -- 2.30.2