aboutsummaryrefslogtreecommitdiff
path: root/gold/layout.cc
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2008-12-05 21:13:35 +0000
committerCary Coutant <ccoutant@google.com>2008-12-05 21:13:35 +0000
commitfd06b4aa51e5e4b322f4784e3ea248e25aab733a (patch)
treea7ba84deb25f1e34d89df746d8728a0396dec609 /gold/layout.cc
parent116e096528b54672ab60a35e88312ca57200232c (diff)
downloadfsf-binutils-gdb-fd06b4aa51e5e4b322f4784e3ea248e25aab733a.zip
fsf-binutils-gdb-fd06b4aa51e5e4b322f4784e3ea248e25aab733a.tar.gz
fsf-binutils-gdb-fd06b4aa51e5e4b322f4784e3ea248e25aab733a.tar.bz2
* layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
Handle --strip-lto-sections option. * options.h (strip_lto_sections): New option.
Diffstat (limited to 'gold/layout.cc')
-rw-r--r--gold/layout.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/gold/layout.cc b/gold/layout.cc
index ec9654e..2097b6d 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -206,6 +206,9 @@ bool
Layout::include_section(Sized_relobj<size, big_endian>*, const char* name,
const elfcpp::Shdr<size, big_endian>& shdr)
{
+ if (shdr.get_sh_flags() & elfcpp::SHF_EXCLUDE)
+ return false;
+
switch (shdr.get_sh_type())
{
case elfcpp::SHT_NULL:
@@ -256,6 +259,14 @@ Layout::include_section(Sized_relobj<size, big_endian>*, const char* name,
&& !is_gdb_debug_section(name))
return false;
}
+ if (parameters->options().strip_lto_sections()
+ && !parameters->options().relocatable()
+ && (shdr.get_sh_flags() & elfcpp::SHF_ALLOC) == 0)
+ {
+ // Ignore LTO sections containing intermediate code.
+ if (is_prefix_of(".gnu.lto_", name))
+ return false;
+ }
return true;
default: