Skip to content

Commit 31e85cc

Browse files
authored
[Android] Drop workarounds for older Android API levels pre 9, 17 and 21 (#161911)
Drop workarounds for Android API levels pre 9, 17, 21. The minimum Android API currently supported by the LTS NDK is 21.
1 parent 2aeefcf commit 31e85cc

File tree

9 files changed

+10
-61
lines changed

9 files changed

+10
-61
lines changed

llvm/include/llvm/IR/RuntimeLibcalls.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,7 @@ struct RuntimeLibcallsInfo {
225225

226226
/// Return true if the target has sincosf/sincos/sincosl functions
227227
static bool hasSinCos(const Triple &TT) {
228-
return TT.isGNUEnvironment() || TT.isOSFuchsia() ||
229-
(TT.isAndroid() && !TT.isAndroidVersionLT(9));
228+
return TT.isGNUEnvironment() || TT.isOSFuchsia() || TT.isAndroid();
230229
}
231230

232231
static bool hasSinCos_f32_f64(const Triple &TT) {

llvm/lib/Analysis/TargetLibraryInfo.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -740,11 +740,6 @@ static void initializeLibCalls(TargetLibraryInfoImpl &TLI, const Triple &T,
740740
TLI.setAvailable(LibFunc_fgets_unlocked);
741741
}
742742

743-
if (T.isAndroid() && T.isAndroidVersionLT(21)) {
744-
TLI.setUnavailable(LibFunc_stpcpy);
745-
TLI.setUnavailable(LibFunc_stpncpy);
746-
}
747-
748743
if (T.isPS()) {
749744
// PS4/PS5 do have memalign.
750745
TLI.setAvailable(LibFunc_memalign);

llvm/lib/Target/X86/X86ISelLoweringCall.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ unsigned X86TargetLowering::getAddressSpace() const {
547547

548548
static bool hasStackGuardSlotTLS(const Triple &TargetTriple) {
549549
return TargetTriple.isOSGlibc() || TargetTriple.isOSFuchsia() ||
550-
(TargetTriple.isAndroid() && !TargetTriple.isAndroidVersionLT(17));
550+
TargetTriple.isAndroid();
551551
}
552552

553553
static Constant* SegmentOffset(IRBuilderBase &IRB,

llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -600,9 +600,7 @@ static ShadowMapping getShadowMapping(const Triple &TargetTriple, int LongSize,
600600
!IsRISCV64 && !IsLoongArch64 &&
601601
!(Mapping.Offset & (Mapping.Offset - 1)) &&
602602
Mapping.Offset != kDynamicShadowSentinel;
603-
bool IsAndroidWithIfuncSupport =
604-
IsAndroid && !TargetTriple.isAndroidVersionLT(21);
605-
Mapping.InGlobal = ClWithIfunc && IsAndroidWithIfuncSupport && IsArmOrThumb;
603+
Mapping.InGlobal = ClWithIfunc && IsAndroid && IsArmOrThumb;
606604

607605
return Mapping;
608606
}

llvm/test/CodeGen/ARM/sincos.ll

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
; RUN: llc < %s -mtriple=armv7-apple-ios7 -mcpu=cortex-a8 | FileCheck %s --check-prefix=SINCOS
33
; RUN: llc < %s -mtriple=armv7-linux-gnu -mcpu=cortex-a8 | FileCheck %s --check-prefix=SINCOS-GNU
44
; RUN: llc < %s -mtriple=armv7-linux-gnueabi -mcpu=cortex-a8 | FileCheck %s --check-prefix=SINCOS-GNU
5-
; RUN: llc < %s -mtriple=armv7-linux-android -mcpu=cortex-a8 | FileCheck %s --check-prefix=NOOPT-ANDROID
6-
; RUN: llc < %s -mtriple=armv7-linux-android9 -mcpu=cortex-a8 | FileCheck %s --check-prefix=SINCOS-GNU
5+
; RUN: llc < %s -mtriple=armv7-linux-android -mcpu=cortex-a8 | FileCheck %s --check-prefix=SINCOS-GNU
76

87
; Combine sin / cos into a single call unless they may write errno (as
98
; captured by readnone attrbiute, controlled by clang -fmath-errno
@@ -22,10 +21,6 @@ entry:
2221
; NOOPT: bl _sinf
2322
; NOOPT: bl _cosf
2423

25-
; NOOPT-ANDROID-LABEL: test1:
26-
; NOOPT-ANDROID: bl sinf
27-
; NOOPT-ANDROID: bl cosf
28-
2924
%call = tail call float @sinf(float %x) readnone
3025
%call1 = tail call float @cosf(float %x) readnone
3126
%add = fadd float %call, %call1
@@ -44,10 +39,6 @@ entry:
4439
; NOOPT: bl _sinf
4540
; NOOPT: bl _cosf
4641

47-
; NOOPT-ANDROID-LABEL: test1_fast:
48-
; NOOPT-ANDROID: bl sinf
49-
; NOOPT-ANDROID: bl cosf
50-
5142
%call = tail call fast float @sinf(float %x) readnone
5243
%call1 = tail call fast float @cosf(float %x) readnone
5344
%add = fadd float %call, %call1
@@ -68,10 +59,6 @@ entry:
6859
; NOOPT: bl _sinf
6960
; NOOPT: bl _cosf
7061

71-
; NOOPT-ANDROID-LABEL: test1_errno:
72-
; NOOPT-ANDROID: bl sinf
73-
; NOOPT-ANDROID: bl cosf
74-
7562
%call = tail call float @sinf(float %x)
7663
%call1 = tail call float @cosf(float %x)
7764
%add = fadd float %call, %call1
@@ -90,10 +77,6 @@ entry:
9077
; NOOPT: bl _sin
9178
; NOOPT: bl _cos
9279

93-
; NOOPT-ANDROID-LABEL: test2:
94-
; NOOPT-ANDROID: bl sin
95-
; NOOPT-ANDROID: bl cos
96-
9780
%call = tail call double @sin(double %x) readnone
9881
%call1 = tail call double @cos(double %x) readnone
9982
%add = fadd double %call, %call1
@@ -112,10 +95,6 @@ entry:
11295
; NOOPT: bl _sin
11396
; NOOPT: bl _cos
11497

115-
; NOOPT-ANDROID-LABEL: test2_fast:
116-
; NOOPT-ANDROID: bl sin
117-
; NOOPT-ANDROID: bl cos
118-
11998
%call = tail call fast double @sin(double %x) readnone
12099
%call1 = tail call fast double @cos(double %x) readnone
121100
%add = fadd double %call, %call1
@@ -136,10 +115,6 @@ entry:
136115
; NOOPT: bl _sin
137116
; NOOPT: bl _cos
138117

139-
; NOOPT-ANDROID-LABEL: test2_errno:
140-
; NOOPT-ANDROID: bl sin
141-
; NOOPT-ANDROID: bl cos
142-
143118
%call = tail call double @sin(double %x)
144119
%call1 = tail call double @cos(double %x)
145120
%add = fadd double %call, %call1

llvm/test/CodeGen/X86/stack-protector-target.ll

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@
22
; RUN: llc -mtriple=i386-linux < %s -o - | FileCheck --check-prefix=I386-TLS %s
33
; RUN: llc -mtriple=x86_64-linux < %s -o - | FileCheck --check-prefix=X64-TLS %s
44

5-
; RUN: llc -mtriple=i386-linux-android < %s -o - | FileCheck --check-prefix=I386 %s
6-
; RUN: llc -mtriple=i386-linux-android16 < %s -o - | FileCheck --check-prefix=I386 %s
7-
; RUN: llc -mtriple=i386-linux-android17 < %s -o - | FileCheck --check-prefix=I386-TLS %s
8-
; RUN: llc -mtriple=i386-linux-android24 < %s -o - | FileCheck --check-prefix=I386-TLS %s
5+
; RUN: llc -mtriple=i386-linux-android < %s -o - | FileCheck --check-prefix=I386-TLS %s
96
; RUN: llc -mtriple=x86_64-linux-android < %s -o - | FileCheck --check-prefix=X64-TLS %s
10-
; RUN: llc -mtriple=x86_64-linux-android17 < %s -o - | FileCheck --check-prefix=X64-TLS %s
11-
; RUN: llc -mtriple=x86_64-linux-android24 < %s -o - | FileCheck --check-prefix=X64-TLS %s
127

138
; RUN: llc -mtriple=i386-kfreebsd < %s -o - | FileCheck --check-prefix=I386-TLS %s
149
; RUN: llc -mtriple=x86_64-kfreebsd < %s -o - | FileCheck --check-prefix=X64-TLS %s
@@ -27,11 +22,6 @@ declare void @_Z7CapturePi(ptr)
2722
; X64-TLS: movq %fs:40, %[[C:.*]]
2823
; X64-TLS: cmpq 16(%rsp), %[[C]]
2924

30-
; I386: movl __stack_chk_guard, %[[B:.*]]
31-
; I386: movl %[[B]], 8(%esp)
32-
; I386: movl __stack_chk_guard, %[[C:.*]]
33-
; I386: cmpl 8(%esp), %[[C]]
34-
3525
; I386-TLS: movl %gs:20, %[[B:.*]]
3626
; I386-TLS: movl %[[B]], 8(%esp)
3727
; I386-TLS: movl %gs:20, %[[C:.*]]

llvm/test/Instrumentation/AddressSanitizer/with-ifunc.ll

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@
44
; RUN: opt -passes=asan -S -asan-with-ifunc=1 -asan-with-ifunc-suppress-remat=0 < %s | FileCheck %s --check-prefixes=CHECK,CHECK-IFUNC
55
; RUN: opt -passes=asan -S -asan-with-ifunc=1 -asan-with-ifunc-suppress-remat=1 < %s | FileCheck %s --check-prefixes=CHECK,CHECK-IFUNC-NOREMAT
66

7-
; Pre-Lollipop Android does not support ifunc.
8-
; RUN: opt -passes=asan -S -asan-with-ifunc=1 -asan-with-ifunc-suppress-remat=0 -mtriple=armv7-linux-android20 < %s | FileCheck %s --check-prefixes=CHECK,CHECK-NOIFUNC
9-
; RUN: opt -passes=asan -S -asan-with-ifunc=1 -asan-with-ifunc-suppress-remat=0 -mtriple=armv7-linux-android < %s | FileCheck %s --check-prefixes=CHECK,CHECK-NOIFUNC
10-
; RUN: opt -passes=asan -S -asan-with-ifunc=1 -asan-with-ifunc-suppress-remat=0 -mtriple=armv7-linux-android21 < %s | FileCheck %s --check-prefixes=CHECK,CHECK-IFUNC
7+
; RUN: opt -passes=asan -S -asan-with-ifunc=1 -asan-with-ifunc-suppress-remat=0 -mtriple=armv7-linux-android < %s | FileCheck %s --check-prefixes=CHECK,CHECK-IFUNC
118

129
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
13-
target triple = "armv7--linux-android22"
10+
target triple = "armv7--linux-android"
1411

1512
; CHECK-IFUNC: @__asan_shadow = external global [0 x i8]
1613
; CHECK-NOIFUNC: @__asan_shadow_memory_dynamic_address = external global i32

llvm/test/Transforms/InstCombine/sprintf-1.ll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
; RUN: opt < %s -mtriple xcore-xmos-elf -passes=instcombine -S | FileCheck %s -check-prefixes=CHECK,WITHSTPCPY,CHECK-IPRINTF
66
; RUN: opt < %s -mtriple=i386-pc-windows-msvc -passes=instcombine -S | FileCheck %s --check-prefixes=CHECK,NOSTPCPY
77
; RUN: opt < %s -mtriple=i386-mingw32 -passes=instcombine -S | FileCheck %s --check-prefixes=CHECK,NOSTPCPY
8-
; RUN: opt < %s -mtriple=armv7-none-linux-android16 -passes=instcombine -S | FileCheck %s --check-prefixes=CHECK,NOSTPCPY
9-
; RUN: opt < %s -mtriple=armv7-none-linux-android21 -passes=instcombine -S | FileCheck %s --check-prefixes=CHECK,WITHSTPCPY
8+
; RUN: opt < %s -mtriple=armv7-none-linux-android -passes=instcombine -S | FileCheck %s --check-prefixes=CHECK,WITHSTPCPY
109
; RUN: opt < %s -mtriple=x86_64-scei-ps4 -passes=instcombine -S | FileCheck %s --check-prefixes=CHECK,NOSTPCPY
1110

1211
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"

llvm/test/Transforms/SafeStack/X86/abi_ssp.ll

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
; RUN: opt -safe-stack -S -mtriple=i686-pc-linux-gnu < %s -o - | FileCheck --check-prefixes=COMMON,TLS32 %s
22
; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck --check-prefixes=COMMON,TLS64 %s
33

4-
; RUN: opt -safe-stack -S -mtriple=i686-linux-android < %s -o - | FileCheck --check-prefixes=COMMON,GLOBAL32 %s
5-
; RUN: opt -safe-stack -S -mtriple=i686-linux-android24 < %s -o - | FileCheck --check-prefixes=COMMON,TLS32 %s
6-
4+
; RUN: opt -safe-stack -S -mtriple=i686-linux-android < %s -o - | FileCheck --check-prefixes=COMMON,TLS32 %s
75
; RUN: opt -safe-stack -S -mtriple=x86_64-linux-android < %s -o - | FileCheck --check-prefixes=COMMON,TLS64 %s
86

97
; RUN: opt -safe-stack -S -mtriple=x86_64-unknown-fuchsia < %s -o - | FileCheck --check-prefixes=COMMON,FUCHSIA64 %s
108

119
; RUN: opt -passes=safe-stack -S -mtriple=i686-pc-linux-gnu < %s -o - | FileCheck --check-prefixes=COMMON,TLS32 %s
1210
; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck --check-prefixes=COMMON,TLS64 %s
1311

14-
; RUN: opt -passes=safe-stack -S -mtriple=i686-linux-android < %s -o - | FileCheck --check-prefixes=COMMON,GLOBAL32 %s
15-
; RUN: opt -passes=safe-stack -S -mtriple=i686-linux-android24 < %s -o - | FileCheck --check-prefixes=COMMON,TLS32 %s
16-
12+
; RUN: opt -passes=safe-stack -S -mtriple=i686-linux-android < %s -o - | FileCheck --check-prefixes=COMMON,TLS32 %s
1713
; RUN: opt -passes=safe-stack -S -mtriple=x86_64-linux-android < %s -o - | FileCheck --check-prefixes=COMMON,TLS64 %s
1814

1915
; RUN: opt -passes=safe-stack -S -mtriple=x86_64-unknown-fuchsia < %s -o - | FileCheck --check-prefixes=COMMON,FUCHSIA64 %s

0 commit comments

Comments
 (0)