This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
RFA: A lousy ARM gas warning
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: binutils at sources dot redhat dot com
- Date: Thu, 22 Jan 2004 15:01:25 -0500
- Subject: RFA: A lousy ARM gas warning
Just something I stumbled across when writing testcases this morning. If
you say:
===
ldr a1, .Lfoo
.long foo
===
and forget to put a label on your constant pool, you get:
Error: internal_relocation (type: OFFSET_IMM) not fixed up
I'd rather see "Error: undefined local label `.Lfoo'" since we've got enough
information to do that. OK?
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
2004-01-22 Daniel Jacobowitz <drow@mvista.com>
* config/tc-arm.c (tc_gen_reloc): Improve error message for
undefined local labels.
2004-01-22 Daniel Jacobowitz <drow@mvista.com>
* gas/arm/arm.exp: Add "undefined" test.
* gas/arm/undefined.s, gas/arm/undefined.l: New files.
Index: config/tc-arm.c
===================================================================
RCS file: /big/fsf/rsync/src-cvs/src/gas/config/tc-arm.c,v
retrieving revision 1.160
diff -u -p -r1.160 tc-arm.c
--- config/tc-arm.c 9 Jan 2004 11:53:16 -0000 1.160
+++ config/tc-arm.c 22 Jan 2004 16:21:04 -0000
@@ -12823,6 +12823,16 @@ tc_gen_reloc (section, fixp)
return NULL;
case BFD_RELOC_ARM_OFFSET_IMM:
+ if (fixp->fx_addsy != NULL
+ && !S_IS_DEFINED (fixp->fx_addsy)
+ && S_IS_LOCAL (fixp->fx_addsy))
+ {
+ as_bad_where (fixp->fx_file, fixp->fx_line,
+ _("undefined local label `%s'"),
+ S_GET_NAME (fixp->fx_addsy));
+ return NULL;
+ }
+
as_bad_where (fixp->fx_file, fixp->fx_line,
_("internal_relocation (type: OFFSET_IMM) not fixed up"));
return NULL;
Index: testsuite/gas/arm/arm.exp
===================================================================
RCS file: /big/fsf/rsync/src-cvs/src/gas/testsuite/gas/arm/arm.exp,v
retrieving revision 1.27
diff -u -p -r1.27 arm.exp
--- testsuite/gas/arm/arm.exp 9 Jan 2004 11:53:16 -0000 1.27
+++ testsuite/gas/arm/arm.exp 22 Jan 2004 16:25:43 -0000
@@ -86,6 +86,8 @@ if {[istarget *arm*-*-*] || [istarget "x
}
gas_test "offset.s" "" $stdoptlist "OFFSET_IMM regression"
+
+ run_errors_test "undefined" "" "Undefined local label error"
}
# Not all arm targets are bi-endian, so only run this test on ones
Index: testsuite/gas/arm/undefined.l
===================================================================
RCS file: testsuite/gas/arm/undefined.l
diff -N testsuite/gas/arm/undefined.l
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/gas/arm/undefined.l 22 Jan 2004 16:26:12 -0000
@@ -0,0 +1,2 @@
+[^:]*: Assembler messages:
+[^:]*:1: Error: undefined local label `\.Lval'
Index: testsuite/gas/arm/undefined.s
===================================================================
RCS file: testsuite/gas/arm/undefined.s
diff -N testsuite/gas/arm/undefined.s
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/gas/arm/undefined.s 22 Jan 2004 16:22:38 -0000
@@ -0,0 +1 @@
+ ldr a1, .Lval