]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[bfd] Provide 8-byte minimum alignment for .plt section
authorJohn David Anglin <danglin@gcc.gnu.org>
Sun, 20 Oct 2019 16:28:35 +0000 (12:28 -0400)
committerJohn David Anglin <danglin@gcc.gnu.org>
Sun, 20 Oct 2019 16:28:35 +0000 (12:28 -0400)
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.

bfd/ChangeLog
bfd/elf32-hppa.c

index 2aa9958526578b3002f2bc799f655a2d607891c6..86ce07a1c17abe9cd3a18e427aee1867217ce306 100644 (file)
@@ -1,5 +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.
+
        * elf32-hppa.c: Revise import stub sequences.
        (LONG_BRANCH_STUB_SIZE): Define.
        (LONG_BRANCH_SHARED_STUB_SIZE): Define.
index 49f0ca6cc028d018b395c28779970e4fffd7d9ec..cd99584f273a8bd94ab1b64db3188828c6d781c1 100644 (file)
@@ -2280,10 +2280,11 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
                 against the .got section.  */
              int gotalign = bfd_section_alignment (dynobj, htab->etab.sgot);
              int pltalign = bfd_section_alignment (dynobj, sec);
+             int align = gotalign > 3 ? gotalign : 3;
              bfd_size_type mask;
 
-             if (gotalign > pltalign)
-               (void) bfd_set_section_alignment (dynobj, sec, gotalign);
+             if (align > pltalign)
+               (void) bfd_set_section_alignment (dynobj, sec, align);
              mask = ((bfd_size_type) 1 << gotalign) - 1;
              sec->size = (sec->size + sizeof (plt_stub) + mask) & ~mask;
            }