| Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 1 | // | 
|  | 2 | // libdl | 
|  | 3 | // | 
|  | 4 | cc_library { | 
| Dan Willemsen | 7ec52b1 | 2016-11-28 17:02:25 -0800 | [diff] [blame] | 5 | name: "libdl", | 
|  | 6 |  | 
|  | 7 | defaults: ["linux_bionic_supported"], | 
| Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 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 |  | 
|  | 18 | ldflags: ["-Wl,--exclude-libs=libgcc.a"], | 
| Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 19 |  | 
|  | 20 | // for x86, exclude libgcc_eh.a for the same reasons as above | 
|  | 21 | arch: { | 
| Dan Willemsen | 9e6f98f | 2015-11-03 14:30:57 -0800 | [diff] [blame] | 22 | arm: { | 
|  | 23 | version_script: "libdl.arm.map", | 
|  | 24 | }, | 
|  | 25 | arm64: { | 
|  | 26 | version_script: "libdl.arm64.map", | 
|  | 27 | }, | 
|  | 28 | mips: { | 
|  | 29 | version_script: "libdl.mips.map", | 
|  | 30 | }, | 
|  | 31 | mips64: { | 
|  | 32 | version_script: "libdl.mips64.map", | 
|  | 33 | }, | 
| Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 34 | x86: { | 
|  | 35 | ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"], | 
| Dan Willemsen | 9e6f98f | 2015-11-03 14:30:57 -0800 | [diff] [blame] | 36 | version_script: "libdl.x86.map", | 
| Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 37 | }, | 
|  | 38 | x86_64: { | 
|  | 39 | ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"], | 
| Dan Willemsen | 9e6f98f | 2015-11-03 14:30:57 -0800 | [diff] [blame] | 40 | version_script: "libdl.x86_64.map", | 
| Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 41 | }, | 
|  | 42 | }, | 
|  | 43 | srcs: ["libdl.c"], | 
|  | 44 | cflags: [ | 
|  | 45 | "-Wall", | 
|  | 46 | "-Wextra", | 
|  | 47 | "-Wunused", | 
|  | 48 | "-Werror", | 
|  | 49 | ], | 
|  | 50 | stl: "none", | 
|  | 51 |  | 
| Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 52 | // NOTE: libdl needs __aeabi_unwind_cpp_pr0 from libgcc.a but libgcc.a needs a | 
|  | 53 | // few symbols from libc. Using --no-undefined here results in having to link | 
|  | 54 | // against libc creating a circular dependency which is removed and we end up | 
|  | 55 | // with missing symbols. Since this library is just a bunch of stubs, we set | 
|  | 56 | // LOCAL_ALLOW_UNDEFINED_SYMBOLS to remove --no-undefined from the linker flags. | 
|  | 57 | allow_undefined_symbols: true, | 
|  | 58 | system_shared_libs: [], | 
|  | 59 |  | 
| Colin Cross | 27c43c5 | 2016-04-07 13:27:24 -0700 | [diff] [blame] | 60 | sanitize: { | 
|  | 61 | never: true, | 
|  | 62 | }, | 
| Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 63 | } | 
| Dan Albert | e8a9108 | 2016-08-04 13:45:44 -0700 | [diff] [blame] | 64 |  | 
|  | 65 | ndk_library { | 
|  | 66 | name: "libdl.ndk", | 
|  | 67 | symbol_file: "libdl.map.txt", | 
|  | 68 | first_version: "9", | 
|  | 69 | } |