Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 1 | // |
| 2 | // libdl |
| 3 | // |
dimitry | c5ea3eb | 2017-10-05 17:23:10 +0200 | [diff] [blame^] | 4 | cc_library_static { |
| 5 | name: "libdl_static", |
| 6 | |
| 7 | srcs: ["libdl.c", "libdl_cfi.cpp"], |
| 8 | |
| 9 | cflags: [ |
| 10 | "-Wall", |
| 11 | "-Wextra", |
| 12 | "-Wunused", |
| 13 | "-Werror", |
| 14 | ], |
| 15 | |
| 16 | // For private/CFIShadow.h. |
| 17 | include_dirs: ["bionic/libc"], |
| 18 | |
| 19 | stl: "none", |
| 20 | |
| 21 | sanitize: { |
| 22 | never: true, |
| 23 | }, |
| 24 | } |
| 25 | |
Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 26 | cc_library { |
Dan Willemsen | 7ec52b1 | 2016-11-28 17:02:25 -0800 | [diff] [blame] | 27 | name: "libdl", |
| 28 | |
| 29 | defaults: ["linux_bionic_supported"], |
Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 30 | |
| 31 | // NOTE: --exclude-libs=libgcc.a makes sure that any symbols libdl.so pulls from |
| 32 | // libgcc.a are made static to libdl.so. This in turn ensures that libraries that |
| 33 | // a) pull symbols from libgcc.a and b) depend on libdl.so will not rely on libdl.so |
| 34 | // to provide those symbols, but will instead pull them from libgcc.a. Specifically, |
| 35 | // we use this property to make sure libc.so has its own copy of the code from |
| 36 | // libgcc.a it uses. |
| 37 | // |
| 38 | // DO NOT REMOVE --exclude-libs! |
| 39 | |
| 40 | ldflags: ["-Wl,--exclude-libs=libgcc.a"], |
Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 41 | |
| 42 | // for x86, exclude libgcc_eh.a for the same reasons as above |
| 43 | arch: { |
Dan Willemsen | 9e6f98f | 2015-11-03 14:30:57 -0800 | [diff] [blame] | 44 | arm: { |
| 45 | version_script: "libdl.arm.map", |
Dimitry Ivanov | ac4bd2f | 2016-11-21 12:50:38 -0800 | [diff] [blame] | 46 | ldflags: ["-Wl,--hash-style=both"], |
Dan Willemsen | 9e6f98f | 2015-11-03 14:30:57 -0800 | [diff] [blame] | 47 | }, |
| 48 | arm64: { |
| 49 | version_script: "libdl.arm64.map", |
| 50 | }, |
| 51 | mips: { |
| 52 | version_script: "libdl.mips.map", |
| 53 | }, |
| 54 | mips64: { |
| 55 | version_script: "libdl.mips64.map", |
| 56 | }, |
Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 57 | x86: { |
Dimitry Ivanov | ac4bd2f | 2016-11-21 12:50:38 -0800 | [diff] [blame] | 58 | ldflags: [ |
| 59 | "-Wl,--exclude-libs=libgcc_eh.a", |
| 60 | "-Wl,--hash-style=both", |
| 61 | ], |
Dan Willemsen | 9e6f98f | 2015-11-03 14:30:57 -0800 | [diff] [blame] | 62 | version_script: "libdl.x86.map", |
Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 63 | }, |
| 64 | x86_64: { |
| 65 | ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"], |
Dan Willemsen | 9e6f98f | 2015-11-03 14:30:57 -0800 | [diff] [blame] | 66 | version_script: "libdl.x86_64.map", |
Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 67 | }, |
| 68 | }, |
dimitry | dc7cc62 | 2017-08-30 10:52:19 +0200 | [diff] [blame] | 69 | shared: { |
dimitry | c5ea3eb | 2017-10-05 17:23:10 +0200 | [diff] [blame^] | 70 | whole_static_libs: ["libdl_static"], |
dimitry | dc7cc62 | 2017-08-30 10:52:19 +0200 | [diff] [blame] | 71 | }, |
| 72 | static: { |
| 73 | srcs: [ "libdl_static.c" ], |
| 74 | }, |
Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 75 | cflags: [ |
| 76 | "-Wall", |
| 77 | "-Wextra", |
| 78 | "-Wunused", |
| 79 | "-Werror", |
| 80 | ], |
| 81 | stl: "none", |
| 82 | |
Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 83 | // NOTE: libdl needs __aeabi_unwind_cpp_pr0 from libgcc.a but libgcc.a needs a |
| 84 | // few symbols from libc. Using --no-undefined here results in having to link |
| 85 | // against libc creating a circular dependency which is removed and we end up |
| 86 | // with missing symbols. Since this library is just a bunch of stubs, we set |
| 87 | // LOCAL_ALLOW_UNDEFINED_SYMBOLS to remove --no-undefined from the linker flags. |
| 88 | allow_undefined_symbols: true, |
| 89 | system_shared_libs: [], |
| 90 | |
Dimitry Ivanov | d9e427c | 2016-11-22 16:55:25 -0800 | [diff] [blame] | 91 | // This is placeholder library the actual implementation is (currently) |
| 92 | // provided by the linker. |
| 93 | shared_libs: [ "ld-android" ], |
| 94 | |
| 95 | sanitize: { |
| 96 | never: true, |
| 97 | }, |
| 98 | } |
| 99 | |
| 100 | cc_library { |
| 101 | // NOTE: --exclude-libs=libgcc.a makes sure that any symbols libdl.so pulls from |
| 102 | // libgcc.a are made static to ld-android.so. This in turn ensures that libraries that |
| 103 | // a) pull symbols from libgcc.a and b) depend on ld-android.so will not rely on ld-android.so |
| 104 | // to provide those symbols, but will instead pull them from libgcc.a. Specifically, |
| 105 | // we use this property to make sure libc.so has its own copy of the code from |
| 106 | // libgcc.a it uses. |
| 107 | // |
| 108 | // DO NOT REMOVE --exclude-libs! |
| 109 | |
| 110 | ldflags: ["-Wl,--exclude-libs=libgcc.a"], |
| 111 | |
| 112 | // for x86, exclude libgcc_eh.a for the same reasons as above |
| 113 | arch: { |
| 114 | x86: { |
| 115 | ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"], |
| 116 | }, |
| 117 | x86_64: { |
| 118 | ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"], |
| 119 | }, |
| 120 | }, |
| 121 | srcs: ["ld_android.c"], |
| 122 | cflags: [ |
| 123 | "-Wall", |
| 124 | "-Wextra", |
| 125 | "-Wunused", |
| 126 | "-Werror", |
| 127 | ], |
| 128 | stl: "none", |
| 129 | |
| 130 | name: "ld-android", |
Dan Willemsen | 8229596 | 2017-03-15 14:23:50 -0700 | [diff] [blame] | 131 | defaults: ["linux_bionic_supported"], |
Dimitry Ivanov | d9e427c | 2016-11-22 16:55:25 -0800 | [diff] [blame] | 132 | |
| 133 | // NOTE: libdl needs __aeabi_unwind_cpp_pr0 from libgcc.a but libgcc.a needs a |
| 134 | // few symbols from libc. Using --no-undefined here results in having to link |
| 135 | // against libc creating a circular dependency which is removed and we end up |
| 136 | // with missing symbols. Since this library is just a bunch of stubs, we set |
| 137 | // LOCAL_ALLOW_UNDEFINED_SYMBOLS to remove --no-undefined from the linker flags. |
| 138 | allow_undefined_symbols: true, |
| 139 | system_shared_libs: [], |
| 140 | |
Colin Cross | 27c43c5 | 2016-04-07 13:27:24 -0700 | [diff] [blame] | 141 | sanitize: { |
| 142 | never: true, |
| 143 | }, |
Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 144 | } |
Dan Albert | e8a9108 | 2016-08-04 13:45:44 -0700 | [diff] [blame] | 145 | |
| 146 | ndk_library { |
Dan Willemsen | 993b083 | 2017-04-07 14:09:18 -0700 | [diff] [blame] | 147 | name: "libdl", |
Dan Albert | e8a9108 | 2016-08-04 13:45:44 -0700 | [diff] [blame] | 148 | symbol_file: "libdl.map.txt", |
| 149 | first_version: "9", |
| 150 | } |
Dan Willemsen | b93d3c2 | 2017-03-20 14:07:47 -0700 | [diff] [blame] | 151 | |
| 152 | llndk_library { |
Dan Willemsen | 993b083 | 2017-04-07 14:09:18 -0700 | [diff] [blame] | 153 | name: "libdl", |
Dan Willemsen | b93d3c2 | 2017-03-20 14:07:47 -0700 | [diff] [blame] | 154 | symbol_file: "libdl.map.txt", |
| 155 | } |