From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 3835A3858429; Fri, 14 Oct 2022 11:10:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3835A3858429 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1665745818; bh=0YNMW/ZyECZ67AT3GNMu7Am7F64/CXrxlj3AiJLQ/bo=; h=From:To:Subject:Date:From; b=Q7TZ+gIutsmP30EoGCBKItDdjBK2o4N2kNXtYalPc9sjXpU6s+RA7wODm723hBvMc 9ayrr+BzNFCKuUzaEsCNT53xnEQ3Es1Ak/DLeAYGY1qrWjPbnYlZaT2dLyWHRDvc+r ZCArtEs1cFV9h05RV05EgG1wrsCzjxqhqXkDQ5Bo= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Fix gdb.base/infoline-reloc-main-from-zero.exp with clang X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 68f7bda9b1c32920ce4a2fe65129525bc0b05bf7 X-Git-Newrev: 21f507efad6bf16edf2432b65b763e7686349b8a Message-Id: <20221014111018.3835A3858429@sourceware.org> Date: Fri, 14 Oct 2022 11:10:16 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D21f507efad6b= f16edf2432b65b763e7686349b8a commit 21f507efad6bf16edf2432b65b763e7686349b8a Author: Tom de Vries Date: Fri Oct 14 13:09:51 2022 +0200 [gdb/testsuite] Fix gdb.base/infoline-reloc-main-from-zero.exp with cla= ng =20 With test-case gdb.base/infoline-reloc-main-from-zero.exp and clang I r= un into: ... gdb compile failed, clang-13.0: warning: -e main: 'linker' input unused= \ [-Wunused-command-line-argument] clang-13.0: warning: -Wl,-Ttext=3D0x00: 'linker' input unused \ [-Wunused-command-line-argument] clang-13.0: warning: -Wl,-N: 'linker' input unused \ [-Wunused-command-line-argument] UNTESTED: gdb.base/infoline-reloc-main-from-zero.exp: \ infoline-reloc-main-from-zero.exp UNTESTED: gdb.base/infoline-reloc-main-from-zero.exp: failed to compile ... =20 Fix this by using ldflags instead of additional_flags. =20 Likewise, fix all occurrences of: ... $ find gdb/testsuite -name *.exp | xargs grep additional_flags.*Wl ... =20 Tested on x86_64-linux. Diff: --- gdb/testsuite/gdb.ada/inline-section-gc.exp | 6 +++--- gdb/testsuite/gdb.base/break-on-linker-gcd-function.exp | 2 +- gdb/testsuite/gdb.base/code_elim.exp | 4 ++-- gdb/testsuite/gdb.base/dump.exp | 2 +- gdb/testsuite/gdb.base/gcore-relro.exp | 2 +- gdb/testsuite/gdb.base/gnu-ifunc.exp | 4 ++-- gdb/testsuite/gdb.base/gold-gdb-index.exp | 2 +- gdb/testsuite/gdb.base/index-cache.exp | 2 +- gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp | 4 ++-- gdb/testsuite/gdb.base/nested-subp2.exp | 2 +- gdb/testsuite/gdb.base/nested-subp3.exp | 2 +- gdb/testsuite/gdb.base/skip-solib.exp | 2 +- gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp | 2 +- gdb/testsuite/gdb.reverse/solib-precsave.exp | 2 +- gdb/testsuite/gdb.threads/gcore-thread.exp | 2 +- gdb/testsuite/lib/gdb.exp | 12 ++++++------ 16 files changed, 26 insertions(+), 26 deletions(-) diff --git a/gdb/testsuite/gdb.ada/inline-section-gc.exp b/gdb/testsuite/gd= b.ada/inline-section-gc.exp index 1f6ef667a87..e1b7bb616b7 100644 --- a/gdb/testsuite/gdb.ada/inline-section-gc.exp +++ b/gdb/testsuite/gdb.ada/inline-section-gc.exp @@ -23,9 +23,9 @@ set options { debug optimize=3D-O2 additional_flags=3D-ffunction-sections - additional_flags=3D-largs - additional_flags=3D-Wl,--gc-sections - additional_flags=3D-margs + ldflags=3D-largs + ldflags=3D-Wl,--gc-sections + ldflags=3D-margs additional_flags=3D-gnatn } if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $options] !=3D "= "} { diff --git a/gdb/testsuite/gdb.base/break-on-linker-gcd-function.exp b/gdb/= testsuite/gdb.base/break-on-linker-gcd-function.exp index b1c93f61c8c..3435c8f19ff 100644 --- a/gdb/testsuite/gdb.base/break-on-linker-gcd-function.exp +++ b/gdb/testsuite/gdb.base/break-on-linker-gcd-function.exp @@ -28,7 +28,7 @@ if { [skip_cplus_tests] } { continue } standard_testfile .cc =20 if {[build_executable_from_specs $testfile.exp $testfile \ - {c++ additional_flags=3D-Wl,--gc-sections} \ + {c++ ldflags=3D-Wl,--gc-sections} \ $srcfile {debug c++ additional_flags=3D-ffunction-sections}]} { untested "failed to compile" return -1 diff --git a/gdb/testsuite/gdb.base/code_elim.exp b/gdb/testsuite/gdb.base/= code_elim.exp index 357472ee9fc..209da0366b4 100644 --- a/gdb/testsuite/gdb.base/code_elim.exp +++ b/gdb/testsuite/gdb.base/code_elim.exp @@ -25,8 +25,8 @@ set binfile2 [standard_output_file ${testfile2}] set opts [list debug] lappend opts "additional_flags=3D-ffunction-sections" lappend opts "additional_flags=3D-fdata-sections" -lappend opts "additional_flags=3D-Wl,-gc-sections" -lappend opts "additional_flags=3D-Wl,-e,main" +lappend opts "ldflags=3D-Wl,-gc-sections" +lappend opts "ldflags=3D-Wl,-e,main" =20 # Place variables in .data instead of .sdata. if {[istarget "riscv*-*-*"]} { diff --git a/gdb/testsuite/gdb.base/dump.exp b/gdb/testsuite/gdb.base/dump.= exp index f56fec05d94..c7dd1b139fc 100644 --- a/gdb/testsuite/gdb.base/dump.exp +++ b/gdb/testsuite/gdb.base/dump.exp @@ -29,7 +29,7 @@ set formats {binary ihex srec tekhex verilog} if [istarget "alpha*-*-*"] then { # SREC etc cannot handle 64-bit addresses. Force the test # program into the low 31 bits of the address space. - lappend options "additional_flags=3D-Wl,-taso" + lappend options "ldflags=3D-Wl,-taso" } =20 # Runs the command 'print zero_all ()'. Uses the PRINT_ZERO_ALL_COUNT diff --git a/gdb/testsuite/gdb.base/gcore-relro.exp b/gdb/testsuite/gdb.bas= e/gcore-relro.exp index 6417ac5b143..4530a9d094a 100644 --- a/gdb/testsuite/gdb.base/gcore-relro.exp +++ b/gdb/testsuite/gdb.base/gcore-relro.exp @@ -29,7 +29,7 @@ set objfile [standard_output_file ${testfile}.o] untested "failed to compile" return -1 } - set opts [list debug shlib=3D${binfile_lib} additional_flags=3D-Wl,-z,rel= ro] + set opts [list debug shlib=3D${binfile_lib} ldflags=3D-Wl,-z,relro] if { [gdb_compile ${objfile} ${binfile} executable $opts] !=3D "" } { unsupported "-Wl,-z,relro compilation failed" return -1 diff --git a/gdb/testsuite/gdb.base/gnu-ifunc.exp b/gdb/testsuite/gdb.base/= gnu-ifunc.exp index 672ae85a218..3fbf237c71c 100644 --- a/gdb/testsuite/gdb.base/gnu-ifunc.exp +++ b/gdb/testsuite/gdb.base/gnu-ifunc.exp @@ -61,8 +61,8 @@ proc build {resolver_attr resolver_debug final_debug} { set final_opts {} =20 # Force lazy binding so we don't resolve everything at process startup. - lappend exec_opts "additional_flags=3D-Wl,-z,lazy" - lappend lib_opts "additional_flags=3D-Wl,-z,lazy" + lappend exec_opts "ldflags=3D-Wl,-z,lazy" + lappend lib_opts "ldflags=3D-Wl,-z,lazy" =20 if {$resolver_attr} { lappend lib_opts "additional_flags=3D-DIFUNC_RESOLVER_ATTR" diff --git a/gdb/testsuite/gdb.base/gold-gdb-index.exp b/gdb/testsuite/gdb.= base/gold-gdb-index.exp index 8ccd2288d7f..6073a64d0a1 100644 --- a/gdb/testsuite/gdb.base/gold-gdb-index.exp +++ b/gdb/testsuite/gdb.base/gold-gdb-index.exp @@ -23,7 +23,7 @@ if { [have_fuse_ld_gold] =3D=3D 0} { =20 if {[prepare_for_testing "failed to prepare" $testfile "$srcfile $srcfile2= " \ {debug c++ additional_flags=3D-fuse-ld=3Dgold \ - additional_flags=3D-Wl,--gdb-index \ + ldflags=3D-Wl,--gdb-index \ additional_flags=3D-ggnu-pubnames}]} { return -1 } diff --git a/gdb/testsuite/gdb.base/index-cache.exp b/gdb/testsuite/gdb.bas= e/index-cache.exp index f96a13ae176..5ecfca3c216 100644 --- a/gdb/testsuite/gdb.base/index-cache.exp +++ b/gdb/testsuite/gdb.base/index-cache.exp @@ -19,7 +19,7 @@ standard_testfile =20 if { [build_executable "failed to prepare" $testfile $srcfile \ - {debug additional_flags=3D-Wl,--build-id}] } { + {debug ldflags=3D-Wl,--build-id}] } { return } =20 diff --git a/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp b/gdb= /testsuite/gdb.base/infoline-reloc-main-from-zero.exp index 35c2db00c07..c1391ee22c9 100644 --- a/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp +++ b/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp @@ -27,9 +27,9 @@ standard_testfile .c =20 set opts {} lappend opts debug -lappend opts "additional_flags=3D-nostdlib -emain -Wl,-Ttext=3D0x00 -Wl,-N" +lappend opts "ldflags=3D-nostdlib -emain -Wl,-Ttext=3D0x00 -Wl,-N" =20 -set ld_flags additional_flags=3D-Wl,--no-warn-rwx-segments +set ld_flags ldflags=3D-Wl,--no-warn-rwx-segments if { [gdb_can_simple_compile ld-flags {int main () { return 0; }} executab= le \ $ld_flags] } { lappend opts $ld_flags diff --git a/gdb/testsuite/gdb.base/nested-subp2.exp b/gdb/testsuite/gdb.ba= se/nested-subp2.exp index 7716e7c8ace..ac41b55ffdc 100644 --- a/gdb/testsuite/gdb.base/nested-subp2.exp +++ b/gdb/testsuite/gdb.base/nested-subp2.exp @@ -33,7 +33,7 @@ set flags {} lappend flags debug lappend flags additional_flags=3D-std=3Dgnu99 =20 -set ld_flags additional_flags=3D-Wl,--no-warn-execstack +set ld_flags ldflags=3D-Wl,--no-warn-execstack if { [gdb_can_simple_compile ld-flags {int main () { return 0; }} executab= le \ $ld_flags] } { lappend flags $ld_flags diff --git a/gdb/testsuite/gdb.base/nested-subp3.exp b/gdb/testsuite/gdb.ba= se/nested-subp3.exp index b547b8efd35..d0c8583ebf0 100644 --- a/gdb/testsuite/gdb.base/nested-subp3.exp +++ b/gdb/testsuite/gdb.base/nested-subp3.exp @@ -33,7 +33,7 @@ set flags {} lappend flags debug lappend flags additional_flags=3D-std=3Dgnu99 =20 -set ld_flags additional_flags=3D-Wl,--no-warn-execstack +set ld_flags ldflags=3D-Wl,--no-warn-execstack if { [gdb_can_simple_compile ld-flags {int main () { return 0; }} executab= le \ $ld_flags] } { lappend flags $ld_flags diff --git a/gdb/testsuite/gdb.base/skip-solib.exp b/gdb/testsuite/gdb.base= /skip-solib.exp index 0f2ce7e1ad8..9af39d829c0 100644 --- a/gdb/testsuite/gdb.base/skip-solib.exp +++ b/gdb/testsuite/gdb.base/skip-solib.exp @@ -54,7 +54,7 @@ set testobjdir [standard_output_file {}] if {[gdb_compile "${binfile_main}.o" "${binfile_main}" executable \ [list debug "additional_flags=3D-L$testobjdir" \ "additional_flags=3D-l${test}" \ - "additional_flags=3D-Wl,-rpath=3D$testobjdir"]] !=3D ""} { + "ldflags=3D-Wl,-rpath=3D$testobjdir"]] !=3D ""} { return -1 } =20 diff --git a/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp b/gdb/testsuite/g= db.dwarf2/per-bfd-sharing.exp index b3ec3f58e38..85e79367f8d 100644 --- a/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp +++ b/gdb/testsuite/gdb.dwarf2/per-bfd-sharing.exp @@ -19,7 +19,7 @@ standard_testfile =20 if { [build_executable "failed to prepare" $testfile $srcfile \ - {debug additional_flags=3D-Wl,--build-id}] =3D=3D -1 } { + {debug ldflags=3D-Wl,--build-id}] =3D=3D -1 } { return } =20 diff --git a/gdb/testsuite/gdb.reverse/solib-precsave.exp b/gdb/testsuite/g= db.reverse/solib-precsave.exp index 18179a5b03f..67bb52addeb 100644 --- a/gdb/testsuite/gdb.reverse/solib-precsave.exp +++ b/gdb/testsuite/gdb.reverse/solib-precsave.exp @@ -52,7 +52,7 @@ set exec_opts [list debug shlib=3D${library1} shlib=3D${l= ibrary2}] # invalid core file. =20 if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable \ - [concat $exec_opts additional_flags=3D-Wl,-z,norelro]] !=3D "" + [concat $exec_opts ldflags=3D-Wl,-z,norelro]] !=3D "" && [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable = $exec_opts] !=3D "" } { untested "failed to compile" return -1 diff --git a/gdb/testsuite/gdb.threads/gcore-thread.exp b/gdb/testsuite/gdb= .threads/gcore-thread.exp index d9820d635a0..748831ed28e 100644 --- a/gdb/testsuite/gdb.threads/gcore-thread.exp +++ b/gdb/testsuite/gdb.threads/gcore-thread.exp @@ -35,7 +35,7 @@ if [istarget "*-*-linux"] then { =20 set opts [list debug] if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${objfile}" ob= ject $opts] !=3D "" - || ([gdb_compile_pthreads "${objfile}" "${binfile}" executable [concat= $opts {additional_flags=3D-Wl,-z,norelro}] ] !=3D "" + || ([gdb_compile_pthreads "${objfile}" "${binfile}" executable [concat= $opts {ldflags=3D-Wl,-z,norelro}] ] !=3D "" && [gdb_compile_pthreads "${objfile}" "${binfile}" executable $opt= s] !=3D "") } { return -1 } diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 1167aa73e2c..bfa9fec628e 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -4589,7 +4589,7 @@ proc gdb_compile {source dest type options} { set shlib_found 1 if { ([istarget "*-*-mingw*"] || [istarget *-*-cygwin*]) } { - lappend new_options "additional_flags=3D-Wl,--enable-auto-import" + lappend new_options "ldflags=3D-Wl,--enable-auto-import" } if { [test_compiler_info "gcc-*"] || [test_compiler_info "clang-*"] } { # Undo debian's change in the default. @@ -4956,7 +4956,7 @@ proc gdb_compile_shlib_1 {sources dest options} { } else { set name ${dest} } - lappend link_options "additional_flags=3D-Wl,--out-implib,${name}.a" + lappend link_options "ldflags=3D-Wl,--out-implib,${name}.a" } else { # Set the soname of the library. This causes the linker on ELF # systems to create the DT_NEEDED entry in the executable referring @@ -4968,7 +4968,7 @@ proc gdb_compile_shlib_1 {sources dest options} { # rpath=3D$ORIGIN value when building the executable, so that it's # able to find the library in its own directory. set destbase [file tail $dest] - lappend link_options "additional_flags=3D-Wl,-soname,$destbase" + lappend link_options "ldflags=3D-Wl,-soname,$destbase" } } if {[gdb_compile "${objects}" "${dest}" executable $link_options] !=3D= ""} { @@ -8585,7 +8585,7 @@ gdb_caching_proc have_fuse_ld_gold { # Return 1 if linker supports -Ttext-segment, otherwise return 0. gdb_caching_proc linker_supports_Ttext_segment_flag { set me "linker_supports_Ttext_segment_flag" - set flags additional_flags=3D"-Wl,-Ttext-segment=3D0x7000000" + set flags ldflags=3D"-Wl,-Ttext-segment=3D0x7000000" set src { int main() { return 0; } } return [gdb_simple_compile $me $src executable $flags] } @@ -8593,7 +8593,7 @@ gdb_caching_proc linker_supports_Ttext_segment_flag { # Return 1 if linker supports -Ttext, otherwise return 0. gdb_caching_proc linker_supports_Ttext_flag { set me "linker_supports_Ttext_flag" - set flags additional_flags=3D"-Wl,-Ttext=3D0x7000000" + set flags ldflags=3D"-Wl,-Ttext=3D0x7000000" set src { int main() { return 0; } } return [gdb_simple_compile $me $src executable $flags] } @@ -8601,7 +8601,7 @@ gdb_caching_proc linker_supports_Ttext_flag { # Return 1 if linker supports --image-base, otherwise 0. gdb_caching_proc linker_supports_image_base_flag { set me "linker_supports_image_base_flag" - set flags additional_flags=3D"-Wl,--image-base=3D0x7000000" + set flags ldflags=3D"-Wl,--image-base=3D0x7000000" set src { int main() { return 0; } } return [gdb_simple_compile $me $src executable $flags] }