non-LVU: error if .[su]leb128's operand is undefined

This commit is contained in:
Alexandre Oliva
2017-03-11 00:10:11 -03:00
parent 769ef0e3e7
commit f07a13fabd
5 changed files with 18 additions and 0 deletions

View File

@@ -394,6 +394,7 @@ if { ![istarget "tic4x*-*-*"] && ![istarget "tic54x*-*-*"] } {
run_dump_test sleb128-7
run_dump_test sleb128-8
}
run_dump_test sleb128-9
# .byte is 32 bits on tic4x, and .p2align isn't supported on tic54x
# .space is different on hppa*-hpux.

View File

@@ -0,0 +1,4 @@
#name: undefined symbols un sleb128 directive
#source: sleb128-9.s
#error-output: sleb128-9.l
#target: *-*-*

View File

@@ -0,0 +1,3 @@
[^:]*: Assembler messages:
[^:]*:2: Error: leb128 operand is an undefined symbol: \.Lundef
[^:]*:3: Error: leb128 operand is an undefined symbol: undef

View File

@@ -0,0 +1,3 @@
.data
.sleb128 .Lundef
.sleb128 undef

View File

@@ -2447,6 +2447,13 @@ relax_segment (struct frag *segment_frag_root, segT segment, int pass)
#endif
case rs_leb128:
if (pass == 0 && !S_IS_DEFINED (fragP->fr_symbol))
{
as_bad_where (fragP->fr_file, fragP->fr_line,
_("leb128 operand is an undefined symbol: %s"),
S_GET_NAME (fragP->fr_symbol));
}
/* Initial guess is always 1; doing otherwise can result in
stable solutions that are larger than the minimum. */
address += fragP->fr_offset = 1;