This is the mail archive of the
mailing list for the binutils project.
Re: [PATCH] another discarded DWARF issue
On Oct 15, 2007, at 6:22 PM, Alan Modra wrote:
On Tue, Oct 16, 2007 at 10:02:17AM +0930, Alan Modra wrote:
On Mon, Oct 15, 2007 at 03:42:37PM -0700, Bob Wilson wrote:
- if (kept != NULL && sec->size != kept->size)
+ /* The kept section may have been relaxed; compare its
original size. */
+ if (kept != NULL
+ && (elf_section_data (sec)->this_hdr.sh_size
+ != elf_section_data (kept)->this_hdr.sh_size))
What if "sec" is non-ELF? (I'm not dead certain this can happen, but
I think it can..)
I'll take your word for it. I wasn't sure how to do this. See below.
I think you should probably use
if (kept != NULL
&& ((sec->rawsize != 0 ? sec->rawsize : sec->size)
== (kept->rawsize != 0 ? kept->rawsize : kept->size)))
OK with that change.
I did that at first but then read the comment describing the rawsize
field: "it is currently only set for sections where the linker
relaxation scheme doesn't cache altered section and reloc contents
(stabs, eh_frame, SEC_MERGE, some coff relaxing targets), and thus
the original size needs to be kept to read the section multiple times."
The Xtensa port _does_ cache the altered section contents and
currently does not set rawsize. I started changing it to set rawsize
but this comment made me think that perhaps that was the wrong
approach. I guess not, since there doesn't seem to be another good
way to get the unrelaxed size of a section. Unless you have other
suggestions, I'll apply the patch with your change, and then fix up
the Xtensa port to set rawsize.