Skip to content

Commit b6889f0

Browse files
rorthtru
authored andcommitted
[Sparc] Don't use SunStyleELFSectionSwitchSyntax
As discussed in D85414 <https://reviews.llvm.org/D85414>, two tests currently `FAIL` on Sparc since that backend uses the Sun assembler syntax for the `.section` directive, controlled by `SunStyleELFSectionSwitchSyntax`. Instead of adapting the affected tests, this patch changes that default. The internal assembler still accepts both forms as input, only the output syntax is affected. Current support for the Sun syntax is cursory at best: the built-in assembler cannot even assemble some of the directives emitted by GCC, and the set supported by the Solaris assembler is even larger: SPARC Assembly Language Reference Manual, 3.4 Pseudo-Op Attributes <https://docs.oracle.com/cd/E37838_01/html/E61063/gmabi.html#scrolltoc>. A few Sparc test cases need to be adjusted. At the same time, the patch fixes the failures from D85414 <https://reviews.llvm.org/D85414>. Tested on `sparcv9-sun-solaris2.11`. Differential Revision: https://reviews.llvm.org/D85415 (cherry picked from commit d999348)
1 parent 87c92cd commit b6889f0

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

llvm/lib/MC/MCParser/ELFAsmParser.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,8 +566,7 @@ bool ELFAsmParser::ParseSectionArguments(bool IsPush, SMLoc loc) {
566566
}
567567

568568
if (getLexer().isNot(AsmToken::String)) {
569-
if (!getContext().getAsmInfo()->usesSunStyleELFSectionSwitchSyntax()
570-
|| getLexer().isNot(AsmToken::Hash))
569+
if (getLexer().isNot(AsmToken::Hash))
571570
return TokError("expected string in directive");
572571
extraFlags = parseSunStyleSectionFlags();
573572
} else {

llvm/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ SparcELFMCAsmInfo::SparcELFMCAsmInfo(const Triple &TheTriple) {
4040

4141
ExceptionsType = ExceptionHandling::DwarfCFI;
4242

43-
SunStyleELFSectionSwitchSyntax = true;
4443
UsesELFSectionDirectiveForBSS = true;
4544
}
4645

llvm/test/CodeGen/SPARC/2008-10-10-InlineAsmRegOperand.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
; PR 1557
33

44
target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-f128:128:128"
5-
module asm "\09.section\09\22.ctors\22,#alloc,#write"
6-
module asm "\09.section\09\22.dtors\22,#alloc,#write"
5+
module asm "\09.section\09.ctors,\22aw\22"
6+
module asm "\09.section\09.dtors,\22aw\22"
77

88
define void @frame_dummy() nounwind {
99
entry:

llvm/test/CodeGen/SPARC/constructor.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ entry:
1414
ret void
1515
}
1616

17-
; CTOR: .section .ctors,#alloc,#write
17+
; CTOR: .section .ctors,"aw"
1818
; CTOR-NEXT: .p2align 2
1919
; CTOR-NEXT: .word f
20-
; CTOR-NEXT: .section .ctors.65520,#alloc,#write
20+
; CTOR-NEXT: .section .ctors.65520,"aGw"
2121
; CTOR-NEXT: .p2align 2
2222
; CTOR-NEXT: .word g
2323

24-
; INIT-ARRAY: .section .init_array.15,#alloc,#write
24+
; INIT-ARRAY: .section .init_array.15,"aGw"
2525
; INIT-ARRAY-NEXT: .p2align 2
2626
; INIT-ARRAY-NEXT: .word g
27-
; INIT-ARRAY-NEXT: .section .init_array,#alloc,#write
27+
; INIT-ARRAY-NEXT: .section .init_array,"aw"
2828
; INIT-ARRAY-NEXT: .p2align 2
2929
; INIT-ARRAY-NEXT: .word f

0 commit comments

Comments
 (0)