[PATCH, MIPS] Support shared library debug with MIPS PIE

Matthew Fortune Matthew.Fortune@imgtec.com
Tue Jun 23 14:40:00 GMT 2015


Hi,

It is not currently possible to extract dynamic linker maps for MIPS position
independent executables. MIPS does not use the DT_DEBUG tag as MIPS has a
read-only dynamic section and the MIPS specific DT_MIPS_RLD_MAP tag stores an
absolute address of the debug map pointer which is unusable for a PIE.
Following previous discussions we are introducing a new dynamic tag as defined
below.

Previous threads on this topic:

https://sourceware.org/ml/binutils/2013-06/msg00183.html
https://sourceware.org/ml/binutils/2014-10/msg00200.html

New dynamic tag:

DT_MIPS_RLD_MAP2 - 0x70000035

Definition:

This member is used by debugging.  It contains a relative offset from the tag's
runtime location of a 32-bit word in the .data section which is supplied by the
compilation environment. The word's contents are not specified and programs
using this value are not ABI - compliant.

I have considered the suggestion from Roland and Maciej about making this a GNU
tag. MIPS needs this feature because of the way the psABI is defined and will
therefore need this for any OS which may well then lead to needing more tags.
If the tag were in the completely generic range (like DT_DEBUG) then I wouldn't
be concerned at all.

No regressions for:

mips64el-freebsd mips64el-linux mips64-freebsd mips64-linux mipsel-elf mips-elf
mipsel-freebsd mipsel-linux mipsel-vxworks mips-freebsd mipsisa32el-elf
mipsisa32-elf mipsisa32el-linux mipsisa32-linux mipsisa64el-elf mipsisa64-elf
mipsisa64el-linux mipsisa64-linux mips-linux mips-sde-elf mips-sgi-irix5
mips-sgi-irix6 mips-vxworks

OK to commit?

Thanks,
Matthew

bfd/

	* elfxx-mips.c (_bfd_mips_elf_create_dynamic_sections): Use executable
	instead of !shared to indicate an application vs shared library.
	(_bfd_mips_elf_size_dynamic_sections): Likewise.
	(_bfd_mips_elf_finish_dynamic_sections): Handle DT_MIPS_RLD_MAP2.
	(_bfd_mips_elf_get_target_dtag): Likewise.

binutils/

	* readelf.c (get_mips_dynamic_type): Handle DT_MIPS_RLD_MAP2.

include/

	* elf/mips.h (DT_MIPS_RLD_MAP2): New macro.

ld/testsuite/

	* ld-mips-elf/pic-and-nonpic-3b.ad: Adjust for extra dynamic tag.
	* ld-mips-elf/pic-and-nonpic-4b.ad: Likewise.
	* ld-mips-elf/pic-and-nonpic-5b.ad: Likewise.
	* ld-mips-elf/pic-and-nonpic-6-n32.ad: Likewise.
	* ld-mips-elf/pic-and-nonpic-6-n64.ad: Likewise.
	* ld-mips-elf/pic-and-nonpic-6-o32.ad: Likewise.
	* ld-mips-elf/tlsdyn-o32-1.d: Likewise.
	* ld-mips-elf/tlsdyn-o32-1.got: Likewise.
	* ld-mips-elf/tlsdyn-o32-2.d: Likewise.
	* ld-mips-elf/tlsdyn-o32-2.got: Likewise.
	* ld-mips-elf/tlsdyn-o32-3.d: Likewise.
	* ld-mips-elf/tlsdyn-o32-3.got: Likewise.
	* ld-mips-elf/tlsdyn-o32.d: Likewise.
	* ld-mips-elf/tlsdyn-o32.got: Likewise.
	* ld-mips-elf/pie-n32.d: New file.
	* ld-mips-elf/pie-n64.d: Likewise.
	* ld-mips-elf/pie-o32.d: Likewise.
	* ld-mips-elf/pie.s: Likewise.
	* ld-mips-elf/mips-elf.exp: Add new tests.
---
 bfd/elfxx-mips.c                                 | 38 ++++++++++++++++++++++--
 binutils/readelf.c                               |  1 +
 include/elf/mips.h                               |  3 ++
 ld/testsuite/ChangeLog                           | 22 ++++++++++++++
 ld/testsuite/ld-mips-elf/mips-elf.exp            |  9 ++++++
 ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.ad    |  1 +
 ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.ad    |  1 +
 ld/testsuite/ld-mips-elf/pic-and-nonpic-5b.ad    |  1 +
 ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.ad |  1 +
 ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.ad |  1 +
 ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.ad |  1 +
 ld/testsuite/ld-mips-elf/pie-n32.d               | 23 ++++++++++++++
 ld/testsuite/ld-mips-elf/pie-n64.d               | 23 ++++++++++++++
 ld/testsuite/ld-mips-elf/pie-o32.d               | 23 ++++++++++++++
 ld/testsuite/ld-mips-elf/pie.s                   |  6 ++++
 ld/testsuite/ld-mips-elf/tlsdyn-o32-1.d          |  4 +--
 ld/testsuite/ld-mips-elf/tlsdyn-o32-1.got        |  2 +-
 ld/testsuite/ld-mips-elf/tlsdyn-o32-2.d          |  4 +--
 ld/testsuite/ld-mips-elf/tlsdyn-o32-2.got        |  2 +-
 ld/testsuite/ld-mips-elf/tlsdyn-o32-3.d          |  4 +--
 ld/testsuite/ld-mips-elf/tlsdyn-o32-3.got        |  2 +-
 ld/testsuite/ld-mips-elf/tlsdyn-o32.d            |  2 +-
 ld/testsuite/ld-mips-elf/tlsdyn-o32.got          |  2 +-
 23 files changed, 162 insertions(+), 14 deletions(-)
 create mode 100644 ld/testsuite/ld-mips-elf/pie-n32.d
 create mode 100644 ld/testsuite/ld-mips-elf/pie-n64.d
 create mode 100644 ld/testsuite/ld-mips-elf/pie-o32.d
 create mode 100644 ld/testsuite/ld-mips-elf/pie.s

diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index a5e6453..7e58f70 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -7614,7 +7614,7 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
   htab->sstubs = s;
 
   if (!mips_elf_hash_table (info)->use_rld_obj_head
-      && !info->shared
+      && info->executable
       && bfd_get_linker_section (abfd, ".rld_map") == NULL)
     {
       s = bfd_make_section_anyway_with_flags (abfd, ".rld_map",
@@ -7678,7 +7678,7 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
 	(void) bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd));
     }
 
-  if (!info->shared)
+  if (info->executable)
     {
       const char *name;
 
@@ -9719,7 +9719,7 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
 	      info->combreloc = 0;
 	    }
 	}
-      else if (! info->shared
+      else if (info->executable
 	       && ! mips_elf_hash_table (info)->use_rld_obj_head
 	       && CONST_STRNEQ (name, ".rld_map"))
 	{
@@ -9782,6 +9782,10 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
 	  && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_MAP, 0))
 	return FALSE;
 
+      if (info->executable
+	  && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_MAP2, 0))
+	return FALSE;
+
       /* The DT_DEBUG entry may be filled in by the dynamic linker and
 	 used by the debugger.  */
       if (info->executable
@@ -11487,11 +11491,37 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd,
 		    break;
 		  }
 		s = h->root.u.def.section;
+
+		/* The MIPS_RLD_MAP tag stores the absolute address of the
+		   debug pointer.  */
 		dyn.d_un.d_ptr = (s->output_section->vma + s->output_offset
 				  + h->root.u.def.value);
 	      }
 	      break;
 
+	    case DT_MIPS_RLD_MAP2:
+	      {
+		struct elf_link_hash_entry *h;
+		bfd_vma dt_addr, rld_addr;
+		h = mips_elf_hash_table (info)->rld_symbol;
+		if (!h)
+		  {
+		    dyn_to_skip = MIPS_ELF_DYN_SIZE (dynobj);
+		    swap_out_p = FALSE;
+		    break;
+		  }
+		s = h->root.u.def.section;
+
+		/* The MIPS_RLD_MAP2 tag stores the offset to the debug
+		   pointer, relative to the address of the tag.  */
+		dt_addr = (sdyn->output_section->vma + sdyn->output_offset
+			   + b - sdyn->contents);
+		rld_addr = (s->output_section->vma + s->output_offset
+			    + h->root.u.def.value);
+		dyn.d_un.d_ptr = rld_addr - dt_addr;
+	      }
+	      break;
+
 	    case DT_MIPS_OPTIONS:
 	      s = (bfd_get_section_by_name
 		   (output_bfd, MIPS_ELF_OPTIONS_SECTION_NAME (output_bfd)));
@@ -15421,6 +15451,8 @@ _bfd_mips_elf_get_target_dtag (bfd_vma dtag)
       return "MIPS_HIPAGENO";
     case DT_MIPS_RLD_MAP:
       return "MIPS_RLD_MAP";
+    case DT_MIPS_RLD_MAP2:
+      return "MIPS_RLD_MAP2";
     case DT_MIPS_DELTA_CLASS:
       return "MIPS_DELTA_CLASS";
     case DT_MIPS_DELTA_CLASS_NO:
diff --git a/binutils/readelf.c b/binutils/readelf.c
index a0c20a3..eb935a3 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -1695,6 +1695,7 @@ get_mips_dynamic_type (unsigned long type)
     case DT_MIPS_GOTSYM: return "MIPS_GOTSYM";
     case DT_MIPS_HIPAGENO: return "MIPS_HIPAGENO";
     case DT_MIPS_RLD_MAP: return "MIPS_RLD_MAP";
+    case DT_MIPS_RLD_MAP2: return "MIPS_RLD_MAP2";
     case DT_MIPS_DELTA_CLASS: return "MIPS_DELTA_CLASS";
     case DT_MIPS_DELTA_CLASS_NO: return "MIPS_DELTA_CLASS_NO";
     case DT_MIPS_DELTA_INSTANCE: return "MIPS_DELTA_INSTANCE";
diff --git a/include/elf/mips.h b/include/elf/mips.h
index 23c21e2..f7099a8 100644
--- a/include/elf/mips.h
+++ b/include/elf/mips.h
@@ -748,6 +748,9 @@ extern void bfd_mips_elf32_swap_reginfo_out
 
 /* Points to the base of a writable PLT.  */
 #define DT_MIPS_RWPLT          0x70000034
+
+/* Relative offset of run time loader map, used for debugging.  */
+#define DT_MIPS_RLD_MAP2       0x70000035
 

 /* Flags which may appear in a DT_MIPS_FLAGS entry.  */
 
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index e81e616..50901e2 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,25 @@
+2015-06-22  Matthew Fortune  <matthew.fortune@imgtec.com>
+
+	* ld-mips-elf/pic-and-nonpic-3b.ad: Adjust for extra dynamic tag.
+	* ld-mips-elf/pic-and-nonpic-4b.ad: Likewise.
+	* ld-mips-elf/pic-and-nonpic-5b.ad: Likewise.
+	* ld-mips-elf/pic-and-nonpic-6-n32.ad: Likewise.
+	* ld-mips-elf/pic-and-nonpic-6-n64.ad: Likewise.
+	* ld-mips-elf/pic-and-nonpic-6-o32.ad: Likewise.
+	* ld-mips-elf/tlsdyn-o32-1.d: Likewise.
+	* ld-mips-elf/tlsdyn-o32-1.got: Likewise.
+	* ld-mips-elf/tlsdyn-o32-2.d: Likewise.
+	* ld-mips-elf/tlsdyn-o32-2.got: Likewise.
+	* ld-mips-elf/tlsdyn-o32-3.d: Likewise.
+	* ld-mips-elf/tlsdyn-o32-3.got: Likewise.
+	* ld-mips-elf/tlsdyn-o32.d: Likewise.
+	* ld-mips-elf/tlsdyn-o32.got: Likewise.
+	* ld-mips-elf/pie-n32.d: New file.
+	* ld-mips-elf/pie-n64.d: Likewise.
+	* ld-mips-elf/pie-o32.d: Likewise.
+	* ld-mips-elf/pie.s: Likewise.
+	* ld-mips-elf/mips-elf.exp: Add new tests.
+
 2015-06-17  Jiong Wang  <jiong.wang@arm.com>
 
 	* ld-aarch64/aarch64-elf.exp (aarch64_choose_ilp32_emul): New function.
diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp
index 7057e2f..923d8df 100644
--- a/ld/testsuite/ld-mips-elf/mips-elf.exp
+++ b/ld/testsuite/ld-mips-elf/mips-elf.exp
@@ -186,6 +186,15 @@ if { $linux_gnu } {
     }
 }
 
+# Test PIE debug dynamic tags
+if { $linux_gnu } {
+    run_dump_test "pie-o32"
+    if { $has_newabi } {
+	run_dump_test "pie-n32"
+	run_dump_test "pie-n64"
+    }
+}
+
 if $has_newabi {
     if { $embedded_elf } {
 	run_dump_test "elf-rel-got-n32-embed" \
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.ad b/ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.ad
index 227d15d..802bb71 100644
--- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.ad
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-3b.ad
@@ -8,6 +8,7 @@ Dynamic section at offset .* contains .*:
  0x0000000a \(STRSZ\) .*
  0x0000000b \(SYMENT\) .*
  0x70000016 \(MIPS_RLD_MAP\) * 0x80000
+ 0x70000035 \(MIPS_RLD_MAP2\) * 0x3dfc8
  0x00000015 \(DEBUG\) * 0x0
  0x00000003 \(PLTGOT\) * 0xa0000
  0x70000001 \(MIPS_RLD_VERSION\) * 1
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.ad b/ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.ad
index e14a2d3..4547220 100644
--- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.ad
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-4b.ad
@@ -8,6 +8,7 @@ Dynamic section at offset .* contains .*:
  0x0000000a \(STRSZ\) .*
  0x0000000b \(SYMENT\) .*
  0x70000016 \(MIPS_RLD_MAP\) * 0x80000
+ 0x70000035 \(MIPS_RLD_MAP2\) * 0x3dfc8
  0x00000015 \(DEBUG\) * 0x0
  0x00000003 \(PLTGOT\) * 0xa0000
  0x00000011 \(REL\) * 0x43000
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-5b.ad b/ld/testsuite/ld-mips-elf/pic-and-nonpic-5b.ad
index d7a672f..f40c09b 100644
--- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-5b.ad
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-5b.ad
@@ -9,6 +9,7 @@ Dynamic section at offset .* contains .*:
  0x0000000a \(STRSZ\) .*
  0x0000000b \(SYMENT\) .*
  0x70000016 \(MIPS_RLD_MAP\) * 0x80000
+ 0x70000035 \(MIPS_RLD_MAP2\) * 0x3dfc0
  0x00000015 \(DEBUG\) * 0x0
  0x00000016 \(TEXTREL\) * 0x0
  0x00000003 \(PLTGOT\) * 0xa0000
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.ad b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.ad
index 5df3c6c..c783085 100644
--- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.ad
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n32.ad
@@ -8,6 +8,7 @@ Dynamic section at offset .* contains .*:
  0x0000000a \(STRSZ\) .*
  0x0000000b \(SYMENT\) .*
  0x70000016 \(MIPS_RLD_MAP\) * 0x80000
+ 0x70000035 \(MIPS_RLD_MAP2\) * 0x3dfc8
  0x00000015 \(DEBUG\) * 0x0
  0x00000003 \(PLTGOT\) * 0xa0000
  0x00000011 \(REL\) * 0x43000
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.ad b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.ad
index d8fc300..714324e 100644
--- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.ad
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-n64.ad
@@ -8,6 +8,7 @@ Dynamic section at offset .* contains .*:
  0x0+0000000a \(STRSZ\) .*
  0x0+0000000b \(SYMENT\) .*
  0x0+70000016 \(MIPS_RLD_MAP\) * 0x80000
+ 0x0+70000035 \(MIPS_RLD_MAP2\) * 0x3df90
  0x0+00000015 \(DEBUG\) * 0x0
  0x0+00000003 \(PLTGOT\) * 0xa0000
  0x0+00000011 \(REL\) * 0x43000
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.ad b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.ad
index 5df3c6c..c783085 100644
--- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.ad
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-6-o32.ad
@@ -8,6 +8,7 @@ Dynamic section at offset .* contains .*:
  0x0000000a \(STRSZ\) .*
  0x0000000b \(SYMENT\) .*
  0x70000016 \(MIPS_RLD_MAP\) * 0x80000
+ 0x70000035 \(MIPS_RLD_MAP2\) * 0x3dfc8
  0x00000015 \(DEBUG\) * 0x0
  0x00000003 \(PLTGOT\) * 0xa0000
  0x00000011 \(REL\) * 0x43000
diff --git a/ld/testsuite/ld-mips-elf/pie-n32.d b/ld/testsuite/ld-mips-elf/pie-n32.d
new file mode 100644
index 0000000..eb0a6e1
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/pie-n32.d
@@ -0,0 +1,23 @@
+#source: pie.s
+#as: -march=from-abi -mabi=n32 -EB
+#ld: -melf32btsmipn32 -pie
+#readelf: -d
+
+Dynamic section at offset 0x180 contains 16 entries:
+  Tag * Type * Name/Value
+ 0x00000004 \(HASH\) * 0x228
+ 0x00000005 \(STRTAB\) * 0x304
+ 0x00000006 \(SYMTAB\) * 0x264
+ 0x0000000a \(STRSZ\) * 72 \(bytes\)
+ 0x0000000b \(SYMENT\) * 16 \(bytes\)
+ 0x70000035 \(MIPS_RLD_MAP2\) * 0x101b8
+ 0x00000015 \(DEBUG\) * 0x0
+ 0x00000003 \(PLTGOT\) * 0x10370
+ 0x70000001 \(MIPS_RLD_VERSION\) * 1
+ 0x70000005 \(MIPS_FLAGS\) * NOTPOT
+ 0x70000006 \(MIPS_BASE_ADDRESS\) * 0x0
+ 0x7000000a \(MIPS_LOCAL_GOTNO\) * 2
+ 0x70000011 \(MIPS_SYMTABNO\) * 10
+ 0x70000012 \(MIPS_UNREFEXTNO\) * 13
+ 0x70000013 \(MIPS_GOTSYM\) * 0xa
+ 0x00000000 \(NULL\) * 0x0
diff --git a/ld/testsuite/ld-mips-elf/pie-n64.d b/ld/testsuite/ld-mips-elf/pie-n64.d
new file mode 100644
index 0000000..714065c
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/pie-n64.d
@@ -0,0 +1,23 @@
+#source: pie.s
+#as: -march=from-abi -mabi=64 -EB
+#ld: -melf64btsmip -pie
+#readelf: -d
+
+Dynamic section at offset 0x208 contains 16 entries:
+  Tag * Type * Name/Value
+ 0x0+00000004 \(HASH\) * 0x358
+ 0x0+00000005 \(STRTAB\) * 0x488
+ 0x0+00000006 \(SYMTAB\) * 0x398
+ 0x0+0000000a \(STRSZ\) * 72 \(bytes\)
+ 0x0+0000000b \(SYMENT\) * 24 \(bytes\)
+ 0x0+70000035 \(MIPS_RLD_MAP2\) * 0x102a8
+ 0x0+00000015 \(DEBUG\) * 0x0
+ 0x0+00000003 \(PLTGOT\) * 0x10510
+ 0x0+70000001 \(MIPS_RLD_VERSION\) * 1
+ 0x0+70000005 \(MIPS_FLAGS\) * NOTPOT
+ 0x0+70000006 \(MIPS_BASE_ADDRESS\) * 0x0
+ 0x0+7000000a \(MIPS_LOCAL_GOTNO\) * 2
+ 0x0+70000011 \(MIPS_SYMTABNO\) * 10
+ 0x0+70000012 \(MIPS_UNREFEXTNO\) * 13
+ 0x0+70000013 \(MIPS_GOTSYM\) * 0xa
+ 0x0+00000000 \(NULL\) * 0x0
diff --git a/ld/testsuite/ld-mips-elf/pie-o32.d b/ld/testsuite/ld-mips-elf/pie-o32.d
new file mode 100644
index 0000000..fcb4d77
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/pie-o32.d
@@ -0,0 +1,23 @@
+#source: pie.s
+#as: -mabi=32 -EB
+#ld: -melf32btsmip -pie
+#readelf: -d
+
+Dynamic section at offset 0x178 contains 16 entries:
+  Tag * Type * Name/Value
+ 0x00000004 \(HASH\) * 0x220
+ 0x00000005 \(STRTAB\) * 0x2fc
+ 0x00000006 \(SYMTAB\) * 0x25c
+ 0x0000000a \(STRSZ\) * 72 \(bytes\)
+ 0x0000000b \(SYMENT\) * 16 \(bytes\)
+ 0x70000035 \(MIPS_RLD_MAP2\) * 0x101c0
+ 0x00000015 \(DEBUG\) * 0x0
+ 0x00000003 \(PLTGOT\) * 0x10370
+ 0x70000001 \(MIPS_RLD_VERSION\) * 1
+ 0x70000005 \(MIPS_FLAGS\) * NOTPOT
+ 0x70000006 \(MIPS_BASE_ADDRESS\) * 0x0
+ 0x7000000a \(MIPS_LOCAL_GOTNO\) * 2
+ 0x70000011 \(MIPS_SYMTABNO\) * 10
+ 0x70000012 \(MIPS_UNREFEXTNO\) * 13
+ 0x70000013 \(MIPS_GOTSYM\) * 0xa
+ 0x00000000 \(NULL\) * 0x0
diff --git a/ld/testsuite/ld-mips-elf/pie.s b/ld/testsuite/ld-mips-elf/pie.s
new file mode 100644
index 0000000..c7f2b20
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/pie.s
@@ -0,0 +1,6 @@
+	.abicalls
+	.global	__start
+	.ent	__start
+__start:
+	jr $31
+	.end	__start
diff --git a/ld/testsuite/ld-mips-elf/tlsdyn-o32-1.d b/ld/testsuite/ld-mips-elf/tlsdyn-o32-1.d
index ca52d8b..6b8f96c 100644
--- a/ld/testsuite/ld-mips-elf/tlsdyn-o32-1.d
+++ b/ld/testsuite/ld-mips-elf/tlsdyn-o32-1.d
@@ -5,7 +5,7 @@ Disassembly of section .text:
 
 .* <__start>:
   .*:	3c1c0fc0 	lui	gp,0xfc0
-  .*:	279c7c40 	addiu	gp,gp,31808
+  .*:	279c7c30 	addiu	gp,gp,31792
   .*:	0399e021 	addu	gp,gp,t9
   .*:	27bdfff0 	addiu	sp,sp,-16
   .*:	afbe0008 	sw	s8,8\(sp\)
@@ -55,7 +55,7 @@ Disassembly of section .text:
 
 .* <other>:
   .*:	3c1c0fc0 	lui	gp,0xfc0
-  .*:	279c7b80 	addiu	gp,gp,31616
+  .*:	279c7b70 	addiu	gp,gp,31600
   .*:	0399e021 	addu	gp,gp,t9
   .*:	27bdfff0 	addiu	sp,sp,-16
   .*:	afbe0008 	sw	s8,8\(sp\)
diff --git a/ld/testsuite/ld-mips-elf/tlsdyn-o32-1.got b/ld/testsuite/ld-mips-elf/tlsdyn-o32-1.got
index 163aeb5..1dbcab4 100644
--- a/ld/testsuite/ld-mips-elf/tlsdyn-o32-1.got
+++ b/ld/testsuite/ld-mips-elf/tlsdyn-o32-1.got
@@ -13,6 +13,6 @@ OFFSET   TYPE              VALUE
 
 
 Contents of section .got:
- 10000020 00000000 80000000 0040047c 00000000  ................
+ 10000020 00000000 80000000 0040048c 00000000  .........@......
  10000030 00000000 00000000 00000000 00000000  ................
  10000040 00000000 00000001 00000000           ............    
diff --git a/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.d b/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.d
index ca52d8b..6b8f96c 100644
--- a/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.d
+++ b/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.d
@@ -5,7 +5,7 @@ Disassembly of section .text:
 
 .* <__start>:
   .*:	3c1c0fc0 	lui	gp,0xfc0
-  .*:	279c7c40 	addiu	gp,gp,31808
+  .*:	279c7c30 	addiu	gp,gp,31792
   .*:	0399e021 	addu	gp,gp,t9
   .*:	27bdfff0 	addiu	sp,sp,-16
   .*:	afbe0008 	sw	s8,8\(sp\)
@@ -55,7 +55,7 @@ Disassembly of section .text:
 
 .* <other>:
   .*:	3c1c0fc0 	lui	gp,0xfc0
-  .*:	279c7b80 	addiu	gp,gp,31616
+  .*:	279c7b70 	addiu	gp,gp,31600
   .*:	0399e021 	addu	gp,gp,t9
   .*:	27bdfff0 	addiu	sp,sp,-16
   .*:	afbe0008 	sw	s8,8\(sp\)
diff --git a/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.got b/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.got
index 80e9148..fb50635 100644
--- a/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.got
+++ b/ld/testsuite/ld-mips-elf/tlsdyn-o32-2.got
@@ -13,6 +13,6 @@ OFFSET   TYPE              VALUE
 
 
 Contents of section .got:
- 10000020 00000000 80000000 0040047c 00000000  .*
+ 10000020 00000000 80000000 0040048c 00000000  .*
  10000030 00000000 00000000 00000000 00000000  .*
  10000040 00000000 00000001 00000000           .*
diff --git a/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.d b/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.d
index 78eb882..758a4f2 100644
--- a/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.d
+++ b/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.d
@@ -5,7 +5,7 @@ Disassembly of section .text:
 
 .* <other>:
   .*:	3c1c0fc0 	lui	gp,0xfc0
-  .*:	279c7c40 	addiu	gp,gp,31808
+  .*:	279c7c30 	addiu	gp,gp,31792
   .*:	0399e021 	addu	gp,gp,t9
   .*:	27bdfff0 	addiu	sp,sp,-16
   .*:	afbe0008 	sw	s8,8\(sp\)
@@ -51,7 +51,7 @@ Disassembly of section .text:
 
 .* <__start>:
   .*:	3c1c0fc0 	lui	gp,0xfc0
-  .*:	279c7b90 	addiu	gp,gp,31632
+  .*:	279c7b80 	addiu	gp,gp,31616
   .*:	0399e021 	addu	gp,gp,t9
   .*:	27bdfff0 	addiu	sp,sp,-16
   .*:	afbe0008 	sw	s8,8\(sp\)
diff --git a/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.got b/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.got
index a1191e7..4a97099 100644
--- a/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.got
+++ b/ld/testsuite/ld-mips-elf/tlsdyn-o32-3.got
@@ -13,6 +13,6 @@ OFFSET   TYPE              VALUE
 
 
 Contents of section .got:
- 10000020 00000000 80000000 0040052c 00000000  .*
+ 10000020 00000000 80000000 0040053c 00000000  .*
  10000030 00000000 00000000 00000000 00000000  .*
  10000040 00000000 00000001 00000000           .*
diff --git a/ld/testsuite/ld-mips-elf/tlsdyn-o32.d b/ld/testsuite/ld-mips-elf/tlsdyn-o32.d
index 699035b..ea50960 100644
--- a/ld/testsuite/ld-mips-elf/tlsdyn-o32.d
+++ b/ld/testsuite/ld-mips-elf/tlsdyn-o32.d
@@ -5,7 +5,7 @@ Disassembly of section .text:
 
 .* <__start>:
   .*:	3c1c0fc0 	lui	gp,0xfc0
-  .*:	279c7bf0 	addiu	gp,gp,31728
+  .*:	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-o32.got b/ld/testsuite/ld-mips-elf/tlsdyn-o32.got
index a1587a6..7942188 100644
--- a/ld/testsuite/ld-mips-elf/tlsdyn-o32.got
+++ b/ld/testsuite/ld-mips-elf/tlsdyn-o32.got
@@ -13,6 +13,6 @@ OFFSET   TYPE              VALUE
 
 
 Contents of section .got:
- 10000020 00000000 80000000 004004cc 00000000  ................
+ 10000020 00000000 80000000 004004dc 00000000  .........@......
  10000030 00000000 00000000 00000001 00000000  ................
  10000040 00000000 00000000 00000000           ............    
-- 
2.2.1



More information about the Binutils mailing list