COFF: Layout sections in the same order as link.exe
authorHans Wennborg <hans@hanshq.net>
Wed, 4 Apr 2018 19:15:55 +0000 (19:15 +0000)
committerHans Wennborg <hans@hanshq.net>
Wed, 4 Apr 2018 19:15:55 +0000 (19:15 +0000)
commit9a9fc78744fe949c31eefa4910e7f2f3ed4033fe
tree62f3d36bbb6ae3fbfa435fa6f09894a31d6a962f
parentbccd18b816c0413f63b14ccb77077cced6f033f7
COFF: Layout sections in the same order as link.exe

One place where this seems to matter is to make sure the .rsrc section comes
after .text. The Win32 UpdateResource() function can change the contents of
.rsrc. It will move the sections that come after, but if .text gets moved, the
entry point header will not get updated and the executable breaks. This was
found by a test in Chromium.

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

llvm-svn: 329221
38 files changed:
lld/COFF/Writer.cpp
lld/test/COFF/arm64-relocs-imports.test
lld/test/COFF/armnt-movt32t.test
lld/test/COFF/associative-comdat.s
lld/test/COFF/baserel.test
lld/test/COFF/combined-resources.test
lld/test/COFF/common-alignment.test
lld/test/COFF/common.test
lld/test/COFF/ctors_dtors_priority.s
lld/test/COFF/delayimports-armnt.yaml
lld/test/COFF/delayimports.test
lld/test/COFF/delayimports32.test
lld/test/COFF/export-armnt.yaml
lld/test/COFF/hello32.test
lld/test/COFF/imports.test
lld/test/COFF/loadcfg.ll
lld/test/COFF/loadcfg.test
lld/test/COFF/loadcfg32.test
lld/test/COFF/lto-comdat.ll
lld/test/COFF/lto.ll
lld/test/COFF/manifestinput.test
lld/test/COFF/pdata-arm64.yaml
lld/test/COFF/pdb-comdat.test
lld/test/COFF/pdb-globals.test
lld/test/COFF/pdb-procid-remapping.test
lld/test/COFF/pdb-scopes.test
lld/test/COFF/pdb-source-lines.test
lld/test/COFF/pdb-symbol-types.yaml
lld/test/COFF/pdb-type-server-simple.test
lld/test/COFF/pdb.test
lld/test/COFF/reloc-arm.test
lld/test/COFF/resource.test
lld/test/COFF/safeseh.s
lld/test/COFF/secidx-absolute.s
lld/test/COFF/secrel-common.s
lld/test/COFF/string-tail-merge.s
lld/test/COFF/symtab.test
lld/test/COFF/unwind.test