Don't generate PLT relocations for now binding

There is no need for PLT relocations with -z now. We can use GOT
relocations, which take less space, instead and replace 16-byte .plt
entres with 8-byte .plt.got entries.

bfd/

	* elf32-i386.c (elf_i386_check_relocs): Create .plt.got section
	for now binding.
	(elf_i386_allocate_dynrelocs): Use .plt.got section for now
	binding.
	* elf64-x86-64.c (elf_x86_64_check_relocs): Create .plt.got
	section for now binding.
	(elf_x86_64_allocate_dynrelocs): Use .plt.got section for now
	binding.

ld/testsuite/

	* ld-i386/i386.exp: Run PR ld/17689 tests with -z now.
	* ld-x86-64/x86-64.exp: Likewise
	* ld-i386/pr17689now.rd: New file.
	* ld-x86-64/pr17689now.rd: Likewise
This commit is contained in:
H.J. Lu
2015-05-16 07:00:21 -07:00
parent 4d18dfad9e
commit 25070364b0
8 changed files with 102 additions and 4 deletions

View File

@@ -1,3 +1,10 @@
2015-05-16 H.J. Lu <hongjiu.lu@intel.com>
* ld-i386/i386.exp: Run PR ld/17689 tests with -z now.
* ld-x86-64/x86-64.exp: Likewise
* ld-i386/pr17689now.rd: New file.
* ld-x86-64/pr17689now.rd: Likewise
2015-05-15 H.J. Lu <hongjiu.lu@intel.com>
PR binutis/18386

View File

@@ -405,6 +405,14 @@ if { [isnative]
{} \
"pr17689.so" \
] \
[list \
"Build pr17689.so with -z now" \
"-shared -Wl,-z,now" \
"-fPIC" \
{ pr17689a.c } \
{{readelf {-Wr} pr17689now.rd}} \
"pr17689now.so" \
] \
[list \
"Build pr17689ver.so" \
"-shared -Wl,--version-script,pr17689a.t" \
@@ -429,6 +437,14 @@ if { [isnative]
{{readelf {-Wr} pr17689.rd}} \
"pr17689" \
] \
[list \
"Build pr17689 with PIE, -z now and GOTOFF" \
"tmpdir/pr17689b.o tmpdir/pr17689.so -pie -Wl,-z,now" \
"" \
{ dummy.c } \
{{readelf {-Wr} pr17689now.rd}} \
"pr17689now" \
] \
[list \
"Build pr17689ver with PIE and GOTOFF" \
"tmpdir/pr17689b.o tmpdir/pr17689ver.so -pie" \
@@ -483,6 +499,14 @@ if { [isnative]
"pr17689" \
"pr17689.out" \
] \
[list \
"Run pr17689 with PIE, -z now and GOTOFF" \
"tmpdir/pr17689b.o tmpdir/pr17689.so -pie -z now" \
"" \
{ dummy.c } \
"pr17689now" \
"pr17689.out" \
] \
[list \
"Run pr17689ver with PIE and GOTOFF" \
"tmpdir/pr17689b.o tmpdir/pr17689ver.so -pie" \

View File

@@ -0,0 +1,4 @@
#failif
#...
[0-9a-f ]+R_386_JUMP_SLOT +0+.*
#...

View File

@@ -0,0 +1,4 @@
#failif
#...
[0-9a-f ]+R_X86_64_JUMP_SLOT +0+ +.*
#...

View File

@@ -439,6 +439,14 @@ if { [isnative] && [which $CC] != 0 } {
{} \
"pr17689.so" \
] \
[list \
"Build pr17689now.so with -z now" \
"-shared -Wl,-z,now" \
"-fPIC" \
{ pr17689a.c } \
{{readelf {-Wr} pr17689now.rd}} \
"pr17689now.so" \
] \
[list \
"Build pr17689 with PIE without -fPIE" \
"tmpdir/pr17689.so -pie" \
@@ -447,6 +455,14 @@ if { [isnative] && [which $CC] != 0 } {
{{readelf {-Wr} pr17689.rd}} \
"pr17689" \
] \
[list \
"Build pr17689 with PIE -z now without -fPIE" \
"tmpdir/pr17689.so -pie -Wl,-z,now" \
"" \
{ pr17689b.S } \
{{readelf {-Wr} pr17689now.rd}} \
"pr17689now" \
] \
[list \
"Build pr17827 with PIE without -fPIE" \
"tmpdir/pr17689.so -pie" \
@@ -493,6 +509,14 @@ if { [isnative] && [which $CC] != 0 } {
"pr17689" \
"pr17689.out" \
] \
[list \
"Run pr17689 with PIE -z now without -fPIE" \
"tmpdir/pr17689.so -pie -z now" \
"" \
{ pr17689b.S } \
"pr17689now" \
"pr17689.out" \
] \
]
if { [istarget "x86_64-*-linux*"] \