Skip to content

Commit 03de2f8

Browse files
committed
[ARM] Uses "Sun Style" syntax for section switching
Summary: Support "Sun Style" syntax for section switching ("#alloc,#write" etc). https://bugs.llvm.org/show_bug.cgi?id=43759 Reviewers: peter.smith, eli.friedman, kristof.beyls, t.p.northover Reviewed By: peter.smith Subscribers: MaskRay, llozano, manojgupta, nickdesaulniers, kristof.beyls, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D69296
1 parent 171cf53 commit 03de2f8

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

llvm/include/llvm/MC/MCAsmInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ class MCAsmInfo {
215215
const char *TPRel64Directive = nullptr;
216216

217217
/// This is true if this target uses "Sun Style" syntax for section switching
218-
/// ("#alloc,#write" etc) instead of the normal ELF syntax (,"a,w") in
218+
/// ("#alloc,#write" etc) alongside the normal ELF syntax (,"a,w") in
219219
/// .section directives. Defaults to false.
220220
bool SunStyleELFSectionSwitchSyntax = false;
221221

llvm/lib/Target/ARM/MCTargetDesc/ARMMCAsmInfo.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ ARMELFMCAsmInfo::ARMELFMCAsmInfo(const Triple &TheTriple) {
7575
UseParensForSymbolVariant = true;
7676

7777
UseIntegratedAssembler = true;
78+
79+
// The GNU assembler supports Sun style section switching for Arm targets, and
80+
// it is used in projects like the Linux kernel.
81+
SunStyleELFSectionSwitchSyntax = true;
7882
}
7983

8084
void ARMELFMCAsmInfo::setUseIntegratedAssembler(bool Value) {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@ RUN: llvm-mc -filetype=obj -triple arm-linux-gnu %s -o - | llvm-readelf --sections | FileCheck %s
2+
3+
@ CHECK: .f1 PROGBITS 00000000 000034 000000 00 A 0 0 1
4+
.section ".f1", #alloc
5+
6+
@ CHECK: .f2 PROGBITS 00000000 000034 000000 00 W 0 0 1
7+
.section ".f2", #write
8+
9+
@ CHECK: .f3 PROGBITS 00000000 000034 000000 00 A 0 0 1
10+
.section ".f3", "a"
11+
12+
@ CHECK: .f4 PROGBITS 00000000 000034 000000 00 W 0 0 1
13+
.section ".f4", "w"

0 commit comments

Comments
 (0)