mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-21 18:39:34 +08:00
PR16005, avr linker crash on a particular instruction sequence with --relax
It's possible for relax_delete_bytes to be called with section contents NULL, as demonstrated by the testcase in this PR. PR 16005 * elf32-avr.c (elf32_avr_relax_delete_bytes): Get section contents if not already available.
This commit is contained in:
@ -1927,6 +1927,9 @@ elf32_avr_relax_delete_bytes (bfd *abfd,
|
||||
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
|
||||
sec_shndx = _bfd_elf_section_from_bfd_section (abfd, sec);
|
||||
contents = elf_section_data (sec)->this_hdr.contents;
|
||||
if (contents == NULL
|
||||
&& !bfd_malloc_and_get_section (abfd, sec, &contents))
|
||||
return false;
|
||||
relax_info = get_avr_relax_info (sec);
|
||||
|
||||
toaddr = sec->size;
|
||||
|
Reference in New Issue
Block a user