This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PR ld/17057: Update elf_i386_compute_jump_table_size


Hi,

Commit e1f987424b7b3f5ac63a2a6ae044a202a44b8ff8 changed how
next_tls_desc_index was set up.  This patch updates
elf_i386_compute_jump_table_size to use elf.srelplt->reloc_count
instead of next_tls_desc_index.  I checked it into master.


H.J.
---
bfd/

	PR ld/17057
	* elf32-i386.c (elf_i386_compute_jump_table_size): Replace
	next_tls_desc_index with elf.srelplt->reloc_count.

ld/testsuite/

	PR ld/17057
	* ld-i386/i386.exp: Run pr17057.
	* ld-i386/pr17057.d: New file.
	* ld-i386/pr17057.s: Likewise.
---
 bfd/ChangeLog                  | 6 ++++++
 bfd/elf32-i386.c               | 2 +-
 ld/testsuite/ChangeLog         | 7 +++++++
 ld/testsuite/ld-i386/i386.exp  | 1 +
 ld/testsuite/ld-i386/pr17057.d | 9 +++++++++
 ld/testsuite/ld-i386/pr17057.s | 3 +++
 6 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 ld/testsuite/ld-i386/pr17057.d
 create mode 100644 ld/testsuite/ld-i386/pr17057.s

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 96f85f7..1ecacdd 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2014-07-15  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/17057
+	* elf32-i386.c (elf_i386_compute_jump_table_size): Replace
+	next_tls_desc_index with elf.srelplt->reloc_count.
+
 2014-07-15  Alan Modra  <amodra@gmail.com>
 
 	* cache.c (cache_bread_1): Don't return -1 when fread returns
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 551d179..2244c6c 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -826,7 +826,7 @@ struct elf_i386_link_hash_table
   == I386_ELF_DATA ? ((struct elf_i386_link_hash_table *) ((p)->hash)) : NULL)
 
 #define elf_i386_compute_jump_table_size(htab) \
-  ((htab)->next_tls_desc_index * 4)
+  ((htab)->elf.srelplt->reloc_count * 4)
 
 /* Create an entry in an i386 ELF linker hash table.  */
 
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index fbc9862..7c81ddf 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2014-07-15  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/17057
+	* ld-i386/i386.exp: Run pr17057.
+	* ld-i386/pr17057.d: New file.
+	* ld-i386/pr17057.s: Likewise.
+
 2014-07-15  Jiong Wang  <jiong.wang@arm.com>
 
 	* ld-aarch64/emit-relocs-local-addend.d: Use target linker script.
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index 04c399b..4d22182 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -254,3 +254,4 @@ run_dump_test "compressed1"
 run_dump_test "pr12627"
 run_dump_test "pr13302"
 run_dump_test "pr14215"
+run_dump_test "pr17057"
diff --git a/ld/testsuite/ld-i386/pr17057.d b/ld/testsuite/ld-i386/pr17057.d
new file mode 100644
index 0000000..29cc676
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr17057.d
@@ -0,0 +1,9 @@
+#name: PR ld/17057
+#as: --32
+#ld: -shared -melf_i386
+#readelf: -r --wide
+
+Relocation section '.rel.plt' at offset 0x[0-9a-f]+ contains 2 entries:
+ Offset     Info    Type                Sym. Value  Symbol's Name
+[0-9a-f ]+R_386_JUMP_SLOT +0+ +foo
+[0-9a-f ]+R_386_TLS_DESC +0+ +my_tls
diff --git a/ld/testsuite/ld-i386/pr17057.s b/ld/testsuite/ld-i386/pr17057.s
new file mode 100644
index 0000000..a4e00ec
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr17057.s
@@ -0,0 +1,3 @@
+	.text
+	leal	my_tls@TLSDESC(%ebx), %eax
+	call	foo@PLT
-- 
1.9.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]