<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">From 50dfab039ed7a308a248179a0ddc87227d83dc48 Mon Sep 17 00:00:00 2001
From: Iain Sandoe &lt;iain@sandoe.co.uk&gt;
Date: Mon, 5 Aug 2024 13:19:28 +0100
Subject: [PATCH 1/6] 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 &lt;iain@sandoe.co.uk&gt;
(cherry picked from commit 4cec7bc79db52bae159c3c60a415e2aea48051d8)
---
 gcc/config/darwin.h   | 2 ++
 gcc/config/darwin.opt | 4 ++++
 2 files changed, 6 insertions(+)

diff --git gcc/config/darwin.h gcc/config/darwin.h
index fcf9eff27d3c..5fd52f2cc0d2 100644
--- gcc/config/darwin.h
+++ gcc/config/darwin.h
@@ -265,6 +265,8 @@ extern GTY(()) int darwin_ms_struct;
   "%{weak_reference_mismatches*:\
     -Xlinker -weak_reference_mismatches -Xlinker %*} \
     %&lt;weak_reference_mismatches*",					\
+  "%{weak_framework*: -Xlinker -weak_framework -Xlinker %*} \
+    %&lt;weak_framework*",							\
   "%{whyload:-Xlinker -whyload} %&lt;whyload",				\
   "%{whatsloaded:-Xlinker -whatsloaded} %&lt;whatsloaded",			\
   "%{w:-Xlinker -w}",							\
diff --git gcc/config/darwin.opt gcc/config/darwin.opt
index 97b1a7479185..501a53b349ec 100644
--- gcc/config/darwin.opt
+++ gcc/config/darwin.opt
@@ -385,6 +385,10 @@ unexported_symbols_list
 Driver RejectNegative Separate
 -unexported_symbols_list &lt;filename&gt;	Do not export the global symbols listed in &lt;filename&gt;.
 
+weak_framework
+Driver RejectNegative Separate
+-weak_framework &lt;framework&gt;	Make a weak link to the specified framework.
+
 weak_reference_mismatches
 Driver RejectNegative Separate
 -weak_reference_mismatches &lt;treatment&gt;	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.
-- 
2.47.0

</pre></body></html>