The Android Open Source Project | a27d2ba | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1 | LOCAL_PATH:= $(call my-dir) |
| 2 | |
| 3 | # |
| 4 | # libdl |
| 5 | # |
| 6 | |
| 7 | include $(CLEAR_VARS) |
| 8 | |
Elliott Hughes | ae5c644 | 2012-08-13 14:06:05 -0700 | [diff] [blame] | 9 | # NOTE: --exclude-libs=libgcc.a makes sure that any symbols libdl.so pulls from |
The Android Open Source Project | a27d2ba | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 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, |
Elliott Hughes | ae5c644 | 2012-08-13 14:06:05 -0700 | [diff] [blame] | 13 | # we use this property to make sure libc.so has its own copy of the code from |
The Android Open Source Project | a27d2ba | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 14 | # libgcc.a it uses. |
| 15 | # |
| 16 | # DO NOT REMOVE --exclude-libs! |
| 17 | |
Dmitriy Ivanov | 79fd668 | 2015-05-21 17:43:49 -0700 | [diff] [blame] | 18 | LOCAL_LDFLAGS := -Wl,--exclude-libs=libgcc.a -Wl,--version-script=$(LOCAL_PATH)/libdl.map |
The Android Open Source Project | 4e468ed | 2008-12-17 18:03:48 -0800 | [diff] [blame] | 19 | |
| 20 | # for x86, exclude libgcc_eh.a for the same reasons as above |
Ying Wang | 1682c63 | 2014-01-23 15:15:28 -0800 | [diff] [blame] | 21 | LOCAL_LDFLAGS_x86 := -Wl,--exclude-libs=libgcc_eh.a |
| 22 | LOCAL_LDFLAGS_x86_64 := $(LOCAL_LDFLAGS_x86) |
The Android Open Source Project | 4e468ed | 2008-12-17 18:03:48 -0800 | [diff] [blame] | 23 | |
The Android Open Source Project | a27d2ba | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 24 | LOCAL_SRC_FILES:= libdl.c |
Elliott Hughes | d286796 | 2014-06-03 15:22:34 -0700 | [diff] [blame] | 25 | LOCAL_CFLAGS := -Wall -Wextra -Wunused -Werror |
Dan Albert | 3ec67de | 2014-09-16 10:10:25 -0700 | [diff] [blame] | 26 | LOCAL_CXX_STL := none |
The Android Open Source Project | a27d2ba | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 27 | |
Elliott Hughes | 7ac9751 | 2014-01-14 17:25:13 -0800 | [diff] [blame] | 28 | LOCAL_MODULE := libdl |
Elliott Hughes | ae5c644 | 2012-08-13 14:06:05 -0700 | [diff] [blame] | 29 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
The Android Open Source Project | a27d2ba | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 30 | |
| 31 | # NOTE: libdl needs __aeabi_unwind_cpp_pr0 from libgcc.a but libgcc.a needs a |
| 32 | # few symbols from libc. Using --no-undefined here results in having to link |
| 33 | # against libc creating a circular dependency which is removed and we end up |
| 34 | # with missing symbols. Since this library is just a bunch of stubs, we set |
| 35 | # LOCAL_ALLOW_UNDEFINED_SYMBOLS to remove --no-undefined from the linker flags. |
| 36 | LOCAL_ALLOW_UNDEFINED_SYMBOLS := true |
Elliott Hughes | ae5c644 | 2012-08-13 14:06:05 -0700 | [diff] [blame] | 37 | LOCAL_SYSTEM_SHARED_LIBRARIES := |
The Android Open Source Project | a27d2ba | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 38 | |
Dan Albert | 11ea08c | 2015-06-16 13:57:54 -0700 | [diff] [blame] | 39 | LOCAL_SANITIZE := never |
The Android Open Source Project | a27d2ba | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 40 | include $(BUILD_SHARED_LIBRARY) |
Dan Albert | a4ed64d | 2014-09-26 15:23:07 -0700 | [diff] [blame] | 41 | |
| 42 | # A dummy libdl.a. Need for static executables using the LLVM unwinder. Most |
| 43 | # functions default to failure, others use a sensible default (dl_iterate_phdr() |
| 44 | # returns 0, as would happen if the user iterated over every phdr). |
| 45 | include $(CLEAR_VARS) |
| 46 | LOCAL_SRC_FILES:= libdl.c |
| 47 | LOCAL_CFLAGS := -Wall -Wextra -Wunused -Werror |
| 48 | LOCAL_CXX_STL := none |
| 49 | |
| 50 | LOCAL_MODULE := libdl |
| 51 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Dan Albert | 11ea08c | 2015-06-16 13:57:54 -0700 | [diff] [blame] | 52 | LOCAL_SANITIZE := never |
Dan Albert | a4ed64d | 2014-09-26 15:23:07 -0700 | [diff] [blame] | 53 | include $(BUILD_STATIC_LIBRARY) |