This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [AVR][PATCH] Add linker relaxation support / Fix 64 bit bug ingas rev. 5
Hi Björn,
The simple test case
.data
here:
.set sym, here
.long sym
Output of objdump:
/tmp/test.o: file format elf32-avr
RELOCATION RECORDS FOR [.data]:
OFFSET TYPE VALUE
00000000 R_AVR_32 sym
Are you using version of GAS with your relaxation patch applied ?
Without it (but with linkrelax set to 1 in md_begin) I get this:
RELOCATION RECORDS FOR [.data]:
OFFSET TYPE VALUE
00000000 R_AVR_32 .data
Ie the reloc has been transformed into a reloc against the .data section
symbol.
Note - the .set pseudo-op does not create an alias, it creates an
equivalence, so in your test case it creates a new symbol called "sym"
whose value is the same as that of the symbol called "here". So for
example with your test case if I run "objdump -t test.o" I see:
SYMBOL TABLE:
00000000 l d .text 00000000 .text
00000000 l d .data 00000000 .data
00000000 l d .bss 00000000 .bss
00000000 l .data 00000000 here
00000000 l .data 00000000 sym
ie both "sym" and "here" exist as local symbols.
Is it possible that in tc_gen_reloc after
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
one would need some kind of recursion for the case where the value of the
symbol sym itself is taken from another symbol?
That should not be necessary. What should have happened is that before
tc_gen_reloc() is called any relocs against local symbols should have
been either resolved or else transformed into relocs against global
symbols (usually section symbols). See adjust_reloc_syms() in
gas/write.c. I am guessing that in your case tc_fix_adjustable() is
defined and not allowing the local symbol reference to be transformed
into a section symbol reference.
Cheers
Nick