Dynamic TLS section symbols

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Dynamic TLS section symbols

Alan Modra-3
It is possible to create shared libraries on PowerPC using
-ftls-model=inital-exec or -ftls-model=local-exec.  The first is half
reasonable, getting you a shared library that can't be dlopen'd but
otherwise is reasonable.  The second is quite bad.  Not only do you
lose being able to dlopen, the library also has dynamic text
relocations.  Worse, the TPREL16_LO, TPREL16_HA and other TPREL16
dynamic relocs emitted were wrong, resulting in wrong values being
applied by ld.so.

Using the first TLS section symbol in dynamic relocations for local
TLS symbols doesn't work.  It's wrong because TLS symbols used by TLS
relocs have values relative to the TLS segment, whereas the TLS
section symbols are addresses.  This patch instead uses a symbol index
of zero which is used elsewhere by PowerPC on dynamic TLS relocs.
It's not strictly ABI compliant to use a non-TLS symbol with TLS
relocs but symbol index zero can be interpreted as "no symbol".  Not
using the first TLS section symbol means it doesn't need to be dynamic.

The patch also fixes a further problem with PowerPC32 dynamic TPREL16*
relocs, which shouldn't have the symbol value in the addend as we do
for non-TLS symbols.

bfd/
        * elflink.c (_bfd_elf_omit_section_dynsym_default): Don't keep
        tls_sec.
        (_bfd_elf_init_1_index_section): Prefer not using TLS sections.
        (_bfd_elf_init_2_index_sections): Likewise.
        * elf64-ppc.c (ppc64_elf_relocate_section): When emitting dynamic
        relocations for local TLS symbols, use STN_UNDEF as the relocation
        symbol.
        * elf32-ppc.c (ppc_elf_relocate_section): Likewise, and don't
        leave TLS symbol value in the addend.
ld/
        * testsuite/ld-powerpc/tlsso.r: Update.
        * testsuite/ld-powerpc/tlsso32.g: Update.
        * testsuite/ld-powerpc/tlsso32.r: Update.
        * testsuite/ld-powerpc/tlstocso.r: Update.
        * testsuite/ld-cris/tls-dso-dtpoffd2.d: Update.
        * testsuite/ld-cris/tls-dso-dtpoffd4.d: Update.
        * testsuite/ld-cris/tls-dso-tpoffgotcomm1.d: Update.
        * testsuite/ld-cris/tls-gd-1.d: Update.
        * testsuite/ld-cris/tls-gd-1h.d: Update.
        * testsuite/ld-cris/tls-gd-2.d: Update.
        * testsuite/ld-cris/tls-gd-2h.d: Update.
        * testsuite/ld-cris/tls-ie-10.d: Update.
        * testsuite/ld-cris/tls-ie-11.d: Update.
        * testsuite/ld-cris/tls-ie-8.d: Update.
        * testsuite/ld-cris/tls-ie-9.d: Update.
        * testsuite/ld-cris/tls-js1.d: Update.
        * testsuite/ld-cris/tls-ld-4.d: Update.
        * testsuite/ld-cris/tls-ld-5.d: Update.
        * testsuite/ld-cris/tls-ld-6.d: Update.
        * testsuite/ld-cris/tls-ld-7.d: Update.
        * testsuite/ld-cris/tls-ldgd-14.d: Update.
        * testsuite/ld-cris/tls-ldgd-15.d: Update.
        * testsuite/ld-cris/tls-ldgdx-14.d: Update.
        * testsuite/ld-cris/tls-ldgdx-15.d: Update.
        * testsuite/ld-cris/tls-local-54.d: Update.
        * testsuite/ld-cris/tls-local-60.d: Update.
        * testsuite/ld-cris/tls-local-61.d: Update.
        * testsuite/ld-cris/tls-local-63.d: Update.
        * testsuite/ld-cris/tls-local-64.d: Update.
        * testsuite/ld-cris/tls-ok-30.d: Update.
        * testsuite/ld-cris/tls-ok-32.d: Update.
        * testsuite/ld-cris/tls-ok-34.d: Update.
        * testsuite/ld-mips-elf/tls-multi-got-1.got: Update.
        * testsuite/ld-mips-elf/tls-multi-got-1.r: Update.
        * testsuite/ld-mips-elf/tlsdyn-pie-o32.d: Update.
        * testsuite/ld-mips-elf/tlsdyn-pie-o32.got: Update.
        * testsuite/ld-mips-elf/tlslib-o32-hidden.got: Update.
        * testsuite/ld-mips-elf/tlslib-o32-ver.got: Update.
        * testsuite/ld-mips-elf/tlslib-o32.got: Update.
        * testsuite/ld-s390/tlspic.rd: Update.
        * testsuite/ld-s390/tlspic_64.rd: Update.
        * testsuite/ld-sparc/tlssunnopic32.rd: Update.
        * testsuite/ld-sparc/tlssunnopic64.rd: Update.
        * testsuite/ld-sparc/tlssunpic32.rd: Update.
        * testsuite/ld-sparc/tlssunpic64.rd: Update.

diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index ae03d72241..33ab4e0d68 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -8209,19 +8209,27 @@ ppc_elf_relocate_section (bfd *output_bfd,
      but ld.so expects buggy relocs.
      FIXME: Why not always use a zero index?  */
   osec = sec->output_section;
-  indx = elf_section_data (osec)->dynindx;
-  if (indx == 0)
+  if ((osec->flags & SEC_THREAD_LOCAL) != 0)
+    {
+      osec = htab->elf.tls_sec;
+      indx = 0;
+    }
+  else
     {
-      osec = htab->elf.text_index_section;
       indx = elf_section_data (osec)->dynindx;
+      if (indx == 0)
+ {
+  osec = htab->elf.text_index_section;
+  indx = elf_section_data (osec)->dynindx;
+ }
+      BFD_ASSERT (indx != 0);
     }
-  BFD_ASSERT (indx != 0);
-#ifdef DEBUG
-  if (indx == 0)
-    printf ("indx=%ld section=%s flags=%08x name=%s\n",
-    indx, osec->name, osec->flags,
-    h->root.root.string);
-#endif
+
+  /* ld.so doesn't expect buggy TLS relocs.
+     Don't leave the symbol value in the
+     addend for them.  */
+  if (IS_PPC_TLS_RELOC (r_type))
+    outrel.r_addend -= osec->vma;
  }
 
       outrel.r_info = ELF32_R_INFO (indx, r_type);
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index c5c18d0823..d77cfdf9d2 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -15891,21 +15891,38 @@ ppc64_elf_relocate_section (bfd *output_bfd,
  }
       else
  {
-  asection *osec;
+  asection *osec = sec->output_section;
 
-  osec = sec->output_section;
-  indx = elf_section_data (osec)->dynindx;
-
-  if (indx == 0)
+  if ((osec->flags & SEC_THREAD_LOCAL) != 0)
+    {
+      /* TLS symbol values are relative to the
+ TLS segment.  Dynamic relocations for
+ local TLS symbols therefore can't be
+ reduced to a relocation against their
+ section symbol because it holds the
+ address of the section, not a value
+ relative to the TLS segment.  We could
+ change the .tdata dynamic section symbol
+ to be zero value but STN_UNDEF works
+ and is used elsewhere, eg. for TPREL64
+ GOT relocs against local TLS symbols.  */
+      osec = htab->elf.tls_sec;
+      indx = 0;
+    }
+  else
     {
-      if ((osec->flags & SEC_READONLY) == 0
-  && htab->elf.data_index_section != NULL)
- osec = htab->elf.data_index_section;
-      else
- osec = htab->elf.text_index_section;
       indx = elf_section_data (osec)->dynindx;
+      if (indx == 0)
+ {
+  if ((osec->flags & SEC_READONLY) == 0
+      && htab->elf.data_index_section != NULL)
+    osec = htab->elf.data_index_section;
+  else
+    osec = htab->elf.text_index_section;
+  indx = elf_section_data (osec)->dynindx;
+ }
+      BFD_ASSERT (indx != 0);
     }
-  BFD_ASSERT (indx != 0);
 
   /* We are turning this relocation into one
      against a section symbol, so subtract out
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 02ea2dc3e1..d146a4b285 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -900,9 +900,6 @@ _bfd_elf_omit_section_dynsym_default (bfd *output_bfd ATTRIBUTE_UNUSED,
  SHT_PROGBITS/SHT_NOBITS.  */
     case SHT_NULL:
       htab = elf_hash_table (info);
-      if (p == htab->tls_sec)
- return FALSE;
-
       if (htab->text_index_section != NULL)
  return p != htab->text_index_section && p != htab->data_index_section;
 
@@ -7052,14 +7049,17 @@ void
 _bfd_elf_init_1_index_section (bfd *output_bfd, struct bfd_link_info *info)
 {
   asection *s;
+  asection *found = NULL;
 
   for (s = output_bfd->sections; s != NULL; s = s->next)
     if ((s->flags & (SEC_EXCLUDE | SEC_ALLOC)) == SEC_ALLOC
  && !_bfd_elf_omit_section_dynsym_default (output_bfd, info, s))
       {
- elf_hash_table (info)->text_index_section = s;
- break;
+ found = s;
+ if ((s->flags & SEC_THREAD_LOCAL) == 0)
+  break;
       }
+  elf_hash_table (info)->text_index_section = found;
 }
 
 /* Find two non-excluded output sections, one for code, one for data.
@@ -7068,29 +7068,30 @@ void
 _bfd_elf_init_2_index_sections (bfd *output_bfd, struct bfd_link_info *info)
 {
   asection *s;
+  asection *found = NULL;
 
   /* Data first, since setting text_index_section changes
      _bfd_elf_omit_section_dynsym_default.  */
   for (s = output_bfd->sections; s != NULL; s = s->next)
-    if (((s->flags & (SEC_EXCLUDE | SEC_ALLOC | SEC_READONLY)) == SEC_ALLOC)
+    if ((s->flags & (SEC_EXCLUDE | SEC_ALLOC)) == SEC_ALLOC
+ && !(s->flags & SEC_READONLY)
  && !_bfd_elf_omit_section_dynsym_default (output_bfd, info, s))
       {
- elf_hash_table (info)->data_index_section = s;
- break;
+ found = s;
+ if ((s->flags & SEC_THREAD_LOCAL) == 0)
+  break;
       }
+  elf_hash_table (info)->data_index_section = found;
 
   for (s = output_bfd->sections; s != NULL; s = s->next)
-    if (((s->flags & (SEC_EXCLUDE | SEC_ALLOC | SEC_READONLY))
- == (SEC_ALLOC | SEC_READONLY))
+    if ((s->flags & (SEC_EXCLUDE | SEC_ALLOC)) == SEC_ALLOC
+ && (s->flags & SEC_READONLY)
  && !_bfd_elf_omit_section_dynsym_default (output_bfd, info, s))
       {
- elf_hash_table (info)->text_index_section = s;
+ found = s;
  break;
       }
-
-  if (elf_hash_table (info)->text_index_section == NULL)
-    elf_hash_table (info)->text_index_section
-      = elf_hash_table (info)->data_index_section;
+  elf_hash_table (info)->text_index_section = found;
 }
 
 bfd_boolean
diff --git a/ld/testsuite/ld-cris/tls-dso-dtpoffd2.d b/ld/testsuite/ld-cris/tls-dso-dtpoffd2.d
index 12fe7f812e..46ad8ab952 100644
--- a/ld/testsuite/ld-cris/tls-dso-dtpoffd2.d
+++ b/ld/testsuite/ld-cris/tls-dso-dtpoffd2.d
@@ -23,13 +23,13 @@ SYMBOL TABLE:
 0+80 g       .tdata 0+4 x
 #...
 Contents of section .rela.dyn:
- 0154 68220000 17030000 00000000           .*
+ 0140 54220000 17020000 00000000           .*
 Contents of section .text:
- 0160 41b20000 5fae0c00                    .*
+ 014c 41b20000 5fae0c00                    .*
 #...
 Contents of section .got:
- 225c ec210000 00000000 00000000 00000000  .*
- 226c 00000000                             .*
+ 2248 d8210000 00000000 00000000 00000000  .*
+ 2258 00000000                             .*
 Contents of section .debug_info:
  0000 80000000                             .*
 #...
diff --git a/ld/testsuite/ld-cris/tls-dso-dtpoffd4.d b/ld/testsuite/ld-cris/tls-dso-dtpoffd4.d
index bb72e87430..a8f1305195 100644
--- a/ld/testsuite/ld-cris/tls-dso-dtpoffd4.d
+++ b/ld/testsuite/ld-cris/tls-dso-dtpoffd4.d
@@ -23,13 +23,13 @@ SYMBOL TABLE:
 0+80 g       .tbss 0+4 x
 #...
 Contents of section .rela.dyn:
- 0154 64220000 17030000 00000000           .*
+ 0140 50220000 17020000 00000000           .*
 Contents of section .text:
- 0160 41b20000 5fae0c00                    .*
+ 014c 41b20000 5fae0c00                    .*
 #...
 Contents of section .got:
- 2258 e8210000 00000000 00000000 00000000  .*
- 2268 00000000                             .*
+ 2244 d4210000 00000000 00000000 00000000  .*
+ 2254 00000000                             .*
 Contents of section .debug_info:
  0000 80000000                             .*
 #...
diff --git a/ld/testsuite/ld-cris/tls-dso-tpoffgotcomm1.d b/ld/testsuite/ld-cris/tls-dso-tpoffgotcomm1.d
index 4aa2794e4d..a5911131bb 100644
--- a/ld/testsuite/ld-cris/tls-dso-tpoffgotcomm1.d
+++ b/ld/testsuite/ld-cris/tls-dso-tpoffgotcomm1.d
@@ -11,7 +11,7 @@
 
 Program Header:
     LOAD off    0x0+ vaddr 0x0+ paddr 0x0+ align 2\*\*13
-         filesz 0x0+178 memsz 0x0+178 flags r-x
+         filesz 0x0+164 memsz 0x0+164 flags r-x
     LOAD off .*
          filesz .*
  DYNAMIC off .*
@@ -21,7 +21,7 @@ Program Header:
 #...
 Sections:
 #...
-  7 .got          0+14  0+21f0  0+21f0  0+1f0  2\*\*2
+  7 .got          0+14  0+21dc  0+21dc  0+1dc  2\*\*2
                   CONTENTS, ALLOC, LOAD, DATA
 SYMBOL TABLE:
 #...
@@ -31,16 +31,16 @@ SYMBOL TABLE:
 
 #...
 Contents of section .got:
- 21f0 78210000 00000000 00000000 00000000  .*
- 2200 00000000                             .*
+ 21dc 64210000 00000000 00000000 00000000  .*
+ 21ec 00000000                             .*
 
 Disassembly of section \.text:
 
-0+168 <_start>:
- 168: 41b2                 moveq 1,\$r11
+0+154 <_start>:
+.*: 41b2                 moveq 1,\$r11
  \.\.\.
 
-0+16c <do_test>:
- 16c: 2f0e 0c00 0000       add\.d c <bar\+0x8>,\$r0
- 172: 1f1e 1000           add\.w 0x10,\$r1
+0+158 <do_test>:
+.*: 2f0e 0c00 0000       add\.d c <bar\+0x8>,\$r0
+.*: 1f1e 1000           add\.w 0x10,\$r1
  \.\.\.
diff --git a/ld/testsuite/ld-cris/tls-gd-1.d b/ld/testsuite/ld-cris/tls-gd-1.d
index 30ab7efdb8..4fbd79cedc 100644
--- a/ld/testsuite/ld-cris/tls-gd-1.d
+++ b/ld/testsuite/ld-cris/tls-gd-1.d
@@ -12,21 +12,21 @@
 
 Program Header:
     LOAD off    0x0+ vaddr 0x0+ paddr 0x0+ align 2\*\*13
-         filesz 0x0+144 memsz 0x0+144 flags r-x
-    LOAD off    0x0+144 vaddr 0x0+2144 paddr 0x0+2144 align 2\*\*13
+         filesz 0x0+130 memsz 0x0+130 flags r-x
+    LOAD off    0x0+130 vaddr 0x0+2130 paddr 0x0+2130 align 2\*\*13
          filesz 0x0+108 memsz 0x0+108 flags rw-
- DYNAMIC off    0x0+1c8 vaddr 0x0+21c8 paddr 0x0+21c8 align 2\*\*2
+ DYNAMIC off    0x0+1b4 vaddr 0x0+21b4 paddr 0x0+21b4 align 2\*\*2
          filesz 0x0+70 memsz 0x0+70 flags rw-
-     TLS off    0x0+144 vaddr 0x0+2144 paddr 0x0+2144 align 2\*\*2
+     TLS off    0x0+130 vaddr 0x0+2130 paddr 0x0+2130 align 2\*\*2
          filesz 0x0+84 memsz 0x0+84 flags r--
 
 Dynamic Section:
   HASH                 0x0+b4
-  STRTAB               0x0+124
-  SYMTAB               0x0+d4
+  STRTAB               0x0+110
+  SYMTAB               0x0+d0
   STRSZ                0x0+d
   SYMENT               0x0+10
-  RELA                 0x0+134
+  RELA                 0x0+120
   RELASZ               0x0+c
   RELAENT              0x0+c
 private flags = 0:
@@ -42,13 +42,13 @@ DYNAMIC SYMBOL TABLE:
 
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE
-0+2244 R_CRIS_DTP        x
+0+2230 R_CRIS_DTP        x
 
 Contents of section \.hash:
 #...
 Contents of section \.text:
- 0140 5fae0c00                             .*
+ 012c 5fae0c00                             .*
 #...
 Contents of section \.got:
- 2238 c8210+ 0+ 0+ 0+  .*
- 2248 0+                             .*
+ 2224 b4210+ 0+ 0+ 0+  .*
+ 2234 0+                             .*
diff --git a/ld/testsuite/ld-cris/tls-gd-1h.d b/ld/testsuite/ld-cris/tls-gd-1h.d
index b323312f30..b95cc2bd96 100644
--- a/ld/testsuite/ld-cris/tls-gd-1h.d
+++ b/ld/testsuite/ld-cris/tls-gd-1h.d
@@ -12,21 +12,21 @@
 
 Program Header:
     LOAD off    0x0+ vaddr 0x0+ paddr 0x0+ align 2\*\*13
-         filesz 0x0+148 memsz 0x0+148 flags r-x
-    LOAD off    0x0+148 vaddr 0x0+2148 paddr 0x0+2148 align 2\*\*13
+         filesz 0x0+134 memsz 0x0+134 flags r-x
+    LOAD off    0x0+134 vaddr 0x0+2134 paddr 0x0+2134 align 2\*\*13
          filesz 0x0+108 memsz 0x0+108 flags rw-
- DYNAMIC off    0x0+1cc vaddr 0x0+21cc paddr 0x0+21cc align 2\*\*2
+ DYNAMIC off    0x0+1b8 vaddr 0x0+21b8 paddr 0x0+21b8 align 2\*\*2
          filesz 0x0+70 memsz 0x0+70 flags rw-
-     TLS off    0x0+148 vaddr 0x0+2148 paddr 0x0+2148 align 2\*\*2
+     TLS off    0x0+134 vaddr 0x0+2134 paddr 0x0+2134 align 2\*\*2
          filesz 0x0+84 memsz 0x0+84 flags r--
 
 Dynamic Section:
   HASH                 0x0+b4
-  STRTAB               0x0+124
-  SYMTAB               0x0+d4
+  STRTAB               0x0+110
+  SYMTAB               0x0+d0
   STRSZ                0x0+12
   SYMENT               0x0+10
-  RELA                 0x0+138
+  RELA                 0x0+124
   RELASZ               0x0+c
   RELAENT              0x0+c
 private flags = 0:
@@ -38,13 +38,13 @@ SYMBOL TABLE:
 
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE
-0+2248 R_CRIS_DTP        \*ABS\*\+0x0+80
+0+2234 R_CRIS_DTP        \*ABS\*\+0x0+80
 
 Contents of section \.hash:
 #...
 Contents of section \.text:
- 0144 5fae0c00                             .*
+ 0130 5fae0c00                             .*
 #...
 Contents of section \.got:
- 223c cc210+ 0+ 0+ 0+  .*
- 224c 0+                             .*
+ 2228 b8210+ 0+ 0+ 0+  .*
+ 2238 0+                             .*
diff --git a/ld/testsuite/ld-cris/tls-gd-2.d b/ld/testsuite/ld-cris/tls-gd-2.d
index b792eaa5a1..1840a586e7 100644
--- a/ld/testsuite/ld-cris/tls-gd-2.d
+++ b/ld/testsuite/ld-cris/tls-gd-2.d
@@ -12,21 +12,21 @@
 
 Program Header:
     LOAD off    0x0+ vaddr 0x0+ paddr 0x0+ align 2\*\*13
-         filesz 0x0+168 memsz 0x0+168 flags r-x
-    LOAD off    0x0+168 vaddr 0x0+2168 paddr 0x0+2168 align 2\*\*13
+         filesz 0x0+154 memsz 0x0+154 flags r-x
+    LOAD off    0x0+154 vaddr 0x0+2154 paddr 0x0+2154 align 2\*\*13
          filesz 0x0+108 memsz 0x0+108 flags rw-
- DYNAMIC off    0x0+1ec vaddr 0x0+21ec paddr 0x0+21ec align 2\*\*2
+ DYNAMIC off    0x0+1d8 vaddr 0x0+21d8 paddr 0x0+21d8 align 2\*\*2
          filesz 0x0+70 memsz 0x0+70 flags rw-
-     TLS off    0x0+168 vaddr 0x0+2168 paddr 0x0+2168 align 2\*\*2
+     TLS off    0x0+154 vaddr 0x0+2154 paddr 0x0+2154 align 2\*\*2
          filesz 0x0+84 memsz 0x0+84 flags r--
 
 Dynamic Section:
   HASH                 0x0+b4
-  STRTAB               0x0+140
-  SYMTAB               0x0+e0
+  STRTAB               0x0+12c
+  SYMTAB               0x0+dc
   STRSZ                0x0+14
   SYMENT               0x0+10
-  RELA                 0x0+154
+  RELA                 0x0+140
   RELASZ               0x0+c
   RELAENT              0x0+c
 private flags = 0:
@@ -42,13 +42,13 @@ DYNAMIC SYMBOL TABLE:
 
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE
-0+2268 R_CRIS_DTP        x
+0+2254 R_CRIS_DTP        x
 
 Contents of section \.hash:
 #...
 Contents of section \.text:
- 0160 6fae0c00 00000000              .*
+ 014c 6fae0c00 00000000              .*
 #...
 Contents of section \.got:
- 225c ec210+ 0+ 0+ 0+  .*
- 226c 0+                             .*
+ 2248 d8210+ 0+ 0+ 0+  .*
+ 2258 0+                             .*
diff --git a/ld/testsuite/ld-cris/tls-gd-2h.d b/ld/testsuite/ld-cris/tls-gd-2h.d
index 211d830a61..c88144816e 100644
--- a/ld/testsuite/ld-cris/tls-gd-2h.d
+++ b/ld/testsuite/ld-cris/tls-gd-2h.d
@@ -12,21 +12,21 @@
 
 Program Header:
     LOAD off    0x0+ vaddr 0x0+ paddr 0x0+ align 2\*\*13
-         filesz 0x0+14c memsz 0x0+14c flags r-x
-    LOAD off    0x0+14c vaddr 0x0+214c paddr 0x0+214c align 2\*\*13
+         filesz 0x0+138 memsz 0x0+138 flags r-x
+    LOAD off    0x0+138 vaddr 0x0+2138 paddr 0x0+2138 align 2\*\*13
          filesz 0x0+108 memsz 0x0+108 flags rw-
- DYNAMIC off    0x0+1d0 vaddr 0x0+21d0 paddr 0x0+21d0 align 2\*\*2
+ DYNAMIC off    0x0+1bc vaddr 0x0+21bc paddr 0x0+21bc align 2\*\*2
          filesz 0x0+70 memsz 0x0+70 flags rw-
-     TLS off    0x0+14c vaddr 0x0+214c paddr 0x0+214c align 2\*\*2
+     TLS off    0x0+138 vaddr 0x0+2138 paddr 0x0+2138 align 2\*\*2
          filesz 0x0+84 memsz 0x0+84 flags r--
 
 Dynamic Section:
   HASH                 0x0+b4
-  STRTAB               0x0+124
-  SYMTAB               0x0+d4
+  STRTAB               0x0+110
+  SYMTAB               0x0+d0
   STRSZ                0x0+12
   SYMENT               0x0+10
-  RELA                 0x0+138
+  RELA                 0x0+124
   RELASZ               0x0+c
   RELAENT              0x0+c
 private flags = 0:
@@ -38,13 +38,13 @@ SYMBOL TABLE:
 
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE
-0+224c R_CRIS_DTP        \*ABS\*\+0x0+80
+0+2238 R_CRIS_DTP        \*ABS\*\+0x0+80
 
 Contents of section \.hash:
 #...
 Contents of section \.text:
- 0144 6fae0c00 00000000              .*
+ 0130 6fae0c00 00000000              .*
 #...
 Contents of section \.got:
- 2240 d0210+ 0+ 0+ 0+  .*
- 2250 0+                             .*
+ 222c bc210+ 0+ 0+ 0+  .*
+ 223c 0+                             .*
diff --git a/ld/testsuite/ld-cris/tls-ie-10.d b/ld/testsuite/ld-cris/tls-ie-10.d
index 9a27cb6039..432b86470c 100644
--- a/ld/testsuite/ld-cris/tls-ie-10.d
+++ b/ld/testsuite/ld-cris/tls-ie-10.d
@@ -12,21 +12,21 @@
 
 Program Header:
     LOAD off    0x0+ vaddr 0x0+ paddr 0x0+ align 2\*\*13
-         filesz 0x0+16c memsz 0x0+16c flags r-x
-    LOAD off    0x0+16c vaddr 0x0+216c paddr 0x0+216c align 2\*\*13
+         filesz 0x0+158 memsz 0x0+158 flags r-x
+    LOAD off    0x0+158 vaddr 0x0+2158 paddr 0x0+2158 align 2\*\*13
          filesz 0x0+10c memsz 0x0+10c flags rw-
- DYNAMIC off    0x0+1f0 vaddr 0x0+21f0 paddr 0x0+21f0 align 2\*\*2
+ DYNAMIC off    0x0+1dc vaddr 0x0+21dc paddr 0x0+21dc align 2\*\*2
          filesz 0x0+78 memsz 0x0+78 flags rw-
-     TLS off    0x0+16c vaddr 0x0+216c paddr 0x0+216c align 2\*\*2
+     TLS off    0x0+158 vaddr 0x0+2158 paddr 0x0+2158 align 2\*\*2
          filesz 0x0+84 memsz 0x0+84 flags r--
 
 Dynamic Section:
   HASH                 0x0+b4
-  STRTAB               0x0+140
-  SYMTAB               0x0+e0
+  STRTAB               0x0+12c
+  SYMTAB               0x0+dc
   STRSZ                0x0+15
   SYMENT               0x0+10
-  RELA                 0x0+158
+  RELA                 0x0+144
   RELASZ               0x0+c
   RELAENT              0x0+c
   FLAGS                0x0+10
@@ -43,12 +43,12 @@ DYNAMIC SYMBOL TABLE:
 
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE
-0+2274 R_CRIS_32_TPREL   x
+0+2260 R_CRIS_32_TPREL   x
 
 Contents of section \.hash:
 #...
 Contents of section \.text:
- 0164 6fae0c00 00000000                    .*
+ 0150 6fae0c00 00000000                    .*
 #...
 Contents of section \.got:
- 2268 f0210+ 0+ 0+ 0+  .*
+ 2254 dc210+ 0+ 0+ 0+  .*
diff --git a/ld/testsuite/ld-cris/tls-ie-11.d b/ld/testsuite/ld-cris/tls-ie-11.d
index 4264777053..c4ef790957 100644
--- a/ld/testsuite/ld-cris/tls-ie-11.d
+++ b/ld/testsuite/ld-cris/tls-ie-11.d
@@ -12,21 +12,21 @@
 
 Program Header:
     LOAD off    0x0+ vaddr 0x0+ paddr 0x0+ align 2\*\*13
-         filesz 0x0+190 memsz 0x0+190 flags r-x
-    LOAD off    0x0+190 vaddr 0x0+2190 paddr 0x0+2190 align 2\*\*13
+         filesz 0x0+17c memsz 0x0+17c flags r-x
+    LOAD off    0x0+17c vaddr 0x0+217c paddr 0x0+217c align 2\*\*13
          filesz 0x0+114 memsz 0x0+114 flags rw-
- DYNAMIC off    0x0+218 vaddr 0x0+2218 paddr 0x0+2218 align 2\*\*2
+ DYNAMIC off    0x0+204 vaddr 0x0+2204 paddr 0x0+2204 align 2\*\*2
          filesz 0x0+78 memsz 0x0+78 flags rw-
-     TLS off    0x0+190 vaddr 0x0+2190 paddr 0x0+2190 align 2\*\*2
+     TLS off    0x0+17c vaddr 0x0+217c paddr 0x0+217c align 2\*\*2
          filesz 0x0+88 memsz 0x0+88 flags r--
 
 Dynamic Section:
   HASH                 0x0+b4
-  STRTAB               0x0+154
-  SYMTAB               0x0+e4
+  STRTAB               0x0+140
+  SYMTAB               0x0+e0
   STRSZ                0x0+17
   SYMENT               0x0+10
-  RELA                 0x0+16c
+  RELA                 0x0+158
   RELASZ               0x0+18
   RELAENT              0x0+c
   FLAGS                0x0+10
@@ -47,14 +47,14 @@ DYNAMIC SYMBOL TABLE:
 
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE
-0+229c R_CRIS_32_TPREL   x2
-0+22a0 R_CRIS_32_TPREL   x1
+0+2288 R_CRIS_32_TPREL   x2
+0+228c R_CRIS_32_TPREL   x1
 
 Contents of section \.hash:
 #...
 Contents of section \.text:
- 0184 6fae1000 00006fbe 0c000000           .*
+ 0170 6fae1000 00006fbe 0c000000           .*
 #...
 Contents of section \.got:
- 2290 18220+ 0+ 0+ 0+  .*
- 22a0 00000000                             .*
+ 227c 04220+ 0+ 0+ 0+  .*
+ 228c 00000000                             .*
diff --git a/ld/testsuite/ld-cris/tls-ie-8.d b/ld/testsuite/ld-cris/tls-ie-8.d
index f1e6edd5d0..29c46f0845 100644
--- a/ld/testsuite/ld-cris/tls-ie-8.d
+++ b/ld/testsuite/ld-cris/tls-ie-8.d
@@ -12,21 +12,21 @@
 
 Program Header:
     LOAD off    0x0+ vaddr 0x0+ paddr 0x0+ align 2\*\*13
-         filesz 0x0+164 memsz 0x0+164 flags r-x
-    LOAD off    0x0+164 vaddr 0x0+2164 paddr 0x0+2164 align 2\*\*13
+         filesz 0x0+150 memsz 0x0+150 flags r-x
+    LOAD off    0x0+150 vaddr 0x0+2150 paddr 0x0+2150 align 2\*\*13
          filesz 0x0+10c memsz 0x0+10c flags rw-
- DYNAMIC off    0x0+1e8 vaddr 0x0+21e8 paddr 0x0+21e8 align 2\*\*2
+ DYNAMIC off    0x0+1d4 vaddr 0x0+21d4 paddr 0x0+21d4 align 2\*\*2
          filesz 0x0+78 memsz 0x0+78 flags rw-
-     TLS off    0x0+164 vaddr 0x0+2164 paddr 0x0+2164 align 2\*\*2
+     TLS off    0x0+150 vaddr 0x0+2150 paddr 0x0+2150 align 2\*\*2
          filesz 0x0+84 memsz 0x0+84 flags r--
 
 Dynamic Section:
   HASH                 0x0+b4
-  STRTAB               0x0+140
-  SYMTAB               0x0+e0
+  STRTAB               0x0+12c
+  SYMTAB               0x0+dc
   STRSZ                0x0+13
   SYMENT               0x0+10
-  RELA                 0x0+154
+  RELA                 0x0+140
   RELASZ               0x0+c
   RELAENT              0x0+c
   FLAGS                0x0+10
@@ -43,12 +43,12 @@ DYNAMIC SYMBOL TABLE:
 
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE
-0+226c R_CRIS_32_TPREL   x
+0+2258 R_CRIS_32_TPREL   x
 
 Contents of section \.hash:
 #...
 Contents of section \.text:
- 0160 5fae0c00                             .*
+ 014c 5fae0c00                             .*
 #...
 Contents of section \.got:
- 2260 e8210+ 0+ 0+ 0+  .*
+ 224c d4210+ 0+ 0+ 0+  .*
diff --git a/ld/testsuite/ld-cris/tls-ie-9.d b/ld/testsuite/ld-cris/tls-ie-9.d
index 0b55fb5766..0117b93aee 100644
--- a/ld/testsuite/ld-cris/tls-ie-9.d
+++ b/ld/testsuite/ld-cris/tls-ie-9.d
@@ -12,21 +12,21 @@
 
 Program Header:
     LOAD off    0x0+ vaddr 0x0+ paddr 0x0+ align 2\*\*13
-         filesz 0x0+18c memsz 0x0+18c flags r-x
-    LOAD off    0x0+18c vaddr 0x0+218c paddr 0x0+218c align 2\*\*13
+         filesz 0x0+178 memsz 0x0+178 flags r-x
+    LOAD off    0x0+178 vaddr 0x0+2178 paddr 0x0+2178 align 2\*\*13
          filesz 0x0+114 memsz 0x0+114 flags rw-
- DYNAMIC off    0x0+214 vaddr 0x0+2214 paddr 0x0+2214 align 2\*\*2
+ DYNAMIC off    0x0+200 vaddr 0x0+2200 paddr 0x0+2200 align 2\*\*2
          filesz 0x0+78 memsz 0x0+78 flags rw-
-     TLS off    0x0+18c vaddr 0x0+218c paddr 0x0+218c align 2\*\*2
+     TLS off    0x0+178 vaddr 0x0+2178 paddr 0x0+2178 align 2\*\*2
          filesz 0x0+88 memsz 0x0+88 flags r--
 
 Dynamic Section:
   HASH                 0x0+b4
-  STRTAB               0x0+154
-  SYMTAB               0x0+e4
+  STRTAB               0x0+140
+  SYMTAB               0x0+e0
   STRSZ                0x0+18
   SYMENT               0x0+10
-  RELA                 0x0+16c
+  RELA                 0x0+158
   RELASZ               0x0+18
   RELAENT              0x0+c
   FLAGS                0x0+10
@@ -47,14 +47,14 @@ DYNAMIC SYMBOL TABLE:
 
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE
-0+2298 R_CRIS_32_TPREL   x2
-0+229c R_CRIS_32_TPREL   x1
+0+2284 R_CRIS_32_TPREL   x2
+0+2288 R_CRIS_32_TPREL   x1
 
 Contents of section \.hash:
 #...
 Contents of section \.text:
- 0184 5fae1000 5fbe0c00                    .*
+ 0170 5fae1000 5fbe0c00                    .*
 #...
 Contents of section \.got:
- 228c 14220+ 0+ 0+ 0+  .*
- 229c 00000000                             .*
+ 2278 00220+ 0+ 0+ 0+  .*
+ 2288 00000000                             .*
diff --git a/ld/testsuite/ld-cris/tls-js1.d b/ld/testsuite/ld-cris/tls-js1.d
index e6b49fa072..f007ea4cf5 100644
--- a/ld/testsuite/ld-cris/tls-js1.d
+++ b/ld/testsuite/ld-cris/tls-js1.d
@@ -16,17 +16,17 @@
 # Making sure .rela.plt has the right contents; no R_CRIS_NONE entries.
 
 #...
-  .* .got[ ]+PROGBITS[ ]+0+22f8 0+2f8 0+20 04  WA  0   0  4
+  .* .got[ ]+PROGBITS[ ]+0+22e4 0+2e4 0+20 04  WA  0   0  4
 #...
-Relocation section '\.rela\.dyn' at offset 0x1bc contains 2 entries:
+Relocation section '\.rela\.dyn' at offset .* contains 2 entries:
  Offset     Info    Type            Sym\.Value  Sym\. Name \+ Addend
-00002304  0000001e R_CRIS_DTPMOD +0
-00002314  0000050a R_CRIS_GLOB_DAT   00002318   expobj \+ 0
+000022f0  0000001e R_CRIS_DTPMOD +0
+00002300  0000040a R_CRIS_GLOB_DAT   00002304   expobj \+ 0
 
-Relocation section '\.rela\.plt' at offset 0x1d4 contains 2 entries:
+Relocation section '\.rela\.plt' at offset .* contains 2 entries:
  Offset     Info    Type            Sym\.Value  Sym\. Name \+ Addend
-0000230c  0000030b R_CRIS_JUMP_SLOT  00000246   dsofn4 \+ 0
-00002310  0000090b R_CRIS_JUMP_SLOT  0000025e   dsofn \+ 0
+000022f8  0000020b R_CRIS_JUMP_SLOT  00000232   dsofn4 \+ 0
+000022fc  0000080b R_CRIS_JUMP_SLOT  0000024a   dsofn \+ 0
 
 The decoding of unwind sections for machine type Axis Communications 32-bit embedded processor is not currently supported.
 #pass
diff --git a/ld/testsuite/ld-cris/tls-ld-4.d b/ld/testsuite/ld-cris/tls-ld-4.d
index 54d51d8f6f..a396a58efd 100644
--- a/ld/testsuite/ld-cris/tls-ld-4.d
+++ b/ld/testsuite/ld-cris/tls-ld-4.d
@@ -12,21 +12,21 @@
 
 Program Header:
     LOAD off    0x0+ vaddr 0x0+ paddr 0x0+ align 2\*\*13
-         filesz 0x0+148 memsz 0x0+148 flags r-x
-    LOAD off    0x0+148 vaddr 0x0+2148 paddr 0x0+2148 align 2\*\*13
+         filesz 0x0+134 memsz 0x0+134 flags r-x
+    LOAD off    0x0+134 vaddr 0x0+2134 paddr 0x0+2134 align 2\*\*13
          filesz 0x0+108 memsz 0x0+108 flags rw-
- DYNAMIC off    0x0+1cc vaddr 0x0+21cc paddr 0x0+21cc align 2\*\*2
+ DYNAMIC off    0x0+1b8 vaddr 0x0+21b8 paddr 0x0+21b8 align 2\*\*2
          filesz 0x0+70 memsz 0x0+70 flags rw-
-     TLS off    0x0+148 vaddr 0x0+2148 paddr 0x0+2148 align 2\*\*2
+     TLS off    0x0+134 vaddr 0x0+2134 paddr 0x0+2134 align 2\*\*2
          filesz 0x0+84 memsz 0x0+84 flags r--
 
 Dynamic Section:
   HASH                 0x0+b4
-  STRTAB               0x0+124
-  SYMTAB               0x0+d4
+  STRTAB               0x0+110
+  SYMTAB               0x0+d0
   STRSZ                0x0+11
   SYMENT               0x0+10
-  RELA                 0x0+138
+  RELA                 0x0+124
   RELASZ               0x0+c
   RELAENT              0x0+c
 private flags = 0:
@@ -38,13 +38,13 @@ SYMBOL TABLE:
 
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE
-0+2248 R_CRIS_DTPMOD     \*ABS\*
+0+2234 R_CRIS_DTPMOD     \*ABS\*
 
 Contents of section \.hash:
 #...
 Contents of section \.text:
- 0144 5fae8000                             .*
+ 0130 5fae8000                             .*
 #...
 Contents of section \.got:
- 223c cc210+ 0+ 0+ 0+  .*
- 224c 0+                             .*
+ 2228 b8210+ 0+ 0+ 0+  .*
+ 2238 0+                             .*
diff --git a/ld/testsuite/ld-cris/tls-ld-5.d b/ld/testsuite/ld-cris/tls-ld-5.d
index 9db125571f..287b5ee104 100644
--- a/ld/testsuite/ld-cris/tls-ld-5.d
+++ b/ld/testsuite/ld-cris/tls-ld-5.d
@@ -12,21 +12,21 @@
 
 Program Header:
     LOAD off    0x0+ vaddr 0x0+ paddr 0x0+ align 2\*\*13
-         filesz 0x0+14c memsz 0x0+14c flags r-x
-    LOAD off    0x0+14c vaddr 0x0+214c paddr 0x0+214c align 2\*\*13
+         filesz 0x0+138 memsz 0x0+138 flags r-x
+    LOAD off    0x0+138 vaddr 0x0+2138 paddr 0x0+2138 align 2\*\*13
          filesz 0x0+10c memsz 0x0+10c flags rw-
- DYNAMIC off    0x0+1d4 vaddr 0x0+21d4 paddr 0x0+21d4 align 2\*\*2
+ DYNAMIC off    0x0+1c0 vaddr 0x0+21c0 paddr 0x0+21c0 align 2\*\*2
          filesz 0x0+70 memsz 0x0+70 flags rw-
-     TLS off    0x0+14c vaddr 0x0+214c paddr 0x0+214c align 2\*\*2
+     TLS off    0x0+138 vaddr 0x0+2138 paddr 0x0+2138 align 2\*\*2
          filesz 0x0+88 memsz 0x0+88 flags r--
 
 Dynamic Section:
   HASH                 0x0+b4
-  STRTAB               0x0+124
-  SYMTAB               0x0+d4
+  STRTAB               0x0+110
+  SYMTAB               0x0+d0
   STRSZ                0x0+11
   SYMENT               0x0+10
-  RELA                 0x0+138
+  RELA                 0x0+124
   RELASZ               0x0+c
   RELAENT              0x0+c
 private flags = 0:
@@ -39,13 +39,13 @@ SYMBOL TABLE:
 
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE
-0+2250 R_CRIS_DTPMOD     \*ABS\*
+0+223c R_CRIS_DTPMOD     \*ABS\*
 
 Contents of section \.hash:
 #...
 Contents of section \.text:
- 0144 5fae8000 5fbe8400              .*
+ 0130 5fae8000 5fbe8400              .*
 #...
 Contents of section \.got:
- 2244 d4210+ 0+ 0+ 0+  .*
- 2254 0+                             .*
+ 2230 c0210+ 0+ 0+ 0+  .*
+ 2240 0+                             .*
diff --git a/ld/testsuite/ld-cris/tls-ld-6.d b/ld/testsuite/ld-cris/tls-ld-6.d
index 43cf43f456..43bb17e187 100644
--- a/ld/testsuite/ld-cris/tls-ld-6.d
+++ b/ld/testsuite/ld-cris/tls-ld-6.d
@@ -12,21 +12,21 @@
 
 Program Header:
     LOAD off    0x0+ vaddr 0x0+ paddr 0x0+ align 2\*\*13
-         filesz 0x0+14c memsz 0x0+14c flags r-x
-    LOAD off    0x0+14c vaddr 0x0+214c paddr 0x0+214c align 2\*\*13
+         filesz 0x0+138 memsz 0x0+138 flags r-x
+    LOAD off    0x0+138 vaddr 0x0+2138 paddr 0x0+2138 align 2\*\*13
          filesz 0x0+108 memsz 0x0+108 flags rw-
- DYNAMIC off    0x0+1d0 vaddr 0x0+21d0 paddr 0x0+21d0 align 2\*\*2
+ DYNAMIC off    0x0+1bc vaddr 0x0+21bc paddr 0x0+21bc align 2\*\*2
          filesz 0x0+70 memsz 0x0+70 flags rw-
-     TLS off    0x0+14c vaddr 0x0+214c paddr 0x0+214c align 2\*\*2
+     TLS off    0x0+138 vaddr 0x0+2138 paddr 0x0+2138 align 2\*\*2
          filesz 0x0+84 memsz 0x0+84 flags r--
 
 Dynamic Section:
   HASH                 0x0+b4
-  STRTAB               0x0+124
-  SYMTAB               0x0+d4
+  STRTAB               0x0+110
+  SYMTAB               0x0+d0
   STRSZ                0x0+11
   SYMENT               0x0+10
-  RELA                 0x0+138
+  RELA                 0x0+124
   RELASZ               0x0+c
   RELAENT              0x0+c
 private flags = 0:
@@ -38,13 +38,13 @@ SYMBOL TABLE:
 
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE
-0+224c R_CRIS_DTPMOD     \*ABS\*
+0+2238 R_CRIS_DTPMOD     \*ABS\*
 
 Contents of section \.hash:
 #...
 Contents of section \.text:
- 0144 6fae8000 00000000              .*
+ 0130 6fae8000 00000000              .*
 #...
 Contents of section \.got:
- 2240 d0210+ 0+ 0+ 0+  .*
- 2250 0+                             .*
+ 222c bc210+ 0+ 0+ 0+  .*
+ 223c 0+                             .*
diff --git a/ld/testsuite/ld-cris/tls-ld-7.d b/ld/testsuite/ld-cris/tls-ld-7.d
index 7be8b87c54..cd3a2f7e26 100644
--- a/ld/testsuite/ld-cris/tls-ld-7.d
+++ b/ld/testsuite/ld-cris/tls-ld-7.d
@@ -12,21 +12,21 @@
 
 Program Header:
     LOAD off    0x0+ vaddr 0x0+ paddr 0x0+ align 2\*\*13
-         filesz 0x0+150 memsz 0x0+150 flags r-x
-    LOAD off    0x0+150 vaddr 0x0+2150 paddr 0x0+2150 align 2\*\*13
+         filesz 0x0+13c memsz 0x0+13c flags r-x
+    LOAD off    0x0+13c vaddr 0x0+213c paddr 0x0+213c align 2\*\*13
          filesz 0x0+10c memsz 0x0+10c flags rw-
- DYNAMIC off    0x0+1d8 vaddr 0x0+21d8 paddr 0x0+21d8 align 2\*\*2
+ DYNAMIC off    0x0+1c4 vaddr 0x0+21c4 paddr 0x0+21c4 align 2\*\*2
          filesz 0x0+70 memsz 0x0+70 flags rw-
-     TLS off    0x0+150 vaddr 0x0+2150 paddr 0x0+2150 align 2\*\*2
+     TLS off    0x0+13c vaddr 0x0+213c paddr 0x0+213c align 2\*\*2
          filesz 0x0+88 memsz 0x0+88 flags r--
 
 Dynamic Section:
   HASH                 0x0+b4
-  STRTAB               0x0+124
-  SYMTAB               0x0+d4
+  STRTAB               0x0+110
+  SYMTAB               0x0+d0
   STRSZ                0x0+11
   SYMENT               0x0+10
-  RELA                 0x0+138
+  RELA                 0x0+124
   RELASZ               0x0+c
   RELAENT              0x0+c
 private flags = 0:
@@ -39,13 +39,13 @@ SYMBOL TABLE:
 
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE
-0+2254 R_CRIS_DTPMOD     \*ABS\*
+0+2240 R_CRIS_DTPMOD     \*ABS\*
 
 Contents of section \.hash:
 #...
 Contents of section \.text:
- 0144 6fae80+ 0+6fbe 840+     .*
+ 0130 6fae80+ 0+6fbe 840+     .*
 #...
 Contents of section \.got:
- 2248 d8210+ 0+ 0+ 0+  .*
- 2258 0+                             .*
+ 2234 c4210+ 0+ 0+ 0+  .*
+ 2244 0+                             .*
diff --git a/ld/testsuite/ld-cris/tls-ldgd-14.d b/ld/testsuite/ld-cris/tls-ldgd-14.d
index 0cbd687ec6..1c3ca022a6 100644
--- a/ld/testsuite/ld-cris/tls-ldgd-14.d
+++ b/ld/testsuite/ld-cris/tls-ldgd-14.d
@@ -17,21 +17,21 @@
 
 Program Header:
     LOAD off    0x0+ vaddr 0x0+ paddr 0x0+ align 2\*\*13
-         filesz 0x0+1dc memsz 0x0+1dc flags r-x
-    LOAD off    0x0+1dc vaddr 0x0+21dc paddr 0x0+21dc align 2\*\*13
+         filesz 0x0+1c8 memsz 0x0+1c8 flags r-x
+    LOAD off    0x0+1c8 vaddr 0x0+21c8 paddr 0x0+21c8 align 2\*\*13
          filesz 0x0+124 memsz 0x0+124 flags rw-
- DYNAMIC off    0x0+26c vaddr 0x0+226c paddr 0x0+226c align 2\*\*2
+ DYNAMIC off    0x0+258 vaddr 0x0+2258 paddr 0x0+2258 align 2\*\*2
          filesz 0x0+70 memsz 0x0+70 flags rw-
-     TLS off    0x0+1dc vaddr 0x0+21dc paddr 0x0+21dc align 2\*\*2
+     TLS off    0x0+1c8 vaddr 0x0+21c8 paddr 0x0+21c8 align 2\*\*2
          filesz 0x0+90 memsz 0x0+90 flags r--
 
 Dynamic Section:
   HASH                 0x0+b4
-  STRTAB               0x0+17c
-  SYMTAB               0x0+ec
+  STRTAB               0x0+168
+  SYMTAB               0x0+e8
   STRSZ                0x0+2a
   SYMENT               0x0+10
-  RELA                 0x0+1a8
+  RELA                 0x0+194
   RELASZ               0x0+24
   RELAENT              0x0+c
 private flags = 0:
@@ -55,17 +55,17 @@ DYNAMIC SYMBOL TABLE:
 
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE
-0+22e8 R_CRIS_DTPMOD     \*ABS\*
-0+22f0 R_CRIS_DTP        x
-0+22f8 R_CRIS_DTP        z
+0+22d4 R_CRIS_DTPMOD     \*ABS\*
+0+22dc R_CRIS_DTP        x
+0+22e4 R_CRIS_DTP        z
 
 Contents of section \.hash:
 #...
 Contents of section \.text:
- 01cc 5fae8800 5fbe8c00 5fae1400 5fae1c00  .*
+ 01b8 5fae8800 5fbe8c00 5fae1400 5fae1c00  .*
 Contents of section .tdata:
 #...
 Contents of section \.got:
- 22dc 6c220+ 0+ 0+ 0+  .*
- 22ec 0+ 0+ 0+ 0+  .*
- 22fc 0+                             .*
+ 22c8 58220+ 0+ 0+ 0+  .*
+ 22d8 0+ 0+ 0+ 0+  .*
+ 22e8 0+                             .*
diff --git a/ld/testsuite/ld-cris/tls-ldgd-15.d b/ld/testsuite/ld-cris/tls-ldgd-15.d
index 54bf280607..32afffa464 100644
--- a/ld/testsuite/ld-cris/tls-ldgd-15.d
+++ b/ld/testsuite/ld-cris/tls-ldgd-15.d
@@ -17,21 +17,21 @@
 
 Program Header:
     LOAD off    0x0+ vaddr 0x0+ paddr 0x0+ align 2\*\*13
-         filesz 0x0+1e8 memsz 0x0+1e8 flags r-x
-    LOAD off    0x0+1e8 vaddr 0x0+21e8 paddr 0x0+21e8 align 2\*\*13
+         filesz 0x0+1d4 memsz 0x0+1d4 flags r-x
+    LOAD off    0x0+1d4 vaddr 0x0+21d4 paddr 0x0+21d4 align 2\*\*13
          filesz 0x0+124 memsz 0x0+124 flags rw-
- DYNAMIC off    0x0+278 vaddr 0x0+2278 paddr 0x0+2278 align 2\*\*2
+ DYNAMIC off    0x0+264 vaddr 0x0+2264 paddr 0x0+2264 align 2\*\*2
          filesz 0x0+70 memsz 0x0+70 flags rw-
-     TLS off    0x0+1e8 vaddr 0x0+21e8 paddr 0x0+21e8 align 2\*\*2
+     TLS off    0x0+1d4 vaddr 0x0+21d4 paddr 0x0+21d4 align 2\*\*2
          filesz 0x0+90 memsz 0x0+90 flags r--
 
 Dynamic Section:
   HASH                 0x0+b4
-  STRTAB               0x0+17c
-  SYMTAB               0x0+ec
+  STRTAB               0x0+168
+  SYMTAB               0x0+e8
   STRSZ                0x0+2a
   SYMENT               0x0+10
-  RELA                 0x0+1a8
+  RELA                 0x0+194
   RELASZ               0x0+24
   RELAENT              0x0+c
 private flags = 0:
@@ -55,18 +55,18 @@ DYNAMIC SYMBOL TABLE:
 
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE
-0+22f4 R_CRIS_DTPMOD     \*ABS\*
-0+22fc R_CRIS_DTP        x
-0+2304 R_CRIS_DTP        z
+0+22e0 R_CRIS_DTPMOD     \*ABS\*
+0+22e8 R_CRIS_DTP        x
+0+22f0 R_CRIS_DTP        z
 
 Contents of section \.hash:
 #...
 Contents of section \.text:
- 01cc 6fae8800 00006fbe 8c000000 6fae1400  .*
- 01dc 0+ 6fae1c00 0+           .*
+ 01b8 6fae8800 00006fbe 8c000000 6fae1400  .*
+ 01c8 0+ 6fae1c00 0+           .*
 Contents of section .tdata:
 #...
 Contents of section \.got:
- 22e8 78220+ 0+ 0+ 0+  .*
- 22f8 0+ 0+ 0+ 0+  .*
- 2308 0+                             .*
+ 22d4 64220+ 0+ 0+ 0+  .*
+ 22e4 0+ 0+ 0+ 0+  .*
+ 22f4 0+                             .*
diff --git a/ld/testsuite/ld-cris/tls-ldgdx-14.d b/ld/testsuite/ld-cris/tls-ldgdx-14.d
index 3b627297e8..0389fb6ccc 100644
--- a/ld/testsuite/ld-cris/tls-ldgdx-14.d
+++ b/ld/testsuite/ld-cris/tls-ldgdx-14.d
@@ -39,17 +39,17 @@ DYNAMIC SYMBOL TABLE:
 #...
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE
-000022e4 R_CRIS_DTPMOD     \*ABS\*
-000022ec R_CRIS_DTP        x
-000022f4 R_CRIS_DTP        z
+000022d0 R_CRIS_DTPMOD     \*ABS\*
+000022d8 R_CRIS_DTP        x
+000022e0 R_CRIS_DTP        z
 
 Contents of section \.hash:
 #...
 Contents of section \.text:
- 01c8 5fae8000 5fbe8400 5fae1400 5fae1c00  .*
+ 01b4 5fae8000 5fbe8400 5fae1400 5fae1c00  .*
 Contents of section .tdata:
 #...
 Contents of section \.got:
- 22d8 60220+ 0+ 0+ 0+  .*
- 22e8 0+ 0+ 0+ 0+  .*
- 22f8 0+                             .*
+ 22c4 4c220+ 0+ 0+ 0+  .*
+ 22d4 0+ 0+ 0+ 0+  .*
+ 22e4 0+                             .*
diff --git a/ld/testsuite/ld-cris/tls-ldgdx-15.d b/ld/testsuite/ld-cris/tls-ldgdx-15.d
index 4ecfa6bfea..97f23516ed 100644
--- a/ld/testsuite/ld-cris/tls-ldgdx-15.d
+++ b/ld/testsuite/ld-cris/tls-ldgdx-15.d
@@ -39,18 +39,18 @@ DYNAMIC SYMBOL TABLE:
 #...
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE
-000022f0 R_CRIS_DTPMOD     \*ABS\*
-000022f8 R_CRIS_DTP        x
-00002300 R_CRIS_DTP        z
+000022dc R_CRIS_DTPMOD     \*ABS\*
+000022e4 R_CRIS_DTP        x
+000022ec R_CRIS_DTP        z
 
 Contents of section \.hash:
 #...
 Contents of section \.text:
- 01c8 6fae8000 00006fbe 84000000 6fae1400  .*
- 01d8 0+ 6fae1c00 0+           .*
+ 01b4 6fae8000 00006fbe 84000000 6fae1400  .*
+ 01c4 0+ 6fae1c00 0+           .*
 Contents of section .tdata:
 #...
 Contents of section \.got:
- 22e4 6c220+ 0+ 0+ 0+  .*
- 22f4 0+ 0+ 0+ 0+  .*
- 2304 0+                             .*
+ 22d0 58220+ 0+ 0+ 0+  .*
+ 22e0 0+ 0+ 0+ 0+  .*
+ 22f0 0+                             .*
diff --git a/ld/testsuite/ld-cris/tls-local-54.d b/ld/testsuite/ld-cris/tls-local-54.d
index f2a100fd53..693f08d488 100644
--- a/ld/testsuite/ld-cris/tls-local-54.d
+++ b/ld/testsuite/ld-cris/tls-local-54.d
@@ -15,13 +15,13 @@ Program Header:
 #...
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE
-0000222c R_CRIS_DTP        \*ABS\*\+0x0000002a
+00002218 R_CRIS_DTP        \*ABS\*\+0x0000002a
 
 Contents of section .hash:
 #...
 Contents of section \.text:
- 0128 6fae0c00 00000000                    .*
+ 0114 6fae0c00 00000000                    .*
 #...
 Contents of section \.got:
- 2220 b0210000 0+ 0+ 0+  .*
- 2230 0+                             .*
+ 220c 9c210000 0+ 0+ 0+  .*
+ 221c 0+                             .*
diff --git a/ld/testsuite/ld-cris/tls-local-60.d b/ld/testsuite/ld-cris/tls-local-60.d
index fb680ea41f..2d99e93b39 100644
--- a/ld/testsuite/ld-cris/tls-local-60.d
+++ b/ld/testsuite/ld-cris/tls-local-60.d
@@ -19,15 +19,15 @@ Program Header:
 #...
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE
-000022c8 R_CRIS_32_TPREL   \*ABS\*\+0x0+4
-000022cc R_CRIS_DTP        \*ABS\*\+0x0+4
+000022b4 R_CRIS_32_TPREL   \*ABS\*\+0x0+4
+000022b8 R_CRIS_DTP        \*ABS\*\+0x0+4
 
 Contents of section \.hash:
 #...
 Contents of section \.text:
- 01ac 6fae1000 00006fae 0c000000 5fae1000  .*
- 01bc 5fae0c00                             .*
+ 0198 6fae1000 00006fae 0c000000 5fae1000  .*
+ 01a8 5fae0c00                             .*
 #...
 Contents of section \.got:
- 22bc 44220+ 0+ 0+ 040+  .*
- 22cc 0+ 0+                    .*
+ 22a8 30220+ 0+ 0+ 040+  .*
+ 22b8 0+ 0+                    .*
diff --git a/ld/testsuite/ld-cris/tls-local-61.d b/ld/testsuite/ld-cris/tls-local-61.d
index 029810bcff..640056b966 100644
--- a/ld/testsuite/ld-cris/tls-local-61.d
+++ b/ld/testsuite/ld-cris/tls-local-61.d
@@ -18,15 +18,15 @@ Program Header:
 #...
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE
-000022b0 R_CRIS_32_TPREL   \*ABS\*
-000022b4 R_CRIS_DTP        \*ABS\*
+0000229c R_CRIS_32_TPREL   \*ABS\*
+000022a0 R_CRIS_DTP        \*ABS\*
 
 Contents of section \.hash:
 #...
 Contents of section \.text:
- 0198 6fae1000 00006fae 0c000000 5fae1000  .*
- 01a8 5fae0c00                             .*
+ 0184 6fae1000 00006fae 0c000000 5fae1000  .*
+ 0194 5fae0c00                             .*
 #...
 Contents of section \.got:
- 22a4 2c220+ 0+ 0+ 0+  .*
- 22b4 0+ 0+                    .*
+ 2290 18220+ 0+ 0+ 0+  .*
+ 22a0 0+ 0+                    .*
diff --git a/ld/testsuite/ld-cris/tls-local-63.d b/ld/testsuite/ld-cris/tls-local-63.d
index 2c16747668..7fde60a3eb 100644
--- a/ld/testsuite/ld-cris/tls-local-63.d
+++ b/ld/testsuite/ld-cris/tls-local-63.d
@@ -10,11 +10,11 @@
 #...
 Relocation section '.rela.dyn' at offset 0x.* contains 1 entry:
  Offset     Info    Type            Sym.Value  Sym. Name \+ Addend
-000021b4  0000001c R_CRIS_32_TPREL[ ]+0
+000021a0  0000001c R_CRIS_32_TPREL[ ]+0
 
 The decoding of unwind sections for machine type Axis Communications 32-bit embedded processor is not currently supported.
 
-Symbol table '.dynsym' contains 4 entries:
+Symbol table '.dynsym' contains 3 entries:
    Num:    Value  Size Type    Bind   Vis      Ndx Name
 #...
 Symbol table '.symtab' contains 13 entries:
@@ -22,10 +22,10 @@ Symbol table '.symtab' contains 13 entries:
      .: 00000000 +4 +TLS +LOCAL +DEFAULT +6 x
 #...
 Hex dump of section '.text':
-  0x00000128 5fae0c00                            .*
+  0x00000114 5fae0c00                            .*
 #...
 Hex dump of section '.tdata':
-  0x0000212c 280+                            .*
+  0x00002118 280+                            .*
 #...
 Hex dump of section '.got':
-  0x0+21a8 30210000 0+ 0+ 0+ .*
+  0x0+2194 1c210000 0+ 0+ 0+ .*
diff --git a/ld/testsuite/ld-cris/tls-local-64.d b/ld/testsuite/ld-cris/tls-local-64.d
index 5f92698303..ec0b0ea5d3 100644
--- a/ld/testsuite/ld-cris/tls-local-64.d
+++ b/ld/testsuite/ld-cris/tls-local-64.d
@@ -12,11 +12,11 @@
 #...
 Relocation section '.rela.dyn' at offset 0x.* contains 1 entry:
  Offset     Info    Type            Sym.Value  Sym. Name \+ Addend
-00002234  0000001c R_CRIS_32_TPREL[ ]+80
+00002220  0000001c R_CRIS_32_TPREL[ ]+80
 
 The decoding of unwind sections for machine type Axis Communications 32-bit embedded processor is not currently supported.
 
-Symbol table '.dynsym' contains 4 entries:
+Symbol table '.dynsym' contains 3 entries:
    Num:    Value  Size Type    Bind   Vis      Ndx Name
 #...
 Symbol table '.symtab' contains [0-9]+ entries:
@@ -24,14 +24,14 @@ Symbol table '.symtab' contains [0-9]+ entries:
     ..: 00000080 +4 +TLS +LOCAL +DEFAULT +6 x
 #...
 Hex dump of section '.text':
-  0x00000128 5fae0c00                            .*
+  0x00000114 5fae0c00                            .*
 #...
 Hex dump of section '.tdata':
-  0x0000212c 2f0+ 0+ 0+ 0+ .*
-  0x0000213c 0+ 0+ 0+ 0+ .*
+  0x00002118 2f0+ 0+ 0+ 0+ .*
+  0x00002128 0+ 0+ 0+ 0+ .*
 #...
-  0x0000219c 0+ 0+ 0+ 0+ .*
-  0x000021ac 280+                            .*
+  0x00002188 0+ 0+ 0+ 0+ .*
+  0x00002198 280+                            .*
 #...
 Hex dump of section '.got':
-  0x0+2228 b0210000 0+ 0+ 80+ .*
+  0x0+2214 9c210000 0+ 0+ 80+ .*
diff --git a/ld/testsuite/ld-cris/tls-ok-30.d b/ld/testsuite/ld-cris/tls-ok-30.d
index 8ab8c2a059..77af273c49 100644
--- a/ld/testsuite/ld-cris/tls-ok-30.d
+++ b/ld/testsuite/ld-cris/tls-ok-30.d
@@ -11,19 +11,19 @@
 
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE
-000b38bc R_CRIS_DTP        x2814
+000b38a8 R_CRIS_DTP        x2814
 #...
-000b82fc R_CRIS_DTP        x8190
+000b82e8 R_CRIS_DTP        x8190
 #...
-000c12b4 R_CRIS_DTP        x0
+000c12a0 R_CRIS_DTP        x0
 #...
-000c38ac R_CRIS_DTP        x1345
+000c3898 R_CRIS_DTP        x1345
 
 Contents of section .got:
- b38b0 40380b00 00000000 00000000 00000000  .*
- b38c0 00000000 00000000 00000000 00000000  .*
+ b389c 2c380b00 00000000 00000000 00000000  .*
+ b38ac 00000000 00000000 00000000 00000000  .*
 #...
- c3890 00000000 00000000 00000000 00000000  .*
- c38a0 00000000 00000000 00000000 00000000  .*
- c38b0 00000000                             .*
+ c387c 00000000 00000000 00000000 00000000  .*
+ c388c 00000000 00000000 00000000 00000000  .*
+ c389c 00000000                             .*
 #PASS
diff --git a/ld/testsuite/ld-cris/tls-ok-32.d b/ld/testsuite/ld-cris/tls-ok-32.d
index e633120cc0..e6f39928c9 100644
--- a/ld/testsuite/ld-cris/tls-ok-32.d
+++ b/ld/testsuite/ld-cris/tls-ok-32.d
@@ -10,14 +10,14 @@
 
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE
-0000a1c4 R_CRIS_DTPMOD     \*ABS\*
+0000a1b0 R_CRIS_DTPMOD     \*ABS\*
 
 Contents of section \.text:
- 0144 5faeff7f                             .*
+ 0130 5faeff7f                             .*
 Contents of section \.tdata:
- 2148 2a2a2a2a 2a2a2a2a 2a2a2a2a 2a2a2a2a  .*
+ 2134 2a2a2a2a 2a2a2a2a 2a2a2a2a 2a2a2a2a  .*
 #...
- a138 2a2a2a2a 2a2a2a2a 2a2a2a2a 2a2a2a2a  .*
+ a124 2a2a2a2a 2a2a2a2a 2a2a2a2a 2a2a2a2a  .*
 Contents of section \.got:
- a1b8 48a10000 00000000 00000000 00000000  .*
- a1c8 00000000                             .*
+ a1a4 34a10000 00000000 00000000 00000000  .*
+ a1b4 00000000                             .*
diff --git a/ld/testsuite/ld-cris/tls-ok-34.d b/ld/testsuite/ld-cris/tls-ok-34.d
index a960c69896..302d6bbac1 100644
--- a/ld/testsuite/ld-cris/tls-ok-34.d
+++ b/ld/testsuite/ld-cris/tls-ok-34.d
@@ -12,17 +12,17 @@
 
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE
-000b381c R_CRIS_32_TPREL   x2814
+000b3808 R_CRIS_32_TPREL   x2814
 #...
-000b4808 R_CRIS_32_TPREL   x8188
+000b47f4 R_CRIS_32_TPREL   x8188
 #...
-000ba510 R_CRIS_32_TPREL   x0
+000ba4fc R_CRIS_32_TPREL   x0
 #...
-000bb80c R_CRIS_32_TPREL   x1345
+000bb7f8 R_CRIS_32_TPREL   x1345
 
 Contents of section .got:
- b3810 98370b00 00000000 00000000 00000000  .*
- b3820 00000000 00000000 00000000 00000000  .*
+ b37fc 84370b00 00000000 00000000 00000000  .*
+ b380c 00000000 00000000 00000000 00000000  .*
 #...
- bb7f0 00000000 00000000 00000000 00000000  .*
- bb800 00000000 00000000 00000000 00000000  .*
+ bb7dc 00000000 00000000 00000000 00000000  .*
+ bb7ec 00000000 00000000 00000000 00000000  .*
diff --git a/ld/testsuite/ld-mips-elf/tls-multi-got-1.got b/ld/testsuite/ld-mips-elf/tls-multi-got-1.got
index a7b8b1c309..dc960c3284 100644
--- a/ld/testsuite/ld-mips-elf/tls-multi-got-1.got
+++ b/ld/testsuite/ld-mips-elf/tls-multi-got-1.got
@@ -4,33 +4,33 @@
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE
 00000000 R_MIPS_NONE       \*ABS\*
-0013f800 R_MIPS_TLS_DTPMOD32  \*ABS\*
-0014945c R_MIPS_TLS_DTPMOD32  \*ABS\*
-0013f808 R_MIPS_TLS_DTPMOD32  tlsvar_gd
-0013f80c R_MIPS_TLS_DTPREL32  tlsvar_gd
-00149468 R_MIPS_TLS_DTPMOD32  tlsvar_gd
-0014946c R_MIPS_TLS_DTPREL32  tlsvar_gd
-0013f810 R_MIPS_TLS_TPREL32  tlsvar_ie
-00149464 R_MIPS_TLS_TPREL32  tlsvar_ie
-00143e88 R_MIPS_REL32      sym_1_9526
+0013f7f0 R_MIPS_TLS_DTPMOD32  \*ABS\*
+0014944c R_MIPS_TLS_DTPMOD32  \*ABS\*
+0013f7f8 R_MIPS_TLS_DTPMOD32  tlsvar_gd
+0013f7fc R_MIPS_TLS_DTPREL32  tlsvar_gd
+00149458 R_MIPS_TLS_DTPMOD32  tlsvar_gd
+0014945c R_MIPS_TLS_DTPREL32  tlsvar_gd
+0013f800 R_MIPS_TLS_TPREL32  tlsvar_ie
+00149454 R_MIPS_TLS_TPREL32  tlsvar_ie
+00143e78 R_MIPS_REL32      sym_1_9526
 #...
-00139a64 R_MIPS_REL32      sym_2_8654
+00139a54 R_MIPS_REL32      sym_2_8654
 
 
 Contents of section .got:
- 122330 00000000 80000000 000d7f58 000d65b4  .*
- 122340 000d1f64 000d5fd0 000d5a08 000d1980  .*
+ 122320 00000000 80000000 000d7f48 000d65a4  .*
+ 122330 000d1f54 000d5fc0 000d59f8 000d1970  .*
 #...
- 135bb0 000cf1c4 000e0e08 00000000 80000000  .*
- 135bc0 00000000 00000000 00000000 00000000  .*
+ 135ba0 000cf1b4 000e0df8 00000000 80000000  .*
+ 135bb0 00000000 00000000 00000000 00000000  .*
 #...
+ 13f7e0 00000000 00000000 00000000 00000000  .*
  13f7f0 00000000 00000000 00000000 00000000  .*
- 13f800 00000000 00000000 00000000 00000000  .*
- 13f810 00000000 00000000 80000000 00000000  .*
+ 13f800 00000000 00000000 80000000 00000000  .*
 #...
+ 149410 00000000 00000000 00000000 00000000  .*
  149420 00000000 00000000 00000000 00000000  .*
  149430 00000000 00000000 00000000 00000000  .*
  149440 00000000 00000000 00000000 00000000  .*
  149450 00000000 00000000 00000000 00000000  .*
- 149460 00000000 00000000 00000000 00000000  .*
 #pass
diff --git a/ld/testsuite/ld-mips-elf/tls-multi-got-1.r b/ld/testsuite/ld-mips-elf/tls-multi-got-1.r
index bb4f4ac74f..a928a95978 100644
--- a/ld/testsuite/ld-mips-elf/tls-multi-got-1.r
+++ b/ld/testsuite/ld-mips-elf/tls-multi-got-1.r
@@ -6,17 +6,17 @@ Dynamic section at offset .* contains 18 entries:
  0x00000006 \(SYMTAB\).*
  0x0000000a \(STRSZ\)                      220065 \(bytes\)
  0x0000000b \(SYMENT\)                     16 \(bytes\)
- 0x00000003 \(PLTGOT\)                     0x122330
- 0x00000011 \(REL\)                        0xa7938
+ 0x00000003 \(PLTGOT\)                     0x122320
+ 0x00000011 \(REL\)                        0xa7924
  0x00000012 \(RELSZ\)                      160072 \(bytes\)
  0x00000013 \(RELENT\)                     8 \(bytes\)
  0x70000001 \(MIPS_RLD_VERSION\)           1
  0x70000005 \(MIPS_FLAGS\)                 NOTPOT
  0x70000006 \(MIPS_BASE_ADDRESS\)          0x0
  0x7000000a \(MIPS_LOCAL_GOTNO\)           2
- 0x70000011 \(MIPS_SYMTABNO\)              20011
+ 0x70000011 \(MIPS_SYMTABNO\)              20010
  0x70000012 \(MIPS_UNREFEXTNO\)            12
- 0x70000013 \(MIPS_GOTSYM\)                0xb
+ 0x70000013 \(MIPS_GOTSYM\)                0xa
  0x0000001e \(FLAGS\)                      STATIC_TLS
  0x00000000 \(NULL\)                       0x0
 
@@ -31,8 +31,8 @@ Relocation section '\.rel\.dyn' at offset 0x[0-9a-f]+ contains 20009 entries:
 [0-9a-f ]+R_MIPS_TLS_DTPREL 00000004   tlsvar_gd
 [0-9a-f ]+R_MIPS_TLS_TPREL3 00000008   tlsvar_ie
 [0-9a-f ]+R_MIPS_TLS_TPREL3 00000008   tlsvar_ie
-[0-9a-f ]+R_MIPS_REL32      000d7f58   sym_1_9526
-[0-9a-f ]+R_MIPS_REL32      000d65b4   sym_1_7885
+[0-9a-f ]+R_MIPS_REL32      000d7f48   sym_1_9526
+[0-9a-f ]+R_MIPS_REL32      000d65a4   sym_1_7885
 #...
-[0-9a-f ]+R_MIPS_REL32      000cf1c4   sym_1_0465
-[0-9a-f ]+R_MIPS_REL32      000e0e08   sym_2_8654
+[0-9a-f ]+R_MIPS_REL32      000cf1b4   sym_1_0465
+[0-9a-f ]+R_MIPS_REL32      000e0df8   sym_2_8654
diff --git a/ld/testsuite/ld-mips-elf/tlsdyn-pie-o32.d b/ld/testsuite/ld-mips-elf/tlsdyn-pie-o32.d
index 4df024faa3..c5ad168366 100644
--- a/ld/testsuite/ld-mips-elf/tlsdyn-pie-o32.d
+++ b/ld/testsuite/ld-mips-elf/tlsdyn-pie-o32.d
@@ -4,7 +4,7 @@ Disassembly of section \.text:
 
 .* <__start>:
   .*: 3c1c0fc0 lui gp,0xfc0
-  .*: 279c7bd0 addiu gp,gp,31696
+  .*: 279c7be0 addiu gp,gp,31712
   .*: 0399e021 addu gp,gp,t9
   .*: 27bdfff0 addiu sp,sp,-16
   .*: afbe0008 sw s8,8\(sp\)
diff --git a/ld/testsuite/ld-mips-elf/tlsdyn-pie-o32.got b/ld/testsuite/ld-mips-elf/tlsdyn-pie-o32.got
index c5dd695d58..2b75ce11e0 100644
--- a/ld/testsuite/ld-mips-elf/tlsdyn-pie-o32.got
+++ b/ld/testsuite/ld-mips-elf/tlsdyn-pie-o32.got
@@ -8,6 +8,6 @@ OFFSET   TYPE              VALUE
 10000040 R_MIPS_TLS_TPREL32  tlsvar_ie
 
 Contents of section .got:
- 10000020 00000000 80000000 004004ec ffff900c  .*
+ 10000020 00000000 80000000 004004dc ffff900c  .*
  10000030 00000000 00000000 00000001 00000000  .*
  10000040 00000000 00000001 ffff8008           .*
diff --git a/ld/testsuite/ld-mips-elf/tlslib-o32-hidden.got b/ld/testsuite/ld-mips-elf/tlslib-o32-hidden.got
index a746031f7e..e8ed1acfa6 100644
--- a/ld/testsuite/ld-mips-elf/tlslib-o32-hidden.got
+++ b/ld/testsuite/ld-mips-elf/tlslib-o32-hidden.got
@@ -4,11 +4,11 @@
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE
 00000000 R_MIPS_NONE       \*ABS\*
-0004039c R_MIPS_TLS_TPREL32  \*ABS\*
-000403a0 R_MIPS_TLS_DTPMOD32  \*ABS\*
-000403a8 R_MIPS_TLS_DTPMOD32  \*ABS\*
+0004038c R_MIPS_TLS_TPREL32  \*ABS\*
+00040390 R_MIPS_TLS_DTPMOD32  \*ABS\*
+00040398 R_MIPS_TLS_DTPMOD32  \*ABS\*
 
 
 Contents of section .got:
- 40390 00000000 80000000 00000360 00000008  ................
- 403a0 00000000 ffff8004 00000000 00000000  ................
+ 40380 00000000 80000000 00000350 00000008  .*
+ 40390 00000000 ffff8004 00000000 00000000  .*
diff --git a/ld/testsuite/ld-mips-elf/tlslib-o32-ver.got b/ld/testsuite/ld-mips-elf/tlslib-o32-ver.got
index 17a6385e8e..b685e0601b 100644
--- a/ld/testsuite/ld-mips-elf/tlslib-o32-ver.got
+++ b/ld/testsuite/ld-mips-elf/tlslib-o32-ver.got
@@ -4,12 +4,12 @@
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE
 00000000 R_MIPS_NONE       \*ABS\*
-000404b8 R_MIPS_TLS_DTPMOD32  \*ABS\*
-000404b0 R_MIPS_TLS_DTPMOD32  tlsvar_gd@@VER_1
-000404b4 R_MIPS_TLS_DTPREL32  tlsvar_gd@@VER_1
-000404ac R_MIPS_TLS_TPREL32  tlsvar_ie@@VER_1
+000404a8 R_MIPS_TLS_DTPMOD32  \*ABS\*
+000404a0 R_MIPS_TLS_DTPMOD32  tlsvar_gd@@VER_1
+000404a4 R_MIPS_TLS_DTPREL32  tlsvar_gd@@VER_1
+0004049c R_MIPS_TLS_TPREL32  tlsvar_ie@@VER_1
 
 
 Contents of section .got:
- 404a0 00000000 80000000 00000470 00000000  ................
- 404b0 00000000 00000000 00000000 00000000  ................
+ 40490 00000000 80000000 00000460 00000000  .*
+ 404a0 00000000 00000000 00000000 00000000  .*
diff --git a/ld/testsuite/ld-mips-elf/tlslib-o32.got b/ld/testsuite/ld-mips-elf/tlslib-o32.got
index a389c30146..8f10e53f2c 100644
--- a/ld/testsuite/ld-mips-elf/tlslib-o32.got
+++ b/ld/testsuite/ld-mips-elf/tlslib-o32.got
@@ -4,12 +4,12 @@ tmpdir/tlslib-o32.so:     file format elf32-tradbigmips
 DYNAMIC RELOCATION RECORDS
 OFFSET   TYPE              VALUE
 00000000 R_MIPS_NONE       \*ABS\*
-00040428 R_MIPS_TLS_DTPMOD32  \*ABS\*
-00040420 R_MIPS_TLS_DTPMOD32  tlsvar_gd
-00040424 R_MIPS_TLS_DTPREL32  tlsvar_gd
-0004041c R_MIPS_TLS_TPREL32  tlsvar_ie
+00040418 R_MIPS_TLS_DTPMOD32  \*ABS\*
+00040410 R_MIPS_TLS_DTPMOD32  tlsvar_gd
+00040414 R_MIPS_TLS_DTPREL32  tlsvar_gd
+0004040c R_MIPS_TLS_TPREL32  tlsvar_ie
 
 
 Contents of section .got:
- 40410 00000000 80000000 000003e0 00000000  ................
- 40420 00000000 00000000 00000000 00000000  ................
+ 40400 00000000 80000000 000003d0 00000000  .*
+ 40410 00000000 00000000 00000000 00000000  .*
diff --git a/ld/testsuite/ld-powerpc/tlsso.r b/ld/testsuite/ld-powerpc/tlsso.r
index 259c69e455..c1d889af6b 100644
--- a/ld/testsuite/ld-powerpc/tlsso.r
+++ b/ld/testsuite/ld-powerpc/tlsso.r
@@ -51,9 +51,9 @@ Relocation section '\.rela\.dyn' at offset .* contains 18 entries:
 [0-9a-f ]+R_PPC64_TPREL16 +0+60 le0 \+ 0
 [0-9a-f ]+R_PPC64_TPREL16_HA +0+68 le1 \+ 0
 [0-9a-f ]+R_PPC64_TPREL16_LO +0+68 le1 \+ 0
-[0-9a-f ]+R_PPC64_TPREL16_DS +[0-9a-f]+ \.tdata \+ 28
-[0-9a-f ]+R_PPC64_TPREL16_HA +[0-9a-f]+ \.tdata \+ 30
-[0-9a-f ]+R_PPC64_TPREL16_LO +[0-9a-f]+ \.tdata \+ 30
+[0-9a-f ]+R_PPC64_TPREL16_DS +28
+[0-9a-f ]+R_PPC64_TPREL16_HA +30
+[0-9a-f ]+R_PPC64_TPREL16_LO +30
 [0-9a-f ]+R_PPC64_DTPMOD64 +0
 [0-9a-f ]+R_PPC64_DTPREL64 +0
 [0-9a-f ]+R_PPC64_DTPREL64 +18
@@ -73,7 +73,7 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
  +Num: +Value +Size +Type +Bind +Vis +Ndx +Name
 .* NOTYPE +LOCAL +DEFAULT +UND *
 .* SECTION +LOCAL +DEFAULT +6 *
-.* SECTION +LOCAL +DEFAULT +7 *
+.* SECTION +LOCAL +DEFAULT +10 *
 .* TLS +GLOBAL +DEFAULT +UND gd
 .* TLS +GLOBAL +DEFAULT +8 le0
 .* NOTYPE +GLOBAL +DEFAULT +UND __tls_get_addr
diff --git a/ld/testsuite/ld-powerpc/tlsso32.g b/ld/testsuite/ld-powerpc/tlsso32.g
index 832a840342..0e01e5d917 100644
--- a/ld/testsuite/ld-powerpc/tlsso32.g
+++ b/ld/testsuite/ld-powerpc/tlsso32.g
@@ -9,4 +9,4 @@
 Contents of section \.got:
 .* 00000000 00000000 00000000 00000000  .*
 .* 00000000 00000000 00000000 00000000  .*
-.* 00000000 (000103ec|ec030100) 00000000 00000000  .*
+.* 00000000 (000103dc|dc030100) 00000000 00000000  .*
diff --git a/ld/testsuite/ld-powerpc/tlsso32.r b/ld/testsuite/ld-powerpc/tlsso32.r
index 6a5a48a064..56b87f350f 100644
--- a/ld/testsuite/ld-powerpc/tlsso32.r
+++ b/ld/testsuite/ld-powerpc/tlsso32.r
@@ -52,9 +52,9 @@ Relocation section '\.rela\.dyn' at offset 0x[0-9a-f]+ contains 18 entries:
 [0-9a-f ]+R_PPC_TPREL16 +0+30 +le0 \+ 0
 [0-9a-f ]+R_PPC_TPREL16_HA +0+34 +le1 \+ 0
 [0-9a-f ]+R_PPC_TPREL16_LO +0+34 +le1 \+ 0
-[0-9a-f ]+R_PPC_TPREL16 +0+103d0 +\.tdata \+ 103e4
-[0-9a-f ]+R_PPC_TPREL16_HA +0+103d0 +\.tdata \+ 103e8
-[0-9a-f ]+R_PPC_TPREL16_LO +0+103d0 +\.tdata \+ 103e8
+[0-9a-f ]+R_PPC_TPREL16 +14
+[0-9a-f ]+R_PPC_TPREL16_HA +18
+[0-9a-f ]+R_PPC_TPREL16_LO +18
 [0-9a-f ]+R_PPC_DTPMOD32 +0
 [0-9a-f ]+R_PPC_DTPREL32 +0
 [0-9a-f ]+R_PPC_DTPMOD32 +0
@@ -72,7 +72,6 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
  +Num: +Value +Size +Type +Bind +Vis +Ndx +Name
 .* NOTYPE +LOCAL +DEFAULT +UND
 .* SECTION +LOCAL +DEFAULT +6
-.* SECTION +LOCAL +DEFAULT +7
 .* TLS +GLOBAL +DEFAULT +UND gd
 .* TLS +GLOBAL +DEFAULT +8 le0
 .* NOTYPE +GLOBAL +DEFAULT +UND __tls_get_addr
diff --git a/ld/testsuite/ld-powerpc/tlstocso.r b/ld/testsuite/ld-powerpc/tlstocso.r
index c43ffb6162..bf3e8fc097 100644
--- a/ld/testsuite/ld-powerpc/tlstocso.r
+++ b/ld/testsuite/ld-powerpc/tlstocso.r
@@ -68,7 +68,7 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
  +Num: +Value +Size +Type +Bind +Vis +Ndx +Name
 .* NOTYPE +LOCAL +DEFAULT +UND *
 .* SECTION +LOCAL +DEFAULT +6 *
-.* SECTION +LOCAL +DEFAULT +7 *
+.* SECTION +LOCAL +DEFAULT +10 *
 .* TLS +GLOBAL +DEFAULT +UND gd
 .* TLS +GLOBAL +DEFAULT +8 le0
 .* NOTYPE +GLOBAL +DEFAULT +UND __tls_get_addr
diff --git a/ld/testsuite/ld-s390/tlspic.rd b/ld/testsuite/ld-s390/tlspic.rd
index 20cb4bf7cb..555e6fe983 100644
--- a/ld/testsuite/ld-s390/tlspic.rd
+++ b/ld/testsuite/ld-s390/tlspic.rd
@@ -70,7 +70,6 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
  +Num: +Value +Size +Type +Bind +Vis +Ndx +Name
 .* NOTYPE +LOCAL +DEFAULT +UND
 .* SECTION +LOCAL +DEFAULT +7
-.* SECTION +LOCAL +DEFAULT +8
 .* TLS +GLOBAL +DEFAULT +8 sg8
 .* TLS +GLOBAL +DEFAULT +8 sg3
 .* TLS +GLOBAL +DEFAULT +8 sg4
diff --git a/ld/testsuite/ld-s390/tlspic_64.rd b/ld/testsuite/ld-s390/tlspic_64.rd
index 646c611cdf..4a926d6c0b 100644
--- a/ld/testsuite/ld-s390/tlspic_64.rd
+++ b/ld/testsuite/ld-s390/tlspic_64.rd
@@ -70,7 +70,6 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
  +Num: +Value +Size +Type +Bind +Vis +Ndx +Name
 .* NOTYPE +LOCAL +DEFAULT +UND
 .* SECTION +LOCAL +DEFAULT +7
-.* SECTION +LOCAL +DEFAULT +8
 .* TLS +GLOBAL +DEFAULT +8 sg8
 .* TLS +GLOBAL +DEFAULT +8 sg3
 .* TLS +GLOBAL +DEFAULT +8 sg4
diff --git a/ld/testsuite/ld-sparc/tlssunnopic32.rd b/ld/testsuite/ld-sparc/tlssunnopic32.rd
index 58c2b57644..0f5a77f73e 100644
--- a/ld/testsuite/ld-sparc/tlssunnopic32.rd
+++ b/ld/testsuite/ld-sparc/tlssunnopic32.rd
@@ -53,7 +53,6 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
  +Num: +Value +Size +Type +Bind +Vis +Ndx +Name
 .* NOTYPE +LOCAL +DEFAULT +UND *
 .* SECTION +LOCAL +DEFAULT +5 *
-.* SECTION +LOCAL +DEFAULT +6 *
 .* SECTION +LOCAL +DEFAULT +8 *
 .* FUNC +GLOBAL +DEFAULT +5 fn3
 .* TLS +GLOBAL +DEFAULT +UND sg1
diff --git a/ld/testsuite/ld-sparc/tlssunnopic64.rd b/ld/testsuite/ld-sparc/tlssunnopic64.rd
index a5a184ef10..0e1a794bf4 100644
--- a/ld/testsuite/ld-sparc/tlssunnopic64.rd
+++ b/ld/testsuite/ld-sparc/tlssunnopic64.rd
@@ -55,7 +55,6 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
  +Num: +Value +Size +Type +Bind +Vis +Ndx +Name
 .* NOTYPE +LOCAL +DEFAULT +UND *
 .* SECTION +LOCAL +DEFAULT +5 *
-.* SECTION +LOCAL +DEFAULT +6 *
 .* SECTION +LOCAL +DEFAULT +8 *
 .* FUNC +GLOBAL +DEFAULT +5 fn3
 .* TLS +GLOBAL +DEFAULT +UND sg1
diff --git a/ld/testsuite/ld-sparc/tlssunpic32.rd b/ld/testsuite/ld-sparc/tlssunpic32.rd
index 38d2513c1e..9e4aa99b61 100644
--- a/ld/testsuite/ld-sparc/tlssunpic32.rd
+++ b/ld/testsuite/ld-sparc/tlssunpic32.rd
@@ -63,7 +63,6 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
  +Num: +Value +Size +Type +Bind +Vis +Ndx +Name
 .* NOTYPE +LOCAL +DEFAULT +UND *
 .* SECTION +LOCAL +DEFAULT +6 *
-.* SECTION +LOCAL +DEFAULT +7 *
 .* SECTION +LOCAL +DEFAULT +10 *
 .* TLS +GLOBAL +DEFAULT +7 sg8
 .* TLS +GLOBAL +DEFAULT +7 sg3
diff --git a/ld/testsuite/ld-sparc/tlssunpic64.rd b/ld/testsuite/ld-sparc/tlssunpic64.rd
index c2a46b3cfa..75c2da301b 100644
--- a/ld/testsuite/ld-sparc/tlssunpic64.rd
+++ b/ld/testsuite/ld-sparc/tlssunpic64.rd
@@ -63,7 +63,6 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
  +Num: +Value +Size +Type +Bind +Vis +Ndx +Name
 .* NOTYPE +LOCAL +DEFAULT +UND *
 .* SECTION +LOCAL +DEFAULT +6 *
-.* SECTION +LOCAL +DEFAULT +7 *
 .* SECTION +LOCAL +DEFAULT +10 *
 .* TLS +GLOBAL +DEFAULT +7 sg8
 .* TLS +GLOBAL +DEFAULT +7 sg3

--
Alan Modra
Australia Development Lab, IBM