diff options
author | Dan Albert <danalbert@google.com> | 2015-03-03 14:10:27 -0800 |
---|---|---|
committer | Dan Albert <danalbert@google.com> | 2015-03-03 15:08:11 -0800 |
commit | 8bf4cc97c2557973cc3530aac593b8660bb0e25e (patch) | |
tree | 85f845c0b45dd1ccc5827a6930a4bf31c35a477c /core/cxx_stl_setup.mk | |
parent | 6492792d8a30f218fff6d54765ba5502de0a9a2a (diff) | |
download | build-8bf4cc97c2557973cc3530aac593b8660bb0e25e.zip build-8bf4cc97c2557973cc3530aac593b8660bb0e25e.tar.gz build-8bf4cc97c2557973cc3530aac593b8660bb0e25e.tar.bz2 |
Fix building static host executables.
BUILD_HOST_static=1 forces all host binaries to be statically linked.
Since -nodefaultlibs was passed (to disable libstdc++), libgcc wasn't
being passed. This change emulates the driver's behavior.
Also fix default STL selection for BUILD_HOST_static.
Bug: 19567451
Change-Id: I617aab782d40ac76ca5a7d9dddf0f202a4e3a69b
Diffstat (limited to 'core/cxx_stl_setup.mk')
-rw-r--r-- | core/cxx_stl_setup.mk | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/core/cxx_stl_setup.mk b/core/cxx_stl_setup.mk index 0f574d2..c1ce6e1 100644 --- a/core/cxx_stl_setup.mk +++ b/core/cxx_stl_setup.mk @@ -10,6 +10,11 @@ ifeq ($(strip $(LOCAL_CXX_STL)),default) # Platform code. Select the appropriate STL. ifndef USE_MINGW my_cxx_stl := libc++ + ifdef LOCAL_IS_HOST_MODULE + ifneq (,$(BUILD_HOST_static)) + my_cxx_stl := libc++_static + endif + endif else # libc++ is not supported on mingw. my_cxx_stl := libstdc++ @@ -33,7 +38,8 @@ ifneq ($(filter $(my_cxx_stl),libc++ libc++_static),) ifdef LOCAL_IS_HOST_MODULE my_cppflags += -nostdinc++ my_ldflags += -nodefaultlibs - my_ldlibs += -lc -lm -lpthread + my_ldlibs += -lpthread -lm + my_ldlibs += -Wl,--start-group -lgcc -lgcc_eh -lc -Wl,--end-group endif else ifneq ($(filter $(my_cxx_stl),stlport stlport_static),) ifndef LOCAL_IS_HOST_MODULE @@ -61,7 +67,8 @@ else ifeq ($(my_cxx_stl),libstdc++) else ifeq ($(my_cxx_stl),none) ifdef LOCAL_IS_HOST_MODULE my_cppflags += -nostdinc++ - my_ldflags += -nodefaultlibs -lc -lm + my_ldflags += -nodefaultlibs + my_ldlibs += -lm -Wl,--start-group -lgcc -lgcc_eh -lc -Wl,--end-group endif else $(error $(my_cxx_stl) is not a supported STL.) |