x86 tests: address test failures caused by Text Relocations
Starting with API level 23, binaries must not contain text relocations.
(see https://android.googlesource.com/platform/bionic/+/master/
android-changes-for-ndk-developers.md
#Text-Relocations-Enforced-for-API-level-23)
Soong creates build rules in a way that non-static binaries are linked
with -pie (see cs/android/build/soong/cc/binary.go?l=278). That causes
the toolchain to generate text relocations, which violate the above
requirement.
Hence, marking the test executables as static and removing all occurrences
of `-Wl,-z,notext` as they are now obsolete.
Tests might still fail with this patch applied, but for a different reason.
Bug: 123864125
Test: run vts-kernel -m VtsKernelLinuxKselftest
Change-Id: If2e44691223685cb1059f656a2499a74deb1e496
Signed-off-by: Matthias Maennich <maennich@google.com>
diff --git a/Android.bp b/Android.bp
index 52689a08..91edc09 100644
--- a/Android.bp
+++ b/Android.bp
@@ -321,7 +321,7 @@
}
}
-// x86 test
+// x86 tests
cc_test {
name: "kselftest_x86_tests",
relative_install_path: "linux-kselftest/x86",
@@ -349,11 +349,6 @@
"tools/testing/selftests/x86/test_FISTTP.c",
"tools/testing/selftests/x86/vdso_restorer.c",
],
- // Allow text (read-only) relocations, which is the default
- // for ld.bfd, but not lld.
- ldflags: [
- "-Wl,-z,notext",
- ],
},
},
cflags: [
@@ -361,6 +356,7 @@
"-pthread",
],
c_std: "gnu99",
+ static_executable: true,
defaults: ["kselftest_defaults"],
}
@@ -428,17 +424,13 @@
"-pthread",
],
c_std: "gnu99",
+ static_executable: true,
test_per_src: false,
defaults: ["kselftest_defaults"],
enabled: false,
arch: {
x86: {
enabled: true,
- // Allow text (read-only) relocations, which is the default
- // for ld.bfd, but not lld.
- ldflags: [
- "-Wl,-z,notext",
- ],
},
},
}