aboutsummaryrefslogtreecommitdiff
path: root/zlib/win32
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2025-08-16 14:49:05 -0700
committerH.J. Lu <hjl.tools@gmail.com>2025-08-18 13:17:24 -0700
commit258ebe350e6d8ca1fa388a05789bf47f3d9d9fb4 (patch)
tree8aa8766576914f53f6c25cb41a744fca877b9f2a /zlib/win32
parentb6ebe65cdac1afc15d5459318007be2d1d8832d0 (diff)
downloadbinutils-258ebe350e6d8ca1fa388a05789bf47f3d9d9fb4.zip
binutils-258ebe350e6d8ca1fa388a05789bf47f3d9d9fb4.tar.gz
binutils-258ebe350e6d8ca1fa388a05789bf47f3d9d9fb4.tar.bz2
ld: Properly override compiler flags in tests
Some tests need to be compiled with additional flags. When binutils is built and compiled with CC="gcc -fsanitize=address,undefined" CXX="g++ -fsanitize=address,undefined" some linker tests fail to disable address sanitizer options since proc default_ld_compile has set ccexe $cc set ccparm [string first " " $cc] set ccflags "" if { $ccparm > 0 } then { set ccflags [string range $cc $ccparm end] set ccexe [string range $cc 0 $ccparm] set cc $ccexe } ... set cmd "$cc $flags $ccflags -c $source -o $object" Compiler flags in $CC and $CXX will be the last ones. Add CFLAGS_FOR_TARGET_TEST and CXXFLAGS_FOR_TARGET_TEST to use them in proc default_ld_compile set cflag_test "" set cxxflag_test "" if {[string match "*++*" $ccexe]} { append flags " $CXXFLAGS_FOR_TARGET" set cflag_test "$CXXFLAGS_FOR_TARGET_TEST" } else { append flags " $CFLAGS_FOR_TARGET" set cflag_test "$CFLAGS_FOR_TARGET_TEST" } ... set cmd "$cc $flags $ccflags $cflag_test -c $source -o $object" so that they will be the last flags passed to compiler. Also update run_ld_link_exec_tests and run_cc_link_tests to make CFLAGS_FOR_TARGET_TEST and CXXFLAGS_FOR_TARGET_TEST the last flags passed to compiler. * testsuite/config/default.exp (CFLAGS_FOR_TARGET_TEST): New. (CXXFLAGS_FOR_TARGET_TEST): Likewise. * testsuite/ld-elf/dwarf.exp (CFLAGS_FOR_TARGET): Renamed to ... (CFLAGS_FOR_TARGET_TEST): This. * testsuite/ld-elf/shared.exp: Save, append and restore CFLAGS_FOR_TARGET_TEST and CXXFLAGS_FOR_TARGET_TEST for $build_tests. Save, append and restore CFLAGS_FOR_TARGET_TEST, instead of CFLAGS_FOR_TARGET, for $dlopen_run_tests. * testsuite/ld-plugin/plugin.exp (CFLAGS_FOR_TARGET): Renamed to ... (CFLAGS_FOR_TARGET_TEST): This. * testsuite/ld-shared/shared.exp (CFLAGS_FOR_TARGET): Renamed to ... (CFLAGS_FOR_TARGET_TEST): This. * testsuite/ld-srec/srec.exp (CFLAGS_FOR_TARGET): Renamed to ... (CFLAGS_FOR_TARGET_TEST): This. (CXXFLAGS_FOR_TARGET): Renamed to ... (CXXFLAGS_FOR_TARGET_TEST): This. * testsuite/lib/ld-lib.exp (default_ld_compile): Append CFLAGS_FOR_TARGET_TEST/CXXFLAGS_FOR_TARGET_TEST to compiler flags. (run_ld_link_exec_tests): Append CFLAGS_FOR_TARGET_TEST and CXXFLAGS_FOR_TARGET_TEST to compiler. (run_cc_link_tests): Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Diffstat (limited to 'zlib/win32')
0 files changed, 0 insertions, 0 deletions