[PATCH] D30229: [MC] Mark sections whose names starts with .text as AX
Petr Hosek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 21 15:07:36 PST 2017
phosek created this revision.
This matches the behavior of GAS which some projects already on.
Repository:
rL LLVM
https://reviews.llvm.org/D30229
Files:
lib/MC/MCParser/ELFAsmParser.cpp
test/MC/ELF/section.s
Index: test/MC/ELF/section.s
===================================================================
--- test/MC/ELF/section.s
+++ test/MC/ELF/section.s
@@ -215,3 +215,20 @@
// CHECK-NEXT: Size:
// CHECK-NEXT: Link: 22
// CHECK-NEXT: Info: 0
+
+.section .text.foo
+// CHECK: Section {
+// CHECK: Name: .text.foo
+// CHECK-NEXT: Type: SHT_PROGBITS
+// CHECK-NEXT: Flags [
+// CHECK-NEXT: SHF_ALLOC
+// CHECK-NEXT: SHF_EXECINSTR
+// CHECK-NEXT: ]
+// CHECK-NEXT: Address: 0x0
+// CHECK-NEXT: Offset:
+// CHECK-NEXT: Size: 0
+// CHECK-NEXT: Link: 0
+// CHECK-NEXT: Info: 0
+// CHECK-NEXT: AddressAlignment: 1
+// CHECK-NEXT: EntrySize: 0
+// CHECK-NEXT: }
Index: lib/MC/MCParser/ELFAsmParser.cpp
===================================================================
--- lib/MC/MCParser/ELFAsmParser.cpp
+++ lib/MC/MCParser/ELFAsmParser.cpp
@@ -488,6 +488,8 @@
Flags |= ELF::SHF_ALLOC;
if (SectionName == ".fini" || SectionName == ".init")
Flags |= ELF::SHF_EXECINSTR;
+ if (SectionName.startswith(".text"))
+ Flags |= ELF::SHF_EXECINSTR | ELF::SHF_ALLOC;
if (getLexer().is(AsmToken::Comma)) {
Lex();
@@ -565,6 +567,8 @@
Type = ELF::SHT_FINI_ARRAY;
else if (SectionName == ".preinit_array")
Type = ELF::SHT_PREINIT_ARRAY;
+ else if (SectionName.startswith(".text"))
+ Type = ELF::SHT_PROGBITS;
} else {
if (TypeName == "init_array")
Type = ELF::SHT_INIT_ARRAY;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30229.89289.patch
Type: text/x-patch
Size: 1505 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170221/703c46ab/attachment.bin>
More information about the llvm-commits
mailing list