Android.mk revision efecfde19a1af5aacbd77a6124968df2d7a49a83
1LOCAL_PATH:= $(call my-dir)
2
3#
4# libdl
5#
6
7include $(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
18LOCAL_LDFLAGS := -Wl,--exclude-libs=libgcc.a
19
20# for x86, exclude libgcc_eh.a for the same reasons as above
21ifneq ($(TARGET_SIMULATOR),true)
22ifeq ($(TARGET_ARCH),x86)
23LOCAL_LDFLAGS += -Wl,--exclude-libs=libgcc_eh.a
24endif
25endif
26
27LOCAL_SRC_FILES:= libdl.c
28
29LOCAL_MODULE:= libdl
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.
36LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
37LOCAL_SYSTEM_SHARED_LIBRARIES := 
38
39ifeq ($(TARGET_ARCH),sh)
40# for SuperH, additional code is necessary to handle .ctors section.
41GEN_SOBEGIN := $(TARGET_OUT_STATIC_LIBRARIES)/sobegin.o
42$(GEN_SOBEGIN): $(LOCAL_PATH)/arch-sh/sobegin.S
43	@mkdir -p $(dir $@)
44	$(TARGET_CC) -o $@ -c $<
45
46GEN_SOEND := $(TARGET_OUT_STATIC_LIBRARIES)/soend.o
47$(GEN_SOEND): $(LOCAL_PATH)/arch-sh/soend.S
48	@mkdir -p $(dir $@)
49	$(TARGET_CC) -o $@ -c $<
50
51LOCAL_ADDITIONAL_DEPENDENCIES := $(GEN_SOBEGIN) $(GEN_SOEND)
52endif
53
54include $(BUILD_SHARED_LIBRARY)
55
56BUILD_DLTEST:=0
57ifeq ($(BUILD_DLTEST),1)
58
59#
60# dltest
61#
62
63include $(CLEAR_VARS)
64
65LOCAL_SRC_FILES:= dltest.c
66
67LOCAL_MODULE:= dltest 
68
69LOCAL_SHARED_LIBRARIES := libdl
70
71include $(BUILD_EXECUTABLE)
72
73endif
74