Fix the assembler to print a better relocatable expression error
authorKevin Enderby <enderby@apple.com>
Tue, 22 Apr 2014 17:27:29 +0000 (17:27 +0000)
committerKevin Enderby <enderby@apple.com>
Tue, 22 Apr 2014 17:27:29 +0000 (17:27 +0000)
commit29c96f133e9e10a8a2f1a8da4441a53f6d461b7c
tree57b2eed6b6507af918d066bcc7a78a091d0a6c0b
parent795e462cc4a94bd6cceefc441038027f4179841b
Fix the assembler to print a better relocatable expression error
diagnostic that includes location information.

Currently if one has this assembly:

.quad (0x1234 + (4 * SOME_VALUE))

where SOME_VALUE is undefined ones gets the less than
useful error message with no location information:

% clang -c x.s
clang -cc1as: fatal error: error in backend: expected relocatable expression

With this fix one now gets a more useful error message
with location information:

% clang -c x.s
x.s:5:8: error: expected relocatable expression
 .quad (0x1234 + (4 * SOME_VALUE))
       ^

To do this I plumbed the SMLoc through the MCObjectStreamer
EmitValue() and EmitValueImpl() interfaces so it could be used
when creating the MCFixup.

rdar://12391022

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206906 91177308-0d34-0410-b5e6-96231b3b80d8
14 files changed:
include/llvm/MC/MCELFStreamer.h
include/llvm/MC/MCObjectStreamer.h
include/llvm/MC/MCStreamer.h
lib/LTO/LTOModule.cpp
lib/MC/MCAsmStreamer.cpp
lib/MC/MCELFStreamer.cpp
lib/MC/MCNullStreamer.cpp
lib/MC/MCObjectStreamer.cpp
lib/MC/MCParser/AsmParser.cpp
lib/MC/MCStreamer.cpp
lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
lib/Target/ARM64/MCTargetDesc/ARM64ELFStreamer.cpp
test/MC/MachO/bad-darwin-x86_64-reloc-expr.s [new file with mode: 0644]