Mitigate relocation overflow [part 1 of 2].
authorHan Shen <shenhan@google.com>
Thu, 10 May 2018 20:44:42 +0000 (20:44 +0000)
committerHan Shen <shenhan@google.com>
Thu, 10 May 2018 20:44:42 +0000 (20:44 +0000)
commit6c0881c3cdb18b624c5d8a8411e784fcdca36c1f
treeb32a14d6b91e6bb01c3f68a69ce921c2bcb42500
parent5d95f2782d1ac2eeb7bd3fb8a6a9c0fe9340437c
Mitigate relocation overflow [part 1 of 2].

This CL is to mitigate R_X86_64_PC32 relocation overflow problems for huge binaries that has near 4G allocated sections.

By examining those binaries, there're 2 issues contributes to the problem:
1). huge ".dynsym" and ".dynstr" stands in the way between .rodata and .text
2). _init_array_start/end are placed at 0 if no ".init_array" presents, this causes .text relocation against them become more prone to overflow.

This CL addresses 1st problem (the 2nd will be addressed in another CL.) by assigning a smaller sortrank to .dynsym and .dynstr thus they no longer stand in between.

llvm-svn: 332038
59 files changed:
lld/ELF/Writer.cpp
lld/test/ELF/aarch64-copy.s
lld/test/ELF/aarch64-thunk-pi.s
lld/test/ELF/arm-copy.s
lld/test/ELF/arm-execute-only.s
lld/test/ELF/arm-exidx-shared.s
lld/test/ELF/basic-ppc.s
lld/test/ELF/basic-ppc64.s
lld/test/ELF/dynamic-no-rosegment.s
lld/test/ELF/dynsec-at-beginning.s [new file with mode: 0644]
lld/test/ELF/eh-frame-padding-no-rosegment.s
lld/test/ELF/gc-merge-local-sym.s
lld/test/ELF/gnu-ifunc-dyntags.s
lld/test/ELF/i386-merge.s
lld/test/ELF/i386-retpoline-nopic-linkerscript.s
lld/test/ELF/i386-retpoline-pic-linkerscript.s
lld/test/ELF/linkerscript/addr-zero.test
lld/test/ELF/linkerscript/align-empty.test
lld/test/ELF/linkerscript/dot-is-not-abs.s
lld/test/ELF/linkerscript/emit-reloc.s
lld/test/ELF/linkerscript/expr-sections.test
lld/test/ELF/linkerscript/implicit-program-header.test
lld/test/ELF/linkerscript/locationcountererr2.s
lld/test/ELF/linkerscript/merge-sections-syms.s
lld/test/ELF/linkerscript/merge-sections.s
lld/test/ELF/linkerscript/no-space.s
lld/test/ELF/linkerscript/non-absolute.s
lld/test/ELF/linkerscript/non-absolute2.test
lld/test/ELF/linkerscript/non-alloc.s
lld/test/ELF/linkerscript/orphan-first-cmd.test
lld/test/ELF/linkerscript/out-of-order.s
lld/test/ELF/linkerscript/overlapping-sections.s
lld/test/ELF/linkerscript/sections-sort.s
lld/test/ELF/linkerscript/sort-non-script.s
lld/test/ELF/linkerscript/symbol-only.test
lld/test/ELF/linkerscript/unused-synthetic.s
lld/test/ELF/map-file.s
lld/test/ELF/merge-gc-piece.s
lld/test/ELF/merge-shared-str.s
lld/test/ELF/merge-shared.s
lld/test/ELF/merge-string.s
lld/test/ELF/merge-sym.s
lld/test/ELF/merge-to-non-alloc.s
lld/test/ELF/mips-got-string.s
lld/test/ELF/mips-gp-ext.s
lld/test/ELF/mips-gp-lowest.s
lld/test/ELF/note-noalloc.s
lld/test/ELF/relocation-shared.s
lld/test/ELF/relocation.s
lld/test/ELF/relro-omagic.s
lld/test/ELF/shared.s
lld/test/ELF/sort-norosegment.s
lld/test/ELF/synthetic-got.s
lld/test/ELF/verdef-defaultver.s
lld/test/ELF/verdef.s
lld/test/ELF/verneed.s
lld/test/ELF/version-script-extern.s
lld/test/ELF/x86-64-retpoline-linkerscript.s
lld/test/ELF/x86-64-retpoline-znow-linkerscript.s