From: Alexandre Oliva Date: Sat, 11 Mar 2017 03:10:11 +0000 (-0300) Subject: non-LVU: error if .[su]leb128's operand is undefined X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=91a73a96a1e1c9e59157cb12acb2174a606b313a;p=thirdparty%2Fbinutils-gdb.git non-LVU: error if .[su]leb128's operand is undefined --- diff --git a/gas/testsuite/gas/all/gas.exp b/gas/testsuite/gas/all/gas.exp index 009e68c2201..c7a3b760f0a 100644 --- a/gas/testsuite/gas/all/gas.exp +++ b/gas/testsuite/gas/all/gas.exp @@ -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. diff --git a/gas/testsuite/gas/all/sleb128-9.d b/gas/testsuite/gas/all/sleb128-9.d new file mode 100644 index 00000000000..7c884516897 --- /dev/null +++ b/gas/testsuite/gas/all/sleb128-9.d @@ -0,0 +1,4 @@ +#name: undefined symbols un sleb128 directive +#source: sleb128-9.s +#error-output: sleb128-9.l +#target: *-*-* diff --git a/gas/testsuite/gas/all/sleb128-9.l b/gas/testsuite/gas/all/sleb128-9.l new file mode 100644 index 00000000000..19842fa2611 --- /dev/null +++ b/gas/testsuite/gas/all/sleb128-9.l @@ -0,0 +1,3 @@ +[^:]*: Assembler messages: +[^:]*:2: Error: leb128 operand is an undefined symbol: \.Lundef +[^:]*:3: Error: leb128 operand is an undefined symbol: undef diff --git a/gas/testsuite/gas/all/sleb128-9.s b/gas/testsuite/gas/all/sleb128-9.s new file mode 100644 index 00000000000..87cb9550135 --- /dev/null +++ b/gas/testsuite/gas/all/sleb128-9.s @@ -0,0 +1,3 @@ + .data + .sleb128 .Lundef + .sleb128 undef diff --git a/gas/write.c b/gas/write.c index 9a99a0f5ae7..24e13d611c6 100644 --- a/gas/write.c +++ b/gas/write.c @@ -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;