Remove duplicate symbolic definitions from ARM literal pools
Nick Clifton
nickc@cambridge.redhat.com
Wed May 2 06:54:00 GMT 2001
Hi Guys,
Intel have complained again. This time it is because the assembler
will not common up duplicate symbolic references in the literal
pool. For example, assembling this source:
.global _start
_start:
ldr r1, =ref_lable
ldr r2, =0x12345678
ldr r1, =ref_lable
ldr r2, =0x12345678
.ltorg
.align 4
ref_lable:
.word 0
Will produce the following object file:
0: e59f1008 ldr r1, [pc, #8] ; 10 <_start+0x10>
4: e59f2008 ldr r2, [pc, #8] ; 14 <_start+0x14>
8: e59f1008 ldr r1, [pc, #8] ; 18 <_start+0x18>
c: e59f2000 ldr r2, [pc, #0] ; 14 <_start+0x14>
10: 00000020 andeq r0, r0, r0, lsr #32
10: R_ARM_ABS32 .text
14: 12345678 eornes r5, r4, #125829120 ; 0x7800000
18: 00000020 andeq r0, r0, r0, lsr #32
18: R_ARM_ABS32 .text
1c: 00000000 andeq r0, r0, r0
Note how the entry at 0x18 is a duplicate of the entry at 0x14,
whereas the entry at 0x16 is used twice, once by the instruction at
0x4 and once by the instruction at 0xc.
The patch below fixes this. Allowing duplicate symbolic entries to
be merged. Unless there are any objections I will apply the patch
tomorrow.
Cheers
Nick
2001-05-02 Nick Clifton <nickc@cambridge.redhat.com>
* config/tc-arm.c (add_to_lit_pool): Reuse duplicate symbolic
entries.
Index: gas/config/tc-arm.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-arm.c,v
retrieving revision 1.79
diff -p -r1.79 tc-arm.c
*** tc-arm.c 2001/05/02 11:33:12 1.79
--- tc-arm.c 2001/05/02 13:43:27
*************** add_to_lit_pool ()
*** 1279,1284 ****
--- 1279,1295 ----
== inst.reloc.exp.X_add_number)
&& literals[lit_count].exp.X_unsigned == inst.reloc.exp.X_unsigned)
break;
+
+ if (literals[lit_count].exp.X_op == inst.reloc.exp.X_op
+ && inst.reloc.exp.X_op == O_symbol
+ && literals[lit_count].exp.X_add_number
+ == inst.reloc.exp.X_add_number
+ && literals[lit_count].exp.X_add_symbol
+ == inst.reloc.exp.X_add_symbol
+ && literals[lit_count].exp.X_op_symbol
+ == inst.reloc.exp.X_op_symbol)
+ break;
+
lit_count++;
}
More information about the Binutils
mailing list