[ELF] Fix X86 & X86_64 PLT retpoline padding
authorAndrew Ng <anng.sw@gmail.com>
Thu, 29 Mar 2018 14:03:01 +0000 (14:03 +0000)
committerAndrew Ng <anng.sw@gmail.com>
Thu, 29 Mar 2018 14:03:01 +0000 (14:03 +0000)
commitfe1d346f996f9a7df76073e0cff2ebefdebc18cf
tree526380d2dcfb01d43a3b2f316d0b6c4a4921e9f3
parent790e422be9e0e9b1e8de250819fcfae84ae6e42c
[ELF] Fix X86 & X86_64 PLT retpoline padding

The PLT retpoline support for X86 and X86_64 did not include the padding
when writing the header and entries. This issue was revealed when linker
scripts were used, as this disables the built-in behaviour of filling
the last page of executable segments with trap instructions. This
particular behaviour was hiding the missing padding.

Added retpoline tests with linker scripts.

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

llvm-svn: 328777
lld/ELF/Arch/X86.cpp
lld/ELF/Arch/X86_64.cpp
lld/test/ELF/i386-retpoline-nopic-linkerscript.s [new file with mode: 0644]
lld/test/ELF/i386-retpoline-pic-linkerscript.s [new file with mode: 0644]
lld/test/ELF/x86-64-retpoline-linkerscript.s [new file with mode: 0644]
lld/test/ELF/x86-64-retpoline-znow-linkerscript.s [new file with mode: 0644]