[llvm] r187939 - Reapply r185872 now that the address sanitizer has been changed to support this.
Bill Wendling
isanbard at gmail.com
Wed Aug 7 16:42:09 PDT 2013
Author: void
Date: Wed Aug 7 18:42:09 2013
New Revision: 187939
URL: http://llvm.org/viewvc/llvm-project?rev=187939&view=rev
Log:
Reapply r185872 now that the address sanitizer has been changed to support this.
Original commit message:
Stop emitting weak symbols into the "coal" sections.
The Mach-O linker has been able to support the weak-def bit on any symbol for
quite a while now. The compiler however continued to place these symbols into a
"coal" section, which required the linker to map them back to the base section
name.
Replace the sections like this:
__TEXT/__textcoal_nt instead use __TEXT/__text
__TEXT/__const_coal instead use __TEXT/__const
__DATA/__datacoal_nt instead use __DATA/__data
<rdar://problem/14265330>
Modified:
llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
llvm/trunk/test/CodeGen/X86/global-sections.ll
Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=187939&r1=187938&r2=187939&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Wed Aug 7 18:42:09 2013
@@ -524,14 +524,14 @@ const MCSection *TargetLoweringObjectFil
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
Mangler *Mang, const TargetMachine &TM) const {
if (Kind.isText())
- 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.
+ return TextSection;
+
+ // If this is weak/linkonce, put this in a read only or data section depending
+ // on whether or not it's writable.
if (GV->isWeakForLinker()) {
if (Kind.isReadOnly())
- return ConstTextCoalSection;
- return DataCoalSection;
+ return ReadOnlySection;
+ return DataSection;
}
// FIXME: Alignment check should be handled by section classifier.
Modified: llvm/trunk/test/CodeGen/X86/global-sections.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/global-sections.ll?rev=187939&r1=187938&r2=187939&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/global-sections.ll (original)
+++ llvm/trunk/test/CodeGen/X86/global-sections.ll Wed Aug 7 18:42:09 2013
@@ -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{{$}}
; DARWIN: _G2:
; DARWIN: .long 42
@@ -70,7 +70,6 @@
; 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":
@@ -85,7 +84,7 @@
; LINUX: .byte 1
; LINUX: .size G6, 1
-; DARWIN: .section __TEXT,__const_coal,coalesced
+; DARWIN: .section __TEXT,__const{{$}}
; DARWIN: .globl _G6
; DARWIN: .weak_definition _G6
; DARWIN:_G6:
@@ -131,7 +130,7 @@
@G10 = weak global [100 x i32] zeroinitializer, align 32 ; <[100 x i32]*> [#uses=0]
-; DARWIN: .section __DATA,__datacoal_nt,coalesced
+; DARWIN: .section __DATA,__data{{$}}
; DARWIN: .globl _G10
; DARWIN: .weak_definition _G10
; DARWIN: .align 5
More information about the llvm-commits
mailing list