Commit: Running the linker testsuite with clang

* testsuite/config/default.exp: If not already set then create the
	CCC_OVERRIDE_OPTIONS environment variable to help when running the
	testsuite with clang.
	* testsuite/ld-elf/pr22269-1.c: Add a missing return statement.
	* testsuite/ld-elfvers/vers.exp: Add checks to detect if files
	were built before attempting to copy them.
This commit is contained in:
Nick Clifton
2020-04-17 13:03:53 +01:00
parent 3557f442a1
commit 49c16254b4
4 changed files with 71 additions and 3 deletions

View File

@ -1,3 +1,12 @@
2020-04-17 Nick Clifton <nickc@redhat.com>
* testsuite/config/default.exp: If not already set then create the
CCC_OVERRIDE_OPTIONS environment variable to help when running the
testsuite with clang.
* testsuite/ld-elf/pr22269-1.c: Add a missing return statement.
* testsuite/ld-elfvers/vers.exp: Add checks to detect if files
were built before attempting to copy them.
2020-04-16 Stephen Casner <casner@acm.org> 2020-04-16 Stephen Casner <casner@acm.org>
PR ld/18963 PR ld/18963

View File

@ -95,6 +95,56 @@ if {![info exists CXXFLAGS]} {
set CXXFLAGS "" set CXXFLAGS ""
} }
# This allows us to run the linker testsuite with clang as the compilation
# driver instead of gcc. The syntax of the overrides are as follows, one
# per line:
#
# '#': Silence information about the changes to the command line arguments.
#
# '^': Add FOO as a new argument at the beginning of the command line.
#
# '+': Add FOO as a new argument at the end of the command line.
#
# 's/XXX/YYY/': Substitute the regular expression XXX with YYY in the command
# line.
#
# 'xOPTION': Removes all instances of the literal argument OPTION.
#
# 'XOPTION': Removes all instances of the literal argument OPTION,
# and the following argument.
#
# 'Ox': Removes all flags matching 'O' or 'O[sz0-9]' and adds 'Ox'
# at the end of the command line.
#
# \param OS - The stream to write edit information to.
# \param Args - The vector of command line arguments.
# \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) "#\
+-Wno-unused-command-line-argument \
+-Wno-unknown-attributes \
+-Wno-tautological-compare \
+-Wno-ignored-optimization-argument \
+-Wno-deprecated \
+-fuse-ld=$ld \
x-Wa,--elf-stt-common=yes \
x-Wa,-mx86-used-note=no \
x-Wa,-mx86-used-note=yes \
x-Wa,-madd-bnd-prefix \
x-fno-early-inlining \
x-fno-toplevel-reorder \
x-flto-partition=none \
x-feliminate-dwarf2-dups \
s/-Wa,-mrelax-relocations=yes,-mx86-used-note=yes/-Wa,-mrelax-relocations=yes/ \
s/-Wa,--compress-debug-sections=zlib/-Wa,-compress-debug-sections=zlib/ \
s/-Wa,--compress-debug-sections=zlib-gabi/-Wa,-compress-debug-sections=zlib-gabi/ \
"
}
# The mips64-*-linux-gnu compiler defaults to the N32 ABI after # The mips64-*-linux-gnu compiler defaults to the N32 ABI after
# installed, but to the O32 ABI in the build tree, because of some # installed, but to the O32 ABI in the build tree, because of some
# specs-file hacks. Make sure we use an ABI that is compatible with # specs-file hacks. Make sure we use an ABI that is compatible with

View File

@ -5,4 +5,5 @@ _start (void)
{ {
if (&foo) if (&foo)
return foo; return foo;
return 0;
} }

View File

@ -668,6 +668,10 @@ proc test_strip_vers_lib { test srclib libname verexp versymexp } {
global tmpdir global tmpdir
global objdump global objdump
if {! [file exists $tmpdir/$srclib] } then {
fail "$test ($tmpdir/$srclib does not exist)"
return
}
verbose -log "cp $tmpdir/$srclib $tmpdir/$libname.so" verbose -log "cp $tmpdir/$srclib $tmpdir/$libname.so"
exec cp $tmpdir/$srclib $tmpdir/$libname.so exec cp $tmpdir/$srclib $tmpdir/$libname.so
@ -903,8 +907,12 @@ build_vers_lib_pic "vers18" vers18.c vers18 vers17.so vers18.map vers18.ver vers
build_exec "vers19" vers19.c vers19 "-Wl,--no-as-needed,-rpath,.,-rpath-link,." vers18.so vers19.ver vers19.dsym "" build_exec "vers19" vers19.c vers19 "-Wl,--no-as-needed,-rpath,.,-rpath-link,." vers18.so vers19.ver vers19.dsym ""
build_vers_lib_no_pic "vers20a" vers20.c vers20a "" vers20.map vers20a.ver vers20.dsym "" build_vers_lib_no_pic "vers20a" vers20.c vers20a "" vers20.map vers20a.ver vers20.dsym ""
exec cp $tmpdir/vers20a.so $tmpdir/vers20b.so if {! [file exists $tmpdir/vers20a.so] } then {
build_vers_lib_no_pic "vers20" vers20.c vers20 "vers20a.so vers20b.so" vers20.map vers20.ver vers20.dsym "" fail "Building vers20a.so"
} else {
exec cp $tmpdir/vers20a.so $tmpdir/vers20b.so
build_vers_lib_no_pic "vers20" vers20.c vers20 "vers20a.so vers20b.so" vers20.map vers20.ver vers20.dsym ""
}
# Test .symver override. # Test .symver override.
build_vers_lib_pic "vers21" vers21.c vers21 "" vers21.map vers21.ver vers21.dsym vers21.sym build_vers_lib_pic "vers21" vers21.c vers21 "" vers21.map vers21.ver vers21.dsym vers21.sym
@ -984,7 +992,7 @@ if [string match "yes" $pic] then {
build_vers_lib_no_pic "vers27c1" vers27c.c vers27c1 "vers27b.o vers27a.so" "" vers27c.ver vers27c.dsym "" build_vers_lib_no_pic "vers27c1" vers27c.c vers27c1 "vers27b.o vers27a.so" "" vers27c.ver vers27c.dsym ""
build_vers_lib_no_pic "vers27c2" vers27c.c vers27c2 "vers27a.so vers27b.o" "" vers27c.ver vers27c.dsym "" build_vers_lib_no_pic "vers27c2" vers27c.c vers27c2 "vers27a.so vers27b.o" "" vers27c.ver vers27c.dsym ""
build_vers_lib_pic "vers27d1" vers27d1.c vers27d1 "" vers27a.map vers27d.ver vers27d.dsym vers27d.sym build_vers_lib_pic "vers27d1" vers27d1.c vers27d1 "" vers27a.map vers27d.ver vers27d.dsym vers27d.sym
build_vers_lib_pic "vers27d2" vers27d2.c vers27d2 "" "" vers27b.ver vers27b.dsym "" build_vers_lib_pic "vers27d2" vers27d2.c vers27d2 "" "" vers27b.ver vers27b.dsym ""
build_executable "vers27d3" vers27d3.c vers27d3 "vers27b.o vers27d2.so vers27d1.so" "" vers27b.ver vers27b.dsym "" build_executable "vers27d3" vers27d3.c vers27d3 "vers27b.o vers27d2.so vers27d1.so" "" vers27b.ver vers27b.dsym ""
build_vers_lib_pic "vers27d4" vers27d2.c vers27d4 "vers27a.so" "" vers27d4.ver vers27d4.dsym "" build_vers_lib_pic "vers27d4" vers27d2.c vers27d4 "vers27a.so" "" vers27d4.ver vers27d4.dsym ""
build_executable "vers27d5" vers27d3.c vers27d5 "vers27d4.so vers27b.o vers27a.so" "" vers27b.ver vers27b.dsym "" build_executable "vers27d5" vers27d3.c vers27d5 "vers27d4.so vers27b.o vers27a.so" "" vers27b.ver vers27b.dsym ""