[llvm] [MC] Add support for `exclude` flag when parsing sun-style section flags (PR #77267)
Shilei Tian via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 7 19:26:23 PST 2024
https://github.com/shiltian created https://github.com/llvm/llvm-project/pull/77267
Fix #64862.
>From fdea6e0324fef62636b1dc7b0f1ec3159447bb9a Mon Sep 17 00:00:00 2001
From: Shilei Tian <i at tianshilei.me>
Date: Sun, 7 Jan 2024 22:25:50 -0500
Subject: [PATCH] [MC] Add support for `exclude` flag when parsing sun-style
section flags
Fix #64862.
---
llvm/lib/MC/MCParser/ELFAsmParser.cpp | 2 ++
llvm/test/MC/AsmParser/pr64862.s | 4 ++++
2 files changed, 6 insertions(+)
create mode 100644 llvm/test/MC/AsmParser/pr64862.s
diff --git a/llvm/lib/MC/MCParser/ELFAsmParser.cpp b/llvm/lib/MC/MCParser/ELFAsmParser.cpp
index 93e1d2f44b8c56..b22d08dfedce0c 100644
--- a/llvm/lib/MC/MCParser/ELFAsmParser.cpp
+++ b/llvm/lib/MC/MCParser/ELFAsmParser.cpp
@@ -379,6 +379,8 @@ unsigned ELFAsmParser::parseSunStyleSectionFlags() {
flags |= ELF::SHF_WRITE;
else if (flagId == "tls")
flags |= ELF::SHF_TLS;
+ else if (flagId == "exclude")
+ flags |= ELF::SHF_EXCLUDE;
else
return -1U;
diff --git a/llvm/test/MC/AsmParser/pr64862.s b/llvm/test/MC/AsmParser/pr64862.s
new file mode 100644
index 00000000000000..1e0458129d9963
--- /dev/null
+++ b/llvm/test/MC/AsmParser/pr64862.s
@@ -0,0 +1,4 @@
+; RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu gfx1030 %s | FileCheck %s
+
+; CHECK: .section ".linker-options",#exclude
+ .section ".linker-options",#exclude
More information about the llvm-commits
mailing list