segmentation fault with --relax option, avr target

S, Pitchumani Pitchumani.S@atmel.com
Thu Dec 29 05:09:00 GMT 2011


Hi,

I encountered a segmentation fault (dereferencing NULL pointer) with
binutils-2.22 (avr target).
- it occurs when --relax option is enabled
- it occurred in file elf32-avr.c:1537 (function:
elf32_avr_relax_delete_bytes)

While debugging I found the difference in "relocs" field of "struct
bfd_section" member "used_by_bfd".

binutils-2.21
ldlang.c:6419  open_input_bfds (statement_list.head, FALSE);

binutils-2.22
ldlang.c:6570  open_input_bfds (statement_list.head, OPEN_BFD_NORMAL);

After above open_input_bfds function call in ldlang.c, "relocs" field of
sections are NULL in binutils-2.22.

Is this expected?

'relocs' field is updated in elflink.c:_bfd_elf_link_read_relocs
function.
In my case, for few sections 'relocs' field is not updated.

Is 'relocs' expected to be NULL for unused sections?
If so, referring 'relocs' field in 'elf32_avr_relax_delete_bytes'
function correct?

Thanks,
Pitchumani.S



More information about the Binutils mailing list