[PATCH] D50284: [COFF, ARM64] Recognize the .hidden directive

Mandeep Singh Grang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 3 17:04:10 PDT 2018


mgrang created this revision.
mgrang added reviewers: rnk, mstorsjo, haripul, TomTan.
Herald added a reviewer: javed.absar.
Herald added subscribers: chrib, kristof.beyls.

Repository:
  rL LLVM

https://reviews.llvm.org/D50284

Files:
  lib/MC/MCParser/COFFAsmParser.cpp
  test/MC/AArch64/coff-gas-directives.s


Index: test/MC/AArch64/coff-gas-directives.s
===================================================================
--- /dev/null
+++ test/MC/AArch64/coff-gas-directives.s
@@ -0,0 +1,15 @@
+// RUN: llvm-mc -filetype=obj -triple aarch64-windows %s \
+// RUN: | llvm-readobj -t | FileCheck %s
+
+  .hidden foo1
+foo1:
+
+// CHECK:   Symbol {
+// CHECK:     Name: foo1
+// CHECK-NEXT:     Value: 0
+// CHECK-NEXT:     Section: .text (1)
+// CHECK-NEXT:     BaseType: Null (0x0)
+// CHECK-NEXT:     ComplexType: Null (0x0)
+// CHECK-NEXT:     StorageClass: Static (0x3)
+// CHECK-NEXT:     AuxSymbolCount: 0
+// CHECK-NEXT:   }
Index: lib/MC/MCParser/COFFAsmParser.cpp
===================================================================
--- lib/MC/MCParser/COFFAsmParser.cpp
+++ lib/MC/MCParser/COFFAsmParser.cpp
@@ -99,6 +99,8 @@
     addDirectiveHandler<&COFFAsmParser::ParseSEHDirectiveEndProlog>(
                                                             ".seh_endprologue");
     addDirectiveHandler<&COFFAsmParser::ParseDirectiveSymbolAttribute>(".weak");
+    addDirectiveHandler<&COFFAsmParser::ParseDirectiveSymbolAttribute>(
+                                                            ".hidden");
   }
 
   bool ParseSectionDirectiveText(StringRef, SMLoc) {
@@ -285,10 +287,11 @@
 }
 
 /// ParseDirectiveSymbolAttribute
-///  ::= { ".weak", ... } [ identifier ( , identifier )* ]
+///  ::= { ".weak", ".hidden", ... } [ identifier ( , identifier )* ]
 bool COFFAsmParser::ParseDirectiveSymbolAttribute(StringRef Directive, SMLoc) {
   MCSymbolAttr Attr = StringSwitch<MCSymbolAttr>(Directive)
     .Case(".weak", MCSA_Weak)
+    .Case(".hidden", MCSA_Hidden)
     .Default(MCSA_Invalid);
   assert(Attr != MCSA_Invalid && "unexpected symbol attribute directive!");
   if (getLexer().isNot(AsmToken::EndOfStatement)) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50284.159135.patch
Type: text/x-patch
Size: 1825 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180804/fbbb81ff/attachment.bin>


More information about the llvm-commits mailing list