diff options
author | Oliver Stannard <oliver.stannard@arm.com> | 2016-12-14 10:43:58 +0000 |
---|---|---|
committer | Oliver Stannard <oliver.stannard@arm.com> | 2016-12-14 10:43:58 +0000 |
commit | 268f42f1cee049b37fe4f601c34d740384dbe88a (patch) | |
tree | eb9b3efc8beff9826b857e7b2531d9b314fd7ded /llvm/lib/MC/MCObjectStreamer.cpp | |
parent | 532bc984f58ed66e7fe7b9c6493d6ad808a89772 (diff) | |
download | bcm5719-llvm-268f42f1cee049b37fe4f601c34d740384dbe88a.tar.gz bcm5719-llvm-268f42f1cee049b37fe4f601c34d740384dbe88a.zip |
[Assembler] Better error messages for .org directive
Currently, the error messages we emit for the .org directive when the
expression is not absolute or is out of range do not include the line
number of the directive, so it can be hard to track down the problem if
a file contains many .org directives.
This patch stores the source location in the MCOrgFragment, so that it
can be used for diagnostics emitted during layout.
Since layout is an iterative process, and the errors are detected during
each iteration, it would have been possible for errors to be reported
multiple times. To prevent this, I've made the assembler bail out after
each iteration if any errors have been reported. This will still allow
multiple unrelated errors to be reported in the common case where they
are all detected in the first round of layout.
Differential Revision: https://reviews.llvm.org/D27411
llvm-svn: 289643
Diffstat (limited to 'llvm/lib/MC/MCObjectStreamer.cpp')
-rw-r--r-- | llvm/lib/MC/MCObjectStreamer.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp index 123295da15a..cae5c1f8d15 100644 --- a/llvm/lib/MC/MCObjectStreamer.cpp +++ b/llvm/lib/MC/MCObjectStreamer.cpp @@ -440,8 +440,9 @@ void MCObjectStreamer::EmitCodeAlignment(unsigned ByteAlignment, } void MCObjectStreamer::emitValueToOffset(const MCExpr *Offset, - unsigned char Value) { - insert(new MCOrgFragment(*Offset, Value)); + unsigned char Value, + SMLoc Loc) { + insert(new MCOrgFragment(*Offset, Value, Loc)); } // Associate DTPRel32 fixup with data and resize data area |