+2020-06-04 Alan Modra <amodra@gmail.com>
+
+ * testsuite/config/default.exp: Remove global directive outside
+ proc body.
+ * testsuite/ld-bootstrap/bootstrap.exp: Likewise.
+ * testsuite/ld-elf/compress.exp: Likewise.
+ * testsuite/ld-elf/elf.exp: Likewise.
+ * testsuite/ld-elf/exclude.exp: Likewise.
+ * testsuite/ld-elf/frame.exp: Likewise.
+ * testsuite/ld-elf/indirect.exp: Likewise.
+ * testsuite/ld-elf/linux-x86.exp: Likewise.
+ * testsuite/ld-elf/shared.exp: Likewise.
+ * testsuite/ld-elf/tls.exp: Likewise.
+ * testsuite/ld-elf/tls_common.exp: Likewise.
+ * testsuite/ld-elfcomm/elfcomm.exp: Likewise.
+ * testsuite/ld-elfweak/elfweak.exp: Likewise.
+ * testsuite/ld-frv/fdpic.exp: Likewise.
+ * testsuite/ld-frv/tls.exp: Likewise.
+ * testsuite/ld-gc/gc.exp: Likewise.
+ * testsuite/ld-i386/i386.exp: Likewise.
+ * testsuite/ld-i386/no-plt.exp: Likewise.
+ * testsuite/ld-ifunc/ifunc.exp: Likewise.
+ * testsuite/ld-mips-elf/mips-elf-flags.exp: Likewise.
+ * testsuite/ld-nios2/nios2.exp: Likewise.
+ * testsuite/ld-plugin/lto.exp: Likewise.
+ * testsuite/ld-plugin/plugin.exp: Likewise.
+ * testsuite/ld-powerpc/export-class.exp: Likewise.
+ * testsuite/ld-scripts/align.exp: Likewise.
+ * testsuite/ld-scripts/crossref.exp: Likewise.
+ * testsuite/ld-scripts/defined.exp: Likewise.
+ * testsuite/ld-scripts/overlay-size.exp: Likewise.
+ * testsuite/ld-scripts/provide.exp: Likewise.
+ * testsuite/ld-scripts/weak.exp: Likewise.
+ * testsuite/ld-selective/selective.exp: Likewise.
+ * testsuite/ld-sh/rd-sh.exp: Likewise.
+ * testsuite/ld-size/size.exp: Likewise.
+ * testsuite/ld-srec/srec.exp: Likewise.
+ * testsuite/ld-x86-64/mpx.exp: Likewise.
+ * testsuite/ld-x86-64/no-plt.exp: Likewise.
+ * testsuite/ld-x86-64/x86-64.exp: Likewise.
+
2020-06-04 Alan Modra <amodra@gmail.com>
* testsuite/ld-dynamic/export-dynamic-symbol-2.d: Match output for
# \param Edit - The override command to perform.
# \param SavedStrings - Set to use for storing string representations.
-global env
# Only set up the environment variable if the user has not already provided one.
if {! [info exists env(CCC_OVERRIDE_OPTIONS)]} {
set env(CCC_OVERRIDE_OPTIONS) "#\
return
}
-global STATIC_LDFLAGS
-
# Determine if plugin support is present.
remote_exec host "$nm --help" "" "/dev/null" "plugin-support"
set tmp [file_contents "plugin-support"]
return
}
-global as
if { ![ld_assemble $as "--compress-debug-sections $srcdir/$subdir/empty.s" tmpdir/empty.o ] } {
fail "linker compressed debug sections"
}
pass "$test_name"
}
-global READELF
-
set test_name "Link -r with zlib compressed debug output"
set test zlibbegin
send_log "$READELF -S -W tmpdir/$test.o > tmpdir/$test.out\n"
set ASFLAGS "$ASFLAGS --defsym UNDERSCORE=1"
}
-global ASFLAGS
set saved_ASFLAGS "$ASFLAGS"
if { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
set ASFLAGS "$ASFLAGS -mx86-used-note=no"
set as_opt "-mpic -mpid=near"
}
-global ar
-global as
-global ld
-global nm
-global nm_output
-
set test1 "ld link shared library"
set test2 "ld export symbols from archive"
set test3 "ld link shared library with --exclude-libs"
set test1 "read-only .eh_frame section"
set test2 "read-only .gcc_except_table section"
-global as
-global ld
-
if { ![ld_assemble_flags $as $as_opt $srcdir/$subdir/tbss.s tmpdir/tbss.o ]
|| ![ld_assemble_flags $as $as_opt $srcdir/$subdir/frame.s tmpdir/frame.o] } {
unresolved "$test1"
run_cc_link_tests $build_tests
-global ld
-
set string ": final link failed: bad value"
set string1 ": local symbol \`foo\' in tmpdir/indirect1b.o is referenced by DSO"
set cmd "$ld -shared -o tmpdir/indirect2.so tmpdir/indirect2.o"
check_link_message "$cmd" [list $string2] "$testname"
-global NOPIE_CFLAGS NOPIE_LDFLAGS
-
set run_tests {
{"Run with libindirect3c.so 1"
"-Wl,--no-as-needed tmpdir/indirect3a.o tmpdir/indirect3b.o tmpdir/libindirect3c.so" ""
return
}
-# Add $PLT_CFLAGS if PLT is expected.
-global PLT_CFLAGS
-# Add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if non-PIE is required.
-global NOPIE_CFLAGS NOPIE_LDFLAGS
-global NOSANTIZE_CFLAGS
-
run_ld_link_exec_tests [list \
[list \
"Run PR ld/23428 test" \
return
}
-# Add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if non-PIE is required.
-global NOPIE_CFLAGS NOPIE_LDFLAGS
-global NOSANTIZE_CFLAGS
-
set old_ASFLAGS $ASFLAGS
# This target requires extra GAS options when building code for shared
append AFLAGS_PIC " -K PIC"
}
-global NOSANTIZE_CFLAGS
-
run_ld_link_tests [list \
[list \
"Build pr22263-1" \
return
}
-global as
-global ld
-global READELF
-global srcdir
-global subdir
-global link_output
-
if { ![ld_assemble $as "--elf-stt-common=no $srcdir/$subdir/tls_common.s" tmpdir/tls_commona.o]
|| ![ld_assemble $as "--elf-stt-common=yes $srcdir/$subdir/tls_common.s" tmpdir/tls_commonb.o] } {
unresolved "tls_common"
return
}
-global ld
-global link_output
-
set options "-r tmpdir/common1a.o tmpdir/common1b.o"
if { [ld_link $ld tmpdir/common1.o $options] } {
set SOBJDUMP_FLAGS --syms
set shared "--shared -Wl,--no-as-needed"
-global NOSANTIZE_CFLAGS
-
#
# objdump_symstuff
# Dump non-dynamic symbol stuff and make sure that it is sane.
return
}
-global ASFLAGS
set saved_ASFLAGS "$ASFLAGS"
set ASFLAGS "$ASFLAGS -mfdpic"
-global LDFLAGS
set saved_LDFLAGS "$LDFLAGS"
set LDFLAGS "$LDFLAGS -melf32frvfd"
return
}
-global ASFLAGS
set saved_ASFLAGS "$ASFLAGS"
set ASFLAGS "$ASFLAGS -mfdpic"
-global LDFLAGS
set saved_LDFLAGS "$LDFLAGS"
set LDFLAGS "$LDFLAGS -melf32frvfd"
return
}
-global NOSANTIZE_CFLAGS
-
set cflags "-ffunction-sections -fdata-sections $NOSANTIZE_CFLAGS"
set objfile "tmpdir/gc.o"
-# Add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if non-PIE is required.
-global NOPIE_CFLAGS NOPIE_LDFLAGS
-
if [istarget powerpc64*-*-*] {
# otherwise with -mcmodel=medium gcc we get XPASSes.
set cflags "$cflags -mminimal-toc"
# MA 02110-1301, USA.
#
-global ASFLAGS
set saved_ASFLAGS "$ASFLAGS"
if { [is_elf_format] \
&& ([istarget "i?86-*-*"] || [istarget "x86_64-*-*"]) } {
}
}
-# Add $PLT_CFLAGS if PLT is expected.
-global PLT_CFLAGS
-
# Must be Linux native with the C compiler
if { [isnative]
&& [istarget "i?86-*-linux*"]
undefined_weak "-fPIE" "-pie -z nodynamic-undefined-weak"
}
-global NOPIE_CFLAGS NOPIE_LDFLAGS
-
# Must be native with the C compiler and working IFUNC support,
if { [isnative]
&& [check_ifunc_available]
return
}
-# Add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if non-PIE is required.
-global NOPIE_CFLAGS NOPIE_LDFLAGS
-
run_cc_link_tests [list \
[list \
"Build no-plt-func1.o no-plt-main1.o" \
return
}
-global ASFLAGS
set saved_ASFLAGS "$ASFLAGS"
if { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
set ASFLAGS "$ASFLAGS -mx86-used-note=no"
return
}
-global ldemul
if {[istarget mips*-*-irix6*]} {
set ldemul "-melf32bsmip"
} elseif {[istarget mips*el-*-linux*]} {
run_dump_test [file rootname $test]
}
-global link_output
-global ld
-
set test_name "NIOS2 Mixed R1 and R2 objects"
set test mixed1
return
}
-global INT128_CFLAGS
-
-global CFLAGS
-global CXXFLAGS
set saved_CFLAGS "$CFLAGS"
set saved_CXXFLAGS "$CXXFLAGS"
regsub -all "(\\-Wp,)?-D_FORTIFY_SOURCE=\[0-9\]+" $CFLAGS "" CFLAGS
regsub -all "(\\-Wp,)?-D_FORTIFY_SOURCE=\[0-9\]+" $CXXFLAGS "" CXXFLAGS
-global NOSANTIZE_CFLAGS
-
proc restore_notify { } {
global saved_CFLAGS
global saved_CXXFLAGS
pass "plugin API enabled"
-global base_dir
-
# Look for the name we can dlopen in the test plugin's libtool control script.
set plugin_name [file_contents "$base_dir/libldtestplug.la"]
set plugin_name [regsub "'.*" [regsub ".*dlname='" "$plugin_name" ""] ""]
set failed_compile 0
set _ ""
set plugin_nm_output ""
-global NOSANTIZE_CFLAGS
set old_CFLAGS "$CFLAGS"
append CFLAGS " $NOSANTIZE_CFLAGS"
if { $can_compile && \
set abis { 32 be elf32ppclinux 32 le elf32lppclinux 64 be elf64ppc 64 le elf64lppc }
-global ld
catch "exec $ld --help | grep emulations" ldemul
foreach { abi endian emul } $abis {
}
# mingw on x86_64 targets need to set the image base to 0 to avoid auto image-basing.
-global LDFLAGS
set saved_LDFLAGS "$LDFLAGS"
if [istarget "x86_64-*-mingw*"] then {
set LDFLAGS "$LDFLAGS --image-base 0"
return
}
-global CFLAGS
set old_CFLAGS "$CFLAGS"
# Pass -fplt to CC since -fno-plt doesn't work with NOCROSSREFS tests.
# Also add $NOPIE_CFLAGS since PIE doesn't work NOCROSSREFS tests.
-global PLT_CFLAGS NOPIE_CFLAGS
set old_CC "$CC"
set CC "$CC $PLT_CFLAGS $NOPIE_CFLAGS"
return
}
-global LDFLAGS
set saved_LDFLAGS "$LDFLAGS"
if [istarget "x86_64-*-mingw*"] then {
set LDFLAGS "$LDFLAGS --image-base 0"
}
}
-global ASFLAGS
set saved_ASFLAGS "$ASFLAGS"
if { [is_elf_format] \
&& ([istarget "i?86-*-*"] || [istarget "x86_64-*-*"]) } {
return
}
-global ASFLAGS
set saved_ASFLAGS "$ASFLAGS"
if { [is_elf_format] \
&& ([istarget "i?86-*-*"] || [istarget "x86_64-*-*"]) } {
return
}
-global LDFLAGS
set saved_LDFLAGS "$LDFLAGS"
if [istarget "x86_64-*-mingw*"] then {
set LDFLAGS "$LDFLAGS --image-base 0"
return
}
-global LDFLAGS
set saved_LDFLAGS "$LDFLAGS"
if [istarget "x86_64-*-mingw*"] then {
set LDFLAGS "$LDFLAGS --image-base 0"
{A::foo() B::foo() dropme1() dropme2()} {*-*-*}}
}
-global NOSANTIZE_CFLAGS
set cflags "-w -O -ffunction-sections -fdata-sections $NOSANTIZE_CFLAGS"
set cxxflags "-fno-exceptions -fno-rtti $NOSANTIZE_CFLAGS"
set ldflags "--gc-sections -Bstatic"
return
}
-global ASFLAGS
-global LDFLAGS
set asflags_save "$ASFLAGS"
set ldflags_save "$LDFLAGS"
return
}
-# Add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if non-PIE is required.
-global NOPIE_CFLAGS NOPIE_LDFLAGS
-
run_cc_link_tests [list \
[list \
"Build libsize-1.so" \
# tests. Also add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if PIE doesn't work
# with S-records. Also add $NOCF_PROTECTION_CFLAGS for S-records.
# Also add $NOSANTIZE_CFLAGS for S-records.
-global PLT_CFLAGS NOPIE_CFLAGS NOPIE_LDFLAGS NOCF_PROTECTION_CFLAGS NOSANTIZE_CFLAGS
set old_CC "$CC"
set CC "$CC $PLT_CFLAGS $NOPIE_CFLAGS $NOPIE_LDFLAGS $NOCF_PROTECTION_CFLAGS $NOSANTIZE_CFLAGS"
set old_CXX "$CXX"
return
}
-# Add $PLT_CFLAGS if PLT is expected.
-global PLT_CFLAGS
-
run_cc_link_tests [list \
[list \
"Build libmpx1a.a" \
return
}
-# Add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if non-PIE is required.
-global NOPIE_CFLAGS NOPIE_LDFLAGS
-
run_cc_link_tests [list \
[list \
"Build no-plt-func1.o no-plt-main1.o" \
set emul "elf_x86_64"
}
-global ASFLAGS
set saved_ASFLAGS "$ASFLAGS"
set ASFLAGS "$ASFLAGS -mx86-used-note=no"
run_ld_link_tests $x86_64tests
-global link_output
-global ld
-
set test_name "Mixed x86_64 and i386 input test 1"
set test mixed1
if { ![ld_link $ld tmpdir/$test "-m$emul tmpdir/${test}a.o tmpdir/${test}b.o"] } {
}
}
-# Add $PLT_CFLAGS if PLT is expected.
-global PLT_CFLAGS
-# Add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if non-PIE is required.
-global NOPIE_CFLAGS NOPIE_LDFLAGS
-# Add $NOCF_PROTECTION_CFLAGS if -fcf-protection=none is required.
-global NOCF_PROTECTION_CFLAGS
-global NOSANTIZE_CFLAGS
-
# Must be native with the C compiler
if { [isnative] && [check_compiler_available] } {
run_cc_link_tests [list \
]
# Linux only tests
-global LD_CLASS
if { "$LD_CLASS" == "64bit" } then {
# This test needs 64-bit linker.
run_dump_test "pr17618"