This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[committed, PATCH] i386/x32: Align .eh_frame section to 4 bytes
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: binutils at sourceware dot org
- Date: Tue, 10 Jan 2017 14:23:00 -0800
- Subject: [committed, PATCH] i386/x32: Align .eh_frame section to 4 bytes
- Authentication-results: sourceware.org; auth=none
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
.eh_frame section covering PLT sections should be aligned to 4 bytes
for i386 and x32.
bfd/
* elf32-i386.c (elf_i386_check_relocs): Align .eh_frame section
to 4 bytes.
* elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Align
.eh_frame section to 4 bytes for x32.
(elf_x86_64_check_relocs): Likewise.
ld/
* testsuite/ld-x86-64/pr20830b.d: Updated.
---
bfd/ChangeLog | 8 ++++++++
bfd/elf32-i386.c | 2 +-
bfd/elf64-x86-64.c | 5 +++--
ld/ChangeLog | 4 ++++
ld/testsuite/ld-x86-64/pr20830b.d | 10 ++--------
5 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index d6d340c..c45022b 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,13 @@
2017-01-10 H.J. Lu <hongjiu.lu@intel.com>
+ * elf32-i386.c (elf_i386_check_relocs): Align .eh_frame section
+ to 4 bytes.
+ * elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Align
+ .eh_frame section to 4 bytes for x32.
+ (elf_x86_64_check_relocs): Likewise.
+
+2017-01-10 H.J. Lu <hongjiu.lu@intel.com>
+
PR ld/20830
* elf32-i386.c (elf_i386_eh_frame_plt_got): New.
(PLT_GOT_FDE_LENGTH): Likewise.
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 982bae6..0860ada 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -2395,7 +2395,7 @@ do_size:
if (htab->plt_got_eh_frame == NULL
|| !bfd_set_section_alignment (htab->elf.dynobj,
htab->plt_got_eh_frame,
- 3))
+ 2))
goto error_return;
}
}
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index b5a949a..1edab04 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -1172,7 +1172,8 @@ elf_x86_64_create_dynamic_sections (bfd *dynobj,
htab->plt_eh_frame
= bfd_make_section_anyway_with_flags (dynobj, ".eh_frame", flags);
if (htab->plt_eh_frame == NULL
- || !bfd_set_section_alignment (dynobj, htab->plt_eh_frame, 3))
+ || !bfd_set_section_alignment (dynobj, htab->plt_eh_frame,
+ ABI_64_P (dynobj) ? 3 : 2))
return FALSE;
}
@@ -2796,7 +2797,7 @@ do_size:
if (htab->plt_got_eh_frame == NULL
|| !bfd_set_section_alignment (htab->elf.dynobj,
htab->plt_got_eh_frame,
- 3))
+ ABI_64_P (htab->elf.dynobj) ? 3 : 2))
goto error_return;
}
}
diff --git a/ld/ChangeLog b/ld/ChangeLog
index d931ea1..96158cd 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,9 @@
2017-01-10 H.J. Lu <hongjiu.lu@intel.com>
+ * testsuite/ld-x86-64/pr20830b.d: Updated.
+
+2017-01-10 H.J. Lu <hongjiu.lu@intel.com>
+
* emulparams/elf32_x86_64.sh (TINY_READONLY_SECTION): New.
* testsuite/ld-x86-64/pr20830.d: Renamed to ...
* testsuite/ld-x86-64/pr20830a.d: This. Updated.
diff --git a/ld/testsuite/ld-x86-64/pr20830b.d b/ld/testsuite/ld-x86-64/pr20830b.d
index 5bd5b8e..218a56e 100644
--- a/ld/testsuite/ld-x86-64/pr20830b.d
+++ b/ld/testsuite/ld-x86-64/pr20830b.d
@@ -26,20 +26,14 @@ Contents of the .eh_frame section:
DW_CFA_nop
DW_CFA_nop
-0+2c ZERO terminator
-
-
-0+30 0000000000000020 00000034 FDE cie=00000000 pc=0000000000000170..0000000000000180
+0+2c 0000000000000020 00000030 FDE cie=00000000 pc=0000000000000170..0000000000000180
DW_CFA_def_cfa_offset: 16
DW_CFA_advance_loc: 6 to 0000000000000176
DW_CFA_def_cfa_offset: 24
DW_CFA_advance_loc: 10 to 0000000000000180
DW_CFA_def_cfa_expression \(DW_OP_breg7 \(rsp\): 8; DW_OP_breg16 \(rip\): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit11; DW_OP_ge; DW_OP_lit3; DW_OP_shl; DW_OP_plus\)
-0+54 ZERO terminator
-
-
-0+58 0000000000000010 0000005c FDE cie=00000000 pc=0000000000000180..0000000000000188
+0+50 0000000000000010 00000054 FDE cie=00000000 pc=0000000000000180..0000000000000188
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
--
2.7.4