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

commit r14-10702-gb292b6b9e104c2418b4b19c8495fef9effe9369f
Author: Iain Sandoe <i...@sandoe.co.uk>
Date:   Mon Aug 5 13:19:28 2024 +0100

    Darwin: Recognise -weak_framework in the driver [PR116237].
    
    XCode compilers recognise the weak_framework linker option in the driver
    and forward it.  This patch makes GCC adopt the same behaviour.
    
            PR target/116237
    
    gcc/ChangeLog:
    
            * config/darwin.h (SUBTARGET_DRIVER_SELF_SPECS): Add a spec for
            weak_framework.
            * config/darwin.opt: Handle weak_framework driver option.
    
    Signed-off-by: Iain Sandoe <i...@sandoe.co.uk>
    (cherry picked from commit 4cec7bc79db52bae159c3c60a415e2aea48051d8)

Diff:
---
 gcc/config/darwin.h   | 2 ++
 gcc/config/darwin.opt | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index c09b9e9dc94d..377599074a75 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -264,6 +264,8 @@ extern GTY(()) int darwin_ms_struct;
   "%{weak_reference_mismatches*:\
     -Xlinker -weak_reference_mismatches -Xlinker %*} \
     %<weak_reference_mismatches*",                                     \
+  "%{weak_framework*: -Xlinker -weak_framework -Xlinker %*} \
+    %<weak_framework*",                                                        
\
   "%{whyload:-Xlinker -whyload} %<whyload",                            \
   "%{whatsloaded:-Xlinker -whatsloaded} %<whatsloaded",                        
\
   "%{w:-Xlinker -w}",                                                  \
diff --git a/gcc/config/darwin.opt b/gcc/config/darwin.opt
index 307a760629ba..114048045b90 100644
--- a/gcc/config/darwin.opt
+++ b/gcc/config/darwin.opt
@@ -381,6 +381,10 @@ unexported_symbols_list
 Driver RejectNegative Separate
 -unexported_symbols_list <filename>    Do not export the global symbols listed 
in <filename>.
 
+weak_framework
+Driver RejectNegative Separate
+-weak_framework <framework>    Make a weak link to the specified framework.
+
 weak_reference_mismatches
 Driver RejectNegative Separate
 -weak_reference_mismatches <treatment> Specifies what to do if a symbol import 
conflicts between file (weak in one and not in another) the default is to treat 
the symbol as non-weak.

Reply via email to