aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorJohn David Anglin <danglin@gcc.gnu.org>2019-10-20 12:01:58 -0400
committerJohn David Anglin <danglin@gcc.gnu.org>2019-10-20 12:01:58 -0400
commit2c9e9550caf28bceb6b8540520f7378e1b1bb9c2 (patch)
tree910c06603154c5eeda877d24092c4a5871b6e0bc /bfd
parent80051c7439399c861b52af0546ad67367f7184e4 (diff)
downloadgdb-2c9e9550caf28bceb6b8540520f7378e1b1bb9c2.zip
gdb-2c9e9550caf28bceb6b8540520f7378e1b1bb9c2.tar.gz
gdb-2c9e9550caf28bceb6b8540520f7378e1b1bb9c2.tar.bz2
[bfd] Provide 8-byte minimum alignment for .plt section
This change increases the default alignment for the .plt section from 4 bytes to 8 bytes. When function descriptors are 8-byte aligned, they can be updated atomically on 32-bit hppa. This helps with ordering issues on SMP machines. It also ensures that descriptors reside on the same cache line. This reduces the probability of a double TLB miss in a call. 2019-10-20 John David Anglin <danglin@gcc.gnu.org> * elf32-hppa.c (elf32_hppa_size_dynamic_sections): Provide 8-byte minimum alignment for .plt section.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf32-hppa.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 44790fb..429e423 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2019-10-20 John David Anglin <danglin@gcc.gnu.org>
+
+ * elf32-hppa.c (elf32_hppa_size_dynamic_sections): Provide 8-byte
+ minimum alignment for .plt section.
+
2019-10-19 John David Anglin <danglin@gcc.gnu.org>
* elf32-hppa.c: Revise import stub sequences.
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index 8a19c19..35564dd 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -2280,10 +2280,11 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
against the .got section. */
int gotalign = bfd_section_alignment (htab->etab.sgot);
int pltalign = bfd_section_alignment (sec);
+ int align = gotalign > 3 ? gotalign : 3;
bfd_size_type mask;
- if (gotalign > pltalign)
- bfd_set_section_alignment (sec, gotalign);
+ if (align > pltalign)
+ bfd_set_section_alignment (sec, align);
mask = ((bfd_size_type) 1 << gotalign) - 1;
sec->size = (sec->size + sizeof (plt_stub) + mask) & ~mask;
}