llvm-project/lld/ELF/Arch
Peter Wu 5391489674 [ELF][X86_64] Fix corrupted LD -> LE optimization for TLS without PLT
The LD -> LE optimization for Thread-Local Storage without PLT requires
an additional "66" prefix, otherwise the next instruction will be
corrupted, causing runtime misbehavior (crashes) of the linked object.

The other (GD -> IE/LD) optimizations are the same with or without PLT,
but add tests for completeness. The instructions are copied from
https://raw.githubusercontent.com/wiki/hjl-tools/x86-psABI/x86-64-psABI-1.0.pdf#subsection.11.1.2

This does not try to address ILP32 (x32) support.

Fixes https://bugs.llvm.org/show_bug.cgi?id=37303

Reviewed By: ruiu

Differential Revision: https://reviews.llvm.org/D56779

llvm-svn: 351396
2019-01-16 23:28:51 +00:00
..
AArch64.cpp [ELF] - Renamed few more AArch64 specific relocation expressions. NFC. 2018-11-15 15:35:44 +00:00
AMDGPU.cpp [ELF] - Do not fail on R_*_NONE relocations when parsing the debug info. 2018-09-26 08:11:34 +00:00
ARM.cpp [ELF] Fix ARM and Thumb V7PILongThunk overflow behavior. 2019-01-10 16:08:23 +00:00
AVR.cpp [ELF] - Do not fail on R_*_NONE relocations when parsing the debug info. 2018-09-26 08:11:34 +00:00
Hexagon.cpp [ELF][HEXAGON] Let input determine e_flag. 2018-10-15 14:44:52 +00:00
MSP430.cpp TrapInstr must be 4 bytes long. Currently we write two zeros on every two bytes. 2019-01-10 17:45:56 +00:00
Mips.cpp [ELF][MIPS] Use MIPS R6 `sigrie` as a trap instruction 2018-11-16 05:30:47 +00:00
MipsArchTree.cpp [ELF][MIPS] Add mote tests on MipsArchTree routines, fix typos in error messages 2018-07-10 16:51:17 +00:00
PPC.cpp [PPC][PPC64] PPC_REL14 and PPC64_REL14 relocations 2018-12-04 12:26:21 +00:00
PPC64.cpp [PPC64] Fix RelType in checkInt and checkAlignment diagnsotics. 2019-01-10 15:08:02 +00:00
RISCV.cpp Omit "virtual" if overridden. 2018-11-01 20:08:39 +00:00
SPARCV9.cpp [ELF] - Do not fail on R_*_NONE relocations when parsing the debug info. 2018-09-26 08:11:34 +00:00
X86.cpp [ELF] Make TrapInstr and Filler byte arrays. NFC. 2018-11-14 21:05:20 +00:00
X86_64.cpp [ELF][X86_64] Fix corrupted LD -> LE optimization for TLS without PLT 2019-01-16 23:28:51 +00:00