Commit 00d68c38 authored by Qiu Chaofan's avatar Qiu Chaofan
Browse files

[PowerPC] Support parsing GNU attributes in MC

This patch is the first step to enable support of GNU attribute in LLVM
PowerPC, enabling it for PowerPC targets, otherwise llvm-mc raises error
when seeing the attribute section.

Reviewed By: jsji

Differential Revision:
parent 8dedf9b5
......@@ -121,6 +121,7 @@ class PPCAsmParser : public MCTargetAsmParser {
bool ParseDirectiveMachine(SMLoc L);
bool ParseDirectiveAbiVersion(SMLoc L);
bool ParseDirectiveLocalEntry(SMLoc L);
bool ParseGNUAttribute(SMLoc L);
bool MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
OperandVector &Operands, MCStreamer &Out,
......@@ -1605,6 +1606,8 @@ bool PPCAsmParser::ParseDirective(AsmToken DirectiveID) {
else if (IDVal == ".localentry")
else if (IDVal.startswith(".gnu_attribute"))
return true;
return false;
......@@ -1720,7 +1723,16 @@ bool PPCAsmParser::ParseDirectiveLocalEntry(SMLoc L) {
return false;
bool PPCAsmParser::ParseGNUAttribute(SMLoc L) {
int64_t Tag;
int64_t IntegerValue;
if (!getParser().parseGNUAttribute(L, Tag, IntegerValue))
return false;
getParser().getStreamer().emitGNUAttribute(Tag, IntegerValue);
return true;
/// Force static initialization.
extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializePowerPCAsmParser() {
# RUN: llvm-mc -triple powerpc64-unknown-linux-gnu < %s | FileCheck %s
# RUN: llvm-mc -triple powerpc64le-unknown-linux-gnu < %s | FileCheck %s
add 3, 4, 3
.gnu_attribute 4, 13
# CHECK: .gnu_attribute 4, 13
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment