[clang] [Android] Drop workarounds for older Android API levels pre 23 (PR #161893)
Brad Smith via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 9 19:59:29 PDT 2025
https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/161893
>From a0c04546fe6faa5feeab5d8c1bb5636a5ed98983 Mon Sep 17 00:00:00 2001
From: Brad Smith <brad at comstyle.com>
Date: Fri, 3 Oct 2025 13:42:48 -0400
Subject: [PATCH] [Android] Drop workarounds for older Android API levels pre
23
Drop workarounds for Android API levels pre 23.
---
clang/lib/Driver/ToolChains/Clang.cpp | 6 ++----
clang/lib/Driver/ToolChains/Linux.cpp | 3 +--
clang/test/Driver/aarch64-features.c | 6 +-----
clang/test/Driver/aarch64-fmv.c | 12 ++----------
clang/test/Driver/linux-ld.c | 11 ++---------
5 files changed, 8 insertions(+), 30 deletions(-)
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index d326a81feb762..66966dd4e9eaa 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -7899,10 +7899,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
addOutlineAtomicsArgs(D, getToolChain(), Args, CmdArgs, Triple);
- if (Triple.isAArch64() &&
- (Args.hasArg(options::OPT_mno_fmv) ||
- (Triple.isAndroid() && Triple.isAndroidVersionLT(23)) ||
- getToolChain().GetRuntimeLibType(Args) != ToolChain::RLT_CompilerRT)) {
+ if (Triple.isAArch64() && (Args.hasArg(options::OPT_mno_fmv) ||
+ getToolChain().GetRuntimeLibType(Args) != ToolChain::RLT_CompilerRT)) {
// Disable Function Multiversioning on AArch64 target.
CmdArgs.push_back("-target-feature");
CmdArgs.push_back("-fmv");
diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
index 8eb4d34e0827a..767c55707ae7b 100644
--- a/clang/lib/Driver/ToolChains/Linux.cpp
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
@@ -300,11 +300,10 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
// and the MIPS ABI require .dynsym to be sorted in different ways.
// .gnu.hash needs symbols to be grouped by hash code whereas the MIPS
// ABI requires a mapping between the GOT and the symbol table.
- // Android loader does not support .gnu.hash until API 23.
// Hexagon linker/loader does not support .gnu.hash.
// SUSE SLES 11 will stop being supported Mar 2028.
if (!IsMips && !IsHexagon) {
- if (Distro.IsOpenSUSE() || (IsAndroid && Triple.isAndroidVersionLT(23)))
+ if (Distro.IsOpenSUSE())
ExtraOpts.push_back("--hash-style=both");
else
ExtraOpts.push_back("--hash-style=gnu");
diff --git a/clang/test/Driver/aarch64-features.c b/clang/test/Driver/aarch64-features.c
index faef3878c0ab0..d2dc5a20119ee 100644
--- a/clang/test/Driver/aarch64-features.c
+++ b/clang/test/Driver/aarch64-features.c
@@ -8,14 +8,10 @@
// CHECK: fno-signed-char
// Check Function Multi Versioning option and rtlib dependency.
-// RUN: %clang --target=aarch64-linux-android23 -rtlib=compiler-rt \
-// RUN: -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-FMV %s
// RUN: %clang --target=aarch64-linux-android -rtlib=compiler-rt \
-// RUN: -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-FMV-OFF %s
+// RUN: -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-FMV %s
// RUN: %clang --target=aarch64-linux-android -rtlib=compiler-rt -mno-fmv \
// RUN: -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-FMV-OFF %s
-// RUN: %clang --target=aarch64-linux-android22 -rtlib=compiler-rt \
-// RUN: -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-FMV-OFF %s
// RUN: %clang --target=aarch64-linux-gnu -rtlib=libgcc \
// RUN: -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-FMV-OFF %s
diff --git a/clang/test/Driver/aarch64-fmv.c b/clang/test/Driver/aarch64-fmv.c
index e7d01d1d5906a..84fb55c67a315 100644
--- a/clang/test/Driver/aarch64-fmv.c
+++ b/clang/test/Driver/aarch64-fmv.c
@@ -1,24 +1,16 @@
// Test which driver flags enable/disable Function Multiversioning on aarch64.
-// FMV is enabled for non-android aarch64 targets:
+// FMV is enabled with compiler-rt:
// RUN: %clang --target=aarch64 --rtlib=compiler-rt -### -c %s 2>&1 | FileCheck -check-prefix=FMV-ENABLED %s
// RUN: %clang --target=aarch64-linux-gnu --rtlib=compiler-rt -### -c %s 2>&1 | FileCheck -check-prefix=FMV-ENABLED %s
+// RUN: %clang --target=aarch64-linux-android --rtlib=compiler-rt -### -c %s 2>&1 | FileCheck -check-prefix=FMV-ENABLED %s
// RUN: %clang --target=arm64-apple-ios --rtlib=compiler-rt -### -c %s 2>&1 | FileCheck -check-prefix=FMV-ENABLED %s
// RUN: %clang --target=arm64-apple-macosx --rtlib=compiler-rt -### -c %s 2>&1 | FileCheck -check-prefix=FMV-ENABLED %s
-// android23 defaults to --rtlib=compiler-rt:
-// RUN: %clang --target=aarch64-linux-android23 -### -c %s 2>&1 | FileCheck -check-prefix=FMV-ENABLED %s
-// RUN: %clang --target=aarch64-linux-android23 --rtlib=compiler-rt -### -c %s 2>&1 | FileCheck -check-prefix=FMV-ENABLED %s
-
// FMV is disabled without compiler-rt:
// RUN: %clang --rtlib=libgcc --target=aarch64 -### -c %s 2>&1 | FileCheck -check-prefix=FMV-DISABLED %s
// RUN: %clang --rtlib=libgcc --target=aarch64-linux-gnu -### -c %s 2>&1 | FileCheck -check-prefix=FMV-DISABLED %s
-// Disabled for older android versions:
-// RUN: %clang --rtlib=compiler-rt --target=aarch64-linux-android -### -c %s 2>&1 | FileCheck -check-prefix=FMV-DISABLED %s
-// RUN: %clang --rtlib=compiler-rt --target=aarch64-linux-android22 -### -c %s 2>&1 | FileCheck -check-prefix=FMV-DISABLED %s
-// RUN: %clang --rtlib=compiler-rt --target=aarch64-linux-android22 -mno-fmv -### -c %s 2>&1 | FileCheck -check-prefix=FMV-DISABLED %s
-
// Disabled explicitly:
// RUN: %clang --rtlib=compiler-rt --target=aarch64 -mno-fmv -### -c %s 2>&1 | FileCheck -check-prefix=FMV-DISABLED %s
// RUN: %clang --rtlib=compiler-rt --target=aarch64-linux-android23 -mno-fmv -### -c %s 2>&1 | FileCheck -check-prefix=FMV-DISABLED %s
diff --git a/clang/test/Driver/linux-ld.c b/clang/test/Driver/linux-ld.c
index be3293cdc253e..becee82b527a0 100644
--- a/clang/test/Driver/linux-ld.c
+++ b/clang/test/Driver/linux-ld.c
@@ -926,16 +926,9 @@
// CHECK-MIPS64EL-REDHAT-NOT: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld-musl-mipsel.so.1"
// CHECK-MIPS64EL-REDHAT-NOT: "--hash-style={{gnu|both}}"
-// Check that we pass --hash-style=both for pre-M Android versions and
-// --hash-style=gnu for newer Android versions.
+// Check that we pass --hash-style=gnu.
// RUN: %clang -### %s -no-pie 2>&1 \
-// RUN: --target=armv7-linux-android21 \
-// RUN: | FileCheck --check-prefix=CHECK-ANDROID-HASH-STYLE-L %s
-// CHECK-ANDROID-HASH-STYLE-L: "{{.*}}ld{{(.exe)?}}"
-// CHECK-ANDROID-HASH-STYLE-L: "--hash-style=both"
-//
-// RUN: %clang -### %s -no-pie 2>&1 \
-// RUN: --target=armv7-linux-android23 \
+// RUN: --target=armv7-linux-android \
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-HASH-STYLE-M %s
// CHECK-ANDROID-HASH-STYLE-M: "{{.*}}ld{{(.exe)?}}"
// CHECK-ANDROID-HASH-STYLE-M: "--hash-style=gnu"
More information about the cfe-commits
mailing list