[SIL] Serialize section name correctly and model it on global variables

Fixes rdar://162549960.
This commit is contained in:
Doug Gregor
2025-10-15 15:11:20 -07:00
parent 3e1ea3c0f7
commit 081b5cd1e8
15 changed files with 58 additions and 19 deletions

View File

@@ -0,0 +1,18 @@
// First parse this and then emit a *.sib. Then read in the *.sib, then recreate
// RUN: %empty-directory(%t)
// RUN: %target-sil-opt -sil-print-types -enable-experimental-feature SymbolLinkageMarkers %s -emit-sib -o %t/tmp.sib -module-name borrow
// RUN: %target-sil-opt -sil-print-types -enable-experimental-feature SymbolLinkageMarkers %t/tmp.sib -o %t/tmp.2.sib -module-name borrow
// RUN: %target-sil-opt -sil-print-types -enable-experimental-feature SymbolLinkageMarkers %t/tmp.2.sib -module-name asmname -emit-sorted-sil | %FileCheck %s
// REQUIRES: swift_feature_SymbolLinkageMarkers
import Swift
// CHECK: sil_global [section "__DATA,__mysection"] @v1 : $Int
sil_global [section "__DATA,__mysection"] @v1 : $Int
// CHECK: sil [section "__TEXT,__mysection"] @f : $@convention(thin) () -> ()
sil [section "__TEXT,__mysection"] @f : $@convention(thin) () -> () {
%0 = tuple ()
return %0
}