forked from OSchip/llvm-project
Disable LibFuncs for stpcpy and stpncpy for Android < 21
These functions don't exist in android API levels < 21. A change in llvm-12 (rG6dbf0cfcf789) caused Oz builds to emit this symbol assuming it's available and thus is causing link errors. Simply disable it here. Differential Revision: https://reviews.llvm.org/D107509
This commit is contained in:
parent
fb0a929512
commit
5848166369
|
@ -589,6 +589,11 @@ static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T,
|
|||
TLI.setAvailable(LibFunc_fgets_unlocked);
|
||||
}
|
||||
|
||||
if (T.isAndroid() && T.isAndroidVersionLT(21)) {
|
||||
TLI.setUnavailable(LibFunc_stpcpy);
|
||||
TLI.setUnavailable(LibFunc_stpncpy);
|
||||
}
|
||||
|
||||
// As currently implemented in clang, NVPTX code has no standard library to
|
||||
// speak of. Headers provide a standard-ish library implementation, but many
|
||||
// of the signatures are wrong -- for example, many libm functions are not
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
; RUN: opt < %s -mtriple xcore-xmos-elf -instcombine -S | FileCheck %s -check-prefixes=CHECK,CHECK-IPRINTF
|
||||
; RUN: opt < %s -mtriple=i386-pc-windows-msvc -instcombine -S | FileCheck %s --check-prefixes=CHECK,WIN
|
||||
; RUN: opt < %s -mtriple=i386-mingw32 -instcombine -S | FileCheck %s --check-prefixes=CHECK,WIN
|
||||
; RUN: opt < %s -mtriple=armv7-none-linux-android16 -instcombine -S | FileCheck %s --check-prefixes=CHECK,ANDROID
|
||||
|
||||
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"
|
||||
|
||||
|
@ -108,6 +109,12 @@ define i32 @test_simplify7(i8* %dst, i8* %str) {
|
|||
; WIN-NEXT: [[LENINC:%.*]] = add i32 [[STRLEN]], 1
|
||||
; WIN-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 [[DST:%.*]], i8* align 1 [[STR]], i32 [[LENINC]], i1 false)
|
||||
; WIN-NEXT: ret i32 [[STRLEN]]
|
||||
;
|
||||
; ANDROID-LABEL: @test_simplify7(
|
||||
; ANDROID-NEXT: [[STRLEN:%.*]] = call i32 @strlen(i8* noundef nonnull dereferenceable(1) [[STR:%.*]])
|
||||
; ANDROID-NEXT: [[LENINC:%.*]] = add i32 [[STRLEN]], 1
|
||||
; ANDROID-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 [[DST:%.*]], i8* align 1 [[STR]], i32 [[LENINC]], i1 false)
|
||||
; ANDROID-NEXT: ret i32 [[STRLEN]]
|
||||
;
|
||||
%fmt = getelementptr [3 x i8], [3 x i8]* @percent_s, i32 0, i32 0
|
||||
%r = call i32 (i8*, i8*, ...) @sprintf(i8* %dst, i8* %fmt, i8* %str)
|
||||
|
|
Loading…
Reference in New Issue