[ELF][X86] Allow PT_LOAD to have overlapping p_offset ranges on EM_386
authorFangrui Song <maskray@google.com>
Tue, 20 Aug 2019 08:43:47 +0000 (08:43 +0000)
committerFangrui Song <maskray@google.com>
Tue, 20 Aug 2019 08:43:47 +0000 (08:43 +0000)
commit9c371309f38cfe1fe1bf52af2e70dd448044e7e2
tree5ee90bc94f17ded6459cd94d6352916cbeb4e69f
parent36848ff8dfb308a284aab9fd2da0c0c240d561d1
[ELF][X86] Allow PT_LOAD to have overlapping p_offset ranges on EM_386

Ported the D64906 technique to EM_386.

If `sh_addralign(.tdata) < sh_addralign(.tbss)`,
we can potentially make `p_vaddr(PT_TLS)%p_align(PT_TLS) != 0`.

ld.so that are known to have problems if p_vaddr%p_align!=0:

* FreeBSD 13.0-CURRENT rtld-elf
* glibc https://sourceware.org/bugzilla/show_bug.cgi?id=24606

New test i386-tls-vaddr-align.s checks our workaround makes p_vaddr%p_align = 0.

Reviewed By: ruiu

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

llvm-svn: 369347
34 files changed:
lld/ELF/Writer.cpp
lld/test/ELF/basic-i386.s
lld/test/ELF/dynamic-got.s
lld/test/ELF/global-offset-table-position-i386.s
lld/test/ELF/gnu-ifunc-i386.s
lld/test/ELF/gnu-ifunc-noplt-i386.s
lld/test/ELF/gnu-ifunc-plt-i386.s
lld/test/ELF/got-i386.s
lld/test/ELF/got32-i386-pie-rw.s
lld/test/ELF/got32-i386.s
lld/test/ELF/got32x-i386.s
lld/test/ELF/i386-gotoff-shared.s
lld/test/ELF/i386-gotpc-dynamic.s
lld/test/ELF/i386-gotpc.s
lld/test/ELF/i386-merge.s
lld/test/ELF/i386-pc8-pc16-addend.s
lld/test/ELF/i386-relax-reloc.s
lld/test/ELF/i386-retpoline-nopic.s
lld/test/ELF/i386-retpoline-pic.s
lld/test/ELF/i386-tls-dynamic.s
lld/test/ELF/i386-tls-gdiele.s
lld/test/ELF/i386-tls-ie-shared.s
lld/test/ELF/i386-tls-ld-preemptable.s
lld/test/ELF/i386-tls-le.s
lld/test/ELF/i386-tls-opt-iele-nopic.s
lld/test/ELF/i386-tls-opt.s
lld/test/ELF/i386-tls-vaddr-align.s [new file with mode: 0644]
lld/test/ELF/map-file-i686.s
lld/test/ELF/plt-i686.s
lld/test/ELF/relocation-copy-i686.s
lld/test/ELF/relocation-i686.s
lld/test/ELF/shared.s
lld/test/ELF/static-with-export-dynamic.s
lld/test/ELF/undef-with-plt-addr-i686.s