x86-64: Fix TLSDESC relaxation for x32
[deliverable/binutils-gdb.git] / gas / config / tc-i386.c
index 8728725b82d49bb64d169269167a58fa103827bc..87ab43bbce017ed338a388b3e6e8ca7331d0dfa4 100644 (file)
@@ -8713,10 +8713,13 @@ output_insn (void)
 #if defined (OBJ_MAYBE_ELF) || defined (OBJ_ELF)
          /* For x32, add a dummy REX_OPCODE prefix for mov/add with
             R_X86_64_GOTTPOFF relocation so that linker can safely
-            perform IE->LE optimization.  */
+            perform IE->LE optimization.  A dummy REX_OPCODE prefix
+            is also needed for lea with R_X86_64_GOTPC32_TLSDESC
+            relocation for GDesc -> IE/LE optimization.  */
          if (x86_elf_abi == X86_64_X32_ABI
              && i.operands == 2
-             && i.reloc[0] == BFD_RELOC_X86_64_GOTTPOFF
+             && (i.reloc[0] == BFD_RELOC_X86_64_GOTTPOFF
+                 || i.reloc[0] == BFD_RELOC_X86_64_GOTPC32_TLSDESC)
              && i.prefix[REX_PREFIX] == 0)
            add_prefix (REX_OPCODE);
 #endif
This page took 0.023923 seconds and 4 git commands to generate.