host: ARM 32-bit targets must be built with 4k elf alignment
- ARM 32-bit targets will be built with 4096 ELF alignment.
- ARM 32-bit targets will only support 4K Page sizes.
- ARM 32-bit targets won't be page agnostic.
Test: b test --config=android //prebuilts/clang/host/linux-x86:cc_toolchain_features_linker_alignment_tests
Bug: 295550555
Change-Id: I766346c40cd686e84cc3022a26b0461ddd36d1a1
diff --git a/toolchains/clang/host/linux-x86/cc_toolchain_features.bzl b/toolchains/clang/host/linux-x86/cc_toolchain_features.bzl
index d6eddb1..853644e 100644
--- a/toolchains/clang/host/linux-x86/cc_toolchain_features.bzl
+++ b/toolchains/clang/host/linux-x86/cc_toolchain_features.bzl
@@ -2183,7 +2183,7 @@
compile_only_flags = ctx.attr.compiler_flags
linker_only_flags = ctx.attr.linker_flags
deviceMaxPageSize = ctx.attr._device_max_page_size_supported[BuildSettingInfo].value
- if deviceMaxPageSize and (target_arch == "arm" or target_arch == "arm64"):
+ if deviceMaxPageSize and target_arch == "arm64":
linker_only_flags = ctx.attr.linker_flags + \
["-Wl,-z,max-page-size=" + deviceMaxPageSize]
diff --git a/toolchains/clang/host/linux-x86/cc_toolchain_features_linker_alignment_test.bzl b/toolchains/clang/host/linux-x86/cc_toolchain_features_linker_alignment_test.bzl
index 7451c3d..44b0319 100644
--- a/toolchains/clang/host/linux-x86/cc_toolchain_features_linker_alignment_test.bzl
+++ b/toolchains/clang/host/linux-x86/cc_toolchain_features_linker_alignment_test.bzl
@@ -78,14 +78,6 @@
},
)
-custom_linker_alignment_flag_arm_test = analysistest.make(
- impl = _test_linker_alignment_flag_impl,
- attrs = test_attrs,
- config_settings = {
- "//command_line_option:platforms": "@//build/bazel/tests/products:aosp_arm_for_testing_custom_linker_alignment",
- },
-)
-
linker_alignment_flag_arm64_test = analysistest.make(
impl = _test_linker_alignment_flag_impl,
attrs = test_attrs,
@@ -132,31 +124,12 @@
name = test_name,
target_under_test = name,
expected_action_mnemonics = ["CppLink"],
- expected_flags = [
+ expected_flags = [],
+ no_expected_flags = [
"-Wl,-z,max-page-size=4096",
- ],
- no_expected_flags = [],
- )
- return test_name
-
-def test_custom_linker_alignment_flag_arm():
- name = "custom_linker_alignment_flag_arm"
- test_name = name + "_test"
-
- native.cc_binary(
- name = name,
- srcs = ["foo.cpp"],
- tags = ["manual"],
- )
-
- custom_linker_alignment_flag_arm_test(
- name = test_name,
- target_under_test = name,
- expected_action_mnemonics = ["CppLink"],
- expected_flags = [
+ "-Wl,-z,max-page-size=16384",
"-Wl,-z,max-page-size=65536",
],
- no_expected_flags = [],
)
return test_name
@@ -254,7 +227,6 @@
tests = [
test_linker_alignment_flag_arm(),
test_linker_alignment_flag_arm64(),
- test_custom_linker_alignment_flag_arm(),
test_custom_linker_alignment_flag_arm64(),
test_linker_alignment_flag_x86(),
test_linker_alignment_flag_x86_64(),