mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
In #33246 among other changes, a CHECK referring to the size of _swift1_autolink_entries was changed from a regex-based expectation to a static value. This means on platforms with different link flags, this expectation fails but does not signify any real failure. Revert back to using a regex check for the length of this constant.
69 lines
2.9 KiB
Plaintext
69 lines
2.9 KiB
Plaintext
// RUN: %target-swift-frontend -disable-autolinking-runtime-compatibility-dynamic-replacements -runtime-compatibility-version none -primary-file %s -emit-ir | %FileCheck -check-prefix CHECK -check-prefix NEGATIVE -check-prefix CHECK-%target-object-format %s
|
|
|
|
// REQUIRES: CPU=x86_64
|
|
|
|
sil_stage canonical
|
|
import Builtin
|
|
import Swift
|
|
|
|
sil private @foo : $@convention(thin) () -> () {
|
|
bb0:
|
|
%0 = function_ref @bar : $@convention(thin) () -> ()
|
|
%1 = apply %0() : $@convention(thin) () -> ()
|
|
return %1 : $()
|
|
}
|
|
|
|
sil public_external @bar : $@convention(thin) () -> () {
|
|
bb0:
|
|
%1 = tuple ()
|
|
return %1 : $()
|
|
}
|
|
|
|
sil shared @baz : $@convention(thin) () -> () {
|
|
bb0:
|
|
%0 = function_ref @bar : $@convention(thin) () -> ()
|
|
%1 = apply %0() : $@convention(thin) () -> ()
|
|
return %1 : $()
|
|
}
|
|
|
|
sil shared @qux : $@convention(thin) () -> () {
|
|
bb0:
|
|
%1 = tuple ()
|
|
return %1 : $()
|
|
}
|
|
|
|
sil hidden @fred : $@convention(thin) () -> () {
|
|
bb0:
|
|
%0 = function_ref @qux : $@convention(thin) () -> ()
|
|
%1 = apply %0() : $@convention(thin) () -> ()
|
|
return %1 : $()
|
|
}
|
|
|
|
sil @frieda : $@convention(thin) () -> () {
|
|
bb0:
|
|
%1 = tuple ()
|
|
return %1 : $()
|
|
}
|
|
|
|
sil @main : $@convention(c) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> Int32 {
|
|
bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>):
|
|
%2 = integer_literal $Builtin.Int32, 0 // user: %3
|
|
%3 = struct $Int32 (%2 : $Builtin.Int32) // user: %4
|
|
return %3 : $Int32 // id: %4
|
|
}
|
|
|
|
// CHECK-macho: @"\01l_entry_point" = private constant { i32 } { i32 trunc (i64 sub (i64 ptrtoint (i32 (i32, i8**)* @main to i64), i64 ptrtoint ({ i32 }* @"\01l_entry_point" to i64)) to i32) }, section "__TEXT, __swift5_entry, regular, no_dead_strip", align 4
|
|
// CHECK-elf: @"\01l_entry_point" = private constant { i32 } { i32 trunc (i64 sub (i64 ptrtoint (i32 (i32, i8**)* @main to i64), i64 ptrtoint ({ i32 }* @"\01l_entry_point" to i64)) to i32) }, section "swift5_entry", align 4
|
|
|
|
// CHECK-macho: @llvm.used = appending global [4 x i8*] [i8* bitcast (void ()* @frieda to i8*), i8* bitcast (i32 (i32, i8**)* @main to i8*), i8* bitcast ({ i32 }* @"\01l_entry_point" to i8*), i8* bitcast (i16* @__swift_reflection_version to i8*)], section "llvm.metadata", align 8
|
|
// CHECK-elf: @llvm.used = appending global [5 x i8*] [i8* bitcast (void ()* @frieda to i8*), i8* bitcast (i32 (i32, i8**)* @main to i8*), i8* bitcast ({ i32 }* @"\01l_entry_point" to i8*), i8* bitcast (i16* @__swift_reflection_version to i8*), i8* getelementptr inbounds ([{{[0-9]+}} x i8], [{{[0-9]+}} x i8]* @_swift1_autolink_entries, i32 0, i32 0)], section "llvm.metadata", align 8
|
|
|
|
// CHECK: define linkonce_odr hidden swiftcc void @qux()
|
|
// CHECK: define hidden swiftcc void @fred()
|
|
// CHECK: define{{( dllexport)?}}{{( protected)?}} swiftcc void @frieda()
|
|
// CHECK: define{{( dllexport)?}}{{( protected)?}} i32 @main
|
|
|
|
// NEGATIVE-NOT: @foo
|
|
// NEGATIVE-NOT: @bar
|
|
// NEGATIVE-NOT: @baz
|