ld: Add $NOSANTIZE_CFLAGS to more linker tests
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 26 Aug 2020 18:28:26 +0000 (11:28 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 26 Aug 2020 18:57:35 +0000 (11:57 -0700)
-fsanitize= can be used to build binutils with

$ CC="gcc -fsanitize=address,undefined" CXX="g++ -fsanitize=address,undefined" .../configure --disable-werror

Since not all linker tests are compatible with -fsanitize=, pass
$NOSANTIZE_CFLAGS to disable -fsanitize= for such tests.

* testsuite/ld-elf/indirect.exp: Append $NOSANTIZE_CFLAGS to CC.
* testsuite/ld-elf/shared.exp: Likewise.
* testsuite/ld-elfcomm/elfcomm.exp: Likewise.
* testsuite/ld-elfvers/vers.exp: Likewise.
* testsuite/ld-elfvsb/elfvsb.exp: Likewise.
* testsuite/ld-elfweak/elfweak.exp: Likewise.
* testsuite/ld-plugin/lto.exp: Likewise.
* testsuite/ld-plugin/plugin.exp: Likewise.
* testsuite/ld-scripts/crossref.exp: Likewise.

ld/ChangeLog
ld/testsuite/ld-elf/indirect.exp
ld/testsuite/ld-elf/shared.exp
ld/testsuite/ld-elfcomm/elfcomm.exp
ld/testsuite/ld-elfvers/vers.exp
ld/testsuite/ld-elfvsb/elfvsb.exp
ld/testsuite/ld-elfweak/elfweak.exp
ld/testsuite/ld-plugin/lto.exp
ld/testsuite/ld-plugin/plugin.exp
ld/testsuite/ld-scripts/crossref.exp

index 662460803328b513dd61da3c31bae7ebb3d59ae6..8bdc015e6d9feedb9a92aee9e1cb808fa0e096a6 100644 (file)
@@ -1,3 +1,15 @@
+2020-08-26  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * testsuite/ld-elf/indirect.exp: Append $NOSANTIZE_CFLAGS to CC.
+       * testsuite/ld-elf/shared.exp: Likewise.
+       * testsuite/ld-elfcomm/elfcomm.exp: Likewise.
+       * testsuite/ld-elfvers/vers.exp: Likewise.
+       * testsuite/ld-elfvsb/elfvsb.exp: Likewise.
+       * testsuite/ld-elfweak/elfweak.exp: Likewise.
+       * testsuite/ld-plugin/lto.exp: Likewise.
+       * testsuite/ld-plugin/plugin.exp: Likewise.
+       * testsuite/ld-scripts/crossref.exp: Likewise.
+
 2020-08-26  Alan Modra  <amodra@gmail.com>
 
        PR 26499
index 8acae4d3c9dc3f9becf5d60ade34d21a11ffa950..9451b21383cd7884578fdcf09dc2915f9f6ea110 100644 (file)
@@ -64,6 +64,9 @@ if {[check_lto_available]} {
    append cc_cmd " -fno-lto"
 }
 
+# Disable all sanitizers.
+append cc_cmd " $NOSANTIZE_CFLAGS"
+
 if { ![ld_compile $cc_cmd $srcdir/$subdir/indirect1a.c tmpdir/indirect1a.o]
      || ![ld_compile $cc_cmd $srcdir/$subdir/indirect1b.c tmpdir/indirect1b.o]
      || ![ld_compile "$cc_cmd -fPIC" $srcdir/$subdir/indirect2.c tmpdir/indirect2.o]
index 4de5b341834135dc8006c2be7809e66c0ecbaa0b..66da7203df0d9f49b52cbe51e5492fdcb9570843 100644 (file)
@@ -749,15 +749,6 @@ set build_tests {
   {"Build needed3"
    "tmpdir/needed3.o -Wl,--as-needed -Ltmpdir -lneeded3a -lneeded3b -lneeded1b" ""
    {dummy.c} {} "needed3"}
-  {"Build libpr2404a.so"
-   "-shared" "-fPIC"
-   {pr2404a.c} {} "libpr2404a.so"}
-  {"Build libpr2404n.so"
-   "-shared -Wl,-z,now" "-fPIC"
-   {pr2404a.c} {} "libpr2404n.so"}
-  {"Build libpr2404b.a"
-   "" ""
-   {pr2404b.c} {} "libpr2404b.a"}
   {"Build rdynamic-1"
    "-Wl,--no-dynamic-linker,-export-dynamic,--gc-sections" "-ffunction-sections"
    {rdynamic-1.c} {{readelf {-s} rdynamic-1.rd}} "rdynamic-1"}
@@ -792,6 +783,34 @@ set build_tests {
    "-shared -Wl,-z,now tmpdir/libpr18458a.so" "-fPIC"
    {pr18458b.c} {} "libpr18458b.so"}
 }
+
+run_cc_link_tests [list \
+    [list \
+       "Build libpr2404a.so" \
+       "-shared $NOSANTIZE_CFLAGS" \
+       "-fPIC $NOSANTIZE_CFLAGS" \
+       {pr2404a.c} \
+       {} \
+       "libpr2404a.so" \
+    ] \
+    [list \
+       "Build libpr2404n.so" \
+       "-shared -Wl,-z,now $NOSANTIZE_CFLAGS" \
+       "-fPIC $NOSANTIZE_CFLAGS" \
+       {pr2404a.c} \
+       {} \
+       "libpr2404n.so" \
+    ] \
+    [list \
+       "Build libpr2404b.a" \
+       "" \
+       "$NOSANTIZE_CFLAGS" \
+       {pr2404b.c} \
+       {} \
+       "libpr2404b.a" \
+    ] \
+]
+
 # pr19073.s uses .set, which has a different meaning on alpha.
 if { ![istarget alpha-*-*] } {
     append build_tests {
@@ -873,7 +892,7 @@ run_ld_link_tests [list \
        { pr22269-1.c } \
        {{readelf -rW pr22269-1.rd}} \
        "pr22269-1" \
-       "-fPIE -O2" \
+       "-fPIE -O2 $NOSANTIZE_CFLAGS" \
     ] \
 ]
 
@@ -1006,11 +1025,16 @@ set run_tests [list \
      "-Wl,--no-as-needed,-rpath=tmpdir -Ltmpdir -lrel" "" \
      {relmain.c} "relmain" "relmain.out" ] \
     [list "Run pr2404" \
-     "-Wl,--no-as-needed tmpdir/pr2404b.o tmpdir/libpr2404a.so" "" \
-     {dummy.c} "pr2404" "pr2404.out" ] \
+     "$NOSANTIZE_CFLAGS -Wl,--no-as-needed \
+      tmpdir/pr2404b.o tmpdir/libpr2404a.so" \
+     "" \
+     {dummy.c} "pr2404" "pr2404.out" \
+     "$NOSANTIZE_CFLAGS" ] \
     [list "Run pr2404n" \
-     "-Wl,-z,now -Wl,--no-as-needed tmpdir/pr2404b.o tmpdir/libpr2404n.so" "" \
-     {dummy.c} "pr2404n" "pr2404.out" ] \
+     "$NOSANTIZE_CFLAGS -Wl,-z,now \
+      -Wl,--no-as-needed tmpdir/pr2404b.o tmpdir/libpr2404n.so" "" \
+     {dummy.c} "pr2404n" "pr2404.out" \
+     "$NOSANTIZE_CFLAGS" ] \
     [list "Run pr18458" \
      "-Wl,--no-as-needed,-z,now tmpdir/libpr18458a.so tmpdir/libpr18458b.so" "" \
      {pr18458c.c} "pr18458" "pass.out" ] \
@@ -1126,14 +1150,29 @@ set build_cxx_tests {
   {"Build libdl3a.so with --dynamic-list-cpp-typeinfo"
    "-shared -Wl,--dynamic-list-cpp-typeinfo" "-fPIC"
    {dl3.cc} {} "libdl3c.so" "c++"}
-  {"Build libdnew1a.so with --Bsymbolic-functions --dynamic-list-cpp-new"
-   "-shared -Wl,-Bsymbolic-functions,--dynamic-list-cpp-new" "-fPIC -ansi"
-   {del.cc new.cc} {} "libnew1a.so" "c++"}
-  {"Build libdnew1b.so with --dynamic-list-data --dynamic-list-cpp-new"
-   "-shared -Wl,--dynamic-list-data,--dynamic-list-cpp-new" "-fPIC -ansi"
-   {del.cc new.cc} {} "libnew1b.so" "c++"}
 }
 
+run_cc_link_tests [list \
+    [list \
+       "Build libdnew1a.so with --Bsymbolic-functions --dynamic-list-cpp-new" \
+       "-shared $NOSANTIZE_CFLAGS -Wl,-Bsymbolic-functions,--dynamic-list-cpp-new" \
+       "-fPIC -ansi $NOSANTIZE_CFLAGS" \
+       {del.cc new.cc} \
+       {} \
+       "libnew1a.so" \
+       "c++" \
+    ] \
+    [list \
+       "Build libdnew1b.so with --dynamic-list-data --dynamic-list-cpp-new" \
+       "-shared $NOSANTIZE_CFLAGS -Wl,--dynamic-list-data,--dynamic-list-cpp-new" \
+       "-fPIC -ansi $NOSANTIZE_CFLAGS" \
+       {del.cc new.cc} \
+       {} \
+       "libnew1b.so" \
+       "c++" \
+    ] \
+]
+
 # "-shared -Bsymbolic" only works with gcc 4.5.0 and newer.
 #    {"Run with libdl3b.so"
 #     "tmpdir/libdl3b.so" ""
@@ -1145,14 +1184,31 @@ set run_cxx_tests {
     {"Run with libdl3c.so"
      "-Wl,--no-as-needed tmpdir/libdl3c.so" ""
      {dl3main.cc} "dl3c" "dl3a.out" "" "c++"}
-    {"Run with libnew1a.so"
-     "-Wl,--no-as-needed tmpdir/libnew1a.so" ""
-     {dl5.cc} "dl5a" "dl5.out" "-ansi" "c++"}
-    {"Run with libnew1b.so"
-     "-Wl,--no-as-needed tmpdir/libnew1b.so" ""
-     {dl5.cc} "dl5b" "dl5.out" "-ansi" "c++"}
 }
 
+run_ld_link_exec_tests [list \
+    [list \
+       "Run with libnew1a.so" \
+       "-Wl,--no-as-needed tmpdir/libnew1a.so $NOSANTIZE_CFLAGS" \
+       "" \
+       {dl5.cc} \
+       "dl5a" \
+       "dl5.out" \
+       "-ansi $NOSANTIZE_CFLAGS" \
+       "c++" \
+    ] \
+    [list \
+       "Run with libnew1b.so" \
+       "-Wl,--no-as-needed tmpdir/libnew1b.so $NOSANTIZE_CFLAGS" \
+       "" \
+       {dl5.cc} \
+       "dl5b" \
+       "dl5.out" \
+       "-ansi $NOSANTIZE_CFLAGS" \
+       "c++" \
+    ] \
+]
+
 run_cc_link_tests $build_cxx_tests
 run_ld_link_exec_tests $run_cxx_tests
 
@@ -1163,7 +1219,7 @@ if { [istarget *-*-linux*]
        [list \
            "Build libpr2404b.a with PIE" \
            "" \
-           "-fPIE" \
+           "-fPIE $NOSANTIZE_CFLAGS" \
            { pr2404b.c } \
            {} \
            "libpr2404b.a" \
@@ -1249,21 +1305,21 @@ if { [istarget *-*-linux*]
        ] \
        [list \
            "Run pr2404 with PIE" \
-           "-pie -Wl,--no-as-needed tmpdir/pr2404b.o tmpdir/libpr2404a.so" \
+           "-pie $NOSANTIZE_CFLAGS -Wl,--no-as-needed tmpdir/pr2404b.o tmpdir/libpr2404a.so" \
            "" \
            { dummy.c } \
            "pr2404pie" \
            "pr2404.out" \
-           "-fPIE" \
+           "-fPIE $NOSANTIZE_CFLAGS" \
        ] \
        [list \
            "Run pr2404 with PIE (-z now)" \
-           "-pie -Wl,-z,now -Wl,--no-as-needed tmpdir/pr2404b.o tmpdir/libpr2404n.so" \
+           "-pie $NOSANTIZE_CFLAGS -Wl,-z,now -Wl,--no-as-needed tmpdir/pr2404b.o tmpdir/libpr2404n.so" \
            "" \
            { dummy.c } \
            "pr2404pien" \
            "pr2404.out" \
-           "-fPIE" \
+           "-fPIE $NOSANTIZE_CFLAGS" \
        ] \
        [list \
            "Run pr18718" \
@@ -1499,7 +1555,7 @@ if { ([istarget "*-*-linux*"]
            { pr23162a.c } \
            "" \
            "libpr23162a.so" \
-           "-fPIC -O2" \
+           "-fPIC -O2 $NOSANTIZE_CFLAGS" \
        ] \
        [list \
            "Build pr23162a" \
@@ -1509,7 +1565,7 @@ if { ([istarget "*-*-linux*"]
            { pr23162b.c } \
            {{readelf {-rW} pr23162.rd}} \
            "pr23162a" \
-           "-fPIC -O0" \
+           "-fPIC -O0 $NOSANTIZE_CFLAGS" \
        ] \
        [list \
            "Build libpr23162b.so" \
@@ -1519,7 +1575,7 @@ if { ([istarget "*-*-linux*"]
            { pr23162a.c } \
            "" \
            "libpr23162b.so" \
-           "-fPIC -O2" \
+           "-fPIC -O2 $NOSANTIZE_CFLAGS" \
        ] \
        [list \
            "Build pr23162b" \
@@ -1529,7 +1585,7 @@ if { ([istarget "*-*-linux*"]
            { pr23162b.c } \
            {{readelf {-rW} pr23162.rd}} \
            "pr23162b" \
-           "-fPIC -O0" \
+           "-fPIC -O0 $NOSANTIZE_CFLAGS" \
        ] \
        [list \
            "Build libpr23161a.so" \
index d23929ea0b1a46adb848aa33a855b1cf103a489a..88dbe46f3bff74f8b98709bfc1b551cbdeb27276 100644 (file)
@@ -169,9 +169,9 @@ if [istarget nios2*-*-*] {
 
 # Explicitly use "-fcommon" so that even if $CFLAGS includes
 # "-fno-common", these tests are compiled as expected.
-if {   ![ld_compile "$CC $CFLAGS -fcommon" $srcdir/$subdir/common1a.c tmpdir/common1a.o]
-    || ![ld_compile "$CC $CFLAGS -fcommon" $srcdir/$subdir/common1b.c tmpdir/common1b.o]
-    || ![ld_compile "$CC $CFLAGS -Wa,--elf-stt-common=yes -fcommon" $srcdir/$subdir/common1b.c tmpdir/common1c.o] } {
+if {   ![ld_compile "$CC $CFLAGS -fcommon $NOSANTIZE_CFLAGS" $srcdir/$subdir/common1a.c tmpdir/common1a.o]
+    || ![ld_compile "$CC $CFLAGS -fcommon $NOSANTIZE_CFLAGS" $srcdir/$subdir/common1b.c tmpdir/common1b.o]
+    || ![ld_compile "$CC $CFLAGS $NOSANTIZE_CFLAGS -Wa,--elf-stt-common=yes -fcommon" $srcdir/$subdir/common1b.c tmpdir/common1c.o] } {
     unresolved $test1
     unresolved $test1
     return
index 0216b13b6ec035b7b48b847f545d7f1c4b4483d1..7fd6270fae02b7cba54d5a26ebe003fa9555e27c 100644 (file)
@@ -489,8 +489,9 @@ proc build_binary { shared pic test source libname other mapfile verexp versymex
     global CC
     global CFLAGS
     global script
+    global NOSANTIZE_CFLAGS
 
-    if ![ld_compile "$CC -S $pic $CFLAGS" $srcdir/$subdir/$source $tmpdir/$libname.s]     {
+    if ![ld_compile "$CC -S $pic $CFLAGS $NOSANTIZE_CFLAGS" $srcdir/$subdir/$source $tmpdir/$libname.s]     {
        unresolved "$test"
        return
     }
@@ -687,6 +688,7 @@ proc build_exec { test source execname flags solibname verexp versymexp symexp }
     global objdump
     global CC
     global CFLAGS
+    global NOSANTIZE_CFLAGS
 
     set shared "--shared --no-undefined-version"
     set script --version-script
@@ -697,6 +699,9 @@ proc build_exec { test source execname flags solibname verexp versymexp symexp }
        append cc_cmd " -fno-lto"
     }
 
+    # Disable all sanitizers.
+    append cc_cmd " $NOSANTIZE_CFLAGS"
+
     if ![ld_compile $cc_cmd $srcdir/$subdir/$source $tmpdir/$execname.s]     {
        unresolved "$test"
        return
index fda2416c6de4fed3eed3f94e28946fc3ec575bee..3a242d35276a57b033053a399e7182ea02b3fcb4 100644 (file)
@@ -444,7 +444,7 @@ visibility_run protected_undef_def
 visibility_run protected_weak
 visibility_run normal
 
-if { ![ld_compile "$CC -g $CFLAGS" $srcdir/$subdir/common.c tmpdir/common.o] } {
+if { ![ld_compile "$CC -g $CFLAGS $NOSANTIZE_CFLAGS" $srcdir/$subdir/common.c tmpdir/common.o] } {
     unresolved "common hidden symbol"
 } else {
     if ![ld_link $ld tmpdir/common "tmpdir/common.o"] {
@@ -454,10 +454,10 @@ if { ![ld_compile "$CC -g $CFLAGS" $srcdir/$subdir/common.c tmpdir/common.o] } {
     }
 }
 
-if { ![ld_compile "$CC -g $CFLAGS" $srcdir/$subdir/test.c tmpdir/test.o] } {
+if { ![ld_compile "$CC -g $CFLAGS $NOSANTIZE_CFLAGS" $srcdir/$subdir/test.c tmpdir/test.o] } {
     unresolved "weak hidden symbol"
 } else {
-   if { ![ld_compile "$CC -g $CFLAGS -DSHARED $picflag" $srcdir/$subdir/sh3.c tmpdir/sh3.o] } {
+   if { ![ld_compile "$CC -g $CFLAGS $NOSANTIZE_CFLAGS -DSHARED $picflag" $srcdir/$subdir/sh3.c tmpdir/sh3.o] } {
        unresolved "weak hidden symbol"
     } else {
        if ![ld_link $ld tmpdir/sh3.so "-shared tmpdir/sh3.o"] {
index 3481878014d75dde49a1df3da2ff18d404041564..355bfe7e0c21b1ef190d57b4dff3c711411d849d 100644 (file)
@@ -267,13 +267,14 @@ proc build_lib {test libname objs dynsymexp} {
     global shared
     global srcdir
     global subdir
+    global NOSANTIZE_CFLAGS
 
     set files ""
     foreach obj $objs {
       set files "$files $tmpdir/$obj"
     }
 
-    if {![ld_link $CC $tmpdir/$libname.so "$shared $files"]} {
+    if {![ld_link "$CC $NOSANTIZE_CFLAGS" $tmpdir/$libname.so "$shared $files"]} {
        fail $test
        return
     }
@@ -355,6 +356,9 @@ if {[check_lto_available]} {
    append cc_cmd " -fno-lto"
 }
 
+# Disable all sanitizers.
+append cc_cmd " $NOSANTIZE_CFLAGS"
+
 # Old version of GCC for MIPS default to enabling -fpic
 # and get confused if it is used on the command line.
 if { [istarget mips*-*-*] && ! [at_least_gcc_version 4 3] } then {
index 6a37025db59d3abd0397242f6e10d780482a4327..6bd2a6aa440e4715256f33dc9ba7c0a3b5ca7747 100644 (file)
@@ -141,7 +141,7 @@ set lto_link_tests [list \
    "" "-flto -O2 $lto_fat $NOSANTIZE_CFLAGS" \
    {pr12758b.c} {} "libpr12758.a"] \
   [list "PR ld/12758" \
-   "$NOPIE_LDFLAGS -O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin tmpdir/pr12758a.o -Wl,--start-group tmpdir/libpr12758.a -Wl,--end-group" \
+   "$NOPIE_LDFLAGS $NOSANTIZE_CFLAGS -O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin tmpdir/pr12758a.o -Wl,--start-group tmpdir/libpr12758.a -Wl,--end-group" \
    "$NOSANTIZE_CFLAGS" \
    {dummy.c} {} "pr12758.exe"] \
   [list "Build libpr13183.a" \
@@ -458,10 +458,12 @@ set lto_link_symbol_tests [list \
    "-O2 -flto -fuse-linker-plugin tmpdir/lto-9.o" "" \
    {dummy.c} {{"nm" {-C} "lto-9.d"}} "lto-9.exe" "c++"] \
   [list "LTO 16a symbol" \
-   "-O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin" "-flto" \
+   "-O2 $NOSANTIZE_CFLAGS -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin" \
+   "-flto $NOSANTIZE_CFLAGS" \
    {lto-16a.c} {{"nm" {} "lto-16a.d"}} "lto-16.exe" "c"] \
   [list "LTO 16b symbol" \
-   "-O2 -Wl,-e,foo -u bar -nostdlib -flto -fuse-linker-plugin" "-flto" \
+   "-O2 $NOSANTIZE_CFLAGS -Wl,-e,foo -u bar -nostdlib -flto -fuse-linker-plugin" \
+   "-flto $NOSANTIZE_CFLAGS" \
    {lto-16a.c lto-16b.c} {{"nm" {} "lto-16b.d"}} "lto-16b.exe" "c"] \
   [list "PR ld/13183" \
    "-O2 -flto -fuse-linker-plugin tmpdir/pr13183b.o tmpdir/libpr13183.a" "" \
@@ -667,7 +669,8 @@ if { [at_least_gcc_version 4 7] } {
        run_cc_link_tests [list \
            [list \
                "Build pr22721a.so" \
-               "-shared -nostdlib -nostartfiles -Wl,-version-script,pr22721.t" \
+               "-shared $NOSANTIZE_CFLAGS -nostdlib -nostartfiles \
+                -Wl,-version-script,pr22721.t" \
                "" \
                {pr22721a.s} \
                {} \
@@ -675,15 +678,16 @@ if { [at_least_gcc_version 4 7] } {
            ] \
            [list \
                "Build pr22721b.o" \
-               "$plug_opt" \
+               "$plug_opt $NOSANTIZE_CFLAGS" \
                "-O2 -fPIC -flto $lto_no_fat" \
                {pr22721b.c} \
            ] \
            [list \
                "Build PR ld/pr22721" \
                "-O2 -flto -fuse-linker-plugin -nostdlib -nostartfiles \
-               -Wl,-e,_start tmpdir/pr22721b.o tmpdir/pr22721a.so" \
-               "" \
+                $NOSANTIZE_CFLAGS \
+                -Wl,-e,_start tmpdir/pr22721b.o tmpdir/pr22721a.so" \
+               "$NOSANTIZE_CFLAGS" \
                {dummy.c} \
                {} \
                "pr22721.exe"
index dc8f007397a00642537115a3ef75eea1f6a9c947..5f6f21af2053e0f8d29267c9aef44d6a4cdc1b9b 100644 (file)
@@ -295,9 +295,9 @@ if { !$can_compile || $failed_compile } {
 run_ld_link_tests $plugin_tests
 
 if { [is_elf_format] \
-     && [ld_compile "$CC $CFLAGS" $srcdir/$subdir/func1p.c tmpdir/func1p.o] \
-     && [ld_compile "$CC $CFLAGS" $srcdir/$subdir/func2i.c tmpdir/func2i.o] \
-     && [ld_compile "$CC $CFLAGS" $srcdir/$subdir/func3h.c tmpdir/func3h.o] } {
+     && [ld_compile "$CC $CFLAGS $NOSANTIZE_CFLAGS" $srcdir/$subdir/func1p.c tmpdir/func1p.o] \
+     && [ld_compile "$CC $CFLAGS $NOSANTIZE_CFLAGS" $srcdir/$subdir/func2i.c tmpdir/func2i.o] \
+     && [ld_compile "$CC $CFLAGS $NOSANTIZE_CFLAGS" $srcdir/$subdir/func3h.c tmpdir/func3h.o] } {
     run_ld_link_tests $plugin_extra_elf_tests
 }
 
index b2f72313e39df5654f1893cc5efdbd6d095f5891..652a0df84c790a962964bd9a06da9aabfe349925 100644 (file)
@@ -63,8 +63,8 @@ if [istarget tic6x*-*-*] {
     set CFLAGS "-mno-dsbt -msdata=none"
 }
 
-if { ![ld_compile $CC "$srcdir/$subdir/cross1.c" tmpdir/cross1.o] \
-     || ![ld_compile $CC "$srcdir/$subdir/cross2.c" tmpdir/cross2.o] } {
+if { ![ld_compile "$CC $NOSANTIZE_CFLAGS" "$srcdir/$subdir/cross1.c" tmpdir/cross1.o] \
+     || ![ld_compile "$CC $NOSANTIZE_CFLAGS" "$srcdir/$subdir/cross2.c" tmpdir/cross2.o] } {
     unresolved $test1
     unresolved $test2
     set CFLAGS "$old_CFLAGS"
@@ -101,7 +101,7 @@ if [string match "" $exec_output] then {
 
 # Check cross references within a single object.
 
-if { ![ld_compile $CC "$srcdir/$subdir/cross3.c" tmpdir/cross3.o] } {
+if { ![ld_compile "$CC $NOSANTIZE_CFLAGS" "$srcdir/$subdir/cross3.c" tmpdir/cross3.o] } {
     unresolved $test2
     set CFLAGS "$old_CFLAGS"
     set CC "$old_CC"
@@ -126,7 +126,7 @@ if [string match "" $exec_output] then {
 
 # Check cross references for ld -r
 
-if { ![ld_compile $CC "$srcdir/$subdir/cross4.c" tmpdir/cross4.o] } {
+if { ![ld_compile "$CC $NOSANTIZE_CFLAGS" "$srcdir/$subdir/cross4.c" tmpdir/cross4.o] } {
     unresolved $test3
     set CFLAGS "$old_CFLAGS"
     set CC "$old_CC"