From fd244cdff94e64c1cb9d660f37606762434c4b40 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ji=C5=99=C3=AD=20Z=C3=A1rev=C3=BAcky?= Date: Sat, 22 Jun 2019 19:22:08 +0200 Subject: [PATCH] Enable building libcpp as shared library --- uspace/Makefile.common | 7 ++++--- uspace/lib/cpp/Makefile | 1 + uspace/lib/cpp/src/__bits/runtime.cpp | 7 +++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/uspace/Makefile.common b/uspace/Makefile.common index e5a00974e..7ce972437 100644 --- a/uspace/Makefile.common +++ b/uspace/Makefile.common @@ -295,6 +295,7 @@ ifeq ($(CONFIG_STRIP_BINARIES),y) endif LIB_CFLAGS = $(CFLAGS) -fPIC +LIB_CXXFLAGS = $(CXXFLAGS) -fPIC LIB_LDFLAGS = $(LDFLAGS) -shared -Wl,-soname,$(LSONAME) -Wl,--no-undefined,--no-allow-shlib-undefined AS_CFLAGS := $(addprefix -Xassembler ,$(AFLAGS)) @@ -414,12 +415,12 @@ endif $(CC_JOB) -c -MD -MP $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) %.lo: %.cpp | depend - $(CXX_JOB) -c -MD -MP $(DEFS) $(CXXFLAGS) $(EXTRA_CXXFLAGS) + $(CXX_JOB) -c -MD -MP $(DEFS) $(LIB_CXXFLAGS) $(EXTRA_CXXFLAGS) %.lo: %.cxx | depend - $(CXX_JOB) -c -MD -MP $(DEFS) $(CXXFLAGS) $(EXTRA_CXXFLAGS) + $(CXX_JOB) -c -MD -MP $(DEFS) $(LIB_CXXFLAGS) $(EXTRA_CXXFLAGS) %.lo: %.cc | depend - $(CXX_JOB) -c -MD -MP $(DEFS) $(CXXFLAGS) $(EXTRA_CXXFLAGS) + $(CXX_JOB) -c -MD -MP $(DEFS) $(LIB_CXXFLAGS) $(EXTRA_CXXFLAGS) -include $(DEPENDS) diff --git a/uspace/lib/cpp/Makefile b/uspace/lib/cpp/Makefile index 67ce67db3..06c640e12 100644 --- a/uspace/lib/cpp/Makefile +++ b/uspace/lib/cpp/Makefile @@ -32,6 +32,7 @@ ROOT_PATH = $(USPACE_PREFIX)/.. CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config LIBRARY = libcpp +SOVERSION = 0.0 -include $(CONFIG_MAKEFILE) diff --git a/uspace/lib/cpp/src/__bits/runtime.cpp b/uspace/lib/cpp/src/__bits/runtime.cpp index 047942d31..26c0cd630 100644 --- a/uspace/lib/cpp/src/__bits/runtime.cpp +++ b/uspace/lib/cpp/src/__bits/runtime.cpp @@ -69,6 +69,13 @@ namespace __cxxabiv1 std::terminate(); } +#ifdef PLATFORM_arm32 + extern "C" int __aeabi_atexit(void* p, void (*f)(void*), void* d) + { + return __cxa_atexit(f, p, d); + } +#endif + extern "C" int __cxa_atexit(void (*f)(void*), void* p, void* d) { if (!aux::destructors) -- 2.11.4.GIT