This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: PR ld/13180: strip -g -> objdump: bad value
- From: Alan Modra <amodra at gmail dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Tue, 13 Sep 2011 09:21:12 +0930
- Subject: Re: PATCH: PR ld/13180: strip -g -> objdump: bad value
- References: <20110912215007.GA30823@intel.com>
On Mon, Sep 12, 2011 at 02:50:07PM -0700, H.J. Lu wrote:
> + /* Remove the group section if all members are removed. */
> + if (!bfd_get_full_section_contents (abfd, sec, &memhunk))
> + {
> + status = 1;
> + bfd_nonfatal_message (NULL, abfd, sec, NULL);
> + return TRUE;
> + }
> +
> + src = memhunk + bfd_section_size (abfd, sec) - 4;
> + for (; src > memhunk; src -= 4)
> + {
> + unsigned int idx;
> + Elf_Internal_Shdr *shdr;
> + idx = H_GET_32 (abfd, src);
> + shdr = elf_elfsections (abfd)[idx];
> + if (!is_strip_section_1 (abfd, shdr->bfd_section))
> + break;
> + }
> +
> + free (memhunk);
> +
> + if (src == memhunk)
> + return TRUE;
I think it would be better if you didn't duplicate the low level
group handling code here. Iterate over the group sections using
elf_next_in_group.
--
Alan Modra
Australia Development Lab, IBM