aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Oliva <oliva@adacore.com>2024-01-29 15:08:35 -0300
committerAlexandre Oliva <oliva@gnu.org>2024-01-29 15:19:28 -0300
commit4bdcc8b3bf239c48140647c19d3addebc5d4b930 (patch)
treedbff2bc922ce9f30ca5701fc5711ecb71f30d670
parent2ddce884b0d4895758d988498739d6cc2d4e1ffd (diff)
downloadgcc-4bdcc8b3bf239c48140647c19d3addebc5d4b930.zip
gcc-4bdcc8b3bf239c48140647c19d3addebc5d4b930.tar.gz
gcc-4bdcc8b3bf239c48140647c19d3addebc5d4b930.tar.bz2
testsuite: require libc sym for -shared
Targets whose binutils support -shared, but that don't have a shared libc, and that can't add PDC (non-PIC) to shared libraries, may succeed at the effective target test for -shared, because it brings nothing from libc, but tests that rely on -shared and that use bits from libc, such as g++.dg/lto/pr108772, fail despite requiring the shared effective target. Extend the effective target test to bring malloc() from libc, that's likely to be present in libc and bring a substantial amount of code if no shared libc is available. for gcc/testsuite/ChangeLog * lib/target-supports.exp (check_effective_target_shared): Check for a static-only libc.
-rw-r--r--gcc/testsuite/lib/target-supports.exp10
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 994e83f..8ee082f 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -1391,10 +1391,16 @@ proc check_effective_target_aarch64_tlsle32 { } {
proc check_effective_target_shared { } {
# Note that M68K has a multilib that supports -fpic but not
# -fPIC, so we need to check both. We test with a program that
- # requires GOT references.
+ # requires GOT references, and with a libc symbol that would
+ # bring in significant parts of a static-only libc. Absent a
+ # shared libc, this would make -shared tests fail, so we don't
+ # want to enable the shared effective target then.
return [check_no_compiler_messages shared executable {
+ #include <stdlib.h>
extern int foo (void); extern int bar;
- int baz (void) { return foo () + bar; }
+ char *baz (void) {
+ return foo () + (char*) malloc (bar);
+ }
} "-shared -fpic"]
}