+2018-06-25 Tom de Vries <tdevries@suse.de>
+
+ PR debug/86257
+ * config/i386/i386.md (define_insn "*tls_global_dynamic_64_<mode>"):
+ Use data16 instead of .byte for insn prefix.
+
2018-06-25 Andreas Krebbel <krebbel@linux.ibm.com>
PR C++/86082
"TARGET_64BIT"
{
if (!TARGET_X32)
- fputs (ASM_BYTE "0x66\n", asm_out_file);
+ /* The .loc directive has effect for 'the immediately following assembly
+ instruction'. So for a sequence:
+ .loc f l
+ .byte x
+ insn1
+ the 'immediately following assembly instruction' is insn1.
+ We want to emit an insn prefix here, but if we use .byte (as shown in
+ 'ELF Handling For Thread-Local Storage'), a preceding .loc will point
+ inside the insn sequence, rather than to the start. After relaxation
+ of the sequence by the linker, the .loc might point inside an insn.
+ Use data16 prefix instead, which doesn't have this problem. */
+ fputs ("\tdata16", asm_out_file);
output_asm_insn
("lea{q}\t{%E1@tlsgd(%%rip), %%rdi|rdi, %E1@tlsgd[rip]}", operands);
if (TARGET_SUN_TLS || flag_plt || !HAVE_AS_IX86_TLS_GET_ADDR_GOT)
--- /dev/null
+/* { dg-require-effective-target fpic } */
+/* { dg-require-effective-target tls } */
+/* { dg-options "-g -fPIC" } */
+
+__thread int i;
+
+void
+foo(void)
+{
+ i = 0;
+}
+
+/* { dg-final { scan-assembler "data16\[ \t\]*leaq" } } */
+/* { dg-final { scan-assembler-not "\.byte\[ \t\]*0x66\n\[ \t\]*leaq" } } */