+2018-12-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR gas/23997
+ * config/tc-i386.c (x86_cons): Check for invalid PLT expression.
+ (md_apply_fix): Subtract the PLT relocation size only for jump
+ instructions.
+ * testsuite/gas/i386/reloc32.s: Add test for invalid PLT
+ expression.
+ * testsuite/gas/i386/reloc64.s: Likewise.
+ * testsuite/gas/i386/ilp32/reloc64.s: Likewise.
+ * testsuite/gas/i386/reloc32.l: Updated.
+ * testsuite/gas/i386/reloc64.l: Likewise.
+ * testsuite/gas/i386/ilp32/reloc64.l: Likewise.
+
2018-12-14 H.J. Lu <hongjiu.lu@intel.com>
PR ld/23900
as_bad (_("missing or invalid expression `%s'"), save);
*input_line_pointer = c;
}
+ else if ((got_reloc == BFD_RELOC_386_PLT32
+ || got_reloc == BFD_RELOC_X86_64_PLT32)
+ && exp->X_op != O_symbol)
+ {
+ char c = *input_line_pointer;
+ *input_line_pointer = 0;
+ as_bad (_("invalid PLT expression `%s'"), save);
+ *input_line_pointer = c;
+ }
}
}
else
{
case BFD_RELOC_386_PLT32:
case BFD_RELOC_X86_64_PLT32:
- /* Make the jump instruction point to the address of the operand. At
- runtime we merely add the offset to the actual PLT entry. */
- value = -4;
+ /* Make the jump instruction point to the address of the operand.
+ At runtime we merely add the offset to the actual PLT entry.
+ NB: Subtract the offset size only for jump instructions. */
+ if (fixP->fx_pcrel)
+ value = -4;
break;
case BFD_RELOC_386_TLS_GD:
.*:175: Error: .*
.*:176: Error: .*
.*:177: Error: .*
+.*:189: Error: .*
.quad xtrn - 0x80000000
.long xtrn@got - 4
.long xtrn@got + 4
+bad .long xtrn@plt - .
.*:159: Error: .*
.*:160: Error: .*
.*:161: Error: .*
+.*:164: Error: .*
#pass
bad .byte xtrn@tpoff
.long xtrn@got + 4
.long xtrn@got - 4
+bad .long xtrn@plt - .
.*:218: Error: .*
.*:219: Error: .*
.*:220: Error: .*
+.*:227: Error: .*
mov xtrn(,%ebx), %eax
vgatherdps %xmm2, xtrn(,%xmm1), %xmm0
addr32 vgatherdps %xmm2, xtrn(,%xmm1), %xmm0
+bad .long xtrn@plt - .
+2018-12-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR gas/23997
+ * testsuite/ld-i386/i386.exp: Run PR gas/23997 test.
+ * testsuite/ld-x86-64/x86-64.exp: Likewise.
+ * testsuite/ld-x86-64/pr23997a.s: New file.
+ * testsuite/ld-x86-64/pr23997b.c: Likewise.
+ * testsuite/ld-x86-64/pr23997c.c: Likewise.
+
2018-12-19 H.J. Lu <hongjiu.lu@intel.com>
* testsuite/ld-x86-64/x86-64.exp: Rename PR ld/22842 run-time
"pr22842" \
"pass.out" \
] \
+ [list \
+ "Run pr23997" \
+ "" \
+ "" \
+ { ../ld-x86-64/pr23997a.s ../ld-x86-64/pr23997b.c \
+ ../ld-x86-64/pr23997c.c } \
+ "pr23997" \
+ "pass.out" \
+ ] \
]
if { [at_least_gcc_version 5 0] } {
--- /dev/null
+ .text
+ .p2align 3
+ .globl foo_p
+foo_p:
+ .long foo@plt
+ .section .note.GNU-stack,"",@progbits
--- /dev/null
+#include <stdio.h>
+
+typedef void (*func_t) (void);
+
+extern func_t get_foo (void);
+
+void
+foo (void)
+{
+}
+
+int
+main ()
+{
+ func_t p;
+
+ foo ();
+ p = get_foo ();
+ p ();
+
+ if (foo == p)
+ printf ("PASS\n");
+
+ return 0;
+}
--- /dev/null
+extern int foo_p;
+
+void *
+get_foo (void)
+{
+ return (void *) ((long) &foo_p + foo_p);
+}
"pr22842" \
"pass.out" \
] \
+ [list \
+ "Run pr23997" \
+ "" \
+ "" \
+ { pr23997a.s pr23997b.c pr23997c.c } \
+ "pr23997" \
+ "pass.out" \
+ ] \
]
# Run-time tests which require working ifunc attribute support.