This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] More aggressive --gc-sections
On Fri, Mar 19, 2004 at 12:49:35AM +0100, Eric Botcazou wrote:
> > Have you tested this when building shared libs?
>
> Yes. GtkAda for example.
>
> > I suspect that elf_gc_mark_dynamic_ref_symbol won't do the right thing for
> > shared libs, specifically, that ELF_LINK_HASH_REF_DYNAMIC won't always be
> > set. You will probably want to disable gc-sections for shared libs.
>
> Is that not already the case?
No. Neither info->relocatable nor info->emitrelocations are necessarily
set. You want to add info->shared to the following. Patch OK for
mainline binutils with that change.
> if (!get_elf_backend_data (abfd)->can_gc_sections
> || info->relocatable
> || info->emitrelocations
> || !is_elf_hash_table (info->hash))
> {
> (*_bfd_error_handler)(_("Warning: gc-sections option ignored"));
> return TRUE;
> }
--
Alan Modra
IBM OzLabs - Linux Technology Centre