From c601a48e24f18fea3dc548c66b1d6b22030d1b2e Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Sat, 7 Jan 2017 20:25:24 +0000 Subject: [PATCH] [llvm, PowerPC] Allow Quoted symbol names. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Darwin needs quoted symbols to cater for Objective C as a minimum. It’s also necessary to support assembling the output from Apple GCC-4.2.1. --- .../Target/PowerPC/AsmParser/PPCAsmParser.cpp | 1 + .../MC/PowerPC/darwin-accept-quoted-symbols.s | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 llvm/test/MC/PowerPC/darwin-accept-quoted-symbols.s diff --git a/llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp b/llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp index 56307a84f2e..04c11950285 100644 --- a/llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp +++ b/llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp @@ -1628,6 +1628,7 @@ bool PPCAsmParser::ParseOperand(OperandVector &Operands) { case AsmToken::Dollar: case AsmToken::Exclaim: case AsmToken::Tilde: + case AsmToken::String: // Note that non-register-name identifiers from the compiler will begin // with '_', 'L'/'l' or '"'. Of course, handwritten asm could include // identifiers like r31foo - so we fall through in the event that parsing diff --git a/llvm/test/MC/PowerPC/darwin-accept-quoted-symbols.s b/llvm/test/MC/PowerPC/darwin-accept-quoted-symbols.s new file mode 100644 index 00000000000..e8d8bc9f6fb --- /dev/null +++ b/llvm/test/MC/PowerPC/darwin-accept-quoted-symbols.s @@ -0,0 +1,19 @@ +# RUN: llvm-mc -triple powerpc-darwin --show-encoding %s | \ +# RUN: FileCheck -check-prefix=CHECK %s +# RUN: llvm-mc -triple powerpc64-darwin --show-encoding %s | \ +# RUN: FileCheck -check-prefix=CHECK %s + +# Test that we can parse and produce output for quoted symbols as required. + +# Needed to support Objective-C + b "+[someObject someMethod:]" +# CHECK: fixup A - offset: 0, value: +[someObject someMethod:], kind: fixup_ppc_br24 + +# Needed to support assembly of .s files produced by Apple gcc-4.2.1 + bcl 20, 31, "L000001$pb" +# CHECK: fixup A - offset: 0, value: L000001$pb, kind: fixup_ppc_brcond14 +"L000001$pb": + nop + blr + +# CHECK: blr ; encoding: [0x4e,0x80,0x00,0x20]