]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Don't convert GOTPCREL relocation against large section
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 13 May 2016 17:59:32 +0000 (10:59 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Sun, 15 May 2016 16:30:27 +0000 (09:30 -0700)
Backport from master

bfd/

PR ld/20093
* elf64-x86-64.c (elf_x86_64_convert_load_reloc): Don't convert
GOTPCREL relocation against large section.

ld/

PR ld/20093
* testsuite/ld-x86-64/pr20093-1.d: New file.
* testsuite/ld-x86-64/pr20093-1.s: Likewise.
* testsuite/ld-x86-64/pr20093-2.d: Likewise.
* testsuite/ld-x86-64/pr20093-2.s: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run pr20093-1 and pr20093-2.

bfd/ChangeLog
bfd/elf64-x86-64.c
ld/ChangeLog
ld/testsuite/ld-x86-64/pr20093-1.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr20093-1.s [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr20093-2.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr20093-2.s [new file with mode: 0644]
ld/testsuite/ld-x86-64/x86-64.exp

index e6c147dbfb1dc1eba84e5bc026ca17dc067fb0bf..8fafc2326fac8a1c5e3c323c7f05e3fa30032702 100644 (file)
@@ -1,3 +1,14 @@
+2016-05-15  H.J. Lu  <hongjiu.lu@intel.com>
+
+       Backport from master
+       2016-05-13  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/20093
+       * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Don't convert
+       GOTPCREL relocation against large section.
+
+       * elflink.c (bfd_elf_final_link): Likewise.
+
 2016-05-11  Alan Modra  <amodra@gmail.com>
 
        PR 20060
index 764adc039de3f0e76bbb558c5541c07d0037123a..7261405eaf15783966e483bd7e1cc67b6069cec7 100644 (file)
@@ -3154,6 +3154,11 @@ elf_x86_64_convert_load (bfd *abfd, asection *sec,
            continue;
        }
 
+      /* Don't convert GOTPCREL relocation against large section.  */
+      if (elf_section_data (tsec) !=  NULL
+         && (elf_section_flags (tsec) & SHF_X86_64_LARGE) != 0)
+       continue;
+
       if (tsec->sec_info_type == SEC_INFO_TYPE_MERGE)
        {
          /* At this stage in linking, no SEC_MERGE symbol has been
index c78293b602c65fd389801fb3c19233bf808b3876..f3e2721cd285c2c446c2c9a1bfcbc6585312ca8a 100644 (file)
@@ -1,3 +1,15 @@
+2016-05-15  H.J. Lu  <hongjiu.lu@intel.com>
+
+       Backport from master
+       2016-05-13  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/20093
+       * testsuite/ld-x86-64/pr20093-1.d: New file.
+       * testsuite/ld-x86-64/pr20093-1.s: Likewise.
+       * testsuite/ld-x86-64/pr20093-2.d: Likewise.
+       * testsuite/ld-x86-64/pr20093-2.s: Likewise.
+       * testsuite/ld-x86-64/x86-64.exp: Run pr20093-1 and pr20093-2.
+
 2016-05-11  Alan Modra  <amodra@gmail.com>
 
        PR 20060
diff --git a/ld/testsuite/ld-x86-64/pr20093-1.d b/ld/testsuite/ld-x86-64/pr20093-1.d
new file mode 100644 (file)
index 0000000..de81443
--- /dev/null
@@ -0,0 +1,11 @@
+#as: --64
+#ld: -pie -melf_x86_64
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    48 8b 05 ([0-9a-f]{2} ){4} *    mov    0x[a-f0-9]+\(%rip\),%rax        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
diff --git a/ld/testsuite/ld-x86-64/pr20093-1.s b/ld/testsuite/ld-x86-64/pr20093-1.s
new file mode 100644 (file)
index 0000000..c86a21e
--- /dev/null
@@ -0,0 +1,11 @@
+       .section        .lbss,"aw",@nobits
+foo1:
+       .space 1073741824
+       .space 1073741824
+       .space 1073741824
+       .text
+       .globl  _start
+       .type   _start, @function
+_start:
+       movq    foo1@GOTPCREL(%rip), %rax
+       .size   _start, .-_start
diff --git a/ld/testsuite/ld-x86-64/pr20093-2.d b/ld/testsuite/ld-x86-64/pr20093-2.d
new file mode 100644 (file)
index 0000000..de81443
--- /dev/null
@@ -0,0 +1,11 @@
+#as: --64
+#ld: -pie -melf_x86_64
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    48 8b 05 ([0-9a-f]{2} ){4} *    mov    0x[a-f0-9]+\(%rip\),%rax        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
diff --git a/ld/testsuite/ld-x86-64/pr20093-2.s b/ld/testsuite/ld-x86-64/pr20093-2.s
new file mode 100644 (file)
index 0000000..cfbe9c2
--- /dev/null
@@ -0,0 +1,9 @@
+       .largecomm      foo1,1073741824,32
+       .largecomm      foo2,1073741824,32
+       .largecomm      foo3,1073741824,32
+       .text
+       .globl  _start
+       .type   _start, @function
+_start:
+       movq    foo1@GOTPCREL(%rip), %rax
+       .size   _start, .-_start
index 378c13feb2b626e5e9d557157b19b01b6ccf61a2..ac115316cbab1ae3ceab2792fe9c6d71b131f874 100644 (file)
@@ -247,6 +247,8 @@ run_dump_test "pr14215"
 run_dump_test "pr14207"
 run_dump_test "gotplt1"
 run_dump_test "pie1"
+run_dump_test "pr20093-1"
+run_dump_test "pr20093-2"
 
 if { ![istarget "x86_64-*-linux*"] && ![istarget "x86_64-*-nacl*"]} {
     return