Use __literal16. It has been supported by the linker since 2005.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201365 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2014-02-13 23:16:11 +00:00
parent c5887a2385
commit cac25de43d
3 changed files with 16 additions and 12 deletions

View File

@ -562,7 +562,7 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
return FourByteConstantSection; return FourByteConstantSection;
if (Kind.isMergeableConst8()) if (Kind.isMergeableConst8())
return EightByteConstantSection; return EightByteConstantSection;
if (Kind.isMergeableConst16() && SixteenByteConstantSection) if (Kind.isMergeableConst16())
return SixteenByteConstantSection; return SixteenByteConstantSection;
} }
@ -601,7 +601,7 @@ TargetLoweringObjectFileMachO::getSectionForConstant(SectionKind Kind) const {
return FourByteConstantSection; return FourByteConstantSection;
if (Kind.isMergeableConst8()) if (Kind.isMergeableConst8())
return EightByteConstantSection; return EightByteConstantSection;
if (Kind.isMergeableConst16() && SixteenByteConstantSection) if (Kind.isMergeableConst16())
return SixteenByteConstantSection; return SixteenByteConstantSection;
return ReadOnlySection; // .const return ReadOnlySection; // .const
} }

View File

@ -79,16 +79,10 @@ void MCObjectFileInfo::InitMachOMCObjectFileInfo(Triple T) {
MCSectionMachO::S_8BYTE_LITERALS, MCSectionMachO::S_8BYTE_LITERALS,
SectionKind::getMergeableConst8()); SectionKind::getMergeableConst8());
// ld_classic doesn't support .literal16 in 32-bit mode, and ld64 falls back SixteenByteConstantSection // .literal16
// to using it in -static mode. = Ctx->getMachOSection("__TEXT", "__literal16",
SixteenByteConstantSection = 0; MCSectionMachO::S_16BYTE_LITERALS,
if (RelocM != Reloc::Static && SectionKind::getMergeableConst16());
T.getArch() != Triple::x86_64 && T.getArch() != Triple::ppc64 &&
T.getArch() != Triple::ppc64le)
SixteenByteConstantSection = // .literal16
Ctx->getMachOSection("__TEXT", "__literal16",
MCSectionMachO::S_16BYTE_LITERALS,
SectionKind::getMergeableConst16());
ReadOnlySection // .const ReadOnlySection // .const
= Ctx->getMachOSection("__TEXT", "__const", 0, = Ctx->getMachOSection("__TEXT", "__const", 0,

View File

@ -1,5 +1,7 @@
; RUN: llc < %s -mtriple=i386-unknown-linux-gnu | FileCheck %s -check-prefix=LINUX ; RUN: llc < %s -mtriple=i386-unknown-linux-gnu | FileCheck %s -check-prefix=LINUX
; RUN: llc < %s -mtriple=i386-apple-darwin9.7 | FileCheck %s -check-prefix=DARWIN ; RUN: llc < %s -mtriple=i386-apple-darwin9.7 | FileCheck %s -check-prefix=DARWIN
; RUN: llc < %s -mtriple=i386-apple-darwin10 -relocation-model=static | FileCheck %s -check-prefix=DARWIN-STATIC
; RUN: llc < %s -mtriple=x86_64-apple-darwin10 | FileCheck %s -check-prefix=DARWIN64
; RUN: llc < %s -mtriple=i386-unknown-linux-gnu -fdata-sections | FileCheck %s -check-prefix=LINUX-SECTIONS ; RUN: llc < %s -mtriple=i386-unknown-linux-gnu -fdata-sections | FileCheck %s -check-prefix=LINUX-SECTIONS
@ -47,6 +49,14 @@
; DARWIN: _G4: ; DARWIN: _G4:
; DARWIN: .long 34 ; DARWIN: .long 34
; DARWIN-STATIC: .section __TEXT,__literal16,16byte_literals
; DARWIN-STATIC: _G4:
; DARWIN-STATIC: .long 34
; DARWIN64: .section __TEXT,__literal16,16byte_literals
; DARWIN64: _G4:
; DARWIN64: .quad 34
; int G5 = 47; ; int G5 = 47;
@G5 = global i32 47 @G5 = global i32 47