forked from OSchip/llvm-project
Emit .comm alignment in bytes but .align in powers of 2 for ARM ELF.
Original patch by Sandeep Patel and updated by me. llvm-svn: 94582
This commit is contained in:
parent
3dd38a8112
commit
dcb03f0f6b
|
@ -181,6 +181,10 @@ namespace llvm {
|
|||
/// directive.
|
||||
bool HasLCOMMDirective; // Defaults to false.
|
||||
|
||||
/// COMMDirectiveAlignmentIsInBytes - True is COMMDirective's optional
|
||||
/// alignment is to be specified in bytes instead of log2(n).
|
||||
bool COMMDirectiveAlignmentIsInBytes; // Defaults to true;
|
||||
|
||||
/// HasDotTypeDotSizeDirective - True if the target has .type and .size
|
||||
/// directives, this is true for most ELF targets.
|
||||
bool HasDotTypeDotSizeDirective; // Defaults to true.
|
||||
|
@ -378,6 +382,9 @@ namespace llvm {
|
|||
}
|
||||
bool hasLCOMMDirective() const { return HasLCOMMDirective; }
|
||||
bool hasDotTypeDotSizeDirective() const {return HasDotTypeDotSizeDirective;}
|
||||
bool getCOMMDirectiveAlignmentIsInBytes() const {
|
||||
return COMMDirectiveAlignmentIsInBytes;
|
||||
}
|
||||
bool hasSingleParameterDotFile() const { return HasSingleParameterDotFile; }
|
||||
bool hasNoDeadStrip() const { return HasNoDeadStrip; }
|
||||
const char *getWeakRefDirective() const { return WeakRefDirective; }
|
||||
|
|
|
@ -51,6 +51,7 @@ MCAsmInfo::MCAsmInfo() {
|
|||
GlobalDirective = "\t.globl\t";
|
||||
SetDirective = 0;
|
||||
HasLCOMMDirective = false;
|
||||
COMMDirectiveAlignmentIsInBytes = true;
|
||||
HasDotTypeDotSizeDirective = true;
|
||||
HasSingleParameterDotFile = true;
|
||||
HasNoDeadStrip = false;
|
||||
|
|
|
@ -18,6 +18,7 @@ using namespace llvm;
|
|||
|
||||
MCAsmInfoCOFF::MCAsmInfoCOFF() {
|
||||
GlobalPrefix = "_";
|
||||
COMMDirectiveAlignmentIsInBytes = false;
|
||||
HasLCOMMDirective = true;
|
||||
HasDotTypeDotSizeDirective = false;
|
||||
HasSingleParameterDotFile = false;
|
||||
|
@ -36,4 +37,3 @@ MCAsmInfoCOFF::MCAsmInfoCOFF() {
|
|||
SupportsDebugInformation = true;
|
||||
DwarfSectionOffsetDirective = "\t.secrel32\t";
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ MCAsmInfoDarwin::MCAsmInfoDarwin() {
|
|||
HasSubsectionsViaSymbols = true;
|
||||
|
||||
AlignmentIsInBytes = false;
|
||||
COMMDirectiveAlignmentIsInBytes = false;
|
||||
InlineAsmStart = " InlineAsm Start";
|
||||
InlineAsmEnd = " InlineAsm End";
|
||||
|
||||
|
|
|
@ -282,7 +282,7 @@ void MCAsmStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
|||
unsigned ByteAlignment) {
|
||||
OS << "\t.comm\t" << *Symbol << ',' << Size;
|
||||
if (ByteAlignment != 0) {
|
||||
if (MAI.getAlignmentIsInBytes())
|
||||
if (MAI.getCOMMDirectiveAlignmentIsInBytes())
|
||||
OS << ',' << ByteAlignment;
|
||||
else
|
||||
OS << ',' << Log2_32(ByteAlignment);
|
||||
|
|
|
@ -52,6 +52,9 @@ ARMMCAsmInfoDarwin::ARMMCAsmInfoDarwin() {
|
|||
}
|
||||
|
||||
ARMELFMCAsmInfo::ARMELFMCAsmInfo() {
|
||||
// ".comm align is in bytes but .align is pow-2."
|
||||
AlignmentIsInBytes = false;
|
||||
|
||||
Data64bitsDirective = 0;
|
||||
CommentString = "@";
|
||||
|
||||
|
|
|
@ -8,31 +8,31 @@
|
|||
; no alignment
|
||||
|
||||
@c = global i16 2
|
||||
;ELF: .align 2
|
||||
;ELF: .align 1
|
||||
;ELF: c:
|
||||
;DARWIN: .align 1
|
||||
;DARWIN: _c:
|
||||
|
||||
@d = global i32 3
|
||||
;ELF: .align 4
|
||||
;ELF: .align 2
|
||||
;ELF: d:
|
||||
;DARWIN: .align 2
|
||||
;DARWIN: _d:
|
||||
|
||||
@e = global i64 4
|
||||
;ELF: .align 8
|
||||
;ELF: .align 3
|
||||
;ELF: e
|
||||
;DARWIN: .align 2
|
||||
;DARWIN: _e:
|
||||
|
||||
@f = global float 5.0
|
||||
;ELF: .align 4
|
||||
;ELF: .align 2
|
||||
;ELF: f:
|
||||
;DARWIN: .align 2
|
||||
;DARWIN: _f:
|
||||
|
||||
@g = global double 6.0
|
||||
;ELF: .align 8
|
||||
;ELF: .align 3
|
||||
;ELF: g:
|
||||
;DARWIN: .align 2
|
||||
;DARWIN: _g:
|
||||
|
|
|
@ -67,9 +67,9 @@ define i32 @test1() {
|
|||
; LinuxPIC: ldr r0, [r0]
|
||||
; LinuxPIC: bx lr
|
||||
|
||||
; LinuxPIC: .align 4
|
||||
; LinuxPIC: .align 2
|
||||
; LinuxPIC: .LCPI1_0:
|
||||
; LinuxPIC: .long _GLOBAL_OFFSET_TABLE_-(.LPC1_0+8)
|
||||
; LinuxPIC: .align 4
|
||||
; LinuxPIC: .align 2
|
||||
; LinuxPIC: .LCPI1_1:
|
||||
; LinuxPIC: .long G(GOT)
|
||||
|
|
Loading…
Reference in New Issue