mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
We changed to `llvm.compiler.used` because of the behaviour of `gold`, which refuses to coalesce sections that have different `SHF_GNU_RETAIN` flags, which causes problems with metadata. Originally I thought we were going to have to generate two sections with distinct names and have the runtime look for both of them, but it turns out that the runtime only wants to see sections that have `SHF_GNU_RETAIN` in any case. It's really the reflection code that is interested in being able to see non-retained sections. The upshot is that we don't need to use `llvm.compiler.used`; it's just fine if we have duplicate sections, as long as the reflection code looks for them when it's inspecting an ELF image. This also means we no longer need to pass `-z nostart-stop-gc` to the linker if we're using `lld`. rdar://123504095
32 lines
1.3 KiB
Plaintext
32 lines
1.3 KiB
Plaintext
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-objc-interop -parse-as-library -emit-ir %s | %FileCheck %s --check-prefix=CHECK-%target-object-format
|
|
// REQUIRES: objc_codegen
|
|
|
|
// It tests whether the vars @"\01l_OBJC_LABEL_PROTOCOL_$__TtP18objc_protocol_vars1T_"
|
|
// and @"\01l_OBJC_PROTOCOL_REFERENCE_$__TtP18objc_protocol_vars1T_" are in llvm.used.
|
|
//
|
|
// import Foundation
|
|
// @objc
|
|
// public protocol T: AnyObject {
|
|
//
|
|
// var current: Int32 { get }
|
|
//
|
|
// func clone() -> T
|
|
//
|
|
//}
|
|
sil_stage canonical
|
|
|
|
import Builtin
|
|
import Swift
|
|
import SwiftShims
|
|
|
|
import Foundation
|
|
|
|
@objc public protocol T : AnyObject {
|
|
@objc var current: Int32 { get }
|
|
@objc func clone() -> T
|
|
}
|
|
|
|
// CHECK-macho: @llvm.used = appending global [{{.*}}] [{{.*}}, ptr @"\01l_OBJC_LABEL_PROTOCOL_$__TtP18objc_protocol_vars1T_", ptr @"\01l_OBJC_PROTOCOL_REFERENCE_$__TtP18objc_protocol_vars1T_", {{.*}}], {{.*}}
|
|
// CHECK-elf: @llvm.used = appending global [{{.*}}] [{{.*}}, ptr @"\01l_OBJC_LABEL_PROTOCOL_$__TtP18objc_protocol_vars1T_", ptr @"\01l_OBJC_PROTOCOL_REFERENCE_$__TtP18objc_protocol_vars1T_", {{.*}}], {{.*}}
|
|
// CHECK-coff: @llvm.used = appending global [{{.*}}] [{{.*}}, ptr @"\01l_OBJC_LABEL_PROTOCOL_$__TtP18objc_protocol_vars1T_", ptr @"\01l_OBJC_PROTOCOL_REFERENCE_$__TtP18objc_protocol_vars1T_", {{.*}}], {{.*}}
|