This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [hjl@lucon.org: Re: your patch to remove unused sections]
- From: "H. J. Lu" <hjl at lucon dot org>
- To: binutils at sources dot redhat dot com
- Date: Mon, 11 Apr 2005 07:55:16 -0700
- Subject: Re: [hjl@lucon.org: Re: your patch to remove unused sections]
- References: <20050411140930.GA14672@lucon.org> <20050411144356.GC861@bubble.modra.org>
On Tue, Apr 12, 2005 at 12:13:56AM +0930, Alan Modra wrote:
> On Mon, Apr 11, 2005 at 07:09:30AM -0700, H. J. Lu wrote:
> > Hi Alan,
> >
> > Have you looked at this patch?
>
> Yes, I was going to ask for a revision, but wanted to check whether my
> idea was feasible before asking you to make a change, which would remove
> the following loop:
>
> > + /* .bss and similar sections won't have the linker_mark
> > + field set. We have to check if its output section is
> > + included in output_bfd. */
> > + for (sec = output_bfd->sections; sec != NULL; sec = sec->next)
> > + if (sec == sym->section->output_section)
> > + break;
>
> I haven't had time to check, but here's the idea anyway: After removing
> an unused output section s with bfd_section_list_remove (output_bfd, s),
> clear s->next. Then
>
> if (sym->section->output_section->next == NULL
> && *output_bfd->section_tail != sym->section->output_section)
> {
> /* The section has been removed. */
> }
>
I will give it a try.
H.J.