Order writable executable sections before writable ones.
authorRafael Espindola <rafael.espindola@gmail.com>
Fri, 26 May 2017 17:23:25 +0000 (17:23 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Fri, 26 May 2017 17:23:25 +0000 (17:23 +0000)
commitd23e9267a6a5b82c12c4c53e0f00479926734e3b
tree343794fe5632db4e50551247ee12cb31b08f6d28
parent9932086895ecfae82d7c06f663d6e5b218727fd8
Order writable executable sections before writable ones.

On SPARC, .plt is both writeable and executable. The current way
sections are sorted means that lld puts it after .data/.bss. but it
really needs to be close to .test to make sure branches into .plt
don't overflow. I'd argue that because .bss is supposed to come last
on all architectures, we should change the default sort order such
that writable and executable sections come before sections that are
just writeable. read-only executable sections should still come after
sections that are just read-only of course. This diff makes this
change.

llvm-svn: 304008
lld/ELF/Writer.cpp
lld/test/ELF/amdgpu-globals.s
lld/test/ELF/gc-sections.s
lld/test/ELF/i386-tls-ie-shared.s
lld/test/ELF/linkerscript/sections-constraint.s
lld/test/ELF/relocation-size-shared.s
lld/test/ELF/relocation-size.s
lld/test/ELF/section-layout.s
lld/test/ELF/tls-i686.s