mirror of
https://github.com/RPCS3/llvm.git
synced 2024-11-30 07:00:57 +00:00
XCore target fix bug in emitArrayBound() causing segmentation fault
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192434 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4315b2b504
commit
ed0ed946ab
@ -36,6 +36,7 @@
|
||||
#include "llvm/MC/MCInst.h"
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/TargetRegistry.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
@ -88,14 +89,12 @@ void XCoreAsmPrinter::emitArrayBound(MCSymbol *Sym, const GlobalVariable *GV) {
|
||||
MCSymbol *SymGlob = OutContext.GetOrCreateSymbol(
|
||||
Twine(Sym->getName() + StringRef(".globound")));
|
||||
OutStreamer.EmitSymbolAttribute(SymGlob, MCSA_Global);
|
||||
|
||||
OutStreamer.EmitRawText("\t.set\t" + Twine(Sym->getName()) +
|
||||
".globound," + Twine(ATy->getNumElements()));
|
||||
|
||||
OutStreamer.EmitAssignment(SymGlob,
|
||||
MCConstantExpr::Create(ATy->getNumElements(),
|
||||
OutContext));
|
||||
if (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage()) {
|
||||
// TODO Use COMDAT groups for LinkOnceLinkage
|
||||
OutStreamer.EmitRawText(MAI->getWeakDefDirective() +Twine(Sym->getName())+
|
||||
".globound");
|
||||
OutStreamer.EmitSymbolAttribute(SymGlob, MCSA_Weak);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -93,4 +93,4 @@ entry:
|
||||
|
||||
@array = global [10 x i16] zeroinitializer, align 2
|
||||
; CHECK: .globl array.globound
|
||||
; CHECK: .set array.globound,10
|
||||
; CHECK: array.globound = 10
|
||||
|
@ -16,6 +16,13 @@ define protected void @test_protected() {
|
||||
unreachable
|
||||
}
|
||||
|
||||
; CHECK: .globl array.globound
|
||||
; CHECK: array.globound = 2
|
||||
; CHECK: .weak array.globound
|
||||
; CHECK: .globl array
|
||||
; CHECK: .weak array
|
||||
@array = weak global [2 x i32] zeroinitializer
|
||||
|
||||
; CHECK: .weak gd
|
||||
@gd = weak global i32 0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user