PATCH: Mark .gnu.lto_main/ .gnu.lto_ sections with SHF_EXCLUDE
H.J. Lu
hjl.tools@gmail.com
Sat Dec 11 00:02:00 GMT 2010
On Fri, Dec 10, 2010 at 3:07 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> Hi,
>
> This patch marks .gnu.lto_main/ .gnu.lto_ sections with SHF_EXCLUDE.
> OK to install?
>
> Thanks.
>
>
> H.J.
> --
> bfd/
>
> 2010-12-10 H.J. Lu <hongjiu.lu@intel.com>
>
> * elf.c (special_sections_g): Add .gnu.lto_main and .gnu.lto_.
>
> gas/testsuite/
>
> 2010-12-10 H.J. Lu <hongjiu.lu@intel.com>
>
> * gas/elf/elf.exp: Run section9.
>
> * gas/elf/section9.d: New.
> * gas/elf/section9.s: Likewise.
>
It turns out gcc uses `_' as separator. for LTO section names.
This updated patch allows `_' as separator.. OK to install?
Thanks.
--
H.J.
-
bfd/
2010-12-10 H.J. Lu <hongjiu.lu@intel.com>
* elf.c (special_sections_g): Add ".gnu.lto".
(_bfd_elf_get_special_section): Allow `_' as separator.
gas/testsuite/
2010-12-10 H.J. Lu <hongjiu.lu@intel.com>
* gas/elf/elf.exp: Run section9.
* gas/elf/section9.d: New.
* gas/elf/section9.s: Likewise.
-------------- next part --------------
bfd/
2010-12-10 H.J. Lu <hongjiu.lu@intel.com>
* elf.c (special_sections_g): Add ".gnu.lto".
(_bfd_elf_get_special_section): Allow `_' as separator.
gas/testsuite/
2010-12-10 H.J. Lu <hongjiu.lu@intel.com>
* gas/elf/elf.exp: Run section9.
* gas/elf/section9.d: New.
* gas/elf/section9.s: Likewise.
diff --git a/bfd/elf.c b/bfd/elf.c
index 1fa659e..2e38029 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -2082,6 +2082,7 @@ static const struct bfd_elf_special_section special_sections_f[] =
static const struct bfd_elf_special_section special_sections_g[] =
{
{ STRING_COMMA_LEN (".gnu.linkonce.b"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".gnu.lto"), -2, SHT_PROGBITS, SHF_EXCLUDE },
{ STRING_COMMA_LEN (".got"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
{ STRING_COMMA_LEN (".gnu.version"), 0, SHT_GNU_versym, 0 },
{ STRING_COMMA_LEN (".gnu.version_d"), 0, SHT_GNU_verdef, 0 },
@@ -2221,6 +2222,7 @@ _bfd_elf_get_special_section (const char *name,
if (suffix_len == 0)
continue;
if (name[prefix_len] != '.'
+ && name[prefix_len] != '_'
&& (suffix_len == -2
|| (rela && spec[i].type == SHT_REL)))
continue;
diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp
index 3babe0b..7f86266 100644
--- a/gas/testsuite/gas/elf/elf.exp
+++ b/gas/testsuite/gas/elf/elf.exp
@@ -174,6 +174,7 @@ if { ([istarget "*-*-*elf*"]
run_dump_test "section6"
run_dump_test "section7"
run_dump_test "section8"
+ run_dump_test "section9"
run_dump_test "dwarf2-1"
run_dump_test "dwarf2-2"
run_dump_test "dwarf2-3"
diff --git a/gas/testsuite/gas/elf/section9.d b/gas/testsuite/gas/elf/section9.d
new file mode 100644
index 0000000..c1df902
--- /dev/null
+++ b/gas/testsuite/gas/elf/section9.d
@@ -0,0 +1,7 @@
+#readelf: -S --wide
+#name: section flags
+
+#...
+[ ]*\[.*\][ ]+\.gnu\.lto_main[ ]+PROGBITS.*[ ]+E[ ]+.*
+[ ]*\[.*\][ ]+\.gnu\.lto_.pureconst[ ]+PROGBITS.*[ ]+E[ ]+.*
+#pass
diff --git a/gas/testsuite/gas/elf/section9.s b/gas/testsuite/gas/elf/section9.s
new file mode 100644
index 0000000..6b8b107
--- /dev/null
+++ b/gas/testsuite/gas/elf/section9.s
@@ -0,0 +1,4 @@
+ .section .gnu.lto_main,"",%progbits
+ .byte 0,0,0,0
+ .section .gnu.lto_.pureconst,"",%progbits
+ .byte 0,0,0,0
More information about the Binutils
mailing list