[llvm] f49e0c8 - [MC] Add section flag 'l' for SHF_X86_64_LARGE
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 14 17:32:30 PDT 2023
Author: Arthur Eubanks
Date: 2023-04-14T17:29:10-07:00
New Revision: f49e0c8d818a863ab70d02eb172ee79c58cf8f8a
URL: https://github.com/llvm/llvm-project/commit/f49e0c8d818a863ab70d02eb172ee79c58cf8f8a
DIFF: https://github.com/llvm/llvm-project/commit/f49e0c8d818a863ab70d02eb172ee79c58cf8f8a.diff
LOG: [MC] Add section flag 'l' for SHF_X86_64_LARGE
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D148358
Added:
Modified:
llvm/lib/MC/MCParser/ELFAsmParser.cpp
llvm/test/MC/ELF/section-flags-unknown.s
llvm/test/MC/ELF/section.s
Removed:
################################################################################
diff --git a/llvm/lib/MC/MCParser/ELFAsmParser.cpp b/llvm/lib/MC/MCParser/ELFAsmParser.cpp
index bb4285289c0b..7db1bae52f8f 100644
--- a/llvm/lib/MC/MCParser/ELFAsmParser.cpp
+++ b/llvm/lib/MC/MCParser/ELFAsmParser.cpp
@@ -339,6 +339,11 @@ static unsigned parseSectionFlags(const Triple &TT, StringRef flagsStr,
case 'G':
flags |= ELF::SHF_GROUP;
break;
+ case 'l':
+ if (TT.getArch() != Triple::x86_64)
+ return -1U;
+ flags |= ELF::SHF_X86_64_LARGE;
+ break;
case 'R':
if (TT.isOSSolaris())
flags |= ELF::SHF_SUNW_NODISCARD;
diff --git a/llvm/test/MC/ELF/section-flags-unknown.s b/llvm/test/MC/ELF/section-flags-unknown.s
index 29fb8bdb878f..90c9185e8bfb 100644
--- a/llvm/test/MC/ELF/section-flags-unknown.s
+++ b/llvm/test/MC/ELF/section-flags-unknown.s
@@ -1,5 +1,6 @@
## Some section flags are processor-specific. Reject them for other targets.
-# RUN: not llvm-mc -triple=x86_64 %s -o /dev/null 2>&1 | FileCheck %s --implicit-check-not=error:
+# REQUIRES: riscv-registered-target
+# RUN: not llvm-mc -triple=riscv32 %s -o /dev/null 2>&1 | FileCheck %s --implicit-check-not=error:
# CHECK: {{.*}}.s:[[# @LINE+1]]:34: error: unknown flag
.section XCORE_SHF_CP_SECTION,"c", at progbits
@@ -12,3 +13,6 @@
# CHECK: {{.*}}.s:[[# @LINE+1]]:30: error: unknown flag
.section SHF_ARM_PURECODE,"y", at progbits
+
+# CHECK: {{.*}}.s:[[# @LINE+1]]:30: error: unknown flag
+.section SHF_X86_64_LARGE,"l", at progbits
diff --git a/llvm/test/MC/ELF/section.s b/llvm/test/MC/ELF/section.s
index b5c7126c83ea..fb0aaadef101 100644
--- a/llvm/test/MC/ELF/section.s
+++ b/llvm/test/MC/ELF/section.s
@@ -268,6 +268,14 @@ bar:
// CHECK-NEXT: SHF_WRITE
// CHECK-NEXT: ]
+.section .large,"l"
+// CHECK: Section {
+// CHECK: Name: .large
+// CHECK-NEXT: Type: SHT_PROGBITS
+// CHECK-NEXT: Flags [
+// CHECK-NEXT: SHF_X86_64_LARGE
+// CHECK-NEXT: ]
+
// Test SHT_LLVM_ODRTAB
.section .odrtab,"e", at llvm_odrtab
More information about the llvm-commits
mailing list