aboutsummaryrefslogtreecommitdiff
path: root/libgcc/config
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2021-09-19 12:35:46 +0100
committerIain Sandoe <iain@sandoe.co.uk>2021-11-19 19:53:39 +0000
commitb9873b4e2c9a9955789318f4d550147ef9405b07 (patch)
treece8181c811d3611cb8161a971846345fc87053b5 /libgcc/config
parentc7b782d847d8682af9d5d91c0614a880cc2436f1 (diff)
downloadgcc-b9873b4e2c9a9955789318f4d550147ef9405b07.zip
gcc-b9873b4e2c9a9955789318f4d550147ef9405b07.tar.gz
gcc-b9873b4e2c9a9955789318f4d550147ef9405b07.tar.bz2
libgcc, emutls: Allow building weak definitions of the emutls functions.
In order to better support use of the emulated TLS between objects with DSO dependencies and static-linked libgcc, allow a target to make weak definitions. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> libgcc/ChangeLog: * config/t-darwin: Build weak-defined emutls objects. * emutls.c (__emutls_get_address): Add optional attributes. (__emutls_register_common): Likewise. (EMUTLS_ATTR): New.
Diffstat (limited to 'libgcc/config')
-rw-r--r--libgcc/config/t-darwin13
1 files changed, 13 insertions, 0 deletions
diff --git a/libgcc/config/t-darwin b/libgcc/config/t-darwin
index 14ae6b3..d6f688d 100644
--- a/libgcc/config/t-darwin
+++ b/libgcc/config/t-darwin
@@ -15,6 +15,19 @@ crttme.o: $(srcdir)/config/darwin-crt-tm.c
LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/config/unwind-dw2-fde-darwin.c \
$(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
+# Make emutls weak so that we can deal with -static-libgcc, override the
+# hidden visibility when this is present in libgcc_eh.
+emutls.o: HOST_LIBGCC2_CFLAGS += \
+ -DEMUTLS_ATTR='__attribute__((__weak__,__visibility__("default")))'
+emutls_s.o: HOST_LIBGCC2_CFLAGS += \
+ -DEMUTLS_ATTR='__attribute__((__weak__,__visibility__("default")))'
+
+# Make the emutls crt as a convenience lib so that it can be linked
+# optionally, use the shared version so that we can link with DSO.
+libemutls_w.a: emutls_s.o
+ $(AR_CREATE_FOR_TARGET) $@ $<
+ $(RANLIB_FOR_TARGET) $@
+
# 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 $<