[PATCH] D44413: FYI: a possible fix for pr36678

Rafael Avila de Espindola via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 12 21:06:33 PDT 2018


espindola created this revision.
espindola added reviewers: ruiu, emaste.
Herald added a subscriber: arichardson.

This is a possible fix for pr36678. Having implemented it I now think there is a better way to do it.

What this does is create special plt entries that don't require ebx to be set.  That way non pic code can be linker into position independent executable.

The problem I see with this patch is that it is a fairly complicated way of supporting a corner case:.

An alternative that might be simpler is using the thunk infrastructure to create thunks that set ebx and jump to the regular plt entry. We would need to make the preempted symbol point to the thunk.

Yet another option is just producing an error in this situation. If someone really want writable code they can use -z text. I will give this a try. Hopefully there are few cases that depend on this and they can be easily fixed (and they would crash right now anyway).


https://reviews.llvm.org/D44413

Files:
  ELF/Arch/X86.cpp
  ELF/Driver.cpp
  ELF/Relocations.cpp
  ELF/Symbols.cpp
  ELF/SyntheticSections.cpp
  ELF/SyntheticSections.h
  ELF/Target.h
  test/ELF/Inputs/i386-pic-plt.s
  test/ELF/i386-pic-plt.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44413.138125.patch
Type: text/x-patch
Size: 14493 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180313/d36bd7c8/attachment.bin>


More information about the llvm-commits mailing list