]> gcc.gnu.org Git - gcc.git/commitdiff
testsuite, Darwin: Allow for undefined symbols in shared test.
authorIain Sandoe <iain@sandoe.co.uk>
Mon, 29 Jan 2024 10:09:25 +0000 (10:09 +0000)
committerIain Sandoe <iain@sandoe.co.uk>
Mon, 29 Apr 2024 07:04:48 +0000 (08:04 +0100)
Darwin's linker defaults to error on undefined (which makes it look as
if we do not support shared, leading to tests being marked incorrectly
as unsupported).

This fixes the issue by allowing the symbols used in the target
supports test to be undefined.

includes 0ed6e5b4820e01fa86b48a7b1d62f752ec97ea41.

gcc/testsuite/ChangeLog:

* lib/target-supports.exp (check_effective_target_shared):
Allow the external symbols referenced in the test to be undefined.

(cherry picked from commit 639bd5e9b759a6d733fadbd5f956889d965e9368)

Co-authored-by: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
gcc/testsuite/lib/target-supports.exp

index 876b972a433b369292cc3d89c2d537c1caea8412..a059a8002981dfa541f0e921b30fc03aa9684128 100644 (file)
@@ -1265,13 +1265,20 @@ proc check_effective_target_aarch64_tlsle32 { } {
 # emitted, 0 otherwise.
 
 proc check_effective_target_shared { } {
+    # Darwin's linker defaults to error on undefined (which makes it look as
+    # if we do not support shared) but we can tell it to allow the symbols used
+    # here to be undefined.
+    set extra_flags ""
+    if { [istarget *-*-darwin\[912\]*] } {
+      set extra_flags "-Wl,-U,_foo,-U,_bar,-U,__Z3foov"
+    }
     # 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.
     return [check_no_compiler_messages shared executable {
        extern int foo (void); extern int bar;
        int baz (void) { return foo () + bar; }
-    } "-shared -fpic"]
+    } "-shared -fpic $extra_flags"]
 }
 
 # Return 1 if -pie, -fpie and -fPIE are supported, 0 otherwise.
This page took 0.072947 seconds and 5 git commands to generate.