fi`
# Strip out sanitization options as we want to test building binaries without any extra paraphernalia
-CFLAGS_FOR_TARGET = `echo $(CFLAGS) | sed -e 's/-fsanitize=address//g' -e 's/-fsanitize=undefined//g'`
-CXXFLAGS_FOR_TARGET = `echo $(CXXFLAGS) | sed -e 's/-fsanitize=address//g' -e 's/-fsanitize=undefined//g'`
+CFLAGS_FOR_TARGET = `echo $(CFLAGS) | sed -e 's/-fsanitize=[^ ]*//g'`
+CXXFLAGS_FOR_TARGET = `echo $(CXXFLAGS) | sed -e 's/-fsanitize=[^ ]*//g'`
transform = s/^ld-new$$/$(installed_linker)/;@program_transform_name@
bin_PROGRAMS = ld-new
# Strip out sanitization options as we want to test building binaries without any extra paraphernalia
-CFLAGS_FOR_TARGET = `echo $(CFLAGS) | sed -e 's/-fsanitize=address//g' -e 's/-fsanitize=undefined//g'`
-CXXFLAGS_FOR_TARGET = `echo $(CXXFLAGS) | sed -e 's/-fsanitize=address//g' -e 's/-fsanitize=undefined//g'`
+CFLAGS_FOR_TARGET = `echo $(CFLAGS) | sed -e 's/-fsanitize=[^ ]*//g'`
+CXXFLAGS_FOR_TARGET = `echo $(CXXFLAGS) | sed -e 's/-fsanitize=[^ ]*//g'`
info_TEXINFOS = ld.texi
ld_TEXINFOS = configdoc.texi
noinst_TEXINFOS = ldint.texi
set MYLIBS "-L/usr/lib -lcygwin -L/usr/lib/w32api -lkernel32"
# Compile the dll.
- if ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET $SHCFLAG" $srcdir/$subdir/dll.c $tmpdir/dll.o] {
+ if ![ld_compile "$CC_FOR_TARGET $SHCFLAG" $srcdir/$subdir/dll.c $tmpdir/dll.o] {
fail "compiling shared lib"
}
if ![ld_special_link "$ld -shared --enable-auto-import -e __cygwin_dll_entry@12 --out-implib=$tmpdir/libstandard.dll.a" $tmpdir/dll.dll "$tmpdir/dll.o $MYLIBS"] {
catch "exec ln -fs dll.dll $tmpdir/libsymlinked_dll.dll.a" ln_catch
# Compile and link the client program.
- if ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET $SHCFLAG" $srcdir/$subdir/client.c $tmpdir/client.o] {
+ if ![ld_compile "$CC_FOR_TARGET $SHCFLAG" $srcdir/$subdir/client.c $tmpdir/client.o] {
fail "compiling client"
}
setup_xfail "mips*-*-irix5*"
}
- if ![ld_link $CC tmpdir/ld1 "$flags tmpdir/ld-partial.o $CTFLIB $BFDLIB $LIBIBERTY $extralibs"] {
+ if ![ld_link $CC tmpdir/ld1 "$CFLAGS $flags tmpdir/ld-partial.o $CTFLIB $BFDLIB $LIBIBERTY $extralibs"] {
fail $testname
continue
}
}
regsub /tmpdir/ld/ $gcc_B_opt_save /tmpdir/gccld1/ gcc_B_opt
- if ![ld_link $CC tmpdir/ld2 "$flags $OFILES $CTFLIB $BFDLIB $LIBIBERTY $extralibs"] {
+ if ![ld_link $CC tmpdir/ld2 "$CFLAGS $flags $OFILES $CTFLIB $BFDLIB $LIBIBERTY $extralibs"] {
fail $testname
continue
}
regsub /tmpdir/ld/ $gcc_B_opt_save /tmpdir/gccld2/ gcc_B_opt
- if ![ld_link $CC tmpdir/ld3 "$flags $OFILES $CTFLIB $BFDLIB $LIBIBERTY $extralibs"] {
+ if ![ld_link $CC tmpdir/ld3 "$CFLAGS $flags $OFILES $CTFLIB $BFDLIB $LIBIBERTY $extralibs"] {
fail $testname
continue
}
# generated by different linkers, tmpdir/ld1 and tmpdir/ld2.
# So we rebuild tmpdir/ld2 with tmpdir/ld3.
regsub /tmpdir/ld/ $gcc_B_opt_save /tmpdir/gccld3/ gcc_B_opt
- if ![ld_link $CC tmpdir/ld2 "$flags $OFILES $CTFLIB $BFDLIB $LIBIBERTY $extralibs"] {
+ if ![ld_link $CC tmpdir/ld2 "$CFLAGS $flags $OFILES $CTFLIB $BFDLIB $LIBIBERTY $extralibs"] {
fail $testname
continue
}
set expected_output "$srcdir/$subdir/cdtest.dat"
-if ![ld_link $CC_FOR_TARGET tmpdir/cdtest {tmpdir/cdtest-foo.o tmpdir/cdtest-bar.o tmpdir/cdtest-main.o}] {
+if ![ld_link $CC_FOR_TARGET tmpdir/cdtest "$CFLAGS_FOR_TARGET tmpdir/cdtest-foo.o tmpdir/cdtest-bar.o tmpdir/cdtest-main.o"] {
fail $test1
} else {
send_log "tmpdir/cdtest >tmpdir/cdtest.out\n"
if ![ld_relocate $ld tmpdir/cdtest.o {-Ur tmpdir/cdtest-foo.o tmpdir/cdtest-bar.o tmpdir/cdtest-main.o}] {
fail $test2
} else {
- if ![ld_link $CC_FOR_TARGET tmpdir/cdtest tmpdir/cdtest.o] {
+ if ![ld_link $CC_FOR_TARGET tmpdir/cdtest "$CFLAGS_FOR_TARGET tmpdir/cdtest.o"] {
fail $test2
} else {
send_log "tmpdir/cdtest >tmpdir/cdtest.out\n"
} \r
\r
# Compile the executable.\r
-if ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET" $srcdir/$subdir/testexe.c $tmpdir/testexe.o] {\r
+if ![ld_compile $CC_FOR_TARGET $srcdir/$subdir/testexe.c $tmpdir/testexe.o] {\r
fail "compiling executable"\r
return\r
}\r
} \r
\r
# Compile the dll.\r
-if ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET" $srcdir/$subdir/testdll.c $tmpdir/testdll.o] {\r
+if ![ld_compile $CC_FOR_TARGET $srcdir/$subdir/testdll.c $tmpdir/testdll.o] {\r
fail "compiling shared lib"\r
return\r
}\r
return 1
}
-if [istarget nios2*-*-*] {
- append CFLAGS_FOR_TARGET " -G0"
-}
-
# Explicitly use "-fcommon" so that even if $CFLAGS includes
# "-fno-common", these tests are compiled as expected.
-if { ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET -fcommon $NOSANITIZE_CFLAGS $NOLTO_CFLAGS" $srcdir/$subdir/common1a.c tmpdir/common1a.o]
- || ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET -fcommon $NOSANITIZE_CFLAGS $NOLTO_CFLAGS" $srcdir/$subdir/common1b.c tmpdir/common1b.o]
- || ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET $NOSANITIZE_CFLAGS $NOLTO_CFLAGS -Wa,--elf-stt-common=yes -fcommon" $srcdir/$subdir/common1b.c tmpdir/common1c.o] } {
+set options "-fcommon $NOSANITIZE_CFLAGS $NOLTO_CFLAGS"
+if [istarget nios2*-*-*] {
+ append options " -G0"
+}
+if { ![ld_compile "$CC_FOR_TARGET $options" $srcdir/$subdir/common1a.c tmpdir/common1a.o]
+ || ![ld_compile "$CC_FOR_TARGET $options" $srcdir/$subdir/common1b.c tmpdir/common1b.o]
+ || ![ld_compile "$CC_FOR_TARGET $options -Wa,--elf-stt-common=yes" $srcdir/$subdir/common1b.c tmpdir/common1c.o] } {
unsupported $test1
return
}
global as_options
global objdump
global CC_FOR_TARGET
- global CFLAGS_FOR_TARGET
global script
global NOSANITIZE_CFLAGS
global NOLTO_CFLAGS
- if ![ld_compile "$CC_FOR_TARGET -S $pic $CFLAGS_FOR_TARGET $NOSANITIZE_CFLAGS $NOLTO_CFLAGS" $srcdir/$subdir/$source $tmpdir/$libname.s] {
+ if ![ld_compile "$CC_FOR_TARGET -S $pic $NOSANITIZE_CFLAGS $NOLTO_CFLAGS" $srcdir/$subdir/$source $tmpdir/$libname.s] {
unsupported "$test"
return
}
global as_options
global objdump
global CC_FOR_TARGET
- global CFLAGS_FOR_TARGET
global script
if [string match "" $other] then {
set other_lib $tmpdir/$other
}
- if ![ld_compile "$CC_FOR_TARGET -S $flag $CFLAGS_FOR_TARGET" $srcdir/$subdir/$source $tmpdir/$execname.s] {
+ if ![ld_compile "$CC_FOR_TARGET -S $flag" $srcdir/$subdir/$source $tmpdir/$execname.s] {
unsupported "$test"
return
}
global tmpdir
global as
global CC_FOR_TARGET
- global CFLAGS_FOR_TARGET
global NOLTO_CFLAGS
- if ![ld_compile "$CC_FOR_TARGET -S $flag $CFLAGS_FOR_TARGET $NOLTO_CFLAGS" $srcdir/$subdir/$source $tmpdir/$execname.s] {
+ if ![ld_compile "$CC_FOR_TARGET -S $flag $NOLTO_CFLAGS" $srcdir/$subdir/$source $tmpdir/$execname.s] {
unsupported "$test"
return
}
global as_options
global objdump
global CC_FOR_TARGET
- global CFLAGS_FOR_TARGET
global NOSANITIZE_CFLAGS
global NOLTO_CFLAGS
set script --version-script
# Disable LTO for these tests.
- set cc_cmd "$CC_FOR_TARGET -S $CFLAGS_FOR_TARGET"
+ set cc_cmd "$CC_FOR_TARGET -S"
if {[check_lto_available]} {
append cc_cmd " -fno-lto"
}
if { [istarget *-*-linux*]
|| [istarget *-*-nacl*]
|| [istarget *-*-gnu*] } {
- if [ld_compile "$CC_FOR_TARGET -g $CFLAGS_FOR_TARGET -DPROTECTED_CHECK" $srcdir/$subdir/main.c $tmpdir/main.o] {
+ if [ld_compile "$CC_FOR_TARGET -g -DPROTECTED_CHECK" $srcdir/$subdir/main.c $tmpdir/main.o] {
if [ld_link $CC_FOR_TARGET $tmpdir/main "$tmpdir/main.o"] {
catch "exec $tmpdir/main" support_protected
}
proc visibility_run {visibility} {
global CC_FOR_TARGET
- global CFLAGS_FOR_TARGET
global SHCFLAG
global srcdir
global subdir
} else {
# Compile the main program. Make sure that PLT is used since PLT
# is expected.
- if ![ld_compile "$CC_FOR_TARGET -g $PLT_CFLAGS $CFLAGS_FOR_TARGET $SHCFLAG $VSBCFLAG $NOSANITIZE_CFLAGS $NOLTO_CFLAGS" $srcdir/$subdir/main.c $tmpdir/mainnp.o] {
+ if ![ld_compile "$CC_FOR_TARGET -g $PLT_CFLAGS $SHCFLAG $VSBCFLAG $NOSANITIZE_CFLAGS $NOLTO_CFLAGS" $srcdir/$subdir/main.c $tmpdir/mainnp.o] {
unsupported "visibility ($visibility) (non PIC)"
unsupported "visibility ($visibility)"
} else {
# will need to do more relocation work. However, note that not
# using -fpic will cause some of the tests to return different
# results. Make sure that PLT is used since PLT is expected.
- if { ![ld_compile "$CC_FOR_TARGET -g $NOPIE_CFLAGS $PLT_CFLAGS $CFLAGS_FOR_TARGET $SHCFLAG $VSBCFLAG $NOSANITIZE_CFLAGS $NOLTO_CFLAGS" $srcdir/$subdir/sh1.c $tmpdir/sh1np.o]
- || ![ld_compile "$CC_FOR_TARGET -g $NOPIE_CFLAGS $PLT_CFLAGS $CFLAGS_FOR_TARGET $SHCFLAG $VSBCFLAG $NOSANITIZE_CFLAGS $NOLTO_CFLAGS" $srcdir/$subdir/sh2.c $tmpdir/sh2np.o] } {
+ if { ![ld_compile "$CC_FOR_TARGET -g $NOPIE_CFLAGS $PLT_CFLAGS $SHCFLAG $VSBCFLAG $NOSANITIZE_CFLAGS $NOLTO_CFLAGS" $srcdir/$subdir/sh1.c $tmpdir/sh1np.o]
+ || ![ld_compile "$CC_FOR_TARGET -g $NOPIE_CFLAGS $PLT_CFLAGS $SHCFLAG $VSBCFLAG $NOSANITIZE_CFLAGS $NOLTO_CFLAGS" $srcdir/$subdir/sh2.c $tmpdir/sh2np.o] } {
unsupported "visibility ($visibility) (non PIC)"
} else {
# SunOS non PIC shared libraries don't permit some cases of
# Now compile the code using -fpic.
- if { ![ld_compile "$CC_FOR_TARGET -g $CFLAGS_FOR_TARGET $SHCFLAG $VSBCFLAG $NOSANITIZE_CFLAGS $NOLTO_CFLAGS -DSHARED $picflag" $srcdir/$subdir/sh1.c $tmpdir/sh1p.o]
- || ![ld_compile "$CC_FOR_TARGET -g $CFLAGS_FOR_TARGET $SHCFLAG $VSBCFLAG $NOSANITIZE_CFLAGS $NOLTO_CFLAGS -DSHARED $picflag" $srcdir/$subdir/sh2.c $tmpdir/sh2p.o] } {
+ if { ![ld_compile "$CC_FOR_TARGET -g $SHCFLAG $VSBCFLAG $NOSANITIZE_CFLAGS $NOLTO_CFLAGS -DSHARED $picflag" $srcdir/$subdir/sh1.c $tmpdir/sh1p.o]
+ || ![ld_compile "$CC_FOR_TARGET -g $SHCFLAG $VSBCFLAG $NOSANITIZE_CFLAGS $NOLTO_CFLAGS -DSHARED $picflag" $srcdir/$subdir/sh2.c $tmpdir/sh2p.o] } {
unsupported "visibility ($visibility)"
} else {
if { [ string match $visibility "protected" ]
# Don't bother.
} else {
# Now do the same tests again, but this time compile main.c PIC.
- if ![ld_compile "$CC_FOR_TARGET -g $CFLAGS_FOR_TARGET $SHCFLAG $VSBCFLAG $NOSANITIZE_CFLAGS $NOLTO_CFLAGS -DSHARED $picflag" $srcdir/$subdir/main.c $tmpdir/mainp.o] {
+ if ![ld_compile "$CC_FOR_TARGET -g $SHCFLAG $VSBCFLAG $NOSANITIZE_CFLAGS $NOLTO_CFLAGS -DSHARED $picflag" $srcdir/$subdir/main.c $tmpdir/mainp.o] {
unsupported "visibility ($visibility) (PIC main, non PIC so)"
unsupported "visibility ($visibility) (PIC main)"
} else {
visibility_run protected_weak
visibility_run normal
-if { ![ld_compile "$CC_FOR_TARGET -g $CFLAGS_FOR_TARGET $NOSANITIZE_CFLAGS $NOLTO_CFLAGS" $srcdir/$subdir/common.c tmpdir/common.o] } {
+if { ![ld_compile "$CC_FOR_TARGET -g $NOSANITIZE_CFLAGS $NOLTO_CFLAGS" $srcdir/$subdir/common.c tmpdir/common.o] } {
unsupported "common hidden symbol"
} else {
if ![ld_link $ld tmpdir/common "tmpdir/common.o"] {
}
}
-if { ![ld_compile "$CC_FOR_TARGET -g $CFLAGS_FOR_TARGET $NOSANITIZE_CFLAGS $NOLTO_CFLAGS" $srcdir/$subdir/test.c tmpdir/test.o] } {
+if { ![ld_compile "$CC_FOR_TARGET -g $NOSANITIZE_CFLAGS $NOLTO_CFLAGS" $srcdir/$subdir/test.c tmpdir/test.o] } {
unsupported "weak hidden symbol"
} else {
- if { ![ld_compile "$CC_FOR_TARGET -g $CFLAGS_FOR_TARGET $NOSANITIZE_CFLAGS $NOLTO_CFLAGS -DSHARED $picflag" $srcdir/$subdir/sh3.c tmpdir/sh3.o] } {
+ if { ![ld_compile "$CC_FOR_TARGET -g $NOSANITIZE_CFLAGS $NOLTO_CFLAGS -DSHARED $picflag" $srcdir/$subdir/sh3.c tmpdir/sh3.o] } {
unsupported "weak hidden symbol"
} else {
if ![ld_link $ld tmpdir/sh3.so "-shared tmpdir/sh3.o"] {
}
verbose "Using $picflag to compile PIC code"
-if {![ld_compile "$cc_cmd $CFLAGS_FOR_TARGET $picflag" $srcdir/$subdir/foo.c $tmpdir/foo.o]
- || ![ld_compile "$cc_cmd $CFLAGS_FOR_TARGET $picflag" $srcdir/$subdir/bar.c $tmpdir/bar.o]
- || ![ld_compile "$cc_cmd $CFLAGS_FOR_TARGET" $srcdir/$subdir/main.c $tmpdir/main.o]
+if {![ld_compile "$cc_cmd $picflag" $srcdir/$subdir/foo.c $tmpdir/foo.o]
+ || ![ld_compile "$cc_cmd $picflag" $srcdir/$subdir/bar.c $tmpdir/bar.o]
+ || ![ld_compile "$cc_cmd" $srcdir/$subdir/main.c $tmpdir/main.o]
|| ![ld_link $cc_cmd $tmpdir/libbar.so "$shared $tmpdir/bar.o"]
- || ![ld_compile "$cc_cmd $CFLAGS_FOR_TARGET $picflag" $srcdir/$subdir/foo1a.c $tmpdir/foo1a.o]
- || ![ld_compile "$cc_cmd $CFLAGS_FOR_TARGET $picflag" $srcdir/$subdir/foo1b.c $tmpdir/foo1b.o]
- || ![ld_compile "$cc_cmd $CFLAGS_FOR_TARGET $picflag" $srcdir/$subdir/bar1a.c $tmpdir/bar1a.o]
- || ![ld_compile "$cc_cmd $CFLAGS_FOR_TARGET $picflag" $srcdir/$subdir/bar1b.c $tmpdir/bar1b.o]
- || ![ld_compile "$cc_cmd $CFLAGS_FOR_TARGET $picflag" $srcdir/$subdir/bar1c.c $tmpdir/bar1c.o]
- || ![ld_compile "$cc_cmd $CFLAGS_FOR_TARGET $picflag" $srcdir/$subdir/main1.c $tmpdir/main1.o]} then {
+ || ![ld_compile "$cc_cmd $picflag" $srcdir/$subdir/foo1a.c $tmpdir/foo1a.o]
+ || ![ld_compile "$cc_cmd $picflag" $srcdir/$subdir/foo1b.c $tmpdir/foo1b.o]
+ || ![ld_compile "$cc_cmd $picflag" $srcdir/$subdir/bar1a.c $tmpdir/bar1a.o]
+ || ![ld_compile "$cc_cmd $picflag" $srcdir/$subdir/bar1b.c $tmpdir/bar1b.o]
+ || ![ld_compile "$cc_cmd $picflag" $srcdir/$subdir/bar1c.c $tmpdir/bar1c.o]
+ || ![ld_compile "$cc_cmd $picflag" $srcdir/$subdir/main1.c $tmpdir/main1.o]} then {
unsupported "ELF weak"
} elseif {![ld_link $cc_cmd $tmpdir/libfoo1a.so "$shared $tmpdir/foo1a.o"]
|| ![ld_link $cc_cmd $tmpdir/libfoo1b.so "$shared $tmpdir/foo1b.o"]
build_exec "ELF weak data last DSO common" foo "libfoo1b.so main1.o libbar1a.so" "-Wl,--no-as-needed,-rpath,.,-rpath-link,." weakdata weakdata.dsym ""
}
-if {![ld_compile "$cc_cmd $CFLAGS_FOR_TARGET $picflag" $srcdir/$subdir/size_foo.c $tmpdir/size_foo.o]
- || ![ld_compile "$cc_cmd $CFLAGS_FOR_TARGET $picflag" $srcdir/$subdir/size_bar.c $tmpdir/size_bar_s.o]
- || ![ld_compile "$cc_cmd $CFLAGS_FOR_TARGET $picflag -DSIZE_BIG" $srcdir/$subdir/size_bar.c $tmpdir/size_bar.o]
- || ![ld_compile "$cc_cmd $CFLAGS_FOR_TARGET" $srcdir/$subdir/size_main.c $tmpdir/size_main.o]} then {
+if {![ld_compile "$cc_cmd $picflag" $srcdir/$subdir/size_foo.c $tmpdir/size_foo.o]
+ || ![ld_compile "$cc_cmd $picflag" $srcdir/$subdir/size_bar.c $tmpdir/size_bar_s.o]
+ || ![ld_compile "$cc_cmd $picflag -DSIZE_BIG" $srcdir/$subdir/size_bar.c $tmpdir/size_bar.o]
+ || ![ld_compile "$cc_cmd" $srcdir/$subdir/size_main.c $tmpdir/size_main.o]} then {
unsupported "ELF weak (size)"
} else {
build_lib "ELF DSO small bar (size)" libsize_bar_s "size_bar_s.o" ""
verbose "size2"
run_dump_test $srcdir/$subdir/size2
-if {![ld_compile "$cc_cmd $CFLAGS_FOR_TARGET $picflag" $srcdir/$subdir/alias.c $tmpdir/alias.o]
+if {![ld_compile "$cc_cmd $picflag" $srcdir/$subdir/alias.c $tmpdir/alias.o]
|| ![ld_link $cc_cmd $tmpdir/alias.so "$shared $tmpdir/alias.o"]
- || ![ld_compile "$cc_cmd $CFLAGS_FOR_TARGET" $srcdir/$subdir/aliasmain.c $tmpdir/aliasmain.o]
- || ![ld_compile "$cc_cmd $CFLAGS_FOR_TARGET" $srcdir/$subdir/weakref1.c $tmpdir/weakref1.o]
- || ![ld_compile "$cc_cmd $CFLAGS_FOR_TARGET" $srcdir/$subdir/weakref2.c $tmpdir/weakref2.o]} then {
+ || ![ld_compile $cc_cmd $srcdir/$subdir/aliasmain.c $tmpdir/aliasmain.o]
+ || ![ld_compile $cc_cmd $srcdir/$subdir/weakref1.c $tmpdir/weakref1.o]
+ || ![ld_compile $cc_cmd $srcdir/$subdir/weakref2.c $tmpdir/weakref2.o]} then {
unsupported "ELF weak (alias)"
} else {
build_exec "ELF weak (alias)" alias "aliasmain.o weakref1.o weakref2.o alias.so" "-Wl,-rpath=.,--no-as-needed" alias "" ""
}
if { [check_compiler_available] } {
- ld_compile "$CC_FOR_TARGET -c $CFLAGS_FOR_TARGET $cflags" $srcdir/$subdir/gc.c $objfile
+ ld_compile "$CC_FOR_TARGET -c $cflags" $srcdir/$subdir/gc.c $objfile
}
proc test_gc { testname filename linker ldflags} {
if { [istarget "*-*-linux*"]
|| [istarget "*-*-nacl*"]
|| [istarget "*-*-gnu*"] } {
- ld_compile "$CC_FOR_TARGET -fPIC $CFLAGS_FOR_TARGET $cflags" $srcdir/$subdir/pr11218-1.c tmpdir/pr11218-1.o
+ ld_compile "$CC_FOR_TARGET -fPIC $cflags" $srcdir/$subdir/pr11218-1.c tmpdir/pr11218-1.o
ld_link $ld tmpdir/pr11218-1.so "-shared tmpdir/pr11218-1.o"
- ld_compile "$CC_FOR_TARGET -c $CFLAGS_FOR_TARGET $cflags" $srcdir/$subdir/pr11218-2.c tmpdir/pr11218-2.o
+ ld_compile "$CC_FOR_TARGET -c $cflags" $srcdir/$subdir/pr11218-2.c tmpdir/pr11218-2.o
run_dump_test "pr11218"
}
}
}
if { [check_compiler_available] } {
- ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET $cflags" $srcdir/$subdir/pr13683.c tmpdir/pr13683.o
+ ld_compile "$CC_FOR_TARGET $cflags" $srcdir/$subdir/pr13683.c tmpdir/pr13683.o
run_dump_test "pr13683" $symdefs
}
if { [check_compiler_available] } {
- ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET $cflags $NOPIE_CFLAGS" $srcdir/$subdir/pr14265.c tmpdir/pr14265.o
+ ld_compile "$CC_FOR_TARGET $cflags $NOPIE_CFLAGS" $srcdir/$subdir/pr14265.c tmpdir/pr14265.o
run_dump_test "pr14265" $symdefs
}
if { [check_compiler_available] } {
- ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET $cflags -O0" $srcdir/$subdir/pr19161-1.c tmpdir/pr19161-1.o
- ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET $cflags -O0" $srcdir/$subdir/pr19161-2.c tmpdir/pr19161-2.o
+ ld_compile "$CC_FOR_TARGET $cflags -O0" $srcdir/$subdir/pr19161-1.c tmpdir/pr19161-1.o
+ ld_compile "$CC_FOR_TARGET $cflags -O0" $srcdir/$subdir/pr19161-2.c tmpdir/pr19161-2.o
if [istarget hppa*-*-linux*] {
set symdefs {{ld {--defsym '\$\$dyncall=0'}}}
}
proc build_basefile1_o {} {
global CC_FOR_TARGET
- global CFLAGS_FOR_TARGET
global srcdir
global subdir
# Compile the object file.
- if ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET" $srcdir/$subdir/basefile1.s tmpdir/basefile1.o] {
+ if ![ld_compile $CC_FOR_TARGET $srcdir/$subdir/basefile1.s tmpdir/basefile1.o] {
fail "compiling basefile1 object"
}
}
proc build_vers_script_dll_o {} {
global CC_FOR_TARGET
- global CFLAGS_FOR_TARGET
global srcdir
global subdir
# Compile the object file.
- if ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET -shared" $srcdir/$subdir/vers-script-dll.c tmpdir/vers-script-dll.o] {
+ if ![ld_compile "$CC_FOR_TARGET -shared" $srcdir/$subdir/vers-script-dll.c tmpdir/vers-script-dll.o] {
fail "compiling shared lib object"
}
}
proc test_direct_link_dll {} {
global CC_FOR_TARGET
- global CFLAGS_FOR_TARGET
global srcdir
global subdir
global tmpdir
# Compile the dll.
- if ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET" $srcdir/$subdir/direct_dll.c $tmpdir/direct_dll.o ] {
+ if ![ld_compile $CC_FOR_TARGET $srcdir/$subdir/direct_dll.c $tmpdir/direct_dll.o ] {
fail "compiling shared lib"
} elseif ![ld_link "$CC_FOR_TARGET -shared" $tmpdir/direct_dll.dll "$tmpdir/direct_dll.o" ] {
fail "linking shared lib (.dll)"
fail "linking shared lib (.sl)"
} else {
# Compile and link the client program.
- if ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET" $srcdir/$subdir/direct_client.c $tmpdir/direct_client.o ] {
+ if ![ld_compile $CC_FOR_TARGET $srcdir/$subdir/direct_client.c $tmpdir/direct_client.o ] {
fail "compiling client"
} else {
# Check linking directly to direct_dll.dll.
global tmpdir
# Compile the dll.
- if ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET" $srcdir/$subdir/direct2_dll.c $tmpdir/direct2_dll.o ] {
+ if ![ld_compile $CC_FOR_TARGET $srcdir/$subdir/direct2_dll.c $tmpdir/direct2_dll.o ] {
fail "compiling shared lib fastcall/stdcall"
} elseif ![ld_link "$CC_FOR_TARGET -shared -Wl,--enable-stdcall-fixup -Wl,--kill-at " $tmpdir/direct2_dll.dll "$tmpdir/direct2_dll.o" ] {
fail "linking shared lib (.dll) fastcall/stdcall"
fail "linking shared lib (.sl) fastcall/stdcall"
} else {
# Compile and link the client program.
- if ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET" $srcdir/$subdir/direct2_client.c $tmpdir/direct2_client.o ] {
+ if ![ld_compile $CC_FOR_TARGET $srcdir/$subdir/direct2_client.c $tmpdir/direct2_client.o ] {
fail "compiling client fastcall/stdcall"
} else {
# Check linking directly to direct2_dll.dll.
}
if { $can_compile && \
- (![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET" $srcdir/$subdir/main.c tmpdir/main.o] \
- || ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET" $srcdir/$subdir/func.c tmpdir/func.o] \
- || ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET" $srcdir/$subdir/text.c tmpdir/text.o] \
- || ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET" $srcdir/$subdir/pr20070a.c tmpdir/pr20070a.o] \
- || ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET" $srcdir/$subdir/dummy.s tmpdir/dummy.o] \
- || ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET" $srcdir/$subdir/pr17973.s tmpdir/pr17973.o]) } {
+ (![ld_compile $CC_FOR_TARGET $srcdir/$subdir/main.c tmpdir/main.o] \
+ || ![ld_compile $CC_FOR_TARGET $srcdir/$subdir/func.c tmpdir/func.o] \
+ || ![ld_compile $CC_FOR_TARGET $srcdir/$subdir/text.c tmpdir/text.o] \
+ || ![ld_compile $CC_FOR_TARGET $srcdir/$subdir/pr20070a.c tmpdir/pr20070a.o] \
+ || ![ld_compile $CC_FOR_TARGET $srcdir/$subdir/dummy.s tmpdir/dummy.o] \
+ || ![ld_compile $CC_FOR_TARGET $srcdir/$subdir/pr17973.s tmpdir/pr17973.o]) } {
# Defer fail until we have list of tests set.
set failed_compile 1
}
run_ld_link_tests $plugin_tests
if { [is_elf_format] \
- && [ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET" $srcdir/$subdir/func1p.c tmpdir/func1p.o] \
- && [ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET" $srcdir/$subdir/func2i.c tmpdir/func2i.o] \
- && [ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET" $srcdir/$subdir/func3h.c tmpdir/func3h.o] } {
+ && [ld_compile $CC_FOR_TARGET $srcdir/$subdir/func1p.c tmpdir/func1p.o] \
+ && [ld_compile $CC_FOR_TARGET $srcdir/$subdir/func2i.c tmpdir/func2i.o] \
+ && [ld_compile $CC_FOR_TARGET $srcdir/$subdir/func3h.c tmpdir/func3h.o] } {
run_ld_link_tests $plugin_extra_elf_tests
}
return
}
-set old_CFLAGS "$CFLAGS_FOR_TARGET"
-
# Pass -fplt to CC since -fno-plt doesn't work with NOCROSSREFS tests.
# Also add $NOPIE_CFLAGS since PIE doesn't work NOCROSSREFS tests.
-set old_CC "$CC_FOR_TARGET"
-append CC_FOR_TARGET " $PLT_CFLAGS $NOPIE_CFLAGS"
+set old_CFLAGS "$CFLAGS_FOR_TARGET"
+append CFLAGS_FOR_TARGET " $PLT_CFLAGS $NOPIE_CFLAGS"
# Xtensa targets currently default to putting literal values in a separate
# section and that requires linker script support, so put literals in text.
unsupported $test1
unsupported $test2
set CFLAGS_FOR_TARGET "$old_CFLAGS"
- set CC_FOR_TARGET "$old_CC"
return
}
if { ![ld_compile "$CC_FOR_TARGET $NOSANITIZE_CFLAGS $NOLTO_CFLAGS" "$srcdir/$subdir/cross3.c" tmpdir/cross3.o] } {
unsupported $test2
set CFLAGS_FOR_TARGET "$old_CFLAGS"
- set CC_FOR_TARGET "$old_CC"
return
}
if { ![ld_compile "$CC_FOR_TARGET $NOSANITIZE_CFLAGS $NOLTO_CFLAGS" "$srcdir/$subdir/cross4.c" tmpdir/cross4.o] } {
unsupported $test3
set CFLAGS_FOR_TARGET "$old_CFLAGS"
- set CC_FOR_TARGET "$old_CC"
return
}
if ![ld_relocate $ld tmpdir/cross3-partial.o "tmpdir/cross1.o tmpdir/cross4.o"] {
fail $test3
set CFLAGS_FOR_TARGET "$old_CFLAGS"
- set CC_FOR_TARGET "$old_CC"
return
}
}
set CFLAGS_FOR_TARGET "$old_CFLAGS"
-set CC_FOR_TARGET "$old_CC"
verbose "Using $picflag to compile PIC code"
# Compile the main program.
-if ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o] {
+if ![ld_compile "$CC_FOR_TARGET $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o] {
unsupported "shared (non PIC)"
unsupported "shared"
} else {
# using -fpic will cause some of the tests to return different
# results. Make sure that PLT is used since PLT is expected.
global PLT_CFLAGS NOPIE_CFLAGS
- if { ![ld_compile "$CC_FOR_TARGET $PLT_CFLAGS $NOPIE_CFLAGS $CFLAGS_FOR_TARGET $SHCFLAG" $srcdir/$subdir/sh1.c $tmpdir/sh1np.o]
- || ![ld_compile "$CC_FOR_TARGET $PLT_CFLAGS $CFLAGS_FOR_TARGET $SHCFLAG" $srcdir/$subdir/sh2.c $tmpdir/sh2np.o] } {
+ if { ![ld_compile "$CC_FOR_TARGET $PLT_CFLAGS $NOPIE_CFLAGS $SHCFLAG" $srcdir/$subdir/sh1.c $tmpdir/sh1np.o]
+ || ![ld_compile "$CC_FOR_TARGET $PLT_CFLAGS $SHCFLAG" $srcdir/$subdir/sh2.c $tmpdir/sh2np.o] } {
unsupported "shared (non PIC)"
} else { if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
shared_test shnp "shared (nonPIC)" mainnp.o sh1np.o sh2np.o xcoff
# Now compile the code using -fpic.
- if { ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET $SHCFLAG $picflag" $srcdir/$subdir/sh1.c $tmpdir/sh1p.o]
- || ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET $SHCFLAG $picflag" $srcdir/$subdir/sh2.c $tmpdir/sh2p.o] } {
+ if { ![ld_compile "$CC_FOR_TARGET $SHCFLAG $picflag" $srcdir/$subdir/sh1.c $tmpdir/sh1p.o]
+ || ![ld_compile "$CC_FOR_TARGET $SHCFLAG $picflag" $srcdir/$subdir/sh2.c $tmpdir/sh2p.o] } {
unsupported "shared"
} else {
if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
shared_test shp "shared" mainnp.o sh1p.o sh2p.o xcoff
} else {
shared_test shp "shared" mainnp.o sh1p.o sh2p.o shared
- ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET -DSYMBOLIC_TEST -DXCOFF_TEST $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o
- ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET -DSYMBOLIC_TEST -DXCOFF_TEST $SHCFLAG $picflag" $srcdir/$subdir/sh1.c $tmpdir/sh1p.o
+ ld_compile "$CC_FOR_TARGET -DSYMBOLIC_TEST -DXCOFF_TEST $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o
+ ld_compile "$CC_FOR_TARGET -DSYMBOLIC_TEST -DXCOFF_TEST $SHCFLAG $picflag" $srcdir/$subdir/sh1.c $tmpdir/sh1p.o
shared_test shp "shared -Bsymbolic" mainnp.o sh1p.o sh2p.o symbolic "-Bsymbolic"
- ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o
- ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET $SHCFLAG $picflag" $srcdir/$subdir/sh1.c $tmpdir/sh1p.o
+ ld_compile "$CC_FOR_TARGET $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o
+ ld_compile "$CC_FOR_TARGET $SHCFLAG $picflag" $srcdir/$subdir/sh1.c $tmpdir/sh1p.o
}
}
}
# Now do the same tests again, but this time compile main.c PIC.
-if ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET $SHCFLAG $picflag" $srcdir/$subdir/main.c $tmpdir/mainp.o] {
+if ![ld_compile "$CC_FOR_TARGET $SHCFLAG $picflag" $srcdir/$subdir/main.c $tmpdir/mainp.o] {
unsupported "shared (PIC main, non PIC so)"
unsupported "shared (PIC main)"
} else {
# 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 $NOSANITIZE_CFLAGS for S-records.
-set old_CC "$CC_FOR_TARGET"
-append CC_FOR_TARGET " $PLT_CFLAGS $NOPIE_CFLAGS $NOPIE_LDFLAGS $NOCF_PROTECTION_CFLAGS $NOSANITIZE_CFLAGS $NOLTO_CFLAGS"
-set old_CXX "$CXX_FOR_TARGET"
+set old_CFLAGS "$CFLAGS_FOR_TARGET"
+append CFLAGS_FOR_TARGET " $PLT_CFLAGS $NOPIE_CFLAGS $NOPIE_LDFLAGS $NOCF_PROTECTION_CFLAGS $NOSANITIZE_CFLAGS $NOLTO_CFLAGS"
set old_CXXFLAGS "$CXXFLAGS_FOR_TARGET"
append CXXFLAGS_FOR_TARGET " $PLT_CFLAGS $NOPIE_CFLAGS $NOPIE_LDFLAGS $NOCF_PROTECTION_CFLAGS $NOSANITIZE_CFLAGS $NOLTO_CFLAGS"
# S-records can't handle .note.gnu.property sections.
if { [is_elf_format] \
&& ([istarget "i?86-*-*"] || [istarget "x86_64-*-*"]) } {
- append CC_FOR_TARGET " -Wa,-mx86-used-note=no"
- append CXX_FOR_TARGET " -Wa,-mx86-used-note=no"
+ append CFLAGS_FOR_TARGET " -Wa,-mx86-used-note=no"
+ append CXXFLAGS_FOR_TARGET " -Wa,-mx86-used-note=no"
}
if { ![ld_compile $CC_FOR_TARGET $srcdir/$subdir/sr1.c tmpdir/sr1.o] \
|| ![ld_compile $CC_FOR_TARGET $srcdir/$subdir/sr2.c tmpdir/sr2.o] } {
unsupported $test1
unsupported $test2
- set CC_FOR_TARGET "$old_CC"
- set CXX_FOR_TARGET "$old_CXX"
+ set CFLAGS_FOR_TARGET "$old_CFLAGS"
set CXXFLAGS_FOR_TARGET "$old_CXXFLAGS"
return
}
if { ![is_remote host] && [which $CXX_FOR_TARGET] == 0 } {
untested $test2
- set CC_FOR_TARGET "$old_CC"
- set CXX_FOR_TARGET "$old_CXX"
+ set CFLAGS_FOR_TARGET "$old_CFLAGS"
set CXXFLAGS_FOR_TARGET "$old_CXXFLAGS"
return
}
-if ![ld_compile "$CXX_FOR_TARGET $CXXFLAGS_FOR_TARGET -fno-exceptions" $srcdir/$subdir/sr3.cc tmpdir/sr3.o] {
+if ![ld_compile "$CXX_FOR_TARGET -fno-exceptions" $srcdir/$subdir/sr3.cc tmpdir/sr3.o] {
unsupported $test2
- set CC_FOR_TARGET "$old_CC"
- set CXX_FOR_TARGET "$old_CXX"
+ set CFLAGS_FOR_TARGET "$old_CFLAGS"
set CXXFLAGS_FOR_TARGET "$old_CXXFLAGS"
return
}
run_srec_test $test2 "tmpdir/sr3.o"
-set CC_FOR_TARGET "$old_CC"
-set CXX_FOR_TARGET "$old_CXX"
+set CFLAGS_FOR_TARGET "$old_CFLAGS"
set CXXFLAGS_FOR_TARGET "$old_CXXFLAGS"