[lld] [ELF] Reject certain unknown section types (PR #85173)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 14 09:34:10 PDT 2024
================
@@ -741,6 +741,31 @@ template <class ELFT> void ObjFile<ELFT>::initializeJustSymbols() {
sections.resize(numELFShdrs);
}
+static bool isKnownSpecificSectionType(uint32_t t, uint32_t flags) {
+ if (SHT_LOUSER <= t && t <= SHT_HIUSER && !(flags & SHF_ALLOC))
+ return true;
+ if (SHT_LOOS <= t && t <= SHT_HIOS && !(flags & SHF_OS_NONCONFORMING))
+ return true;
+ switch (config->emachine) {
+ case EM_ARM:
+ return t == SHT_ARM_EXIDX || t == SHT_ARM_ATTRIBUTES;
+ case EM_AARCH64:
+ return t == SHT_AARCH64_MEMTAG_GLOBALS_STATIC;
----------------
MaskRay wrote:
Thanks. Sounds good to allow SHT_AARCH64_ATTRIBUTES as well even if it is unused now.
SHT_AARCH64_AUTH_RELR is for dynamic relocations only, so rejecting it here is fine. The test has a SHT_RELR example.
Shall we just allow all processor-specific relocation types?
https://github.com/llvm/llvm-project/pull/85173
More information about the llvm-commits
mailing list