am e0b505d4: Merge change 1958 into donut
Merge commit 'e0b505d438fc72c6a092ca85cce434b54d033a27' * commit 'e0b505d438fc72c6a092ca85cce434b54d033a27': Force --no-undefined at link time to generate an error when trying to generate a shared library that references undefined symbols.
This commit is contained in:
committed by
The Android Open Source Project
commit
94970f09f3
@@ -54,6 +54,14 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
# If LOCAL_ALLOW_UNDEFINED_SYMBOLS, the linker will allow the generation
|
||||
# of a binary that uses undefined symbols.
|
||||
#
|
||||
ifeq ($(strip $(LOCAL_ALLOW_UNDEFINED_SYMBOLS)),)
|
||||
LOCAL_LDFLAGS := $(LOCAL_LDFLAGS) $($(my)NO_UNDEFINED_LDFLAGS)
|
||||
endif
|
||||
|
||||
#
|
||||
# The original Android build system allows you to use the .arm prefix
|
||||
# to a source file name to indicate that it should be defined in either
|
||||
|
||||
@@ -27,6 +27,7 @@ NDK_LOCAL_VARS := \
|
||||
LOCAL_STATIC_WHOLE_LIBRARIES \
|
||||
LOCAL_SHARED_LIBRARIES \
|
||||
LOCAL_MAKEFILE \
|
||||
LOCAL_NO_UNDEFINED_SYMBOLS \
|
||||
|
||||
$(call clear-vars, $(NDK_LOCAL_VARS))
|
||||
|
||||
|
||||
@@ -76,6 +76,10 @@ TARGET_ARFLAGS := crs
|
||||
TARGET_LIBGCC := $(shell $(TARGET_CC) -mthumb-interwork -print-libgcc-file-name)
|
||||
TARGET_LDLIBS := -Wl,-rpath-link=$(SYSROOT)/usr/lib $(TARGET_LIBGCC)
|
||||
|
||||
# These flags are used to ensure that a binary doesn't reference undefined
|
||||
# flags.
|
||||
TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
|
||||
|
||||
# The ABI-specific sub-directory that the SDK tools recognize for
|
||||
# this toolchain's generated binaries
|
||||
TARGET_ABI_SUBDIR := armeabi
|
||||
|
||||
@@ -352,3 +352,12 @@ LOCAL_SHARED_LIBRARIES
|
||||
Note that this does not append the listed modules to the build graph,
|
||||
i.e. you should still add them to your application's required modules
|
||||
in your Application.mk
|
||||
|
||||
LOCAL_ALLOW_UNDEFINED_SYMBOLS
|
||||
By default, any undefined reference encountered when trying to build
|
||||
a shared library will result in an "undefined symbol" error. This is a
|
||||
great help to catch bugs in your source code.
|
||||
|
||||
However, if for some reason you need to disable this check, set this
|
||||
variable to 'true'. Note that the corresponding shared library may fail
|
||||
to load at runtime.
|
||||
|
||||
Reference in New Issue
Block a user