]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Darwin, crts: Build Darwin10 unwinder shim as a library.
authorIain Sandoe <iain@sandoe.co.uk>
Sat, 18 Sep 2021 16:08:42 +0000 (17:08 +0100)
committerIain Sandoe <iain@sandoe.co.uk>
Sun, 29 May 2022 19:10:49 +0000 (20:10 +0100)
We have a small unwinder shim that is only used for Darwin10
(and only then in quite specific cases).  To avoid linking
this code for every executable or DSO, we can present the crt
as a convenience library (rather than a .o file).

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ChangeLog:

* config/darwin.h (LINK_COMMAND_SPEC_A): Use Darwin10
unwinder shim as a convenience library.

libgcc/ChangeLog:

* config.host: Use convenience library for Darwin10
unwinder shim.
* config/t-darwin: Build Darwin10 unwinder shim as a
convenience library.

(cherry picked from commit 873854387865d18484bd0d39324773cd1e76df85)

gcc/config/darwin.h
libgcc/config.host
libgcc/config/t-darwin

index 64f12d766259ea59303ef6342a79569960bb70c7..6bcd1d18ffcdd1b73e0120685a582036a2295315 100644 (file)
@@ -230,7 +230,7 @@ extern GTY(()) int darwin_ms_struct;
       %{%:sanitize(address): -lasan } \
       %{%:sanitize(undefined): -lubsan } \
       %(link_ssp) \
-      %:version-compare(>< 10.6 10.7 mmacosx-version-min= -ld10-uwfef.o) \
+      %:version-compare(>< 10.6 10.7 mmacosx-version-min= -ld10-uwfef) \
       %(link_gcc_c_sequence) \
     }}}\
     %{!nostdlib:%{!r:%{!nostartfiles:%E}}} %{T*} %{F*} "\
index ab58027e68e6d65dcced0ab18a1df4a16ba2cda8..324bbdacbecc53610badf21f209166aac0792636 100644 (file)
@@ -218,7 +218,7 @@ case ${host} in
 *-*-darwin*)
   asm_hidden_op=.private_extern
   tmake_file="$tmake_file t-darwin ${cpu_type}/t-darwin t-libgcc-pic t-slibgcc-darwin"
-  extra_parts="crt3.o d10-uwfef.o crttms.o crttme.o"
+  extra_parts="crt3.o libd10-uwfef.a crttms.o crttme.o"
   ;;
 *-*-dragonfly*)
   tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip"
index 3b5e342895815ba95caef0e77faec6934da5f852..4b6317b5d85a9e5ef38f84b95f17fdee60fec9e7 100644 (file)
@@ -18,3 +18,9 @@ LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/config/unwind-dw2-fde-darwin.c \
 # Patch to __Unwind_Find_Enclosing_Function for Darwin10.
 d10-uwfef.o: $(srcdir)/config/darwin10-unwind-find-enc-func.c
        $(crt_compile) -mmacosx-version-min=10.6 -c $<
+
+# Using this crt as a library means that it will not be added to an exe
+# (or module) unless needed.
+libd10-uwfef.a: d10-uwfef.o
+       $(AR_CREATE_FOR_TARGET) $@ d10-uwfef.o
+       $(RANLIB_FOR_TARGET) $@