llvm-project/lld/test
Rui Ueyama 9c766d7a39 Fix PLT and GOTPLT entries for 32-bit x86 PIC.
Previously, the code we set to our .plt entries expected that .got
and .got.plt are consecutive in the virtual address space.
Since %ebx points to the last entry of .got for position-independent
code, it assumed that .got is accessible with small negative
displacements and .got.plt are accessible with small positive
displacements.

That assumption was simply wrong. We don't impose any restrictions on
relative layout of .got and .got.plt. As a result, the control is
transferred to a bogus address from .plt at runtime, which resulted in
segfaults.

This patch removes that wrong assumption. We still assume that .got.plt
has a fixed relative address to .got, but we no longer assume that they
are consecutive in memory.

With this change, a "hello world" program compiled with -fPIC works.

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

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

llvm-svn: 299553
2017-04-05 16:01:33 +00:00
..
COFF [COFF] support /ERRORLIMIT option 2017-04-05 00:43:54 +00:00
Driver/Inputs Remove the old ELF linker. 2016-02-28 00:10:58 +00:00
ELF Fix PLT and GOTPLT entries for 32-bit x86 PIC. 2017-04-05 16:01:33 +00:00
Unit Replace hardcoded comment at 'lit.site.cfg.in' 2016-04-16 07:09:39 +00:00
darwin Add the GC commandline options and throw errors if they are used 2016-01-15 17:39:02 +00:00
mach-o Partially revert r287009: Remove trailing whitespace. 2016-11-15 19:09:13 +00:00
CMakeLists.txt Add missing test dependency. 2017-03-01 23:11:58 +00:00
lit.cfg [test] Fix zlib cond when building stand-alone, clean up 2017-02-08 20:08:29 +00:00
lit.site.cfg.in [test] Fix zlib cond when building stand-alone, clean up 2017-02-08 20:08:29 +00:00