AS reloc bug
Mikulas Patocka
mikulas@artax.karlin.mff.cuni.cz
Fri Aug 15 18:47:00 GMT 2003
Hi
There's bug in relocating in current as.
$ as
call a-b
a:
b:
$ objdump --disassemble
a.out: file format elf32-i386
Disassembly of section .text:
00000000 <a-0x5>:
0: e8 fb ff ff ff call 0 <a-0x5>
$ objdump --reloc
a.out: file format elf32-i386
$
a-b is an absolute expression and call needs relative offset, so it should
generate R_386_PC32 reloc on offset 1 --- but it doesn't.
When I write "call 0", the reloc is generated, but with "call a-b" it
isn't.
I send a patch that solves this problem. I am not sure if patch is
correct, it needs some to be checked by someone who understands it.
Mikulas
-------------- next part --------------
--- gas/write.c_ Fri Aug 15 20:29:31 2003
+++ gas/write.c Fri Aug 15 20:29:36 2003
@@ -2645,16 +2645,8 @@
fixP->fx_offset = add_number;
/* If the back-end code has selected a pc-relative
reloc, adjust the value to be pc-relative. */
- if (1
-#ifdef TC_M68K
- /* See the comment below about 68k weirdness. */
- && 0
-#endif
- && fixP->fx_pcrel)
- add_number -= MD_PCREL_FROM_SECTION (fixP, this_segment);
fixP->fx_addsy = NULL;
fixP->fx_subsy = NULL;
- fixP->fx_pcrel = 0;
}
else if (sub_symbol_segment == absolute_section
&& !TC_FORCE_RELOCATION_SUB_ABS (fixP))
More information about the Binutils
mailing list