• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//
2// libdl
3//
4package {
5    default_applicable_licenses: ["bionic_libdl_license"],
6}
7
8license {
9    name: "bionic_libdl_license",
10    visibility: [":__subpackages__"],
11    license_kinds: [
12        "SPDX-license-identifier-Apache-2.0",
13    ],
14    license_text: [
15        "NOTICE",
16    ],
17}
18
19cc_library_static {
20    name: "libdl_static",
21    defaults: ["linux_bionic_supported"],
22    ramdisk_available: true,
23    vendor_ramdisk_available: true,
24    recovery_available: true,
25    native_bridge_supported: true,
26
27    srcs: [
28        "libdl.cpp",
29        "libdl_cfi.cpp",
30    ],
31
32    cflags: [
33        "-Wall",
34        "-Wextra",
35        "-Wunused",
36        "-Werror",
37    ],
38
39    // For private/CFIShadow.h.
40    include_dirs: ["bionic/libc"],
41
42    stl: "none",
43    system_shared_libs: [],
44    header_libs: ["libc_headers"],
45    export_header_lib_headers: ["libc_headers"],
46
47    sanitize: {
48        never: true,
49    },
50}
51
52cc_library {
53    name: "libdl",
54    ramdisk_available: true,
55    vendor_ramdisk_available: true,
56    recovery_available: true,
57    native_bridge_supported: true,
58    static_ndk_lib: true,
59
60    defaults: ["linux_bionic_supported"],
61
62    // NOTE: --exclude-libs=libgcc.a makes sure that any symbols libdl.so pulls from
63    // libgcc.a are made static to libdl.so.  This in turn ensures that libraries that
64    // a) pull symbols from libgcc.a and b) depend on libdl.so will not rely on libdl.so
65    // to provide those symbols, but will instead pull them from libgcc.a.  Specifically,
66    // we use this property to make sure libc.so has its own copy of the code from
67    // libgcc.a it uses.
68    //
69    // DO NOT REMOVE --exclude-libs!
70
71    ldflags: [
72        "-Wl,--exclude-libs=libgcc.a",
73        "-Wl,--exclude-libs=libgcc_stripped.a",
74        "-Wl,--exclude-libs=libclang_rt.builtins-arm-android.a",
75        "-Wl,--exclude-libs=libclang_rt.builtins-aarch64-android.a",
76        "-Wl,--exclude-libs=libclang_rt.builtins-i686-android.a",
77        "-Wl,--exclude-libs=libclang_rt.builtins-x86_64-android.a",
78    ],
79
80    // for x86, exclude libgcc_eh.a for the same reasons as above
81    arch: {
82        arm: {
83            version_script: ":libdl.arm.map",
84            pack_relocations: false,
85            ldflags: ["-Wl,--hash-style=both"],
86        },
87        arm64: {
88            version_script: ":libdl.arm64.map",
89        },
90        x86: {
91            pack_relocations: false,
92            ldflags: [
93                "-Wl,--exclude-libs=libgcc_eh.a",
94                "-Wl,--hash-style=both",
95            ],
96            version_script: ":libdl.x86.map",
97        },
98        x86_64: {
99            ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"],
100            version_script: ":libdl.x86_64.map",
101        },
102    },
103    shared: {
104        whole_static_libs: ["libdl_static"],
105    },
106    static: {
107        srcs: ["libdl_static.cpp"],
108    },
109    cflags: [
110        "-Wall",
111        "-Wextra",
112        "-Wunused",
113        "-Werror",
114    ],
115    stl: "none",
116
117    nocrt: true,
118    system_shared_libs: [],
119    header_libs: ["libc_headers"],
120
121    // Opt out of native_coverage when opting out of system_shared_libs
122    native_coverage: false,
123
124    // This is placeholder library the actual implementation is (currently)
125    // provided by the linker.
126    shared_libs: ["ld-android"],
127
128    sanitize: {
129        never: true,
130    },
131
132    stubs: {
133        symbol_file: "libdl.map.txt",
134        versions: [
135            "29",
136            "current",
137        ],
138    },
139    llndk: {
140        symbol_file: "libdl.map.txt",
141    },
142
143    apex_available: [
144        "//apex_available:platform",
145        "com.android.runtime",
146    ],
147
148    lto: {
149        never: true,
150    },
151}
152
153cc_library {
154    name: "libdl_android",
155
156    defaults: ["linux_bionic_supported"],
157    ramdisk_available: true,
158    vendor_ramdisk_available: true,
159    recovery_available: true,
160    native_bridge_supported: true,
161
162    // NOTE: --exclude-libs=libgcc.a makes sure that any symbols libdl.so pulls from
163    // libgcc.a are made static to libdl.so.  This in turn ensures that libraries that
164    // a) pull symbols from libgcc.a and b) depend on libdl.so will not rely on libdl.so
165    // to provide those symbols, but will instead pull them from libgcc.a.  Specifically,
166    // we use this property to make sure libc.so has its own copy of the code from
167    // libgcc.a it uses.
168    //
169    // DO NOT REMOVE --exclude-libs!
170
171    ldflags: [
172        "-Wl,--exclude-libs=libgcc.a",
173        "-Wl,--exclude-libs=libgcc_stripped.a",
174        "-Wl,--exclude-libs=libclang_rt.builtins-arm-android.a",
175        "-Wl,--exclude-libs=libclang_rt.builtins-aarch64-android.a",
176        "-Wl,--exclude-libs=libclang_rt.builtins-i686-android.a",
177        "-Wl,--exclude-libs=libclang_rt.builtins-x86_64-android.a",
178    ],
179
180    // for x86, exclude libgcc_eh.a for the same reasons as above
181    arch: {
182        x86: {
183            ldflags: [
184                "-Wl,--exclude-libs=libgcc_eh.a",
185            ],
186        },
187        x86_64: {
188            ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"],
189        },
190    },
191
192    srcs: [ "libdl_android.cpp" ],
193    version_script: "libdl_android.map.txt",
194
195    cflags: [
196        "-Wall",
197        "-Wextra",
198        "-Wunused",
199        "-Werror",
200    ],
201
202    stl: "none",
203
204    nocrt: true,
205    system_shared_libs: [],
206    header_libs: ["libc_headers"],
207
208    // Opt out of native_coverage when opting out of system_shared_libs
209    native_coverage: false,
210
211    // This is placeholder library the actual implementation is (currently)
212    // provided by the linker.
213    shared_libs: ["ld-android"],
214
215    sanitize: {
216        never: true,
217    },
218
219    stubs: {
220        symbol_file: "libdl_android.map.txt",
221        versions: ["current"],
222    },
223
224    apex_available: [
225        "//apex_available:platform",
226        "com.android.runtime",
227    ],
228
229    lto: {
230        never: true,
231    },
232}
233
234ndk_library {
235    name: "libdl",
236    symbol_file: "libdl.map.txt",
237    first_version: "9",
238}
239
240genrule {
241    name: "libdl.arm.map",
242    out: ["libdl.arm.map"],
243    srcs: ["libdl.map.txt"],
244    tool_files: [":bionic-generate-version-script"],
245    cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
246}
247
248genrule {
249    name: "libdl.arm64.map",
250    out: ["libdl.arm64.map"],
251    srcs: ["libdl.map.txt"],
252    tool_files: [":bionic-generate-version-script"],
253    cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
254}
255
256genrule {
257    name: "libdl.x86.map",
258    out: ["libdl.x86.map"],
259    srcs: ["libdl.map.txt"],
260    tool_files: [":bionic-generate-version-script"],
261    cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
262}
263
264genrule {
265    name: "libdl.x86_64.map",
266    out: ["libdl.x86_64.map"],
267    srcs: ["libdl.map.txt"],
268    tool_files: [":bionic-generate-version-script"],
269    cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
270}
271