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", |
Dan Willemsen | 17b3559 | 2018-10-11 23:32:26 -0700 | [diff] [blame] | 6 | defaults: ["linux_bionic_supported"], |
Jiyong Park | 5603c6e | 2018-04-27 21:53:11 +0900 | [diff] [blame] | 7 | recovery_available: true, |
dimitry | c5ea3eb | 2017-10-05 17:23:10 +0200 | [diff] [blame] | 8 | |
Elliott Hughes | d50a1de | 2018-02-05 17:30:57 -0800 | [diff] [blame] | 9 | srcs: [ |
| 10 | "libdl.cpp", |
| 11 | "libdl_cfi.cpp", |
| 12 | ], |
dimitry | c5ea3eb | 2017-10-05 17:23:10 +0200 | [diff] [blame] | 13 | |
| 14 | cflags: [ |
| 15 | "-Wall", |
| 16 | "-Wextra", |
| 17 | "-Wunused", |
| 18 | "-Werror", |
| 19 | ], |
| 20 | |
| 21 | // For private/CFIShadow.h. |
| 22 | include_dirs: ["bionic/libc"], |
| 23 | |
| 24 | stl: "none", |
Dan Willemsen | 6b3be17 | 2018-12-03 13:57:20 -0800 | [diff] [blame] | 25 | system_shared_libs: [], |
dimitry | c5ea3eb | 2017-10-05 17:23:10 +0200 | [diff] [blame] | 26 | |
| 27 | sanitize: { |
| 28 | never: true, |
| 29 | }, |
| 30 | } |
| 31 | |
Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 32 | cc_library { |
Dan Willemsen | 7ec52b1 | 2016-11-28 17:02:25 -0800 | [diff] [blame] | 33 | name: "libdl", |
Jiyong Park | 5603c6e | 2018-04-27 21:53:11 +0900 | [diff] [blame] | 34 | recovery_available: true, |
Dan Albert | 40f15ec | 2017-10-27 11:21:20 -0700 | [diff] [blame] | 35 | static_ndk_lib: true, |
Dan Willemsen | 7ec52b1 | 2016-11-28 17:02:25 -0800 | [diff] [blame] | 36 | |
| 37 | defaults: ["linux_bionic_supported"], |
Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 38 | |
| 39 | // NOTE: --exclude-libs=libgcc.a makes sure that any symbols libdl.so pulls from |
| 40 | // libgcc.a are made static to libdl.so. This in turn ensures that libraries that |
| 41 | // a) pull symbols from libgcc.a and b) depend on libdl.so will not rely on libdl.so |
| 42 | // to provide those symbols, but will instead pull them from libgcc.a. Specifically, |
| 43 | // we use this property to make sure libc.so has its own copy of the code from |
| 44 | // libgcc.a it uses. |
| 45 | // |
| 46 | // DO NOT REMOVE --exclude-libs! |
| 47 | |
Yi Kong | 7786a34 | 2018-08-31 19:01:56 -0700 | [diff] [blame] | 48 | ldflags: [ |
| 49 | "-Wl,--exclude-libs=libgcc.a", |
Yi Kong | 7ac2afb | 2019-05-06 16:23:10 -0700 | [diff] [blame^] | 50 | "-Wl,--exclude-libs=libgcc_stripped.a", |
Yi Kong | 7786a34 | 2018-08-31 19:01:56 -0700 | [diff] [blame] | 51 | "-Wl,--exclude-libs=libclang_rt.builtins-arm-android.a", |
| 52 | "-Wl,--exclude-libs=libclang_rt.builtins-aarch64-android.a", |
| 53 | "-Wl,--exclude-libs=libclang_rt.builtins-x86-android.a", |
| 54 | "-Wl,--exclude-libs=libclang_rt.builtins-x86_64-android.a", |
| 55 | ], |
Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 56 | |
| 57 | // for x86, exclude libgcc_eh.a for the same reasons as above |
| 58 | arch: { |
Dan Willemsen | 9e6f98f | 2015-11-03 14:30:57 -0800 | [diff] [blame] | 59 | arm: { |
Elliott Hughes | d19b3c5 | 2018-09-06 16:04:08 -0700 | [diff] [blame] | 60 | version_script: ":libdl.arm.map", |
Chih-Hung Hsieh | ecbff83 | 2018-05-23 18:45:53 -0700 | [diff] [blame] | 61 | pack_relocations: false, |
Ian Pedowitz | b6310c2 | 2018-01-18 16:26:19 -0800 | [diff] [blame] | 62 | ldflags: ["-Wl,--hash-style=both"], |
Dan Willemsen | 9e6f98f | 2015-11-03 14:30:57 -0800 | [diff] [blame] | 63 | }, |
| 64 | arm64: { |
Elliott Hughes | d19b3c5 | 2018-09-06 16:04:08 -0700 | [diff] [blame] | 65 | version_script: ":libdl.arm64.map", |
Dan Willemsen | 9e6f98f | 2015-11-03 14:30:57 -0800 | [diff] [blame] | 66 | }, |
Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 67 | x86: { |
Chih-Hung Hsieh | ecbff83 | 2018-05-23 18:45:53 -0700 | [diff] [blame] | 68 | pack_relocations: false, |
Dimitry Ivanov | ac4bd2f | 2016-11-21 12:50:38 -0800 | [diff] [blame] | 69 | ldflags: [ |
| 70 | "-Wl,--exclude-libs=libgcc_eh.a", |
Ian Pedowitz | b6310c2 | 2018-01-18 16:26:19 -0800 | [diff] [blame] | 71 | "-Wl,--hash-style=both", |
Dimitry Ivanov | ac4bd2f | 2016-11-21 12:50:38 -0800 | [diff] [blame] | 72 | ], |
Elliott Hughes | d19b3c5 | 2018-09-06 16:04:08 -0700 | [diff] [blame] | 73 | version_script: ":libdl.x86.map", |
Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 74 | }, |
| 75 | x86_64: { |
| 76 | ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"], |
Elliott Hughes | d19b3c5 | 2018-09-06 16:04:08 -0700 | [diff] [blame] | 77 | version_script: ":libdl.x86_64.map", |
Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 78 | }, |
| 79 | }, |
dimitry | dc7cc62 | 2017-08-30 10:52:19 +0200 | [diff] [blame] | 80 | shared: { |
dimitry | c5ea3eb | 2017-10-05 17:23:10 +0200 | [diff] [blame] | 81 | whole_static_libs: ["libdl_static"], |
dimitry | dc7cc62 | 2017-08-30 10:52:19 +0200 | [diff] [blame] | 82 | }, |
| 83 | static: { |
Elliott Hughes | 46a943c | 2018-04-03 15:56:35 -0700 | [diff] [blame] | 84 | srcs: ["libdl_static.cpp"], |
dimitry | dc7cc62 | 2017-08-30 10:52:19 +0200 | [diff] [blame] | 85 | }, |
Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 86 | cflags: [ |
| 87 | "-Wall", |
| 88 | "-Wextra", |
| 89 | "-Wunused", |
| 90 | "-Werror", |
| 91 | ], |
| 92 | stl: "none", |
| 93 | |
Ryan Prichard | 470b666 | 2018-03-27 22:10:55 -0700 | [diff] [blame] | 94 | nocrt: true, |
Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 95 | system_shared_libs: [], |
Pirama Arumuga Nainar | eeb2ee6 | 2019-02-15 11:40:40 -0800 | [diff] [blame] | 96 | |
| 97 | // Opt out of native_coverage when opting out of system_shared_libs |
Pirama Arumuga Nainar | 852d523 | 2018-12-20 13:52:19 -0800 | [diff] [blame] | 98 | native_coverage: false, |
Dan Willemsen | 208ae17 | 2015-09-16 16:33:27 -0700 | [diff] [blame] | 99 | |
Dimitry Ivanov | d9e427c | 2016-11-22 16:55:25 -0800 | [diff] [blame] | 100 | // This is placeholder library the actual implementation is (currently) |
| 101 | // provided by the linker. |
Elliott Hughes | d50a1de | 2018-02-05 17:30:57 -0800 | [diff] [blame] | 102 | shared_libs: ["ld-android"], |
Dimitry Ivanov | d9e427c | 2016-11-22 16:55:25 -0800 | [diff] [blame] | 103 | |
| 104 | sanitize: { |
| 105 | never: true, |
| 106 | }, |
Jiyong Park | c45fe9f | 2018-12-13 18:26:48 +0900 | [diff] [blame] | 107 | |
| 108 | stubs: { |
| 109 | symbol_file: "libdl.map.txt", |
| 110 | versions: ["10000"], |
| 111 | }, |
Dimitry Ivanov | d9e427c | 2016-11-22 16:55:25 -0800 | [diff] [blame] | 112 | } |
| 113 | |
dimitry | 8868d9e | 2019-03-19 13:01:42 +0100 | [diff] [blame] | 114 | cc_library { |
| 115 | name: "libdl_android", |
| 116 | |
| 117 | defaults: ["linux_bionic_supported"], |
Jiyong Park | 3ff116a | 2019-04-02 23:04:52 +0900 | [diff] [blame] | 118 | recovery_available: true, |
dimitry | 8868d9e | 2019-03-19 13:01:42 +0100 | [diff] [blame] | 119 | |
| 120 | // NOTE: --exclude-libs=libgcc.a makes sure that any symbols libdl.so pulls from |
| 121 | // libgcc.a are made static to libdl.so. This in turn ensures that libraries that |
| 122 | // a) pull symbols from libgcc.a and b) depend on libdl.so will not rely on libdl.so |
| 123 | // to provide those symbols, but will instead pull them from libgcc.a. Specifically, |
| 124 | // we use this property to make sure libc.so has its own copy of the code from |
| 125 | // libgcc.a it uses. |
| 126 | // |
| 127 | // DO NOT REMOVE --exclude-libs! |
| 128 | |
| 129 | ldflags: [ |
| 130 | "-Wl,--exclude-libs=libgcc.a", |
Yi Kong | 7ac2afb | 2019-05-06 16:23:10 -0700 | [diff] [blame^] | 131 | "-Wl,--exclude-libs=libgcc_stripped.a", |
dimitry | 8868d9e | 2019-03-19 13:01:42 +0100 | [diff] [blame] | 132 | "-Wl,--exclude-libs=libclang_rt.builtins-arm-android.a", |
| 133 | "-Wl,--exclude-libs=libclang_rt.builtins-aarch64-android.a", |
| 134 | "-Wl,--exclude-libs=libclang_rt.builtins-x86-android.a", |
| 135 | "-Wl,--exclude-libs=libclang_rt.builtins-x86_64-android.a", |
| 136 | ], |
| 137 | |
| 138 | // for x86, exclude libgcc_eh.a for the same reasons as above |
| 139 | arch: { |
| 140 | x86: { |
| 141 | ldflags: [ |
| 142 | "-Wl,--exclude-libs=libgcc_eh.a", |
| 143 | ], |
| 144 | }, |
| 145 | x86_64: { |
| 146 | ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"], |
| 147 | }, |
| 148 | }, |
| 149 | |
| 150 | srcs: [ "libdl_android.cpp" ], |
| 151 | version_script: "libdl_android.map.txt", |
| 152 | |
| 153 | cflags: [ |
| 154 | "-Wall", |
| 155 | "-Wextra", |
| 156 | "-Wunused", |
| 157 | "-Werror", |
| 158 | ], |
| 159 | |
| 160 | stl: "none", |
| 161 | |
| 162 | nocrt: true, |
| 163 | system_shared_libs: [], |
| 164 | |
| 165 | // Opt out of native_coverage when opting out of system_shared_libs |
| 166 | native_coverage: false, |
| 167 | |
| 168 | // This is placeholder library the actual implementation is (currently) |
| 169 | // provided by the linker. |
| 170 | shared_libs: ["ld-android"], |
| 171 | |
| 172 | sanitize: { |
| 173 | never: true, |
| 174 | }, |
| 175 | |
| 176 | stubs: { |
| 177 | symbol_file: "libdl_android.map.txt", |
| 178 | versions: ["10000"], |
| 179 | }, |
| 180 | } |
| 181 | |
Dan Albert | e8a9108 | 2016-08-04 13:45:44 -0700 | [diff] [blame] | 182 | ndk_library { |
Dan Willemsen | 993b083 | 2017-04-07 14:09:18 -0700 | [diff] [blame] | 183 | name: "libdl", |
Dan Albert | e8a9108 | 2016-08-04 13:45:44 -0700 | [diff] [blame] | 184 | symbol_file: "libdl.map.txt", |
| 185 | first_version: "9", |
| 186 | } |
Dan Willemsen | b93d3c2 | 2017-03-20 14:07:47 -0700 | [diff] [blame] | 187 | |
| 188 | llndk_library { |
Dan Willemsen | 993b083 | 2017-04-07 14:09:18 -0700 | [diff] [blame] | 189 | name: "libdl", |
Dan Willemsen | b93d3c2 | 2017-03-20 14:07:47 -0700 | [diff] [blame] | 190 | symbol_file: "libdl.map.txt", |
| 191 | } |
Elliott Hughes | d19b3c5 | 2018-09-06 16:04:08 -0700 | [diff] [blame] | 192 | |
| 193 | genrule { |
| 194 | name: "libdl.arm.map", |
| 195 | out: ["libdl.arm.map"], |
| 196 | srcs: ["libdl.map.txt"], |
| 197 | tool_files: [":bionic-generate-version-script"], |
| 198 | cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)", |
| 199 | } |
| 200 | |
| 201 | genrule { |
| 202 | name: "libdl.arm64.map", |
| 203 | out: ["libdl.arm64.map"], |
| 204 | srcs: ["libdl.map.txt"], |
| 205 | tool_files: [":bionic-generate-version-script"], |
| 206 | cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)", |
| 207 | } |
| 208 | |
| 209 | genrule { |
| 210 | name: "libdl.x86.map", |
| 211 | out: ["libdl.x86.map"], |
| 212 | srcs: ["libdl.map.txt"], |
| 213 | tool_files: [":bionic-generate-version-script"], |
| 214 | cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)", |
| 215 | } |
| 216 | |
| 217 | genrule { |
| 218 | name: "libdl.x86_64.map", |
| 219 | out: ["libdl.x86_64.map"], |
| 220 | srcs: ["libdl.map.txt"], |
| 221 | tool_files: [":bionic-generate-version-script"], |
| 222 | cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)", |
| 223 | } |