summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/MC/MCAsmInfo.h2
-rw-r--r--llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp4
-rw-r--r--llvm/test/MC/AsmParser/gas-compl-sun-elf.s13
3 files changed, 18 insertions, 1 deletions
diff --git a/llvm/include/llvm/MC/MCAsmInfo.h b/llvm/include/llvm/MC/MCAsmInfo.h
index 3261c483e0d..ce24ffb9744 100644
--- a/llvm/include/llvm/MC/MCAsmInfo.h
+++ b/llvm/include/llvm/MC/MCAsmInfo.h
@@ -215,7 +215,7 @@ protected:
const char *TPRel64Directive = nullptr;
/// This is true if this target uses "Sun Style" syntax for section switching
- /// ("#alloc,#write" etc) instead of the normal ELF syntax (,"a,w") in
+ /// ("#alloc,#write" etc) alongside the normal ELF syntax (,"a,w") in
/// .section directives. Defaults to false.
bool SunStyleELFSectionSwitchSyntax = false;
diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp
index d30d15df3d0..03505c0876a 100644
--- a/llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp
+++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp
@@ -75,6 +75,10 @@ ARMELFMCAsmInfo::ARMELFMCAsmInfo(const Triple &TheTriple) {
UseParensForSymbolVariant = true;
UseIntegratedAssembler = true;
+
+ // The GNU assembler supports Sun style section switching for Arm targets, and
+ // it is used in projects like the Linux kernel.
+ SunStyleELFSectionSwitchSyntax = true;
}
void ARMELFMCAsmInfo::setUseIntegratedAssembler(bool Value) {
diff --git a/llvm/test/MC/AsmParser/gas-compl-sun-elf.s b/llvm/test/MC/AsmParser/gas-compl-sun-elf.s
new file mode 100644
index 00000000000..7934109d343
--- /dev/null
+++ b/llvm/test/MC/AsmParser/gas-compl-sun-elf.s
@@ -0,0 +1,13 @@
+@ RUN: llvm-mc -filetype=obj -triple arm-linux-gnu %s -o - | llvm-readelf --sections | FileCheck %s
+
+@ CHECK: .f1 PROGBITS 00000000 000034 000000 00 A 0 0 1
+.section ".f1", #alloc
+
+@ CHECK: .f2 PROGBITS 00000000 000034 000000 00 W 0 0 1
+.section ".f2", #write
+
+@ CHECK: .f3 PROGBITS 00000000 000034 000000 00 A 0 0 1
+.section ".f3", "a"
+
+@ CHECK: .f4 PROGBITS 00000000 000034 000000 00 W 0 0 1
+.section ".f4", "w"
OpenPOWER on IntegriCloud