[ELF][PPC32] Support .got2 in an output section description
authorFangrui Song <i@maskray.me>
Thu, 23 Dec 2021 19:32:44 +0000 (11:32 -0800)
committerFangrui Song <i@maskray.me>
Thu, 23 Dec 2021 19:32:44 +0000 (11:32 -0800)
commitbf45624ba07f8bd65f38db872c89d8c0e4ffd5fe
treef9b66a90d48f6d527bb8d45810e0c9ff09821a8f
parentf103ee2e9e3fc530fbada7cf3db6ca6913a502c1
[ELF][PPC32] Support .got2 in an output section description

I added `PPC32Got2Section` D62464 to support .got2 but did not implement .got2
in another output section.

PR52799 has a linker script placing .got2 in .rodata, which causes a null
pointer dereference because a MergeSyntheticSection's file is nullptr.
Add the support.
lld/ELF/InputFiles.h
lld/ELF/InputSection.cpp
lld/ELF/SyntheticSections.cpp
lld/ELF/Thunks.cpp
lld/test/ELF/linkerscript/ppc32-got2.s [new file with mode: 0644]
lld/test/ELF/ppc32-relocatable-got2.s