bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gold/17795] Initial-Exec to Local-Exec may change the previous inst


From: hjl.tools at gmail dot com
Subject: [Bug gold/17795] Initial-Exec to Local-Exec may change the previous instruction
Date: Mon, 05 Jan 2015 17:28:33 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=17795

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
The same thing happens with ld.bfd:

address@hidden pr17795]$ make LD=ld.bfd
cc -O2 -c x.s
ld.bfd -o x x.o
objdump -dw x

x:     file format elf64-x86-64


Disassembly of section .text:

00000000004000e8 <_start>:
  4000e8:    64 48 8b 04 25 00 00 00 00     mov    %fs:0x0,%rax
  4000f1:    81 c3 00 00 00 4d        add    $0x4d000000,%ebx
  4000f7:    8d 80 fc ff ff ff        lea    -0x4(%rax),%eax
  4000fd:    c3                       retq   
address@hidden pr17795]$ 

Target_x86_64<size>::Relocate::tls_ie_to_le has

  unsigned char op1 = view[-3];
  unsigned char op2 = view[-2];
  unsigned char op3 = view[-1];
  unsigned char reg = op3 >> 3;

It is safe only if view[-3] is a REX prefix of the current instruction.
However, I can't find a good way to detect if view[-3] is a REX prefix
or the last byte of the previous instruction.  Compilers may have to
always generate a REX prefix even if it isn't needed to encode the
instruction.

-- 
You are receiving this mail because:
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]