From 0e1f1593bc441863d0e5dc586ca3dd8945d36782 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Mon, 6 Jan 2020 16:24:23 +0000 Subject: [PATCH] Add -fcommon compiler command line option to linker tests that need common symbols. PR 25327 * testsuite/ld-elf/shared.exp: Add -fcommon option to compiler command line when building libcomm1.o and pr13250 tests. * testsuite/ld-plugin/lto.exp: Likewise for pr20267 tests. --- ld/ChangeLog | 7 +++++++ ld/testsuite/ld-elf/shared.exp | 12 ++++++------ ld/testsuite/ld-plugin/lto.exp | 20 ++++++++++---------- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index fa7534da892..a9871938ef1 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,10 @@ +2020-01-06 Nick Clifton + + PR 25327 + * testsuite/ld-elf/shared.exp: Add -fcommon option to compiler + command line when building libcomm1.o and pr13250 tests. + * testsuite/ld-plugin/lto.exp: Likewise for pr20267 tests. + 2020-01-06 Nick Clifton PR 25326 diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp index 7852890999a..e03906a142d 100644 --- a/ld/testsuite/ld-elf/shared.exp +++ b/ld/testsuite/ld-elf/shared.exp @@ -603,7 +603,7 @@ set build_tests { "-shared" "-fPIC" {data2.c} {} "libdata2.so"} {"Build libcomm1.o" - "-r -nostdlib" "" + "-r -nostdlib" "-fcommon" {comm1.c} {} "libcomm1.o"} {"Build libfunc1.so" "-shared" "-fPIC" @@ -634,16 +634,16 @@ set build_tests { "-r -nostdlib" "" {pr11138-2.c} {} "libpr11138-2.o"} {"Build pr13250-1.so" - "-shared" "-fPIC" + "-shared" "-fPIC -fcommon" {pr13250-1.c} {} "libpr13250-1.so"} {"Build pr13250-2.so with libpr13250-1.so" - "-shared -Wl,--no-as-needed tmpdir/libpr13250-1.so" "-fPIC" + "-shared -Wl,--no-as-needed tmpdir/libpr13250-1.so" "-fPIC -fcommon" {pr13250-2.c} {} "libpr13250-2.so"} {"Build libpr13250-3.o" - "-r -nostdlib" "" + "-r -nostdlib" "-fcommon" {pr13250-3.c} {} "libpr13250-3.o"} {"Build libpr14323-2.so" - "-shared" "-fPIC" + "-shared" "-fPIC -fcommon" {pr14323-2.c} {} "libpr14323-2.so"} {"Build pr14862-1.o" "-r -nostdlib" "" @@ -879,7 +879,7 @@ set run_tests [list \ "-Wl,--no-as-needed,--version-script=pr11138-2.map tmpdir/libpr11138-1.so tmpdir/pr11138-2.o" "" \ {dummy.c} "pr11138b" "pr11138.out" ] \ [list "Run with pr13250-3.c, libpr13250-1.so and libpr13250-2.so" \ - "-Wl,--as-needed tmpdir/pr13250-3.o tmpdir/libpr13250-1.so tmpdir/libpr13250-2.so" "" \ + "-Wl,--as-needed tmpdir/pr13250-3.o tmpdir/libpr13250-1.so tmpdir/libpr13250-2.so" "-fcommon" \ {dummy.c} "pr13250" "pass.out" ] \ [list "Run with pr14323-1.c pr14323-2.so" \ "-Wl,--no-as-needed tmpdir/libpr14323-2.so" "" \ diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp index cf30ab5c55b..9b03b7b3977 100644 --- a/ld/testsuite/ld-plugin/lto.exp +++ b/ld/testsuite/ld-plugin/lto.exp @@ -192,19 +192,19 @@ set lto_link_tests [list \ "$plug_opt" "-flto $lto_no_fat" \ {pr19317.c} {} "libpr19317.a"] \ [list "Build pr20276a.o" \ - "" "-fno-lto" \ + "" "-fno-lto -fcommon" \ {pr20276a.c}] \ [list "Build pr20276b.o" \ - "$plug_opt" "-flto $lto_no_fat" \ + "$plug_opt" "-flto $lto_no_fat -fcommon" \ {pr20276b.c}] \ [list "Build pr20267a.o" \ - "" "" \ + "" "-fcommon" \ {pr20267a.c}] \ [list "Build libpr20267a.a" \ - "$plug_opt" "-flto $lto_fat" \ + "$plug_opt" "-flto $lto_fat -fcommon" \ {pr20267b.c} {} "libpr20267a.a"] \ [list "Build libpr20267b.a" \ - "$plug_opt" "-flto $lto_no_fat" \ + "$plug_opt" "-flto $lto_no_fat -fcommon" \ {pr20267b.c} {} "libpr20267b.a"] \ [list "Build pr20321" \ "-flto -Wl,-plugin,$plug_so" "-flto" \ @@ -437,14 +437,14 @@ set lto_run_tests [list \ "-O2 -flto tmpdir/pr20276a.o tmpdir/pr20276b.o" "" \ {dummy.c} "pr20276" "pass.out" "-flto -O2" "c"] \ [list "Run pr20267a" \ - "-O2 -flto tmpdir/pr20267a.o tmpdir/libpr20267a.a" "" \ - {dummy.c} "pr20267a" "pass.out" "-flto -O2" "c"] \ + "-O2 -flto -fcommon tmpdir/pr20267a.o tmpdir/libpr20267a.a" "" \ + {dummy.c} "pr20267a" "pass.out" "-flto -O2 -fcommon" "c"] \ [list "Run pr20267b" \ - "-O2 -flto tmpdir/pr20267a.o tmpdir/libpr20267b.a" "" \ - {dummy.c} "pr20267b" "pass.out" "-flto -O2" "c"] \ + "-O2 -flto -fcommon tmpdir/pr20267a.o tmpdir/libpr20267b.a" "" \ + {dummy.c} "pr20267b" "pass.out" "-flto -O2 -fcommon" "c"] \ [list "Run pr22502" \ "-O2 -flto tmpdir/pr22502a.o tmpdir/pr22502b.o" "" \ - {dummy.c} "pr20267" "pass.out" "-flto -O2" "c"] \ + {dummy.c} "pr20267" "pass.out" "-flto -O2 -fcommon" "c"] \ [list "Run pr22751" \ "-O2 -flto" "" \ {dummy.c} "pr22751" "pass.out" "-flto -O2" "c" "" \ -- 2.30.2