This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [gold][patch] Add option to strip LTO sections from output
- From: Ian Lance Taylor <iant at google dot com>
- To: Cary Coutant <ccoutant at google dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Thu, 04 Dec 2008 21:31:43 -0800
- Subject: Re: [gold][patch] Add option to strip LTO sections from output
- References: <c17be2b30812041430s5f69a390w601a396aeeff0adb@mail.gmail.com>
Cary Coutant <ccoutant@google.com> writes:
> This patch adds a --strip-lto-sections option to gold, which tells it
> to ignore any PROGBITS section where SHF_ALLOC is not set and whose
> name begins with ".gnu.lto_".
>
> It may be worth making this the default behavior.
I agree that it seems simpler to make this the default behaviour.
Does anybody see a problem with that?
Really we should modify gas to always recognize 'e' as a section flag
setting SHF_EXCLUDE, and modify ld and gold to always recognize
SHF_EXCLUDE. That flag seems generically useful, and given its use by
several targets it seems quite unlikely that it will ever get another
meaning for generic ELF.
> + // Ignore LTO sections containing intermediate code if requested.
> + if (parameters->options().strip_lto_sections()
> + && shdr.get_sh_type() == elfcpp::SHT_PROGBITS
> + && (shdr.get_sh_flags() & elfcpp::SHF_ALLOC) == 0)
> + {
> + const char* const lto_prefix = ".gnu.lto_";
> + if (strncmp(name, lto_prefix, strlen(lto_prefix)) == 0)
> + omit[i] = true;
> + }
Please do this in Layout::include_section instead, like
--strip-debug-gdb, etc.
Ian