1//
2// libdl
3//
4cc_library {
5
6    // NOTE: --exclude-libs=libgcc.a makes sure that any symbols libdl.so pulls from
7    // libgcc.a are made static to libdl.so.  This in turn ensures that libraries that
8    // a) pull symbols from libgcc.a and b) depend on libdl.so will not rely on libdl.so
9    // to provide those symbols, but will instead pull them from libgcc.a.  Specifically,
10    // we use this property to make sure libc.so has its own copy of the code from
11    // libgcc.a it uses.
12    //
13    // DO NOT REMOVE --exclude-libs!
14
15    ldflags: ["-Wl,--exclude-libs=libgcc.a"],
16
17    // for x86, exclude libgcc_eh.a for the same reasons as above
18    arch: {
19        arm: {
20            version_script: "libdl.arm.map",
21        },
22        arm64: {
23            version_script: "libdl.arm64.map",
24        },
25        mips: {
26            version_script: "libdl.mips.map",
27        },
28        mips64: {
29            version_script: "libdl.mips64.map",
30        },
31        x86: {
32            ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"],
33            version_script: "libdl.x86.map",
34        },
35        x86_64: {
36            ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"],
37            version_script: "libdl.x86_64.map",
38        },
39    },
40    srcs: ["libdl.c"],
41    cflags: [
42        "-Wall",
43        "-Wextra",
44        "-Wunused",
45        "-Werror",
46    ],
47    stl: "none",
48
49    name: "libdl",
50
51    // NOTE: libdl needs __aeabi_unwind_cpp_pr0 from libgcc.a but libgcc.a needs a
52    // few symbols from libc. Using --no-undefined here results in having to link
53    // against libc creating a circular dependency which is removed and we end up
54    // with missing symbols. Since this library is just a bunch of stubs, we set
55    // LOCAL_ALLOW_UNDEFINED_SYMBOLS to remove --no-undefined from the linker flags.
56    allow_undefined_symbols: true,
57    system_shared_libs: [],
58
59    sanitize: ["never"],
60}
61