8ea6af53e2
This is important for enabling the error about unsupported TLS relocations to local symbols. The fast path tends to skip this error, because it fails during lookup_symbol(). Add a test for this error. I didn't see a performance regression in the linker_relocation benchmark. Bug: http://b/226978634 Test: m bionic-unit-tests Change-Id: Ibef9bde2973cf8c2d420ecc9e8fe2c69a5097ce2
30 lines
884 B
Bash
Executable file
30 lines
884 B
Bash
Executable file
#!/bin/bash
|
|
#
|
|
# Bionic doesn't support the references to STB_LOCAL symbols of type STT_TLS
|
|
# and STT_SECTION that ld.gold generates. Set NDK21E to the path to a copy of
|
|
# NDK r21e, which still has ld.gold (unlike the platform build or newer NDKs).
|
|
|
|
set -e
|
|
|
|
cat >test.c <<EOF
|
|
static __thread int tls_var_1;
|
|
extern __thread int tls_var_2;
|
|
int* getaddr1() { return &tls_var_1; }
|
|
int* getaddr2() { return &tls_var_2; }
|
|
EOF
|
|
cat >test2.c <<EOF
|
|
__attribute__((visibility("hidden"))) __thread int tls_var_2;
|
|
EOF
|
|
|
|
build() {
|
|
arch=$1
|
|
target=$2
|
|
$NDK21E/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -O2 --target=$target \
|
|
-fpic -shared -o $arch/libtest_invalid-local-tls.so -fno-emulated-tls \
|
|
-fuse-ld=gold test.c test2.c
|
|
}
|
|
|
|
build arm armv7a-linux-androideabi29
|
|
build arm64 aarch64-linux-android29
|
|
build x86 i686-linux-android29
|
|
build x86_64 x86_64-linux-android29
|