forked from OSchip/llvm-project
[XCOFF] Adjust .rename emission sequence
Summary: AIX assembler does not generate correct relocation when .rename appear between tc entry label and .tc directive. So only emit .rename after .tc/.comm or other linkage is emitted. Reviewed By: daltenty, hubert.reinterpretcast Differential Revision: https://reviews.llvm.org/D85317
This commit is contained in:
parent
b129c9d81a
commit
7866442b3f
|
@ -800,11 +800,6 @@ void MCAsmStreamer::emitXCOFFLocalCommonSymbol(MCSymbol *LabelSym,
|
|||
|
||||
void MCAsmStreamer::emitXCOFFSymbolLinkageWithVisibility(
|
||||
MCSymbol *Symbol, MCSymbolAttr Linkage, MCSymbolAttr Visibility) {
|
||||
// Print symbol's rename (original name contains invalid character(s)) if
|
||||
// there is one.
|
||||
if (cast<MCSymbolXCOFF>(Symbol)->hasRename())
|
||||
emitXCOFFRenameDirective(Symbol,
|
||||
cast<MCSymbolXCOFF>(Symbol)->getSymbolTableName());
|
||||
|
||||
switch (Linkage) {
|
||||
case MCSA_Global:
|
||||
|
@ -839,6 +834,12 @@ void MCAsmStreamer::emitXCOFFSymbolLinkageWithVisibility(
|
|||
report_fatal_error("unexpected value for Visibility type");
|
||||
}
|
||||
EmitEOL();
|
||||
|
||||
// Print symbol's rename (original name contains invalid character(s)) if
|
||||
// there is one.
|
||||
if (cast<MCSymbolXCOFF>(Symbol)->hasRename())
|
||||
emitXCOFFRenameDirective(Symbol,
|
||||
cast<MCSymbolXCOFF>(Symbol)->getSymbolTableName());
|
||||
}
|
||||
|
||||
void MCAsmStreamer::emitXCOFFRenameDirective(const MCSymbol *Name,
|
||||
|
@ -868,12 +869,6 @@ void MCAsmStreamer::emitELFSize(MCSymbol *Symbol, const MCExpr *Value) {
|
|||
|
||||
void MCAsmStreamer::emitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
||||
unsigned ByteAlignment) {
|
||||
// Print symbol's rename (original name contains invalid character(s)) if
|
||||
// there is one.
|
||||
MCSymbolXCOFF *XSym = dyn_cast<MCSymbolXCOFF>(Symbol);
|
||||
if (XSym && XSym->hasRename())
|
||||
emitXCOFFRenameDirective(XSym, XSym->getSymbolTableName());
|
||||
|
||||
OS << "\t.comm\t";
|
||||
Symbol->print(OS, MAI);
|
||||
OS << ',' << Size;
|
||||
|
@ -885,6 +880,13 @@ void MCAsmStreamer::emitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
|||
OS << ',' << Log2_32(ByteAlignment);
|
||||
}
|
||||
EmitEOL();
|
||||
|
||||
// Print symbol's rename (original name contains invalid character(s)) if
|
||||
// there is one.
|
||||
MCSymbolXCOFF *XSym = dyn_cast<MCSymbolXCOFF>(Symbol);
|
||||
if (XSym && XSym->hasRename())
|
||||
emitXCOFFRenameDirective(XSym, XSym->getSymbolTableName());
|
||||
|
||||
}
|
||||
|
||||
void MCAsmStreamer::emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
||||
|
|
|
@ -124,9 +124,10 @@ public:
|
|||
MCSymbolXCOFF *TCSym =
|
||||
cast<MCSymbolXCOFF>(Streamer.getContext().getOrCreateSymbol(
|
||||
XSym->getSymbolTableName() + "[TC]"));
|
||||
OS << "\t.tc " << TCSym->getName() << "," << XSym->getName() << '\n';
|
||||
|
||||
if (TCSym->hasRename())
|
||||
Streamer.emitXCOFFRenameDirective(TCSym, TCSym->getSymbolTableName());
|
||||
OS << "\t.tc " << TCSym->getName() << "," << XSym->getName() << '\n';
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,10 +40,10 @@ entry:
|
|||
; This is f@o
|
||||
declare i32 @"f\40o"(...)
|
||||
|
||||
; ASM: .rename _Renamed..24f_o[DS],"f$o" # -- Begin function f$o
|
||||
; ASM-NEXT: .lglobl _Renamed..24f_o[DS]
|
||||
; ASM-NEXT: .rename ._Renamed..24f_o,".f$o"
|
||||
; ASM: .lglobl _Renamed..24f_o[DS] # -- Begin function f$o
|
||||
; ASM-NEXT: .rename _Renamed..24f_o[DS],"f$o"
|
||||
; ASM-NEXT: .lglobl ._Renamed..24f_o
|
||||
; ASM-NEXT: .rename ._Renamed..24f_o,".f$o"
|
||||
; ASM-NEXT: .align 4
|
||||
; ASM-NEXT: .csect _Renamed..24f_o[DS],2
|
||||
; ASM-NEXT: .vbyte 4, ._Renamed..24f_o # @"f$o"
|
||||
|
@ -53,10 +53,10 @@ declare i32 @"f\40o"(...)
|
|||
; ASM-NEXT: ._Renamed..24f_o:
|
||||
; ASM: bl ._Renamed..40f_o
|
||||
; ASM-NEXT: nop
|
||||
; ASM: .rename _Renamed..26f_o[DS],"f&o" # -- Begin function f&o
|
||||
; ASM-NEXT: .globl _Renamed..26f_o[DS]
|
||||
; ASM-NEXT: .rename ._Renamed..26f_o,".f&o"
|
||||
; ASM: .globl _Renamed..26f_o[DS] # -- Begin function f&o
|
||||
; ASM-NEXT: .rename _Renamed..26f_o[DS],"f&o"
|
||||
; ASM-NEXT: .globl ._Renamed..26f_o
|
||||
; ASM-NEXT: .rename ._Renamed..26f_o,".f&o"
|
||||
; ASM-NEXT: .align 4
|
||||
; ASM-NEXT: .csect _Renamed..26f_o[DS],2
|
||||
; ASM-NEXT: .vbyte 4, ._Renamed..26f_o # @"f&o"
|
||||
|
@ -65,10 +65,10 @@ declare i32 @"f\40o"(...)
|
|||
; ASM-NEXT: .csect .text[PR],2
|
||||
; ASM-NEXT: ._Renamed..26f_o:
|
||||
; ASM: bl ._Renamed..24f_o
|
||||
; ASM: .rename _Renamed..265ff__o[DS],"f&_o" # -- Begin function f&_o
|
||||
; ASM-NEXT: .globl _Renamed..265ff__o[DS]
|
||||
; ASM-NEXT: .rename ._Renamed..265ff__o,".f&_o"
|
||||
; ASM: .globl _Renamed..265ff__o[DS] # -- Begin function f&_o
|
||||
; ASM-NEXT: .rename _Renamed..265ff__o[DS],"f&_o"
|
||||
; ASM-NEXT: .globl ._Renamed..265ff__o
|
||||
; ASM-NEXT: .rename ._Renamed..265ff__o,".f&_o"
|
||||
; ASM-NEXT: .align 4
|
||||
; ASM-NEXT: .csect _Renamed..265ff__o[DS],2
|
||||
; ASM-NEXT: .vbyte 4, ._Renamed..265ff__o # @"f&_o"
|
||||
|
@ -77,21 +77,21 @@ declare i32 @"f\40o"(...)
|
|||
; ASM-NEXT: .csect .text[PR],2
|
||||
; ASM-NEXT: ._Renamed..265ff__o:
|
||||
; ASM: .csect .data[RW],2
|
||||
; ASM-NEXT: .rename _Renamed..60f_o,"f`o"
|
||||
; ASM-NEXT: .globl _Renamed..60f_o
|
||||
; ASM-NEXT: .rename _Renamed..60f_o,"f`o"
|
||||
; ASM-NEXT: .align 2
|
||||
; ASM-NEXT: _Renamed..60f_o:
|
||||
; ASM-NEXT: .vbyte 4, 10 # 0xa
|
||||
; ASM-NEXT: .rename _Renamed..2222f_o_[RW],"f""o"""
|
||||
; ASM-NEXT: .comm _Renamed..2222f_o_[RW],4,2
|
||||
; ASM-NEXT: .rename ._Renamed..40f_o,".f@o"
|
||||
; ASM-NEXT: .rename _Renamed..2222f_o_[RW],"f""o"""
|
||||
; ASM-NEXT: .extern ._Renamed..40f_o
|
||||
; ASM-NEXT: .rename _Renamed..40f_o[DS],"f@o"
|
||||
; ASM-NEXT: .rename ._Renamed..40f_o,".f@o"
|
||||
; ASM-NEXT: .extern _Renamed..40f_o[DS]
|
||||
; ASM-NEXT: .rename _Renamed..40f_o[DS],"f@o"
|
||||
; ASM-NEXT: .toc
|
||||
; ASM-NEXT: L..C0:
|
||||
; ASM-NEXT: .rename _Renamed..40f_o[TC],"f@o"
|
||||
; ASM-NEXT: .tc _Renamed..40f_o[TC],_Renamed..40f_o[DS]
|
||||
; ASM-NEXT: .rename _Renamed..40f_o[TC],"f@o"
|
||||
|
||||
; OBJ: Disassembly of section .text:
|
||||
; OBJ-EMPTY:
|
||||
|
|
Loading…
Reference in New Issue