public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Iain D Sandoe <iains@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-10360] testsuite, Darwin: Allow for undefined symbols in shared test.
Date: Sat, 20 Apr 2024 14:46:11 +0000 (GMT)	[thread overview]
Message-ID: <20240420144611.93F563858D37@sourceware.org> (raw)

https://gcc.gnu.org/g:edc5acccf94e521c126b4d3b3b49287ceb8cd841

commit r12-10360-gedc5acccf94e521c126b4d3b3b49287ceb8cd841
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Mon Jan 29 10:09:25 2024 +0000

    testsuite, Darwin: Allow for undefined symbols in shared test.
    
    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 commit 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>

Diff:
---
 gcc/testsuite/lib/target-supports.exp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index e0076ed8f69..64216dfbdb2 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -1258,13 +1258,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.

                 reply	other threads:[~2024-04-20 14:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240420144611.93F563858D37@sourceware.org \
    --to=iains@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).