diff --git a/ndk/build/toolchains/arm-eabi-4.2.1/setup.mk b/ndk/build/toolchains/arm-eabi-4.2.1/setup.mk index 4c10c07bd..f5ca8b45e 100644 --- a/ndk/build/toolchains/arm-eabi-4.2.1/setup.mk +++ b/ndk/build/toolchains/arm-eabi-4.2.1/setup.mk @@ -74,7 +74,7 @@ TARGET_AR := $(TOOLCHAIN_PREFIX)ar TARGET_ARFLAGS := crs TARGET_LIBGCC := $(shell $(TARGET_CC) -mthumb-interwork -print-libgcc-file-name) -TARGET_LDLIBS := -Wl,-rpath-link=$(SYSROOT)/usr/lib $(TARGET_LIBGCC) +TARGET_LDLIBS := -Wl,-rpath-link=$(SYSROOT)/usr/lib # These flags are used to ensure that a binary doesn't reference undefined # flags. @@ -84,6 +84,15 @@ TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined # this toolchain's generated binaries TARGET_ABI_SUBDIR := armeabi +# NOTE: Ensure that TARGET_LIBGCC is placed after all private objects +# and static libraries, but before any other library in the link +# command line when generating shared libraries and executables. +# +# This ensures that all libgcc.a functions required by the target +# will be included into it, instead of relying on what's available +# on other libraries like libc.so, which may change between system +# releases due to toolchain or library changes. +# define cmd-build-shared-library $(TARGET_CC) \ -nostdlib -Wl,-soname,$(notdir $@) \ @@ -93,6 +102,7 @@ $(TARGET_CC) \ $(PRIVATE_WHOLE_STATIC_LIBRARIES) \ -Wl,--no-whole-archive \ $(PRIVATE_STATIC_LIBRARIES) \ + $(TARGET_LIBGCC) \ $(PRIVATE_SHARED_LIBRARIES) \ $(PRIVATE_LDFLAGS) \ $(PRIVATE_LDLIBS) \ @@ -105,10 +115,11 @@ $(TARGET_CC) \ -Wl,-dynamic-linker,/system/bin/linker \ -Wl,--gc-sections \ -Wl,-z,nocopyreloc \ - $(PRIVATE_SHARED_LIBRARIES) \ $(TARGET_CRTBEGIN_DYNAMIC_O) \ $(PRIVATE_OBJECTS) \ $(PRIVATE_STATIC_LIBRARIES) \ + $(TARGET_LIBGCC) \ + $(PRIVATE_SHARED_LIBRARIES) \ $(PRIVATE_LDFLAGS) \ $(PRIVATE_LDLIBS) \ $(TARGET_CRTEND_O) \ diff --git a/ndk/docs/CHANGES.TXT b/ndk/docs/CHANGES.TXT index faad11db8..c03fc6093 100644 --- a/ndk/docs/CHANGES.TXT +++ b/ndk/docs/CHANGES.TXT @@ -1,5 +1,13 @@ Android NDK ChangeLog: +------------------------------------------------------------------------------- +current version + +IMPORTANT BUG FIXES: + +- Make target shared libraries portable to systems that don't use the exact same + toolchain (GCC 4.2.1) . + ------------------------------------------------------------------------------- android-ndk-1.6_r1 @@ -24,7 +32,7 @@ IMPORTANT BUG FIXES: in $(CLEAR_VARS) script. -IMPORTANT CHANGES +IMPORTANT CHANGES: - The 'sources' directory is gone. The NDK build system now looks for $(APP_PROJECT_PATH)/jni/Android.mk by default. You can override this with