aboutsummaryrefslogtreecommitdiffstats
path: root/libdl/Android.bp
blob: 8c6b47e69f0682eff5d872ee64fe5dd1ff486e54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
//
// libdl
//
cc_library {
    name: "libdl",

    defaults: ["linux_bionic_supported"],

    // NOTE: --exclude-libs=libgcc.a makes sure that any symbols libdl.so pulls from
    // libgcc.a are made static to libdl.so.  This in turn ensures that libraries that
    // a) pull symbols from libgcc.a and b) depend on libdl.so will not rely on libdl.so
    // to provide those symbols, but will instead pull them from libgcc.a.  Specifically,
    // we use this property to make sure libc.so has its own copy of the code from
    // libgcc.a it uses.
    //
    // DO NOT REMOVE --exclude-libs!

    ldflags: ["-Wl,--exclude-libs=libgcc.a"],

    // for x86, exclude libgcc_eh.a for the same reasons as above
    arch: {
        arm: {
            version_script: "libdl.arm.map",
            ldflags: ["-Wl,--hash-style=both"],
        },
        arm64: {
            version_script: "libdl.arm64.map",
        },
        mips: {
            version_script: "libdl.mips.map",
        },
        mips64: {
            version_script: "libdl.mips64.map",
        },
        x86: {
            ldflags: [
                "-Wl,--exclude-libs=libgcc_eh.a",
                "-Wl,--hash-style=both",
            ],
            version_script: "libdl.x86.map",
        },
        x86_64: {
            ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"],
            version_script: "libdl.x86_64.map",
        },
    },
    srcs: ["libdl.c", "libdl_cfi.cpp"],
    cflags: [
        "-Wall",
        "-Wextra",
        "-Wunused",
        "-Werror",
    ],
    stl: "none",

    // NOTE: libdl needs __aeabi_unwind_cpp_pr0 from libgcc.a but libgcc.a needs a
    // few symbols from libc. Using --no-undefined here results in having to link
    // against libc creating a circular dependency which is removed and we end up
    // with missing symbols. Since this library is just a bunch of stubs, we set
    // LOCAL_ALLOW_UNDEFINED_SYMBOLS to remove --no-undefined from the linker flags.
    allow_undefined_symbols: true,
    system_shared_libs: [],

    // For private/CFIShadow.h.
    include_dirs: ["bionic/libc"],

    // This is placeholder library the actual implementation is (currently)
    // provided by the linker.
    shared_libs: [ "ld-android" ],

    sanitize: {
        never: true,
    },
}

cc_library {
    // NOTE: --exclude-libs=libgcc.a makes sure that any symbols libdl.so pulls from
    // libgcc.a are made static to ld-android.so.  This in turn ensures that libraries that
    // a) pull symbols from libgcc.a and b) depend on ld-android.so will not rely on ld-android.so
    // to provide those symbols, but will instead pull them from libgcc.a.  Specifically,
    // we use this property to make sure libc.so has its own copy of the code from
    // libgcc.a it uses.
    //
    // DO NOT REMOVE --exclude-libs!

    ldflags: ["-Wl,--exclude-libs=libgcc.a"],

    // for x86, exclude libgcc_eh.a for the same reasons as above
    arch: {
        x86: {
            ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"],
        },
        x86_64: {
            ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"],
        },
    },
    srcs: ["ld_android.c"],
    cflags: [
        "-Wall",
        "-Wextra",
        "-Wunused",
        "-Werror",
    ],
    stl: "none",

    name: "ld-android",
    defaults: ["linux_bionic_supported"],

    // NOTE: libdl needs __aeabi_unwind_cpp_pr0 from libgcc.a but libgcc.a needs a
    // few symbols from libc. Using --no-undefined here results in having to link
    // against libc creating a circular dependency which is removed and we end up
    // with missing symbols. Since this library is just a bunch of stubs, we set
    // LOCAL_ALLOW_UNDEFINED_SYMBOLS to remove --no-undefined from the linker flags.
    allow_undefined_symbols: true,
    system_shared_libs: [],

    sanitize: {
        never: true,
    },
}

ndk_library {
    name: "libdl.ndk",
    symbol_file: "libdl.map.txt",
    first_version: "9",
}

llndk_library {
    name: "libdl.llndk",
    symbol_file: "libdl.map.txt",
}