llvm-mirror/test/MC/AArch64/error-location-during-layout.s
Oliver Stannard f0a90b93e6 [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
2016-12-14 10:43:58 +00:00

15 lines
426 B
ArmAsm

// RUN: not llvm-mc -triple aarch64--none-eabi -filetype obj < %s -o /dev/null 2>&1 | FileCheck %s
.section a
.space 8
// CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: invalid .org offset '4' (at offset '8')
.org 4
.section b
// CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: expected absolute expression
.org undef
.section c
// CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: expected assembly-time absolute expression
.org -undef