| Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 1 | // | 
 | 2 | // libdl | 
 | 3 | // | 
 | 4 | cc_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"], | 
| Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 16 |  | 
 | 17 |     // for x86, exclude libgcc_eh.a for the same reasons as above | 
 | 18 |     arch: { | 
| Dan Willemsen | 9e6f98f | 2015-11-03 14:30:57 -0800 | [diff] [blame] | 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 |         }, | 
| Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 31 |         x86: { | 
 | 32 |             ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"], | 
| Dan Willemsen | 9e6f98f | 2015-11-03 14:30:57 -0800 | [diff] [blame] | 33 |             version_script: "libdl.x86.map", | 
| Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 34 |         }, | 
 | 35 |         x86_64: { | 
 | 36 |             ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"], | 
| Dan Willemsen | 9e6f98f | 2015-11-03 14:30:57 -0800 | [diff] [blame] | 37 |             version_script: "libdl.x86_64.map", | 
| Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 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 | } |