From e5eb3e3836a7d5ad86cb6e3ee991600622eb0f82 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sat, 6 Mar 2021 16:26:27 -0800 Subject: [PATCH] [MC] Parse end-of-line for .addrsig & .addrsig_sym --- llvm/lib/MC/MCParser/AsmParser.cpp | 6 ++++-- llvm/test/MC/ELF/addrsig.s | 10 +++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index 0324760aec5d..2d6d060cb25c 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -5782,14 +5782,16 @@ bool AsmParser::parseDirectivePrint(SMLoc DirectiveLoc) { } bool AsmParser::parseDirectiveAddrsig() { + if (parseToken(AsmToken::EndOfStatement)) + return true; getStreamer().emitAddrsig(); return false; } bool AsmParser::parseDirectiveAddrsigSym() { StringRef Name; - if (check(parseIdentifier(Name), - "expected identifier in '.addrsig_sym' directive")) + if (check(parseIdentifier(Name), "expected identifier") || + parseToken(AsmToken::EndOfStatement)) return true; MCSymbol *Sym = getContext().getOrCreateSymbol(Name); getStreamer().emitAddrsigSym(Sym); diff --git a/llvm/test/MC/ELF/addrsig.s b/llvm/test/MC/ELF/addrsig.s index 54abec564a8a..fb0895a1a3ae 100644 --- a/llvm/test/MC/ELF/addrsig.s +++ b/llvm/test/MC/ELF/addrsig.s @@ -70,16 +70,16 @@ // CHECK-NEXT: Sym: (1) // CHECK-NEXT: ] -// ASM: .addrsig +// ASM: .addrsig +// ASM-NEXT: .addrsig_sym g1 .addrsig -// ASM: .addrsig_sym g1 .addrsig_sym g1 .globl g2 -// ASM: .addrsig_sym g3 +// ASM: .addrsig_sym g3 +// ASM-NEXT: .addrsig_sym local +// ASM-NEXT: .addrsig_sym .Llocal .addrsig_sym g3 -// ASM: .addrsig_sym local .addrsig_sym local -// ASM: .addrsig_sym .Llocal .addrsig_sym .Llocal local: