Instead of the GNU extension SHF_GNU_RETAIN, Solaris provides equivalent
functionality with SHF_SUNW_NODISCARD. This patch implements the necessary
support.
Tested on sparcv9-sun-solaris2.11, amd64-pc-solaris2.11, and x86_64-pc-linux-gnu.
The patch passes existing tests, although I suspect something might still be missing.
I've inspected elf-retain.o with both Solaris' native elfdump and llvm-readelf to
check that the SHF_SUNW_NODISCARD flag is indeed present.
One caveat is that, unlike Solaris, Illumos and derivatives don't support
SHF_SUNW_NODISCARD. Unfortunately, there's currently no way to distinguish
the two related OSes and the Illumos community barely reacted to my attempts to
reach out to them.
align: