diff options
Diffstat (limited to 'lld/ELF/Writer.cpp')
-rw-r--r-- | lld/ELF/Writer.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index aff04c8432b..344f86fa5ca 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -1228,10 +1228,15 @@ template <class ELFT> void Writer<ELFT>::addStartEndSymbols() { auto Define = [&](StringRef Start, StringRef End, OutputSection *OS) { // These symbols resolve to the image base if the section does not exist. // A special value -1 indicates end of the section. - if (!OS && Config->pic()) - OS = Out::ElfHeader; - addOptionalRegular<ELFT>(Start, OS, 0); - addOptionalRegular<ELFT>(End, OS, OS ? -1 : 0); + if (OS) { + addOptionalRegular<ELFT>(Start, OS, 0); + addOptionalRegular<ELFT>(End, OS, -1); + } else { + if (Config->pic()) + OS = Out::ElfHeader; + addOptionalRegular<ELFT>(Start, OS, 0); + addOptionalRegular<ELFT>(End, OS, 0); + } }; Define("__preinit_array_start", "__preinit_array_end", Out::PreinitArray); |