<div dir="ltr">Note: this change lands us in this assert in est/MC/COFF/secidx-diagnostic.s:<div><br></div><div>lib/MC/WinCOFFObjectWriter.cpp:1065: virtual void (anonymous namespace)::WinCOFFObjectWriter::writeObject(llvm::MCAssembler &, const llvm::MCAsmLayout &): Assertion `getStream().tell() <= (*i)->Header.PointerToRawData && "Section::PointerToRawData is insane!"' failed.</div><div><br></div><div>Some of the time; I'm currently trying to figure out what exactly triggers this.</div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Nov 17, 2015 at 11:03 AM Oliver Stannard via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: olista01<br>
Date: Tue Nov 17 04:00:43 2015<br>
New Revision: 253328<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=253328&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=253328&view=rev</a><br>
Log:<br>
[Assembler] Make fatal assembler errors non-fatal<br>
<br>
Currently, if the assembler encounters an error after parsing (such as an<br>
out-of-range fixup), it reports this as a fatal error, and so stops after the<br>
first error. However, for most of these there is an obvious way to recover<br>
after emitting the error, such as emitting the fixup with a value of zero. This<br>
means that we can report on all of the errors in a file, not just the first<br>
one. MCContext::reportError records the fact that an error was encountered, so<br>
we won't actually emit an object file with the incorrect contents.<br>
<br>
Differential Revision: <a href="http://reviews.llvm.org/D14717" rel="noreferrer" target="_blank">http://reviews.llvm.org/D14717</a><br>
<br>
<br>
Added:<br>
llvm/trunk/test/MC/ARM/thumb1-relax.s<br>
llvm/trunk/test/MC/MachO/AArch64/reloc-errors.s<br>
Removed:<br>
llvm/trunk/test/MC/ARM/thumb1-relax-adr-local.s<br>
llvm/trunk/test/MC/ARM/thumb1-relax-bcc-local.s<br>
llvm/trunk/test/MC/ARM/thumb1-relax-br-local.s<br>
llvm/trunk/test/MC/ARM/thumb1-relax-ldrlit-local-behind.s<br>
llvm/trunk/test/MC/ARM/thumb1-relax-ldrlit-local-misaligned.s<br>
llvm/trunk/test/MC/ARM/thumb1-relax-ldrlit-local-range.s<br>
llvm/trunk/test/MC/MachO/bad-darwin-x86_64-reloc-expr1.s<br>
llvm/trunk/test/MC/MachO/bad-darwin-x86_64-reloc-expr2.s<br>
Modified:<br>
llvm/trunk/include/llvm/MC/MCWinCOFFStreamer.h<br>
llvm/trunk/lib/MC/ELFObjectWriter.cpp<br>
llvm/trunk/lib/MC/MCAssembler.cpp<br>
llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp<br>
llvm/trunk/lib/MC/WinCOFFStreamer.cpp<br>
llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp<br>
llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp<br>
llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp<br>
llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp<br>
llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp<br>
llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp<br>
llvm/trunk/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp<br>
llvm/trunk/test/MC/AArch64/error-location.s<br>
llvm/trunk/test/MC/ARM/arm-elf-relocation-diagnostics.s<br>
llvm/trunk/test/MC/ARM/error-location.s<br>
llvm/trunk/test/MC/COFF/bad-expr.s<br>
llvm/trunk/test/MC/COFF/invalid-def.s<br>
llvm/trunk/test/MC/COFF/invalid-endef.s<br>
llvm/trunk/test/MC/COFF/invalid-scl-range.s<br>
llvm/trunk/test/MC/COFF/invalid-scl.s<br>
llvm/trunk/test/MC/COFF/invalid-type.s<br>
llvm/trunk/test/MC/COFF/label-undefined.s<br>
llvm/trunk/test/MC/COFF/secidx-diagnostic.s<br>
llvm/trunk/test/MC/ELF/common-error1.s<br>
llvm/trunk/test/MC/ELF/common-error2.s<br>
llvm/trunk/test/MC/MachO/ARM/bad-darwin-ARM-reloc.s<br>
llvm/trunk/test/MC/MachO/bad-darwin-x86_64-diff-relocs.s<br>
llvm/trunk/test/MC/Mips/micromips-diagnostic-fixup.s<br>
llvm/trunk/test/MC/Mips/micromips-pc16-fixup.s<br>
llvm/trunk/test/MC/Mips/mips-diagnostic-fixup.s<br>
llvm/trunk/test/MC/Mips/mips-pc16-fixup.s<br>
<br>
Modified: llvm/trunk/include/llvm/MC/MCWinCOFFStreamer.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCWinCOFFStreamer.h?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCWinCOFFStreamer.h?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/MC/MCWinCOFFStreamer.h (original)<br>
+++ llvm/trunk/include/llvm/MC/MCWinCOFFStreamer.h Tue Nov 17 04:00:43 2015<br>
@@ -73,7 +73,7 @@ protected:<br>
void EmitInstToData(const MCInst &Inst, const MCSubtargetInfo &STI) override;<br>
<br>
private:<br>
- LLVM_ATTRIBUTE_NORETURN void FatalError(const Twine &Msg) const;<br>
+ void Error(const Twine &Msg) const;<br>
};<br>
}<br>
<br>
<br>
Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)<br>
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Tue Nov 17 04:00:43 2015<br>
@@ -630,28 +630,36 @@ void ELFObjectWriter::recordRelocation(M<br>
// In general, ELF has no relocations for -B. It can only represent (A + C)<br>
// or (A + C - R). If B = R + K and the relocation is not pcrel, we can<br>
// replace B to implement it: (A - R - K + C)<br>
- if (IsPCRel)<br>
- Asm.getContext().reportFatalError(<br>
+ if (IsPCRel) {<br>
+ Asm.getContext().reportError(<br>
Fixup.getLoc(),<br>
"No relocation available to represent this relative expression");<br>
+ return;<br>
+ }<br>
<br>
const auto &SymB = cast<MCSymbolELF>(RefB->getSymbol());<br>
<br>
- if (SymB.isUndefined())<br>
- Asm.getContext().reportFatalError(<br>
+ if (SymB.isUndefined()) {<br>
+ Asm.getContext().reportError(<br>
Fixup.getLoc(),<br>
Twine("symbol '") + SymB.getName() +<br>
"' can not be undefined in a subtraction expression");<br>
+ return;<br>
+ }<br>
<br>
assert(!SymB.isAbsolute() && "Should have been folded");<br>
const MCSection &SecB = SymB.getSection();<br>
- if (&SecB != &FixupSection)<br>
- Asm.getContext().reportFatalError(<br>
+ if (&SecB != &FixupSection) {<br>
+ Asm.getContext().reportError(<br>
Fixup.getLoc(), "Cannot represent a difference across sections");<br>
+ return;<br>
+ }<br>
<br>
- if (::isWeak(SymB))<br>
- Asm.getContext().reportFatalError(<br>
+ if (::isWeak(SymB)) {<br>
+ Asm.getContext().reportError(<br>
Fixup.getLoc(), "Cannot represent a subtraction with a weak symbol");<br>
+ return;<br>
+ }<br>
<br>
uint64_t SymBOffset = Layout.getSymbolOffset(SymB);<br>
uint64_t K = SymBOffset - FixupOffset;<br>
@@ -784,8 +792,10 @@ void ELFObjectWriter::computeSymbolTable<br>
Renames.count(&Symbol)))<br>
continue;<br>
<br>
- if (Symbol.isTemporary() && Symbol.isUndefined())<br>
- Ctx.reportFatalError(SMLoc(), "Undefined temporary");<br>
+ if (Symbol.isTemporary() && Symbol.isUndefined()) {<br>
+ Ctx.reportError(SMLoc(), "Undefined temporary symbol");<br>
+ continue;<br>
+ }<br>
<br>
ELFSymbolData MSD;<br>
MSD.Symbol = cast<MCSymbolELF>(&Symbol);<br>
<br>
Modified: llvm/trunk/lib/MC/MCAssembler.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAssembler.cpp?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAssembler.cpp?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/MC/MCAssembler.cpp (original)<br>
+++ llvm/trunk/lib/MC/MCAssembler.cpp Tue Nov 17 04:00:43 2015<br>
@@ -179,14 +179,19 @@ const MCSymbol *MCAsmLayout::getBaseSymb<br>
<br>
const MCExpr *Expr = Symbol.getVariableValue();<br>
MCValue Value;<br>
- if (!Expr->evaluateAsValue(Value, *this))<br>
- llvm_unreachable("Invalid Expression");<br>
+ if (!Expr->evaluateAsValue(Value, *this)) {<br>
+ Assembler.getContext().reportError(<br>
+ SMLoc(), "expression could not be evaluated");<br>
+ return nullptr;<br>
+ }<br>
<br>
const MCSymbolRefExpr *RefB = Value.getSymB();<br>
- if (RefB)<br>
- Assembler.getContext().reportFatalError(<br>
+ if (RefB) {<br>
+ Assembler.getContext().reportError(<br>
SMLoc(), Twine("symbol '") + RefB->getSymbol().getName() +<br>
"' could not be evaluated in a subtraction expression");<br>
+ return nullptr;<br>
+ }<br>
<br>
const MCSymbolRefExpr *A = Value.getSymA();<br>
if (!A)<br>
@@ -196,9 +201,10 @@ const MCSymbol *MCAsmLayout::getBaseSymb<br>
const MCAssembler &Asm = getAssembler();<br>
if (ASym.isCommon()) {<br>
// FIXME: we should probably add a SMLoc to MCExpr.<br>
- Asm.getContext().reportFatalError(SMLoc(),<br>
- "Common symbol " + ASym.getName() +<br>
- " cannot be used in assignment expr");<br>
+ Asm.getContext().reportError(SMLoc(),<br>
+ "Common symbol '" + ASym.getName() +<br>
+ "' cannot be used in assignment expr");<br>
+ return nullptr;<br>
}<br>
<br>
return &ASym;<br>
@@ -436,8 +442,13 @@ bool MCAssembler::evaluateFixup(const MC<br>
// probably merge the two into a single callback that tries to evaluate a<br>
// fixup and records a relocation if one is needed.<br>
const MCExpr *Expr = Fixup.getValue();<br>
- if (!Expr->evaluateAsRelocatable(Target, &Layout, &Fixup))<br>
- getContext().reportFatalError(Fixup.getLoc(), "expected relocatable expression");<br>
+ if (!Expr->evaluateAsRelocatable(Target, &Layout, &Fixup)) {<br>
+ getContext().reportError(Fixup.getLoc(), "expected relocatable expression");<br>
+ // Claim to have completely evaluated the fixup, to prevent any further<br>
+ // processing from being done.<br>
+ Value = 0;<br>
+ return true;<br>
+ }<br>
<br>
bool IsPCRel = Backend.getFixupKindInfo(<br>
Fixup.getKind()).Flags & MCFixupKindInfo::FKF_IsPCRel;<br>
<br>
Modified: llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp (original)<br>
+++ llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp Tue Nov 17 04:00:43 2015<br>
@@ -706,14 +706,17 @@ void WinCOFFObjectWriter::recordRelocati<br>
<br>
const MCSymbol &Symbol = Target.getSymA()->getSymbol();<br>
const MCSymbol &A = Symbol;<br>
- if (!A.isRegistered())<br>
- Asm.getContext().reportFatalError(Fixup.getLoc(),<br>
+ if (!A.isRegistered()) {<br>
+ Asm.getContext().reportError(Fixup.getLoc(),<br>
Twine("symbol '") + A.getName() +<br>
"' can not be undefined");<br>
+ return;<br>
+ }<br>
if (A.isTemporary() && A.isUndefined()) {<br>
- Asm.getContext().reportFatalError(Fixup.getLoc(),<br>
+ Asm.getContext().reportError(Fixup.getLoc(),<br>
Twine("assembler label '") + A.getName() +<br>
"' can not be undefined");<br>
+ return;<br>
}<br>
<br>
MCSection *Section = Fragment->getParent();<br>
@@ -731,17 +734,21 @@ void WinCOFFObjectWriter::recordRelocati<br>
<br>
if (SymB) {<br>
const MCSymbol *B = &SymB->getSymbol();<br>
- if (!B->getFragment())<br>
- Asm.getContext().reportFatalError(<br>
+ if (!B->getFragment()) {<br>
+ Asm.getContext().reportError(<br>
Fixup.getLoc(),<br>
Twine("symbol '") + B->getName() +<br>
"' can not be undefined in a subtraction expression");<br>
+ return;<br>
+ }<br>
<br>
- if (!A.getFragment())<br>
- Asm.getContext().reportFatalError(<br>
+ if (!A.getFragment()) {<br>
+ Asm.getContext().reportError(<br>
Fixup.getLoc(),<br>
Twine("symbol '") + Symbol.getName() +<br>
"' can not be undefined in a subtraction expression");<br>
+ return;<br>
+ }<br>
<br>
CrossSection = &Symbol.getSection() != &B->getSection();<br>
<br>
<br>
Modified: llvm/trunk/lib/MC/WinCOFFStreamer.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFStreamer.cpp?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFStreamer.cpp?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/MC/WinCOFFStreamer.cpp (original)<br>
+++ llvm/trunk/lib/MC/WinCOFFStreamer.cpp Tue Nov 17 04:00:43 2015<br>
@@ -122,29 +122,37 @@ void MCWinCOFFStreamer::BeginCOFFSymbolD<br>
"Got non-COFF section in the COFF backend!");<br>
<br>
if (CurSymbol)<br>
- FatalError("starting a new symbol definition without completing the "<br>
- "previous one");<br>
+ Error("starting a new symbol definition without completing the "<br>
+ "previous one");<br>
CurSymbol = Symbol;<br>
}<br>
<br>
void MCWinCOFFStreamer::EmitCOFFSymbolStorageClass(int StorageClass) {<br>
- if (!CurSymbol)<br>
- FatalError("storage class specified outside of symbol definition");<br>
+ if (!CurSymbol) {<br>
+ Error("storage class specified outside of symbol definition");<br>
+ return;<br>
+ }<br>
<br>
- if (StorageClass & ~COFF::SSC_Invalid)<br>
- FatalError("storage class value '" + Twine(StorageClass) +<br>
+ if (StorageClass & ~COFF::SSC_Invalid) {<br>
+ Error("storage class value '" + Twine(StorageClass) +<br>
"' out of range");<br>
+ return;<br>
+ }<br>
<br>
getAssembler().registerSymbol(*CurSymbol);<br>
cast<MCSymbolCOFF>(CurSymbol)->setClass((uint16_t)StorageClass);<br>
}<br>
<br>
void MCWinCOFFStreamer::EmitCOFFSymbolType(int Type) {<br>
- if (!CurSymbol)<br>
- FatalError("symbol type specified outside of a symbol definition");<br>
+ if (!CurSymbol) {<br>
+ Error("symbol type specified outside of a symbol definition");<br>
+ return;<br>
+ }<br>
<br>
- if (Type & ~0xffff)<br>
- FatalError("type value '" + Twine(Type) + "' out of range");<br>
+ if (Type & ~0xffff) {<br>
+ Error("type value '" + Twine(Type) + "' out of range");<br>
+ return;<br>
+ }<br>
<br>
getAssembler().registerSymbol(*CurSymbol);<br>
cast<MCSymbolCOFF>(CurSymbol)->setType((uint16_t)Type);<br>
@@ -152,7 +160,7 @@ void MCWinCOFFStreamer::EmitCOFFSymbolTy<br>
<br>
void MCWinCOFFStreamer::EndCOFFSymbolDef() {<br>
if (!CurSymbol)<br>
- FatalError("ending symbol definition without starting one");<br>
+ Error("ending symbol definition without starting one");<br>
CurSymbol = nullptr;<br>
}<br>
<br>
@@ -281,9 +289,8 @@ void MCWinCOFFStreamer::FinishImpl() {<br>
MCObjectStreamer::FinishImpl();<br>
}<br>
<br>
-LLVM_ATTRIBUTE_NORETURN<br>
-void MCWinCOFFStreamer::FatalError(const Twine &Msg) const {<br>
- getContext().reportFatalError(SMLoc(), Msg);<br>
+void MCWinCOFFStreamer::Error(const Twine &Msg) const {<br>
+ getContext().reportError(SMLoc(), Msg);<br>
}<br>
}<br>
<br>
<br>
Modified: llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp (original)<br>
+++ llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp Tue Nov 17 04:00:43 2015<br>
@@ -90,9 +90,11 @@ bool AArch64MachObjectWriter::getAArch64<br>
Log2Size = llvm::Log2_32(4);<br>
// This encompasses the relocation for the whole 21-bit value.<br>
switch (Sym->getKind()) {<br>
- default:<br>
- Asm.getContext().reportFatalError(Fixup.getLoc(),<br>
- "ADR/ADRP relocations must be GOT relative");<br>
+ default: {<br>
+ Asm.getContext().reportError(Fixup.getLoc(),<br>
+ "ADR/ADRP relocations must be GOT relative");<br>
+ return false;<br>
+ }<br>
case MCSymbolRefExpr::VK_PAGE:<br>
RelocType = unsigned(MachO::ARM64_RELOC_PAGE21);<br>
return true;<br>
@@ -170,25 +172,25 @@ void AArch64MachObjectWriter::recordRelo<br>
// assembler local symbols. If we got here, that's not what we have,<br>
// so complain loudly.<br>
if (Kind == AArch64::fixup_aarch64_pcrel_branch19) {<br>
- Asm.getContext().reportFatalError(Fixup.getLoc(),<br>
- "conditional branch requires assembler-local"<br>
- " label. '" +<br>
- Target.getSymA()->getSymbol().getName() +<br>
- "' is external.");<br>
+ Asm.getContext().reportError(Fixup.getLoc(),<br>
+ "conditional branch requires assembler-local"<br>
+ " label. '" +<br>
+ Target.getSymA()->getSymbol().getName() +<br>
+ "' is external.");<br>
return;<br>
}<br>
<br>
// 14-bit branch relocations should only target internal labels, and so<br>
// should never get here.<br>
if (Kind == AArch64::fixup_aarch64_pcrel_branch14) {<br>
- Asm.getContext().reportFatalError(Fixup.getLoc(),<br>
- "Invalid relocation on conditional branch!");<br>
+ Asm.getContext().reportError(Fixup.getLoc(),<br>
+ "Invalid relocation on conditional branch!");<br>
return;<br>
}<br>
<br>
if (!getAArch64FixupKindMachOInfo(Fixup, Type, Target.getSymA(), Log2Size,<br>
- Asm)) {<br>
- Asm.getContext().reportFatalError(Fixup.getLoc(), "unknown AArch64 fixup kind!");<br>
+ Asm)) {<br>
+ Asm.getContext().reportError(Fixup.getLoc(), "unknown AArch64 fixup kind!");<br>
return;<br>
}<br>
<br>
@@ -200,8 +202,9 @@ void AArch64MachObjectWriter::recordRelo<br>
Type = MachO::ARM64_RELOC_UNSIGNED;<br>
<br>
if (IsPCRel) {<br>
- Asm.getContext().reportFatalError(Fixup.getLoc(),<br>
- "PC relative absolute relocation!");<br>
+ Asm.getContext().reportError(Fixup.getLoc(),<br>
+ "PC relative absolute relocation!");<br>
+ return;<br>
<br>
// FIXME: x86_64 sets the type to a branch reloc here. Should we do<br>
// something similar?<br>
@@ -229,16 +232,20 @@ void AArch64MachObjectWriter::recordRelo<br>
Writer->addRelocation(A_Base, Fragment->getParent(), MRE);<br>
return;<br>
} else if (Target.getSymA()->getKind() != MCSymbolRefExpr::VK_None ||<br>
- Target.getSymB()->getKind() != MCSymbolRefExpr::VK_None)<br>
+ Target.getSymB()->getKind() != MCSymbolRefExpr::VK_None) {<br>
// Otherwise, neither symbol can be modified.<br>
- Asm.getContext().reportFatalError(Fixup.getLoc(),<br>
- "unsupported relocation of modified symbol");<br>
+ Asm.getContext().reportError(Fixup.getLoc(),<br>
+ "unsupported relocation of modified symbol");<br>
+ return;<br>
+ }<br>
<br>
// We don't support PCrel relocations of differences.<br>
- if (IsPCRel)<br>
- Asm.getContext().reportFatalError(Fixup.getLoc(),<br>
- "unsupported pc-relative relocation of "<br>
- "difference");<br>
+ if (IsPCRel) {<br>
+ Asm.getContext().reportError(Fixup.getLoc(),<br>
+ "unsupported pc-relative relocation of "<br>
+ "difference");<br>
+ return;<br>
+ }<br>
<br>
// AArch64 always uses external relocations. If there is no symbol to use as<br>
// a base address (a local symbol with no preceding non-local symbol),<br>
@@ -246,20 +253,26 @@ void AArch64MachObjectWriter::recordRelo<br>
//<br>
// FIXME: We should probably just synthesize an external symbol and use<br>
// that.<br>
- if (!A_Base)<br>
- Asm.getContext().reportFatalError(<br>
+ if (!A_Base) {<br>
+ Asm.getContext().reportError(<br>
Fixup.getLoc(),<br>
"unsupported relocation of local symbol '" + A->getName() +<br>
"'. Must have non-local symbol earlier in section.");<br>
- if (!B_Base)<br>
- Asm.getContext().reportFatalError(<br>
+ return;<br>
+ }<br>
+ if (!B_Base) {<br>
+ Asm.getContext().reportError(<br>
Fixup.getLoc(),<br>
"unsupported relocation of local symbol '" + B->getName() +<br>
"'. Must have non-local symbol earlier in section.");<br>
+ return;<br>
+ }<br>
<br>
- if (A_Base == B_Base && A_Base)<br>
- Asm.getContext().reportFatalError(Fixup.getLoc(),<br>
- "unsupported relocation with identical base");<br>
+ if (A_Base == B_Base && A_Base) {<br>
+ Asm.getContext().reportError(<br>
+ Fixup.getLoc(), "unsupported relocation with identical base");<br>
+ return;<br>
+ }<br>
<br>
Value += (!A->getFragment() ? 0 : Writer->getSymbolAddress(*A, Layout)) -<br>
(!A_Base || !A_Base->getFragment() ? 0 : Writer->getSymbolAddress(<br>
@@ -309,10 +322,12 @@ void AArch64MachObjectWriter::recordRelo<br>
// we need to preserve and merge with the new Target? How about<br>
// the FixedValue?<br>
if (!Symbol->getVariableValue()->evaluateAsRelocatable(Target, &Layout,<br>
- &Fixup))<br>
- Asm.getContext().reportFatalError(Fixup.getLoc(),<br>
- "unable to resolve variable '" +<br>
- Symbol->getName() + "'");<br>
+ &Fixup)) {<br>
+ Asm.getContext().reportError(Fixup.getLoc(),<br>
+ "unable to resolve variable '" +<br>
+ Symbol->getName() + "'");<br>
+ return;<br>
+ }<br>
return recordRelocation(Writer, Asm, Layout, Fragment, Fixup, Target,<br>
FixedValue);<br>
}<br>
@@ -337,11 +352,13 @@ void AArch64MachObjectWriter::recordRelo<br>
Value +=<br>
Layout.getSymbolOffset(*Symbol) - Layout.getSymbolOffset(*Base);<br>
} else if (Symbol->isInSection()) {<br>
- if (!CanUseLocalRelocation)<br>
- Asm.getContext().reportFatalError(<br>
+ if (!CanUseLocalRelocation) {<br>
+ Asm.getContext().reportError(<br>
Fixup.getLoc(),<br>
"unsupported relocation of local symbol '" + Symbol->getName() +<br>
"'. Must have non-local symbol earlier in section.");<br>
+ return;<br>
+ }<br>
// Adjust the relocation to be section-relative.<br>
// The index is the section ordinal (1-based).<br>
const MCSection &Sec = Symbol->getSection();<br>
@@ -361,9 +378,10 @@ void AArch64MachObjectWriter::recordRelo<br>
return;<br>
}<br>
}<br>
- Asm.getContext().reportFatalError(Fixup.getLoc(),<br>
+ Asm.getContext().reportError(Fixup.getLoc(),<br>
"unsupported relocation of variable '" +<br>
Symbol->getName() + "'");<br>
+ return;<br>
}<br>
}<br>
<br>
<br>
Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp (original)<br>
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp Tue Nov 17 04:00:43 2015<br>
@@ -395,8 +395,10 @@ unsigned ARMAsmBackend::adjustFixupValue<br>
Value = -Value;<br>
isAdd = false;<br>
}<br>
- if (Ctx && Value >= 4096)<br>
- Ctx->reportFatalError(Fixup.getLoc(), "out of range pc-relative fixup value");<br>
+ if (Ctx && Value >= 4096) {<br>
+ Ctx->reportError(Fixup.getLoc(), "out of range pc-relative fixup value");<br>
+ return 0;<br>
+ }<br>
Value |= isAdd << 23;<br>
<br>
// Same addressing mode as fixup_arm_pcrel_10,<br>
@@ -414,8 +416,10 @@ unsigned ARMAsmBackend::adjustFixupValue<br>
Value = -Value;<br>
opc = 2; // 0b0010<br>
}<br>
- if (Ctx && ARM_AM::getSOImmVal(Value) == -1)<br>
- Ctx->reportFatalError(Fixup.getLoc(), "out of range pc-relative fixup value");<br>
+ if (Ctx && ARM_AM::getSOImmVal(Value) == -1) {<br>
+ Ctx->reportError(Fixup.getLoc(), "out of range pc-relative fixup value");<br>
+ return 0;<br>
+ }<br>
// Encode the immediate and shift the opcode into place.<br>
return ARM_AM::getSOImmVal(Value) | (opc << 21);<br>
}<br>
@@ -544,8 +548,10 @@ unsigned ARMAsmBackend::adjustFixupValue<br>
// could have an error on our hands.<br>
if (Ctx && !STI->getFeatureBits()[ARM::FeatureThumb2] && IsResolved) {<br>
const char *FixupDiagnostic = reasonForFixupRelaxation(Fixup, Value);<br>
- if (FixupDiagnostic)<br>
- Ctx->reportFatalError(Fixup.getLoc(), FixupDiagnostic);<br>
+ if (FixupDiagnostic) {<br>
+ Ctx->reportError(Fixup.getLoc(), FixupDiagnostic);<br>
+ return 0;<br>
+ }<br>
}<br>
// Offset by 4, and don't encode the low two bits.<br>
return ((Value - 4) >> 2) & 0xff;<br>
@@ -559,16 +565,20 @@ unsigned ARMAsmBackend::adjustFixupValue<br>
// Offset by 4 and don't encode the lower bit, which is always 0.<br>
if (Ctx && !STI->getFeatureBits()[ARM::FeatureThumb2]) {<br>
const char *FixupDiagnostic = reasonForFixupRelaxation(Fixup, Value);<br>
- if (FixupDiagnostic)<br>
- Ctx->reportFatalError(Fixup.getLoc(), FixupDiagnostic);<br>
+ if (FixupDiagnostic) {<br>
+ Ctx->reportError(Fixup.getLoc(), FixupDiagnostic);<br>
+ return 0;<br>
+ }<br>
}<br>
return ((Value - 4) >> 1) & 0x7ff;<br>
case ARM::fixup_arm_thumb_bcc:<br>
// Offset by 4 and don't encode the lower bit, which is always 0.<br>
if (Ctx && !STI->getFeatureBits()[ARM::FeatureThumb2]) {<br>
const char *FixupDiagnostic = reasonForFixupRelaxation(Fixup, Value);<br>
- if (FixupDiagnostic)<br>
- Ctx->reportFatalError(Fixup.getLoc(), FixupDiagnostic);<br>
+ if (FixupDiagnostic) {<br>
+ Ctx->reportError(Fixup.getLoc(), FixupDiagnostic);<br>
+ return 0;<br>
+ }<br>
}<br>
return ((Value - 4) >> 1) & 0xff;<br>
case ARM::fixup_arm_pcrel_10_unscaled: {<br>
@@ -580,8 +590,10 @@ unsigned ARMAsmBackend::adjustFixupValue<br>
isAdd = false;<br>
}<br>
// The value has the low 4 bits encoded in [3:0] and the high 4 in [11:8].<br>
- if (Ctx && Value >= 256)<br>
- Ctx->reportFatalError(Fixup.getLoc(), "out of range pc-relative fixup value");<br>
+ if (Ctx && Value >= 256) {<br>
+ Ctx->reportError(Fixup.getLoc(), "out of range pc-relative fixup value");<br>
+ return 0;<br>
+ }<br>
Value = (Value & 0xf) | ((Value & 0xf0) << 4);<br>
return Value | (isAdd << 23);<br>
}<br>
@@ -599,8 +611,10 @@ unsigned ARMAsmBackend::adjustFixupValue<br>
}<br>
// These values don't encode the low two bits since they're always zero.<br>
Value >>= 2;<br>
- if (Ctx && Value >= 256)<br>
- Ctx->reportFatalError(Fixup.getLoc(), "out of range pc-relative fixup value");<br>
+ if (Ctx && Value >= 256) {<br>
+ Ctx->reportError(Fixup.getLoc(), "out of range pc-relative fixup value");<br>
+ return 0;<br>
+ }<br>
Value |= isAdd << 23;<br>
<br>
// Same addressing mode as fixup_arm_pcrel_10, but with 16-bit halfwords<br>
<br>
Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp (original)<br>
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp Tue Nov 17 04:00:43 2015<br>
@@ -509,8 +509,10 @@ public:<br>
/// necessary.<br>
void EmitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc) override {<br>
if (const MCSymbolRefExpr *SRE = dyn_cast_or_null<MCSymbolRefExpr>(Value))<br>
- if (SRE->getKind() == MCSymbolRefExpr::VK_ARM_SBREL && !(Size == 4))<br>
- getContext().reportFatalError(Loc, "relocated expression must be 32-bit");<br>
+ if (SRE->getKind() == MCSymbolRefExpr::VK_ARM_SBREL && !(Size == 4)) {<br>
+ getContext().reportError(Loc, "relocated expression must be 32-bit");<br>
+ return;<br>
+ }<br>
<br>
EmitDataMappingSymbol();<br>
MCELFStreamer::EmitValueImpl(Value, Size, Loc);<br>
<br>
Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp (original)<br>
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp Tue Nov 17 04:00:43 2015<br>
@@ -150,10 +150,12 @@ RecordARMScatteredHalfRelocation(MachObj<br>
// See <reloc.h>.<br>
const MCSymbol *A = &Target.getSymA()->getSymbol();<br>
<br>
- if (!A->getFragment())<br>
- Asm.getContext().reportFatalError(Fixup.getLoc(),<br>
+ if (!A->getFragment()) {<br>
+ Asm.getContext().reportError(Fixup.getLoc(),<br>
"symbol '" + A->getName() +<br>
"' can not be undefined in a subtraction expression");<br>
+ return;<br>
+ }<br>
<br>
uint32_t Value = Writer->getSymbolAddress(*A, Layout);<br>
uint32_t Value2 = 0;<br>
@@ -163,10 +165,12 @@ RecordARMScatteredHalfRelocation(MachObj<br>
if (const MCSymbolRefExpr *B = Target.getSymB()) {<br>
const MCSymbol *SB = &B->getSymbol();<br>
<br>
- if (!SB->getFragment())<br>
- Asm.getContext().reportFatalError(Fixup.getLoc(),<br>
+ if (!SB->getFragment()) {<br>
+ Asm.getContext().reportError(Fixup.getLoc(),<br>
"symbol '" + B->getSymbol().getName() +<br>
"' can not be undefined in a subtraction expression");<br>
+ return;<br>
+ }<br>
<br>
// Select the appropriate difference relocation type.<br>
Type = MachO::ARM_RELOC_HALF_SECTDIFF;<br>
@@ -251,10 +255,12 @@ void ARMMachObjectWriter::RecordARMScatt<br>
// See <reloc.h>.<br>
const MCSymbol *A = &Target.getSymA()->getSymbol();<br>
<br>
- if (!A->getFragment())<br>
- Asm.getContext().reportFatalError(Fixup.getLoc(),<br>
+ if (!A->getFragment()) {<br>
+ Asm.getContext().reportError(Fixup.getLoc(),<br>
"symbol '" + A->getName() +<br>
"' can not be undefined in a subtraction expression");<br>
+ return;<br>
+ }<br>
<br>
uint32_t Value = Writer->getSymbolAddress(*A, Layout);<br>
uint64_t SecAddr = Writer->getSectionAddress(A->getFragment()->getParent());<br>
@@ -265,10 +271,12 @@ void ARMMachObjectWriter::RecordARMScatt<br>
assert(Type == MachO::ARM_RELOC_VANILLA && "invalid reloc for 2 symbols");<br>
const MCSymbol *SB = &B->getSymbol();<br>
<br>
- if (!SB->getFragment())<br>
- Asm.getContext().reportFatalError(Fixup.getLoc(),<br>
+ if (!SB->getFragment()) {<br>
+ Asm.getContext().reportError(Fixup.getLoc(),<br>
"symbol '" + B->getSymbol().getName() +<br>
"' can not be undefined in a subtraction expression");<br>
+ return;<br>
+ }<br>
<br>
// Select the appropriate difference relocation type.<br>
Type = MachO::ARM_RELOC_SECTDIFF;<br>
@@ -346,13 +354,15 @@ void ARMMachObjectWriter::recordRelocati<br>
unsigned IsPCRel = Writer->isFixupKindPCRel(Asm, Fixup.getKind());<br>
unsigned Log2Size;<br>
unsigned RelocType = MachO::ARM_RELOC_VANILLA;<br>
- if (!getARMFixupKindMachOInfo(Fixup.getKind(), RelocType, Log2Size))<br>
+ if (!getARMFixupKindMachOInfo(Fixup.getKind(), RelocType, Log2Size)) {<br>
// If we failed to get fixup kind info, it's because there's no legal<br>
// relocation type for the fixup kind. This happens when it's a fixup that's<br>
// expected to always be resolvable at assembly time and not have any<br>
// relocations needed.<br>
- Asm.getContext().reportFatalError(Fixup.getLoc(),<br>
- "unsupported relocation on symbol");<br>
+ Asm.getContext().reportError(Fixup.getLoc(),<br>
+ "unsupported relocation on symbol");<br>
+ return;<br>
+ }<br>
<br>
// If this is a difference or a defined symbol plus an offset, then we need a<br>
// scattered relocation entry. Differences always require scattered<br>
<br>
Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp (original)<br>
+++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp Tue Nov 17 04:00:43 2015<br>
@@ -63,15 +63,19 @@ static unsigned adjustFixupValue(const M<br>
// address range. Forcing a signed division because Value can be negative.<br>
Value = (int64_t)Value / 4;<br>
// We now check if Value can be encoded as a 16-bit signed immediate.<br>
- if (!isInt<16>(Value) && Ctx)<br>
- Ctx->reportFatalError(Fixup.getLoc(), "out of range PC16 fixup");<br>
+ if (!isInt<16>(Value) && Ctx) {<br>
+ Ctx->reportError(Fixup.getLoc(), "out of range PC16 fixup");<br>
+ return 0;<br>
+ }<br>
break;<br>
case Mips::fixup_MIPS_PC19_S2:<br>
// Forcing a signed division because Value can be negative.<br>
Value = (int64_t)Value / 4;<br>
// We now check if Value can be encoded as a 19-bit signed immediate.<br>
- if (!isInt<19>(Value) && Ctx)<br>
- Ctx->reportFatalError(Fixup.getLoc(), "out of range PC19 fixup");<br>
+ if (!isInt<19>(Value) && Ctx) {<br>
+ Ctx->reportError(Fixup.getLoc(), "out of range PC19 fixup");<br>
+ return 0;<br>
+ }<br>
break;<br>
case Mips::fixup_Mips_26:<br>
// So far we are only using this type for jumps.<br>
@@ -104,45 +108,57 @@ static unsigned adjustFixupValue(const M<br>
// Forcing a signed division because Value can be negative.<br>
Value = (int64_t) Value / 2;<br>
// We now check if Value can be encoded as a 7-bit signed immediate.<br>
- if (!isInt<7>(Value) && Ctx)<br>
- Ctx->reportFatalError(Fixup.getLoc(), "out of range PC7 fixup");<br>
+ if (!isInt<7>(Value) && Ctx) {<br>
+ Ctx->reportError(Fixup.getLoc(), "out of range PC7 fixup");<br>
+ return 0;<br>
+ }<br>
break;<br>
case Mips::fixup_MICROMIPS_PC10_S1:<br>
Value -= 2;<br>
// Forcing a signed division because Value can be negative.<br>
Value = (int64_t) Value / 2;<br>
// We now check if Value can be encoded as a 10-bit signed immediate.<br>
- if (!isInt<10>(Value) && Ctx)<br>
- Ctx->reportFatalError(Fixup.getLoc(), "out of range PC10 fixup");<br>
+ if (!isInt<10>(Value) && Ctx) {<br>
+ Ctx->reportError(Fixup.getLoc(), "out of range PC10 fixup");<br>
+ return 0;<br>
+ }<br>
break;<br>
case Mips::fixup_MICROMIPS_PC16_S1:<br>
Value -= 4;<br>
// Forcing a signed division because Value can be negative.<br>
Value = (int64_t)Value / 2;<br>
// We now check if Value can be encoded as a 16-bit signed immediate.<br>
- if (!isInt<16>(Value) && Ctx)<br>
- Ctx->reportFatalError(Fixup.getLoc(), "out of range PC16 fixup");<br>
+ if (!isInt<16>(Value) && Ctx) {<br>
+ Ctx->reportError(Fixup.getLoc(), "out of range PC16 fixup");<br>
+ return 0;<br>
+ }<br>
break;<br>
case Mips::fixup_MIPS_PC18_S3:<br>
// Forcing a signed division because Value can be negative.<br>
Value = (int64_t)Value / 8;<br>
// We now check if Value can be encoded as a 18-bit signed immediate.<br>
- if (!isInt<18>(Value) && Ctx)<br>
- Ctx->reportFatalError(Fixup.getLoc(), "out of range PC18 fixup");<br>
+ if (!isInt<18>(Value) && Ctx) {<br>
+ Ctx->reportError(Fixup.getLoc(), "out of range PC18 fixup");<br>
+ return 0;<br>
+ }<br>
break;<br>
case Mips::fixup_MIPS_PC21_S2:<br>
// Forcing a signed division because Value can be negative.<br>
Value = (int64_t) Value / 4;<br>
// We now check if Value can be encoded as a 21-bit signed immediate.<br>
- if (!isInt<21>(Value) && Ctx)<br>
- Ctx->reportFatalError(Fixup.getLoc(), "out of range PC21 fixup");<br>
+ if (!isInt<21>(Value) && Ctx) {<br>
+ Ctx->reportError(Fixup.getLoc(), "out of range PC21 fixup");<br>
+ return 0;<br>
+ }<br>
break;<br>
case Mips::fixup_MIPS_PC26_S2:<br>
// Forcing a signed division because Value can be negative.<br>
Value = (int64_t) Value / 4;<br>
// We now check if Value can be encoded as a 26-bit signed immediate.<br>
- if (!isInt<26>(Value) && Ctx)<br>
- Ctx->reportFatalError(Fixup.getLoc(), "out of range PC26 fixup");<br>
+ if (!isInt<26>(Value) && Ctx) {<br>
+ Ctx->reportError(Fixup.getLoc(), "out of range PC26 fixup");<br>
+ return 0;<br>
+ }<br>
break;<br>
}<br>
<br>
<br>
Modified: llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp (original)<br>
+++ llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp Tue Nov 17 04:00:43 2015<br>
@@ -241,12 +241,12 @@ bool PPCMachObjectWriter::recordScattere<br>
if (FixupOffset > 0xffffff) {<br>
char Buffer[32];<br>
format("0x%x", FixupOffset).print(Buffer, sizeof(Buffer));<br>
- Asm.getContext().reportFatalError(Fixup.getLoc(),<br>
+ Asm.getContext().reportError(Fixup.getLoc(),<br>
Twine("Section too large, can't encode "<br>
"r_address (") +<br>
Buffer + ") into 24 bits of scattered "<br>
"relocation entry.");<br>
- llvm_unreachable("fatal error returned?!");<br>
+ return false;<br>
}<br>
<br>
// Is this supposed to follow MCTarget/PPCAsmBackend.cpp:adjustFixupValue()?<br>
<br>
Modified: llvm/trunk/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp (original)<br>
+++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp Tue Nov 17 04:00:43 2015<br>
@@ -175,9 +175,10 @@ void X86MachObjectWriter::RecordX86_64Re<br>
// non-relocatable expression.<br>
if (A->isUndefined() || B->isUndefined()) {<br>
StringRef Name = A->isUndefined() ? A->getName() : B->getName();<br>
- Asm.getContext().reportFatalError(Fixup.getLoc(),<br>
+ Asm.getContext().reportError(Fixup.getLoc(),<br>
"unsupported relocation with subtraction expression, symbol '" +<br>
Name + "' can not be undefined in a subtraction expression");<br>
+ return;<br>
}<br>
<br>
Value += Writer->getSymbolAddress(*A, Layout) -<br>
@@ -387,12 +388,12 @@ bool X86MachObjectWriter::recordScattere<br>
if (FixupOffset > 0xffffff) {<br>
char Buffer[32];<br>
format("0x%x", FixupOffset).print(Buffer, sizeof(Buffer));<br>
- Asm.getContext().reportFatalError(Fixup.getLoc(),<br>
+ Asm.getContext().reportError(Fixup.getLoc(),<br>
Twine("Section too large, can't encode "<br>
"r_address (") + Buffer +<br>
") into 24 bits of scattered "<br>
"relocation entry.");<br>
- llvm_unreachable("fatal error returned?!");<br>
+ return false;<br>
}<br>
<br>
MachO::any_relocation_info MRE;<br>
<br>
Modified: llvm/trunk/test/MC/AArch64/error-location.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AArch64/error-location.s?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AArch64/error-location.s?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/AArch64/error-location.s (original)<br>
+++ llvm/trunk/test/MC/AArch64/error-location.s Tue Nov 17 04:00:43 2015<br>
@@ -1,5 +1,49 @@<br>
// RUN: not llvm-mc -triple aarch64--none-eabi -filetype obj < %s -o /dev/null 2>&1 | FileCheck %s<br>
<br>
+// Note: These errors are not always emitted in the order in which the relevant<br>
+// source appears, this file is carefully ordered so that that is the case.<br>
+<br>
.text<br>
// CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: symbol 'undef' can not be undefined in a subtraction expression<br>
.word (0-undef)<br>
+<br>
+// CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: expected relocatable expression<br>
+ .word -undef<br>
+<br>
+// CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: No relocation available to represent this relative expression<br>
+ adr x0, #a-undef<br>
+<br>
+// CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Cannot represent a difference across sections<br>
+ .word x_a - y_a<br>
+<br>
+// CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Cannot represent a subtraction with a weak symbol<br>
+ .word a - w<br>
+<br>
+// CHECK: <unknown>:0: error: expression could not be evaluated<br>
+ .set v1, -undef<br>
+<br>
+ .comm common, 4<br>
+// CHECK: <unknown>:0: error: Common symbol 'common' cannot be used in assignment expr<br>
+ .set v3, common<br>
+<br>
+// CHECK: <unknown>:0: error: Undefined temporary symbol<br>
+ .word 5f<br>
+<br>
+// CHECK: <unknown>:0: error: symbol 'undef' could not be evaluated in a subtraction expression<br>
+ .set v2, a-undef<br>
+<br>
+<br>
+<br>
+w:<br>
+ .word 0<br>
+ .weak w<br>
+<br>
+<br>
+ .section sec_x<br>
+x_a:<br>
+ .word 0<br>
+<br>
+<br>
+ .section sec_y<br>
+y_a:<br>
+ .word 0<br>
<br>
Modified: llvm/trunk/test/MC/ARM/arm-elf-relocation-diagnostics.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/arm-elf-relocation-diagnostics.s?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/arm-elf-relocation-diagnostics.s?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/ARM/arm-elf-relocation-diagnostics.s (original)<br>
+++ llvm/trunk/test/MC/ARM/arm-elf-relocation-diagnostics.s Tue Nov 17 04:00:43 2015<br>
@@ -8,20 +8,19 @@<br>
@ CHECK: .byte target(sbrel)<br>
@ CHECK: ^<br>
<br>
-@ TODO: enable these negative test cases<br>
-@ .hword target(sbrel)<br>
-@ @ CHECK-SBREL-HWORD: error: relocated expression must be 32-bit<br>
-@ @ CHECK-SBREL-HWORD: .hword target(sbrel)<br>
-@ @ CHECK-SBREL-HWORD: ^<br>
-@<br>
-@ .short target(sbrel)<br>
-@ @ CHECK-SBREL-SHORT: error: relocated expression must be 32-bit<br>
-@ @ CHECK-SBREL-SHORT: .short target(sbrel)<br>
-@ @ CHECK-SBREL-SHORT: ^<br>
-@<br>
-@ .quad target(sbrel)<br>
-@ @ CHECK-SBREL-SHORT: error: relocated expression must be 32-bit<br>
-@ @ CHECK-SBREL-SHORT: .quad target(sbrel)<br>
-@ @ CHECK-SBREL-SHORT: ^<br>
+ .hword target(sbrel)<br>
+@ CHECK: error: relocated expression must be 32-bit<br>
+@ CHECK: .hword target(sbrel)<br>
+@ CHECK: ^<br>
+<br>
+ .short target(sbrel)<br>
+@ CHECK: error: relocated expression must be 32-bit<br>
+@ CHECK: .short target(sbrel)<br>
+@ CHECK: ^<br>
+<br>
+ .quad target(sbrel)<br>
+@ CHECK: error: relocated expression must be 32-bit<br>
+@ CHECK: .quad target(sbrel)<br>
+@ CHECK: ^<br>
<br>
<br>
<br>
Modified: llvm/trunk/test/MC/ARM/error-location.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/error-location.s?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/error-location.s?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/ARM/error-location.s (original)<br>
+++ llvm/trunk/test/MC/ARM/error-location.s Tue Nov 17 04:00:43 2015<br>
@@ -1,5 +1,49 @@<br>
@ RUN: not llvm-mc -triple armv7a--none-eabi -filetype obj < %s -o /dev/null 2>&1 | FileCheck %s<br>
<br>
+@ Note: These errors are not always emitted in the order in which the relevant<br>
+@ source appears, this file is carefully ordered so that that is the case.<br>
+<br>
.text<br>
@ CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: symbol 'undef' can not be undefined in a subtraction expression<br>
.word (0-undef)<br>
+<br>
+@ CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: expected relocatable expression<br>
+ .word -undef<br>
+<br>
+@ CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: No relocation available to represent this relative expression<br>
+ adr r0, #a-undef<br>
+<br>
+@ CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Cannot represent a difference across sections<br>
+ .word x_a - y_a<br>
+<br>
+@ CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Cannot represent a subtraction with a weak symbol<br>
+ .word a - w<br>
+<br>
+@ CHECK: <unknown>:0: error: expression could not be evaluated<br>
+ .set v1, -undef<br>
+<br>
+ .comm common, 4<br>
+@ CHECK: <unknown>:0: error: Common symbol 'common' cannot be used in assignment expr<br>
+ .set v3, common<br>
+<br>
+@ CHECK: <unknown>:0: error: Undefined temporary symbol<br>
+ .word 5f<br>
+<br>
+@ CHECK: <unknown>:0: error: symbol 'undef' could not be evaluated in a subtraction expression<br>
+ .set v2, a-undef<br>
+<br>
+<br>
+<br>
+w:<br>
+ .word 0<br>
+ .weak w<br>
+<br>
+<br>
+ .section sec_x<br>
+x_a:<br>
+ .word 0<br>
+<br>
+<br>
+ .section sec_y<br>
+y_a:<br>
+ .word 0<br>
<br>
Removed: llvm/trunk/test/MC/ARM/thumb1-relax-adr-local.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/thumb1-relax-adr-local.s?rev=253327&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/thumb1-relax-adr-local.s?rev=253327&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/ARM/thumb1-relax-adr-local.s (original)<br>
+++ llvm/trunk/test/MC/ARM/thumb1-relax-adr-local.s (removed)<br>
@@ -1,9 +0,0 @@<br>
-@ RUN: not llvm-mc -triple thumbv6m-none-macho -filetype=obj -o /dev/null %s 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s<br>
-<br>
- .global func1<br>
- adr r0, Lmisaligned<br>
-Lmisaligned:<br>
- .word 42<br>
-<br>
-@ CHECK-ERROR: misaligned pc-relative fixup value<br>
-<br>
<br>
Removed: llvm/trunk/test/MC/ARM/thumb1-relax-bcc-local.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/thumb1-relax-bcc-local.s?rev=253327&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/thumb1-relax-bcc-local.s?rev=253327&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/ARM/thumb1-relax-bcc-local.s (original)<br>
+++ llvm/trunk/test/MC/ARM/thumb1-relax-bcc-local.s (removed)<br>
@@ -1,6 +0,0 @@<br>
-@ RUN: not llvm-mc -triple thumbv6m-none-macho -filetype=obj -o /dev/null %s 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s<br>
-<br>
- bne Lfar<br>
- .space 258<br>
-Lfar:<br>
-@ CHECK-ERROR: out of range pc-relative fixup value<br>
<br>
Removed: llvm/trunk/test/MC/ARM/thumb1-relax-br-local.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/thumb1-relax-br-local.s?rev=253327&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/thumb1-relax-br-local.s?rev=253327&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/ARM/thumb1-relax-br-local.s (original)<br>
+++ llvm/trunk/test/MC/ARM/thumb1-relax-br-local.s (removed)<br>
@@ -1,8 +0,0 @@<br>
-@ RUN: not llvm-mc -triple thumbv6m-none-macho -filetype=obj -o /dev/null %s 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s<br>
-<br>
- b Lfar<br>
- .space 2050<br>
-<br>
-Lfar:<br>
-<br>
-@ CHECK-ERROR: out of range pc-relative fixup value<br>
<br>
Removed: llvm/trunk/test/MC/ARM/thumb1-relax-ldrlit-local-behind.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/thumb1-relax-ldrlit-local-behind.s?rev=253327&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/thumb1-relax-ldrlit-local-behind.s?rev=253327&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/ARM/thumb1-relax-ldrlit-local-behind.s (original)<br>
+++ llvm/trunk/test/MC/ARM/thumb1-relax-ldrlit-local-behind.s (removed)<br>
@@ -1,7 +0,0 @@<br>
-@ RUN: not llvm-mc -triple thumbv6m-none-macho -filetype=obj -o /dev/null %s 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s<br>
-<br>
-Lhere:<br>
- ldr r0, Lhere<br>
-<br>
-@ CHECK-ERROR: out of range pc-relative fixup value<br>
-<br>
<br>
Removed: llvm/trunk/test/MC/ARM/thumb1-relax-ldrlit-local-misaligned.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/thumb1-relax-ldrlit-local-misaligned.s?rev=253327&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/thumb1-relax-ldrlit-local-misaligned.s?rev=253327&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/ARM/thumb1-relax-ldrlit-local-misaligned.s (original)<br>
+++ llvm/trunk/test/MC/ARM/thumb1-relax-ldrlit-local-misaligned.s (removed)<br>
@@ -1,10 +0,0 @@<br>
-@ RUN: not llvm-mc -triple thumbv6m-none-macho -filetype=obj -o /dev/null %s 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s<br>
-<br>
- .global func1<br>
-_func1:<br>
- ldr r0, L_misaligned<br>
-L_misaligned:<br>
- .word 42<br>
-<br>
-@ CHECK-ERROR: misaligned pc-relative fixup value<br>
-<br>
<br>
Removed: llvm/trunk/test/MC/ARM/thumb1-relax-ldrlit-local-range.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/thumb1-relax-ldrlit-local-range.s?rev=253327&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/thumb1-relax-ldrlit-local-range.s?rev=253327&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/ARM/thumb1-relax-ldrlit-local-range.s (original)<br>
+++ llvm/trunk/test/MC/ARM/thumb1-relax-ldrlit-local-range.s (removed)<br>
@@ -1,13 +0,0 @@<br>
-@ RUN: not llvm-mc -triple thumbv6m-none-macho -filetype=obj -o /dev/null %s 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s<br>
-<br>
- .global func1<br>
-_func1:<br>
- ldr r0, L_far<br>
- .space 1024<br>
-<br>
- .p2align 2<br>
-L_far:<br>
- .word 42<br>
-<br>
-@ CHECK-ERROR: out of range pc-relative fixup value<br>
-<br>
<br>
Added: llvm/trunk/test/MC/ARM/thumb1-relax.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/thumb1-relax.s?rev=253328&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/thumb1-relax.s?rev=253328&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/ARM/thumb1-relax.s (added)<br>
+++ llvm/trunk/test/MC/ARM/thumb1-relax.s Tue Nov 17 04:00:43 2015<br>
@@ -0,0 +1,35 @@<br>
+@ RUN: not llvm-mc -triple thumbv6m-none-macho -filetype=obj -o /dev/null %s 2>&1 | FileCheck %s<br>
+@ RUN: not llvm-mc -triple thumbv6m-none-eabi -filetype=obj -o /dev/null %s 2>&1 | FileCheck %s<br>
+<br>
+Lhere:<br>
+@ CHECK: out of range pc-relative fixup value<br>
+ ldr r0, Lhere<br>
+<br>
+@ CHECK: out of range pc-relative fixup value<br>
+ b Lfar2<br>
+<br>
+@ CHECK: out of range pc-relative fixup value<br>
+ bne Lfar1<br>
+<br>
+@ CHECK: out of range pc-relative fixup value<br>
+ ldr r0, Lfar2<br>
+<br>
+@ CHECK: misaligned pc-relative fixup value<br>
+ adr r0, Lmisaligned<br>
+<br>
+@ CHECK: misaligned pc-relative fixup value<br>
+ ldr r0, Lmisaligned<br>
+<br>
+ .balign 4<br>
+ .short 0<br>
+Lmisaligned:<br>
+ .word 42<br>
+<br>
+ .space 256<br>
+Lfar1:<br>
+ .word 42<br>
+<br>
+ .space 2050<br>
+Lfar2:<br>
+ .word 42<br>
+<br>
<br>
Modified: llvm/trunk/test/MC/COFF/bad-expr.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/bad-expr.s?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/bad-expr.s?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/COFF/bad-expr.s (original)<br>
+++ llvm/trunk/test/MC/COFF/bad-expr.s Tue Nov 17 04:00:43 2015<br>
@@ -1,7 +1,9 @@<br>
// RUN: not llvm-mc -filetype=obj -triple i386-pc-win32 %s 2>&1 | FileCheck %s<br>
<br>
// CHECK: symbol '__ImageBase' can not be undefined in a subtraction expression<br>
+// CHECK: symbol '__ImageBase' can not be undefined in a subtraction expression<br>
<br>
.data<br>
_x:<br>
.long _x-__ImageBase<br>
+ .long __ImageBase-_x<br>
<br>
Modified: llvm/trunk/test/MC/COFF/invalid-def.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/invalid-def.s?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/invalid-def.s?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/COFF/invalid-def.s (original)<br>
+++ llvm/trunk/test/MC/COFF/invalid-def.s Tue Nov 17 04:00:43 2015<br>
@@ -1,5 +1,8 @@<br>
-# RUN: not llvm-mc -triple i686-windows -filetype obj -o /dev/null %s<br>
+# RUN: not llvm-mc -triple i686-windows -filetype obj -o /dev/null %s 2>&1 | FileCheck %s<br>
<br>
+# CHECK: error: starting a new symbol definition without completing the previous one<br>
+# CHECK: error: starting a new symbol definition without completing the previous one<br>
.def first<br>
.def second<br>
+ .def third<br>
<br>
<br>
Modified: llvm/trunk/test/MC/COFF/invalid-endef.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/invalid-endef.s?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/invalid-endef.s?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/COFF/invalid-endef.s (original)<br>
+++ llvm/trunk/test/MC/COFF/invalid-endef.s Tue Nov 17 04:00:43 2015<br>
@@ -1,4 +1,7 @@<br>
-# RUN: not llvm-mc -triple i686-windows -filetype obj -o /dev/null %s<br>
+# RUN: not llvm-mc -triple i686-windows -filetype obj -o /dev/null %s 2>&1 | FileCheck %s<br>
<br>
+# CHECK: ending symbol definition without starting one<br>
+# CHECK: ending symbol definition without starting one<br>
+ .endef<br>
.endef<br>
<br>
<br>
Modified: llvm/trunk/test/MC/COFF/invalid-scl-range.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/invalid-scl-range.s?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/invalid-scl-range.s?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/COFF/invalid-scl-range.s (original)<br>
+++ llvm/trunk/test/MC/COFF/invalid-scl-range.s Tue Nov 17 04:00:43 2015<br>
@@ -1,6 +1,9 @@<br>
# RUN: not llvm-mc -triple i686-windows -filetype obj -o /dev/null %s<br>
<br>
.def storage_class_range<br>
+# CHECK: storage class value '1337' out of range<br>
+# CHECK: storage class value '9001' out of range<br>
.scl 1337<br>
+ .scl 9001<br>
.endef<br>
<br>
<br>
Modified: llvm/trunk/test/MC/COFF/invalid-scl.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/invalid-scl.s?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/invalid-scl.s?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/COFF/invalid-scl.s (original)<br>
+++ llvm/trunk/test/MC/COFF/invalid-scl.s Tue Nov 17 04:00:43 2015<br>
@@ -1,4 +1,7 @@<br>
-# RUN: not llvm-mc -triple i686-windows -filetype obj -o /dev/null %s<br>
+# RUN: not llvm-mc -triple i686-windows -filetype obj -o /dev/null %s 2>&1 | FileCheck %s<br>
<br>
+# CHECK: storage class specified outside of symbol definition<br>
+# CHECK: storage class specified outside of symbol definition<br>
+ .scl 1337<br>
.scl 1337<br>
<br>
<br>
Modified: llvm/trunk/test/MC/COFF/invalid-type.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/invalid-type.s?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/invalid-type.s?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/COFF/invalid-type.s (original)<br>
+++ llvm/trunk/test/MC/COFF/invalid-type.s Tue Nov 17 04:00:43 2015<br>
@@ -1,4 +1,7 @@<br>
-# RUN: not llvm-mc -triple i686-windows -filetype obj -o /dev/null %s<br>
+# RUN: not llvm-mc -triple i686-windows -filetype obj -o /dev/null %s 2>&1 | FileCheck %s<br>
<br>
+# CHECK: symbol type specified outside of a symbol definition<br>
+# CHECK: symbol type specified outside of a symbol definition<br>
.type 65536<br>
+ .type 65537<br>
<br>
<br>
Modified: llvm/trunk/test/MC/COFF/label-undefined.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/label-undefined.s?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/label-undefined.s?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/COFF/label-undefined.s (original)<br>
+++ llvm/trunk/test/MC/COFF/label-undefined.s Tue Nov 17 04:00:43 2015<br>
@@ -1,4 +1,6 @@<br>
// RUN: not llvm-mc -filetype=obj -triple i386-pc-win32 %s 2>&1 | FileCheck %s<br>
// CHECK: assembler label 'Lundefined' can not be undefined<br>
+// CHECK: assembler label 'Lundefined2' can not be undefined<br>
.text<br>
movl Lundefined, %eax<br>
+ movl Lundefined2, %eax<br>
<br>
Modified: llvm/trunk/test/MC/COFF/secidx-diagnostic.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/secidx-diagnostic.s?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/secidx-diagnostic.s?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/COFF/secidx-diagnostic.s (original)<br>
+++ llvm/trunk/test/MC/COFF/secidx-diagnostic.s Tue Nov 17 04:00:43 2015<br>
@@ -2,7 +2,9 @@<br>
// RUN: FileCheck %s < %t<br>
<br>
// CHECK: symbol 'bar' can not be undefined<br>
+// CHECK: symbol 'baz' can not be undefined<br>
<br>
.data<br>
foo:<br>
.secidx bar<br>
+ .secidx baz<br>
<br>
Modified: llvm/trunk/test/MC/ELF/common-error1.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/common-error1.s?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/common-error1.s?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/ELF/common-error1.s (original)<br>
+++ llvm/trunk/test/MC/ELF/common-error1.s Tue Nov 17 04:00:43 2015<br>
@@ -3,4 +3,4 @@<br>
.comm C,4,4<br>
.set A,C<br>
<br>
-// CHECK: Common symbol C cannot be used in assignment expr<br>
+// CHECK: Common symbol 'C' cannot be used in assignment expr<br>
<br>
Modified: llvm/trunk/test/MC/ELF/common-error2.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/common-error2.s?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/common-error2.s?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/ELF/common-error2.s (original)<br>
+++ llvm/trunk/test/MC/ELF/common-error2.s Tue Nov 17 04:00:43 2015<br>
@@ -3,4 +3,4 @@<br>
.set A,C<br>
.comm C,4,4<br>
<br>
-// CHECK: Common symbol C cannot be used in assignment expr<br>
+// CHECK: Common symbol 'C' cannot be used in assignment expr<br>
<br>
Added: llvm/trunk/test/MC/MachO/AArch64/reloc-errors.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/MachO/AArch64/reloc-errors.s?rev=253328&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/MachO/AArch64/reloc-errors.s?rev=253328&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/MachO/AArch64/reloc-errors.s (added)<br>
+++ llvm/trunk/test/MC/MachO/AArch64/reloc-errors.s Tue Nov 17 04:00:43 2015<br>
@@ -0,0 +1,10 @@<br>
+; RUN: not llvm-mc -triple aarch64-none-macho %s -filetype=obj -o - 2>&1 | FileCheck %s<br>
+<br>
+; CHECK: error: conditional branch requires assembler-local label. 'external' is external.<br>
+ b.eq external<br>
+<br>
+; CHECK: error: Invalid relocation on conditional branch<br>
+ tbz w0, #4, external<br>
+<br>
+; CHECK: error: unknown AArch64 fixup kind!<br>
+ adr x0, external<br>
<br>
Modified: llvm/trunk/test/MC/MachO/ARM/bad-darwin-ARM-reloc.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/MachO/ARM/bad-darwin-ARM-reloc.s?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/MachO/ARM/bad-darwin-ARM-reloc.s?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/MachO/ARM/bad-darwin-ARM-reloc.s (original)<br>
+++ llvm/trunk/test/MC/MachO/ARM/bad-darwin-ARM-reloc.s Tue Nov 17 04:00:43 2015<br>
@@ -7,3 +7,9 @@<br>
L___fcommon:<br>
.word 0<br>
@ CHECK-ERROR: unsupported relocation on symbol<br>
+<br>
+c:<br>
+ .word a - b<br>
+@ CHECK-ERROR: symbol 'a' can not be undefined in a subtraction expression<br>
+ .word c - b<br>
+@ CHECK-ERROR: symbol 'b' can not be undefined in a subtraction expression<br>
<br>
Modified: llvm/trunk/test/MC/MachO/bad-darwin-x86_64-diff-relocs.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/MachO/bad-darwin-x86_64-diff-relocs.s?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/MachO/bad-darwin-x86_64-diff-relocs.s?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/MachO/bad-darwin-x86_64-diff-relocs.s (original)<br>
+++ llvm/trunk/test/MC/MachO/bad-darwin-x86_64-diff-relocs.s Tue Nov 17 04:00:43 2015<br>
@@ -2,4 +2,12 @@<br>
// RUN: FileCheck --check-prefix=CHECK-ERROR < %t.err %s<br>
<br>
.quad _foo - _bar<br>
-// CHECK-ERROR: unsupported relocation with subtraction expression<br>
+// CHECK-ERROR: error: unsupported relocation with subtraction expression<br>
+<br>
+_Y:<br>
+.long (_Y+4)-_b<br>
+// CHECK-ERROR: error: unsupported relocation with subtraction expression, symbol '_b' can not be undefined in a subtraction expression<br>
+<br>
+_Z:<br>
+.long (_a+4)-_Z<br>
+// CHECK-ERROR: error: unsupported relocation with subtraction expression, symbol '_a' can not be undefined in a subtraction expression<br>
<br>
Removed: llvm/trunk/test/MC/MachO/bad-darwin-x86_64-reloc-expr1.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/MachO/bad-darwin-x86_64-reloc-expr1.s?rev=253327&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/MachO/bad-darwin-x86_64-reloc-expr1.s?rev=253327&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/MachO/bad-darwin-x86_64-reloc-expr1.s (original)<br>
+++ llvm/trunk/test/MC/MachO/bad-darwin-x86_64-reloc-expr1.s (removed)<br>
@@ -1,6 +0,0 @@<br>
-// RUN: not llvm-mc -triple x86_64-apple-darwin10 %s -filetype=obj -o - 2> %t.err > %t<br>
-// RUN: FileCheck --check-prefix=CHECK-ERROR < %t.err %s<br>
-<br>
-_Z:<br>
-.long (_Z+4)-_b<br>
-// CHECK-ERROR: error: unsupported relocation with subtraction expression, symbol '_b' can not be undefined in a subtraction expression<br>
<br>
Removed: llvm/trunk/test/MC/MachO/bad-darwin-x86_64-reloc-expr2.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/MachO/bad-darwin-x86_64-reloc-expr2.s?rev=253327&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/MachO/bad-darwin-x86_64-reloc-expr2.s?rev=253327&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/MachO/bad-darwin-x86_64-reloc-expr2.s (original)<br>
+++ llvm/trunk/test/MC/MachO/bad-darwin-x86_64-reloc-expr2.s (removed)<br>
@@ -1,6 +0,0 @@<br>
-// RUN: not llvm-mc -triple x86_64-apple-darwin10 %s -filetype=obj -o - 2> %t.err > %t<br>
-// RUN: FileCheck --check-prefix=CHECK-ERROR < %t.err %s<br>
-<br>
-_Z:<br>
-.long (_a+4)-_Z<br>
-// CHECK-ERROR: error: unsupported relocation with subtraction expression, symbol '_a' can not be undefined in a subtraction expression<br>
<br>
Modified: llvm/trunk/test/MC/Mips/micromips-diagnostic-fixup.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/micromips-diagnostic-fixup.s?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/micromips-diagnostic-fixup.s?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/Mips/micromips-diagnostic-fixup.s (original)<br>
+++ llvm/trunk/test/MC/Mips/micromips-diagnostic-fixup.s Tue Nov 17 04:00:43 2015<br>
@@ -1,9 +1,12 @@<br>
# RUN: not llvm-mc %s -triple=mipsel-unknown-linux -mcpu=mips32r2 -arch=mips -mattr=+micromips 2>&1 -filetype=obj | FileCheck %s<br>
-#<br>
+<br>
+# Two instructions, to check that this is not a fatal error<br>
+# CHECK: error: out of range PC16 fixup<br>
# CHECK: error: out of range PC16 fixup<br>
<br>
.text<br>
b foo<br>
+ b foo<br>
.space 65536 - 6, 1 # -6 = size of b instr plus size of automatically inserted nop<br>
nop # This instr makes the branch too long to fit into a 17-bit offset<br>
foo:<br>
<br>
Modified: llvm/trunk/test/MC/Mips/micromips-pc16-fixup.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/micromips-pc16-fixup.s?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/micromips-pc16-fixup.s?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/Mips/micromips-pc16-fixup.s (original)<br>
+++ llvm/trunk/test/MC/Mips/micromips-pc16-fixup.s Tue Nov 17 04:00:43 2015<br>
@@ -1,6 +1,6 @@<br>
# RUN: llvm-mc %s -triple=mips-unknown-linux -mcpu=mips32r2 -arch=mips -mattr=+micromips 2>&1 -filetype=obj | FileCheck %s<br>
#<br>
-# CHECK-NOT: LLVM ERROR: out of range PC16 fixup<br>
+# CHECK-NOT: error: out of range PC16 fixup<br>
<br>
.text<br>
b foo<br>
<br>
Modified: llvm/trunk/test/MC/Mips/mips-diagnostic-fixup.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/mips-diagnostic-fixup.s?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/mips-diagnostic-fixup.s?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/Mips/mips-diagnostic-fixup.s (original)<br>
+++ llvm/trunk/test/MC/Mips/mips-diagnostic-fixup.s Tue Nov 17 04:00:43 2015<br>
@@ -1,9 +1,12 @@<br>
# RUN: not llvm-mc %s -triple=mipsel-unknown-linux -mcpu=mips32r2 -arch=mips 2>&1 -filetype=obj | FileCheck %s<br>
-#<br>
+<br>
+# Two instructions, to check that this is not a fatal error<br>
+# CHECK: error: out of range PC16 fixup<br>
# CHECK: error: out of range PC16 fixup<br>
<br>
.text<br>
b foo<br>
+ b foo<br>
.space 131072 - 8, 1 # -8 = size of b instr plus size of automatically inserted nop<br>
nop # This instr makes the branch too long to fit into a 18-bit offset<br>
foo:<br>
<br>
Modified: llvm/trunk/test/MC/Mips/mips-pc16-fixup.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/mips-pc16-fixup.s?rev=253328&r1=253327&r2=253328&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/mips-pc16-fixup.s?rev=253328&r1=253327&r2=253328&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/Mips/mips-pc16-fixup.s (original)<br>
+++ llvm/trunk/test/MC/Mips/mips-pc16-fixup.s Tue Nov 17 04:00:43 2015<br>
@@ -1,6 +1,6 @@<br>
# RUN: llvm-mc %s -triple=mips-unknown-linux -mcpu=mips32r2 -arch=mips 2>&1 -filetype=obj | FileCheck %s<br>
#<br>
-# CHECK-NOT: LLVM ERROR: out of range PC16 fixup<br>
+# CHECK-NOT: error: out of range PC16 fixup<br>
<br>
.text<br>
b foo<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>