[PATCH] D56779: [ELF][X86_64] Fix corrupted LD -> LE optimization for TLS without PLT

Peter Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 16 05:43:32 PST 2019


Lekensteyn created this revision.
Lekensteyn added reviewers: ruiu, grimar.
Herald added subscribers: llvm-commits, arichardson, emaste.
Herald added a reviewer: espindola.

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 at tests for completeness. Those 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


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D56779

Files:
  ELF/Arch/X86_64.cpp
  test/ELF/tls-opt-x86_64-noplt.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56779.182018.patch
Type: text/x-patch
Size: 4264 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190116/9790b694/attachment.bin>


More information about the llvm-commits mailing list