[ELF] Use SHF_SUNW_NODISCARD instead of SHF_GNU_RETAIN on Solaris
authorRainer Orth <ro@gcc.gnu.org>
Wed, 23 Feb 2022 14:41:43 +0000 (15:41 +0100)
committerRainer Orth <ro@gcc.gnu.org>
Wed, 23 Feb 2022 14:41:43 +0000 (15:41 +0100)
commit42e391e4ca848e152bf8cdb072ed3ca2a394da2b
treefe797810b1e831356e7da7a02c47579dd9b3d4c5
parent03e6efb8c23f489e45353b6b6d941628d9c49ca2
[ELF] Use SHF_SUNW_NODISCARD instead of SHF_GNU_RETAIN on Solaris

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`.

Differential Revision: https://reviews.llvm.org/D107955
llvm/include/llvm/BinaryFormat/ELF.h
llvm/include/llvm/ObjectYAML/ELFYAML.h
llvm/lib/ObjectYAML/ELFYAML.cpp
llvm/test/tools/llvm-readobj/ELF/section-flags-solaris.test [new file with mode: 0644]
llvm/test/tools/obj2yaml/ELF/retain-section.yaml [new file with mode: 0644]
llvm/test/tools/yaml2obj/ELF/retain-section.yaml [new file with mode: 0644]
llvm/tools/llvm-readobj/ELFDumper.cpp