This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

md_apply_fix3 bug on arm-linux


A user reports that "mov r0, #UNDEFINED_SYMBOL" assembles to "mov r0,
#0" without emitting any relocation or diagnostic, which clearly isn't
right.

Also, this code:

.word 0
foo:
mov r0, #foo

assembles to "mov r0, #4", again with no relocation, which also seems
fairly bogus.

A patch like the one below seems to clear it up.  Does this look right? 
I guess I should also generate some cases for the testsuite.

Thanks

p.

2004-04-05  Philip Blundell  <philb@gnu.org>

	* config/tc-arm.c (md_apply_fix3): Decline to handle IMMEDIATE
	relocs involving symbols.

--- gas/config/tc-arm.c	2004-04-05 19:40:42.000000000 +0100
+++ gas/config/tc-arm.c	2004-04-05 19:40:36.000000000 +0100
@@ -12190,6 +12167,10 @@
   switch (fixP->fx_r_type)
     {
     case BFD_RELOC_ARM_IMMEDIATE:
+      /* If a symbol is involved, we must leave this to the linker.  */
+      if (fixP->fx_addsy)
+	return;
+
       newimm = validate_immediate (value);
       temp = md_chars_to_number (buf, INSN_SIZE);
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]