From 808ff3714e43cf363399d7ec090dee2b204e9a47 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Thu, 22 Aug 2019 14:21:30 +0200 Subject: [PATCH] rust: don't export cxx syms from libunwind-rust --- repos/libports/lib/mk/libunwind-rust.mk | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/repos/libports/lib/mk/libunwind-rust.mk b/repos/libports/lib/mk/libunwind-rust.mk index 378c91b9e..8de4f392f 100644 --- a/repos/libports/lib/mk/libunwind-rust.mk +++ b/repos/libports/lib/mk/libunwind-rust.mk @@ -3,3 +3,19 @@ LIBS = libcore-rust vpath % $(REP_DIR)/src/lib/rust/libunwind CC_CXX_WARN_STRICT = + +# +# libunwind contains the public symbol '_Unwind_Resume', which clashes with +# the symbol provided by the cxx library. The aliasing can lead to unexpected +# symbol resolutions by the dynamic linker at runtime, i.e., a C++ exception +# thrown in the libc ending up in the '_Unwind_Resume' code of libunwind-rust. +# +# This rule solves this uncertainty by making the symbol private to the +# libunwind library. +# +ifeq ($(called_from_lib_mk),yes) +$(LIB).lib.a: hide_cxx_symbols +hide_cxx_symbols: lib.o + $(VERBOSE)cp $< $<.tmp + $(VERBOSE)$(OBJCOPY) --localize-symbol=_Unwind_Resume $<.tmp $< +endif