]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
non-LVU: error if .[su]leb128's operand is undefined
authorAlexandre Oliva <aoliva@redhat.com>
Sat, 11 Mar 2017 03:10:11 +0000 (00:10 -0300)
committerAlexandre Oliva <aoliva@redhat.com>
Sat, 11 Mar 2017 03:10:11 +0000 (00:10 -0300)
gas/testsuite/gas/all/gas.exp
gas/testsuite/gas/all/sleb128-9.d [new file with mode: 0644]
gas/testsuite/gas/all/sleb128-9.l [new file with mode: 0644]
gas/testsuite/gas/all/sleb128-9.s [new file with mode: 0644]
gas/write.c

index 009e68c22015e222c41cd6494fc8d1bae44b24e5..c7a3b760f0a0767ede03c0518666d184f1bbb4ba 100644 (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.
diff --git a/gas/testsuite/gas/all/sleb128-9.d b/gas/testsuite/gas/all/sleb128-9.d
new file mode 100644 (file)
index 0000000..7c88451
--- /dev/null
@@ -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 (file)
index 0000000..19842fa
--- /dev/null
@@ -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 (file)
index 0000000..87cb955
--- /dev/null
@@ -0,0 +1,3 @@
+       .data
+       .sleb128 .Lundef
+       .sleb128 undef
index 9a99a0f5ae740a330fdaa6ca455759e31ae75907..24e13d611c69862f5aee03b7da7bd2667531d3e9 100644 (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;