fix the definitions of ConstTextCoalSection/ConstDataCoalSection
authorChris Lattner <sabre@nondot.org>
Thu, 15 Jul 2010 21:22:00 +0000 (21:22 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 15 Jul 2010 21:22:00 +0000 (21:22 +0000)
to keep "Text" in sync with the "pure instructions" section attribute.
Lack of this attribute was preventing the assembler from emitting
multibyte noops instructions for templates (and inlines, and other
coalesced stuff) and was causing the assembler to mismatch .o files.

This fixes rdar://8018335

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108461 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/TargetLoweringObjectFileImpl.cpp
test/CodeGen/X86/global-sections.ll

index a80cfc4b256fe62a124ba6ebd4ad2eb548962821..3b25714c04b8d09e46842de4e96ec439fcb8dd78 100644 (file)
@@ -518,12 +518,13 @@ void TargetLoweringObjectFileMachO::Initialize(MCContext &Ctx,
                                    SectionKind::getText());
   ConstTextCoalSection
     = getContext().getMachOSection("__TEXT", "__const_coal", 
-                                   MCSectionMachO::S_COALESCED,
+                                   MCSectionMachO::S_COALESCED |
+                                   MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
                                    SectionKind::getText());
   ConstDataCoalSection
     = getContext().getMachOSection("__DATA","__const_coal",
                                    MCSectionMachO::S_COALESCED,
-                                   SectionKind::getText());
+                                   SectionKind::getReadOnly());
   ConstDataSection  // .const_data
     = getContext().getMachOSection("__DATA", "__const", 0,
                                    SectionKind::getReadOnlyWithRel());
index 6d211913b0153eae0f58dd4bfab51dc42db01954..2d8f429eff6323a5b52b3399dd39e1dc2ab414d1 100644 (file)
@@ -20,7 +20,7 @@
 
 ; TODO: linux drops this into .rodata, we drop it into ".gnu.linkonce.r.G2"
 
-; DARWIN: .section __TEXT,__const_coal,coalesced
+; DARWIN: .section __TEXT,__const_coal,coalesced,pure_instructions
 ; DARWIN: _G2:
 ; DARWIN:    .long 42
 
@@ -85,7 +85,7 @@
 ; LINUX:   .byte       1
 ; LINUX:   .size       G6, 1
 
-; DARWIN:  .section __TEXT,__const_coal,coalesced
+; DARWIN:  .section __TEXT,__const_coal,coalesced,pure_instructions
 ; DARWIN:  .globl _G6
 ; DARWIN:  .weak_definition _G6
 ; DARWIN:_G6: