-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Commit c355611
committed
Android: always build libraries as PIC
This adjusts the stdlib bits to be built as position independent. As we
build a single instance of the code and then create static and dynamic
runtimes, simply pay a penalty when performing static linking of the
runtime to make the dynamic case work properly. This repairs part of the
runtime build on Android where we would previously see when building
SwiftRemoteMirror:
```
ld.lld: error: relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol 'vtable for std::__ndk1::basic_stringstream<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>'; recompile with -fPIC
>>> defined in lib/swift/android/aarch64/libswiftRemoteInspection.a(TypeRefBuilder.cpp.o)
>>> referenced by TypeRefBuilder.cpp
>>> TypeRefBuilder.cpp.o:(swift::reflection::TypeRefBuilder::ReflectionTypeDescriptorFinder::collectFieldTypes(std::__ndk1::optional<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>)) in archive lib/swift/android/aarch64/libswiftRemoteInspection.a
ld.lld: error: relocation R_AARCH64_ADD_ABS_LO12_NC cannot be used against symbol 'vtable for std::__ndk1::basic_stringstream<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>'; recompile with -fPIC
>>> defined in lib/swift/android/aarch64/libswiftRemoteInspection.a(TypeRefBuilder.cpp.o)
>>> referenced by TypeRefBuilder.cpp
>>> TypeRefBuilder.cpp.o:(swift::reflection::TypeRefBuilder::ReflectionTypeDescriptorFinder::collectFieldTypes(std::__ndk1::optional<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>)) in archive lib/swift/android/aarch64/libswiftRemoteInspection.a
ld.lld: error: relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol 'construction vtable for std::__ndk1::basic_istream<char, std::__ndk1::char_traits<char>>-in-std::__ndk1::basic_stringstream<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>'; recompile with -fPIC
>>> defined in lib/swift/android/aarch64/libswiftRemoteInspection.a(TypeRefBuilder.cpp.o)
>>> referenced by TypeRefBuilder.cpp
>>> TypeRefBuilder.cpp.o:(swift::reflection::TypeRefBuilder::ReflectionTypeDescriptorFinder::collectFieldTypes(std::__ndk1::optional<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>)) in archive lib/swift/android/aarch64/libswiftRemoteInspection.a
ld.lld: error: relocation R_AARCH64_ADD_ABS_LO12_NC cannot be used against symbol 'construction vtable for std::__ndk1::basic_istream<char, std::__ndk1::char_traits<char>>-in-std::__ndk1::basic_stringstream<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>'; recompile with -fPIC
>>> defined in lib/swift/android/aarch64/libswiftRemoteInspection.a(TypeRefBuilder.cpp.o)
>>> referenced by TypeRefBuilder.cpp
>>> TypeRefBuilder.cpp.o:(swift::reflection::TypeRefBuilder::ReflectionTypeDescriptorFinder::collectFieldTypes(std::__ndk1::optional<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>)) in archive lib/swift/android/aarch64/libswiftRemoteInspection.a
ld.lld: error: relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol 'vtable for std::__ndk1::basic_stringbuf<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>'; recompile with -fPIC
>>> defined in lib/swift/android/aarch64/libswiftRemoteInspection.a(TypeRefBuilder.cpp.o)
>>> referenced by TypeRefBuilder.cpp
>>> TypeRefBuilder.cpp.o:(swift::reflection::TypeRefBuilder::ReflectionTypeDescriptorFinder::collectFieldTypes(std::__ndk1::optional<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>)) in archive lib/swift/android/aarch64/libswiftRemoteInspection.a
ld.lld: error: relocation R_AARCH64_ADD_ABS_LO12_NC cannot be used against symbol 'vtable for std::__ndk1::basic_stringbuf<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>'; recompile with -fPIC
>>> defined in lib/swift/android/aarch64/libswiftRemoteInspection.a(TypeRefBuilder.cpp.o)
>>> referenced by TypeRefBuilder.cpp
>>> TypeRefBuilder.cpp.o:(swift::reflection::TypeRefBuilder::ReflectionTypeDescriptorFinder::collectFieldTypes(std::__ndk1::optional<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>)) in archive lib/swift/android/aarch64/libswiftRemoteInspection.a
ld.lld: error: relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol 'vtable for std::__ndk1::basic_stringstream<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>'; recompile with -fPIC
>>> defined in lib/swift/android/aarch64/libswiftRemoteInspection.a(TypeRefBuilder.cpp.o)
>>> referenced by TypeRefBuilder.cpp
>>> TypeRefBuilder.cpp.o:(swift::reflection::TypeRefBuilder::ReflectionTypeDescriptorFinder::collectFieldTypes(std::__ndk1::optional<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>)) in archive lib/swift/android/aarch64/libswiftRemoteInspection.a
ld.lld: error: relocation R_AARCH64_ADD_ABS_LO12_NC cannot be used against symbol 'vtable for std::__ndk1::basic_stringstream<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>'; recompile with -fPIC
>>> defined in lib/swift/android/aarch64/libswiftRemoteInspection.a(TypeRefBuilder.cpp.o)
>>> referenced by TypeRefBuilder.cpp
>>> TypeRefBuilder.cpp.o:(swift::reflection::TypeRefBuilder::ReflectionTypeDescriptorFinder::collectFieldTypes(std::__ndk1::optional<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>)) in archive lib/swift/android/aarch64/libswiftRemoteInspection.a
ld.lld: error: relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol 'vtable for std::__ndk1::basic_stringbuf<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>'; recompile with -fPIC
>>> defined in lib/swift/android/aarch64/libswiftRemoteInspection.a(TypeRefBuilder.cpp.o)
>>> referenced by TypeRefBuilder.cpp
>>> TypeRefBuilder.cpp.o:(swift::reflection::TypeRefBuilder::ReflectionTypeDescriptorFinder::collectFieldTypes(std::__ndk1::optional<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>)) in archive lib/swift/android/aarch64/libswiftRemoteInspection.a
ld.lld: error: relocation R_AARCH64_ADD_ABS_LO12_NC cannot be used against symbol 'vtable for std::__ndk1::basic_stringbuf<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>'; recompile with -fPIC
>>> defined in lib/swift/android/aarch64/libswiftRemoteInspection.a(TypeRefBuilder.cpp.o)
>>> referenced by TypeRefBuilder.cpp
>>> TypeRefBuilder.cpp.o:(swift::reflection::TypeRefBuilder::ReflectionTypeDescriptorFinder::collectFieldTypes(std::__ndk1::optional<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>)) in archive lib/swift/android/aarch64/libswiftRemoteInspection.a
ld.lld: error: relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol 'VTT for std::__ndk1::basic_stringstream<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>'; recompile with -fPIC
>>> defined in lib/swift/android/aarch64/libswiftRemoteInspection.a(TypeRefBuilder.cpp.o)
>>> referenced by TypeRefBuilder.cpp
>>> TypeRefBuilder.cpp.o:(swift::reflection::TypeRefBuilder::ReflectionTypeDescriptorFinder::collectFieldTypes(std::__ndk1::optional<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>)) in archive lib/swift/android/aarch64/libswiftRemoteInspection.a
ld.lld: error: relocation R_AARCH64_ADD_ABS_LO12_NC cannot be used against symbol 'VTT for std::__ndk1::basic_stringstream<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>'; recompile with -fPIC
>>> defined in lib/swift/android/aarch64/libswiftRemoteInspection.a(TypeRefBuilder.cpp.o)
>>> referenced by TypeRefBuilder.cpp
>>> TypeRefBuilder.cpp.o:(swift::reflection::TypeRefBuilder::ReflectionTypeDescriptorFinder::collectFieldTypes(std::__ndk1::optional<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>)) in archive lib/swift/android/aarch64/libswiftRemoteInspection.a
ld.lld: error: relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol 'vtable for std::__ndk1::basic_stringstream<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>'; recompile with -fPIC
>>> defined in lib/swift/android/aarch64/libswiftRemoteInspection.a(TypeRefBuilder.cpp.o)
>>> referenced by TypeRefBuilder.cpp
>>> TypeRefBuilder.cpp.o:(std::__ndk1::basic_stringstream<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>::~basic_stringstream()) in archive lib/swift/android/aarch64/libswiftRemoteInspection.a
ld.lld: error: relocation R_AARCH64_ADD_ABS_LO12_NC cannot be used against symbol 'vtable for std::__ndk1::basic_stringstream<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>'; recompile with -fPIC
>>> defined in lib/swift/android/aarch64/libswiftRemoteInspection.a(TypeRefBuilder.cpp.o)
>>> referenced by TypeRefBuilder.cpp
>>> TypeRefBuilder.cpp.o:(std::__ndk1::basic_stringstream<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>::~basic_stringstream()) in archive lib/swift/android/aarch64/libswiftRemoteInspection.a
ld.lld: error: relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol 'vtable for std::__ndk1::basic_stringbuf<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>'; recompile with -fPIC
>>> defined in lib/swift/android/aarch64/libswiftRemoteInspection.a(TypeRefBuilder.cpp.o)
>>> referenced by TypeRefBuilder.cpp
>>> TypeRefBuilder.cpp.o:(std::__ndk1::basic_stringstream<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>::~basic_stringstream()) in archive lib/swift/android/aarch64/libswiftRemoteInspection.a
ld.lld: error: relocation R_AARCH64_ADD_ABS_LO12_NC cannot be used against symbol 'vtable for std::__ndk1::basic_stringbuf<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>'; recompile with -fPIC
>>> defined in lib/swift/android/aarch64/libswiftRemoteInspection.a(TypeRefBuilder.cpp.o)
>>> referenced by TypeRefBuilder.cpp
>>> TypeRefBuilder.cpp.o:(std::__ndk1::basic_stringstream<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>::~basic_stringstream()) in archive lib/swift/android/aarch64/libswiftRemoteInspection.a
ld.lld: error: relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol 'VTT for std::__ndk1::basic_stringstream<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>'; recompile with -fPIC
>>> defined in lib/swift/android/aarch64/libswiftRemoteInspection.a(TypeRefBuilder.cpp.o)
>>> referenced by TypeRefBuilder.cpp
>>> TypeRefBuilder.cpp.o:(std::__ndk1::basic_stringstream<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>::~basic_stringstream()) in archive lib/swift/android/aarch64/libswiftRemoteInspection.a
ld.lld: error: relocation R_AARCH64_ADD_ABS_LO12_NC cannot be used against symbol 'VTT for std::__ndk1::basic_stringstream<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>'; recompile with -fPIC
>>> defined in lib/swift/android/aarch64/libswiftRemoteInspection.a(TypeRefBuilder.cpp.o)
>>> referenced by TypeRefBuilder.cpp
>>> TypeRefBuilder.cpp.o:(std::__ndk1::basic_stringstream<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>::~basic_stringstream()) in archive lib/swift/android/aarch64/libswiftRemoteInspection.a
ld.lld: error: relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol 'vtable for std::__ndk1::basic_stringstream<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>'; recompile with -fPIC
>>> defined in lib/swift/android/aarch64/libswiftRemoteInspection.a(TypeRefBuilder.cpp.o)
>>> referenced by TypeRefBuilder.cpp
>>> TypeRefBuilder.cpp.o:(non-virtual thunk to std::__ndk1::basic_stringstream<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>::~basic_stringstream()) in archive lib/swift/android/aarch64/libswiftRemoteInspection.a
ld.lld: error: relocation R_AARCH64_ADD_ABS_LO12_NC cannot be used against symbol 'vtable for std::__ndk1::basic_stringstream<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>'; recompile with -fPIC
>>> defined in lib/swift/android/aarch64/libswiftRemoteInspection.a(TypeRefBuilder.cpp.o)
>>> referenced by TypeRefBuilder.cpp
>>> TypeRefBuilder.cpp.o:(non-virtual thunk to std::__ndk1::basic_stringstream<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>::~basic_stringstream()) in archive lib/swift/android/aarch64/libswiftRemoteInspection.a
ld.lld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)
```1 parent ba21a14 commit c355611Copy full SHA for c355611
File tree
Expand file treeCollapse file tree
1 file changed
+3
-0
lines changedFilter options
- stdlib/cmake/modules
Expand file treeCollapse file tree
1 file changed
+3
-0
lines changedstdlib/cmake/modules/AddSwiftStdlib.cmake
Copy file name to clipboardExpand all lines: stdlib/cmake/modules/AddSwiftStdlib.cmake+3Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1237 | 1237 |
| |
1238 | 1238 |
| |
1239 | 1239 |
| |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
1240 | 1243 |
| |
1241 | 1244 |
| |
1242 | 1245 |
| |
|
0 commit comments