Commit fd082a66 by Tom de Vries Committed by Tom de Vries

[i386/debug] Fix insn prefix in tls_global_dynamic_64_<mode>

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.

	* gcc.target/i386/pr86257.c: New test.

From-SVN: r262006
parent 4f1c88ae
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> 2018-06-25 Andreas Krebbel <krebbel@linux.ibm.com>
PR C++/86082 PR C++/86082
......
...@@ -14733,7 +14733,18 @@ ...@@ -14733,7 +14733,18 @@
"TARGET_64BIT" "TARGET_64BIT"
{ {
if (!TARGET_X32) 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 output_asm_insn
("lea{q}\t{%E1@tlsgd(%%rip), %%rdi|rdi, %E1@tlsgd[rip]}", operands); ("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) if (TARGET_SUN_TLS || flag_plt || !HAVE_AS_IX86_TLS_GET_ADDR_GOT)
......
2018-06-25 Tom de Vries <tdevries@suse.de>
PR debug/86257
* gcc.target/i386/pr86257.c: New test.
2018-06-25 Andreas Krebbel <krebbel@linux.ibm.com> 2018-06-25 Andreas Krebbel <krebbel@linux.ibm.com>
PR C++/86082 PR C++/86082
......
/* { 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" } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment