[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Number of bfd_count_sections changes during bfd_simple_get_relocated
From: |
Alan Modra |
Subject: |
Re: Number of bfd_count_sections changes during bfd_simple_get_relocated_section_contents |
Date: |
Thu, 14 Jul 2022 09:03:49 +0930 |
On Tue, Jul 12, 2022 at 03:30:44PM +0200, Tom de Vries wrote:
> Hi,
>
> with gdb we've run into this PR (
> https://sourceware.org/bugzilla/show_bug.cgi?id=29295 ) which is due to:
> - gdb expecting bfd_count_sections to remain constant, and
> - bfd changing the bfd_count_sections from 6 to 7, due to the
> creation of a COMMON section during
> bfd_simple_get_relocated_section_contents
>
> The question is: is this expected behaviour for bfd
It is. I'm assuming you are loading ELF files.
simple_get_relocated_section_contents needs to load ELF symbols in
order to apply relocations. If a symbol with a section of SHN_COMMON
is seen, a per-file COMMON section will be created. Hmm, I suppose
you could argue that since this is done for the linker, there is no
need to do so for simple_get_relocated_section_contents.
--
Alan Modra
Australia Development Lab, IBM