1 LOCAL_PATH:= $(call my-dir) 2 3 # 4 # libdl 5 # 6 7 include $(CLEAR_VARS) 8 9 # NOTE: --exclude-libs=libgcc.a makes sure that any symbols libdl.so pulls from 10 # libgcc.a are made static to libdl.so. This in turn ensures that libraries that 11 # a) pull symbols from libgcc.a and b) depend on libdl.so will not rely on libdl.so 12 # to provide those symbols, but will instead pull them from libgcc.a. Specifically, 13 # we use this property to make sure libc.so has its own copy of the code from 14 # libgcc.a it uses. 15 # 16 # DO NOT REMOVE --exclude-libs! 17 18 LOCAL_LDFLAGS := -Wl,--exclude-libs=libgcc.a 19 20 # for x86, exclude libgcc_eh.a for the same reasons as above 21 LOCAL_LDFLAGS_x86 := -Wl,--exclude-libs=libgcc_eh.a 22 LOCAL_LDFLAGS_x86_64 := $(LOCAL_LDFLAGS_x86) 23 24 LOCAL_LDFLAGS_arm += -Wl,--version-script=$(LOCAL_PATH)/libdl.arm.map 25 LOCAL_LDFLAGS_arm64 += -Wl,--version-script=$(LOCAL_PATH)/libdl.arm64.map 26 LOCAL_LDFLAGS_mips += -Wl,--version-script=$(LOCAL_PATH)/libdl.mips.map 27 LOCAL_LDFLAGS_mips64 += -Wl,--version-script=$(LOCAL_PATH)/libdl.mips64.map 28 LOCAL_LDFLAGS_x86 += -Wl,--version-script=$(LOCAL_PATH)/libdl.x86.map 29 LOCAL_LDFLAGS_x86_64 += -Wl,--version-script=$(LOCAL_PATH)/libdl.x86_64.map 30 31 LOCAL_SRC_FILES:= libdl.c 32 LOCAL_CFLAGS := -Wall -Wextra -Wunused -Werror 33 LOCAL_CXX_STL := none 34 35 LOCAL_MODULE := libdl 36 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk \ 37 $(LOCAL_PATH)/libdl.arm.map \ 38 $(LOCAL_PATH)/libdl.arm64.map \ 39 $(LOCAL_PATH)/libdl.mips.map \ 40 $(LOCAL_PATH)/libdl.mips64.map \ 41 $(LOCAL_PATH)/libdl.x86.map \ 42 $(LOCAL_PATH)/libdl.x86_64.map \ 43 44 # NOTE: libdl needs __aeabi_unwind_cpp_pr0 from libgcc.a but libgcc.a needs a 45 # few symbols from libc. Using --no-undefined here results in having to link 46 # against libc creating a circular dependency which is removed and we end up 47 # with missing symbols. Since this library is just a bunch of stubs, we set 48 # LOCAL_ALLOW_UNDEFINED_SYMBOLS to remove --no-undefined from the linker flags. 49 LOCAL_ALLOW_UNDEFINED_SYMBOLS := true 50 LOCAL_SYSTEM_SHARED_LIBRARIES := 51 52 LOCAL_SANITIZE := never 53 include $(BUILD_SHARED_LIBRARY) 54 55 # A dummy libdl.a. Need for static executables using the LLVM unwinder. Most 56 # functions default to failure, others use a sensible default (dl_iterate_phdr() 57 # returns 0, as would happen if the user iterated over every phdr). 58 include $(CLEAR_VARS) 59 LOCAL_SRC_FILES:= libdl.c 60 LOCAL_CFLAGS := -Wall -Wextra -Wunused -Werror 61 LOCAL_CXX_STL := none 62 63 LOCAL_MODULE := libdl 64 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 65 LOCAL_SANITIZE := never 66 include $(BUILD_STATIC_LIBRARY) 67