From 9b19dfc2e003e33892be2d80ad535d18f24c53d9 Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Thu, 8 Aug 2013 21:04:16 +0000 Subject: [PATCH] Revert "Reapply r185872 now that the address sanitizer has been changed to support this." This reverts commit r187939. It broke an O0 build of a spec benchmark. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188012 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 12 ++++++------ test/CodeGen/X86/global-sections.ll | 7 ++++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index cf70ad6a2ec..ea0d62e6ef3 100644 --- a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -524,14 +524,14 @@ const MCSection *TargetLoweringObjectFileMachO:: SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler *Mang, const TargetMachine &TM) const { if (Kind.isText()) - return TextSection; - - // If this is weak/linkonce, put this in a read only or data section depending - // on whether or not it's writable. + return GV->isWeakForLinker() ? TextCoalSection : TextSection; + + // If this is weak/linkonce, put this in a coalescable section, either in text + // or data depending on if it is writable. if (GV->isWeakForLinker()) { if (Kind.isReadOnly()) - return ReadOnlySection; - return DataSection; + return ConstTextCoalSection; + return DataCoalSection; } // FIXME: Alignment check should be handled by section classifier. diff --git a/test/CodeGen/X86/global-sections.ll b/test/CodeGen/X86/global-sections.ll index b38aea4e7bb..194f59765e5 100644 --- a/test/CodeGen/X86/global-sections.ll +++ b/test/CodeGen/X86/global-sections.ll @@ -20,7 +20,7 @@ ; TODO: linux drops this into .rodata, we drop it into ".gnu.linkonce.r.G2" -; DARWIN: .section __TEXT,__const{{$}} +; DARWIN: .section __TEXT,__const_coal,coalesced ; DARWIN: _G2: ; DARWIN: .long 42 @@ -70,6 +70,7 @@ ; LINUX: .weak foo_20_bar ; LINUX: foo_20_bar: +; DARWIN: .section __DATA,__datacoal_nt,coalesced ; DARWIN: .globl "_foo bar" ; DARWIN: .weak_definition "_foo bar" ; DARWIN: "_foo bar": @@ -84,7 +85,7 @@ ; LINUX: .byte 1 ; LINUX: .size G6, 1 -; DARWIN: .section __TEXT,__const{{$}} +; DARWIN: .section __TEXT,__const_coal,coalesced ; DARWIN: .globl _G6 ; DARWIN: .weak_definition _G6 ; DARWIN:_G6: @@ -130,7 +131,7 @@ @G10 = weak global [100 x i32] zeroinitializer, align 32 ; <[100 x i32]*> [#uses=0] -; DARWIN: .section __DATA,__data{{$}} +; DARWIN: .section __DATA,__datacoal_nt,coalesced ; DARWIN: .globl _G10 ; DARWIN: .weak_definition _G10 ; DARWIN: .align 5