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 $<
void **data[];
};
+/* EMUTLS_ATTR is provided to allow targets to build the emulated tls
+ routines as weak definitions, for example.
+ If there is no definition, fall back to the default. */
+#ifndef EMUTLS_ATTR
+# define EMUTLS_ATTR
+#endif
+
+EMUTLS_ATTR
void *__emutls_get_address (struct __emutls_object *);
+EMUTLS_ATTR
void __emutls_register_common (struct __emutls_object *, word, word, void *);
#ifdef __GTHREADS
return ret;
}
-void *
+/* Despite applying the attribute to the declaration, in this case the mis-
+ match between the builtin's declaration [void * (*)(void *)] and the
+ implementation here, causes the decl. attributes to be discarded. */
+
+EMUTLS_ATTR void *
__emutls_get_address (struct __emutls_object *obj)
{
if (! __gthread_active_p ())
#endif
}
-void
+EMUTLS_ATTR void
__emutls_register_common (struct __emutls_object *obj,
word size, word align, void *templ)
{