mirror of
https://github.com/apple/swift.git
synced 2026-01-17 12:17:35 +01:00
This prevents the linker from trying to emit relative relocations to locally-defined public symbols into dynamic libraries, which gives ld.so heartache.
20 lines
854 B
Plaintext
20 lines
854 B
Plaintext
// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
|
|
|
|
// REQUIRES: objc_interop
|
|
|
|
sil_stage canonical
|
|
|
|
import Builtin
|
|
|
|
// CHECK: @"\01L_selector_data(help:me:)" = private global [9 x i8] c"help:me:\00", section "__TEXT,__objc_methname,cstring_literals"
|
|
// CHECK: @"\01L_selector(help:me:)" = private externally_initialized global i8* getelementptr inbounds ([9 x i8], [9 x i8]* @"\01L_selector_data(help:me:)", {{i(32|64)}} 0, {{i(32|64)}} 0), section "__DATA,__objc_selrefs,literal_pointers,no_dead_strip"
|
|
|
|
// CHECK-LABEL: define{{( protected)?}} i8* @objc_selector_literal() #0 {
|
|
sil @objc_selector_literal : $@convention(thin) () -> Builtin.RawPointer {
|
|
bb0:
|
|
// CHECK: [[SEL:%[0-9]+]] = load i8*, i8** @"\01L_selector(help:me:)"
|
|
%0 = string_literal objc_selector "help:me:"
|
|
// CHECK-NEXT: ret i8* [[SEL]]
|
|
return %0 : $Builtin.RawPointer
|
|
}
|