public inbox for binutils-cvs@sourceware.org help / color / mirror / Atom feed
From: Alan Modra <amodra@sourceware.org> To: bfd-cvs@sourceware.org Subject: [binutils-gdb] Re: PR16005, avr linker crash on a particular instruction sequence with --relax Date: Fri, 29 Jul 2022 13:58:27 +0000 (GMT) [thread overview] Message-ID: <20220729135827.A19433857832@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=10948fb9fd66c029d59c97e04556ab827076336c commit 10948fb9fd66c029d59c97e04556ab827076336c Author: Alan Modra <amodra@gmail.com> Date: Fri Jul 29 22:35:13 2022 +0930 Re: PR16005, avr linker crash on a particular instruction sequence with --relax The last patch wasn't so clever. The contents in fact have already been read, just not cached where relax_delete_bytes expects them. relax_delete_bytes also modifies relocs and syms, so they should be cached too. PR 16005 * elf32-avr.c (elf32_avr_relax_delete_bytes): Revert last change. (elf32_avr_relax_section): Cache contents, relocs and syms before calling relax_delete_bytes. Diff: --- bfd/elf32-avr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c index 3a1d238e707..8c003d0553b 100644 --- a/bfd/elf32-avr.c +++ b/bfd/elf32-avr.c @@ -1927,9 +1927,6 @@ 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; @@ -3071,6 +3068,10 @@ elf32_avr_relax_section (bfd *abfd, "at address 0x%x deleted.\n", (int) dot + insn_size); + elf_section_data (sec)->relocs = internal_relocs; + elf_section_data (sec)->this_hdr.contents = contents; + symtab_hdr->contents = (unsigned char *) isymbuf; + /* Delete two bytes of data. */ if (!elf32_avr_relax_delete_bytes (abfd, sec, irel->r_offset + insn_size, 2,
reply other threads:[~2022-07-29 13:58 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220729135827.A19433857832@sourceware.org \ --to=amodra@sourceware.org \ --cc=bfd-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).