File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -1989,11 +1989,16 @@ llvm::Value *IRGenFunction::emitTypeLayoutRef(SILType type) {
1989
1989
1990
1990
void IRGenModule::setTrueConstGlobal (llvm::GlobalVariable *var) {
1991
1991
switch (TargetInfo.OutputObjectFormat ) {
1992
+ case llvm::Triple::UnknownObjectFormat:
1993
+ llvm_unreachable (" unknown object format" );
1992
1994
case llvm::Triple::MachO:
1993
- var->setSection (" __TEXT, __const" );
1995
+ var->setSection (" __TEXT,__const" );
1994
1996
break ;
1995
- // TODO: ELF?
1996
- default :
1997
+ case llvm::Triple::ELF:
1998
+ var->setSection (" .rodata" );
1999
+ break ;
2000
+ case llvm::Triple::COFF:
2001
+ var->setSection (" .rdata" );
1997
2002
break ;
1998
2003
}
1999
2004
}
Original file line number Diff line number Diff line change
1
+ // RUN: %swift -target x86_64-apple-macosx10.10 -emit-ir -parse-stdlib -primary-file %s -module-name main -o - | FileCheck %s -check-prefix CHECK-MACHO
2
+ // RUN: %swift -target x86_64-unknown-linux-gnu -emit-ir -parse-stdlib -primary-file %s -module-name main -o - | FileCheck %s -check-prefix CHECK-ELF
3
+ // RUN: %swift -target x86_64-unknown-windows-itanium -emit-ir -parse-stdlib -primary-file %s -module-name main -o - | FileCheck %s -check-prefix CHECK-COFF
4
+
5
+ // CHECK-MACHO: @_TMnV4main1s = constant {{.*}}, section "__TEXT,__const"
6
+ // CHECK-ELF: @_TMnV4main1s = {{.*}}constant {{.*}}, section ".rodata"
7
+ // CHECK-COFF: @_TMnV4main1s = {{.*}}constant {{.*}}, section ".rdata"
8
+
9
+ public struct s {
10
+ }
11
+
You can’t perform that action at this time.
0 commit comments