[llvm] r324731 - [ELF] Print the .type assembly directive correctly for STT_NOTYPE

Oliver Stannard via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 9 05:34:39 PST 2018


Author: olista01
Date: Fri Feb  9 05:34:39 2018
New Revision: 324731

URL: http://llvm.org/viewvc/llvm-project?rev=324731&view=rev
Log:
[ELF] Print the .type assembly directive correctly for STT_NOTYPE

The llvm assembly parser and gas both accept "@notype" in the .type
assembly directive, but we were printing it as "@no_type", which isn't
accepted by either assembler.

Differential revision: https://reviews.llvm.org/D43116


Added:
    llvm/trunk/test/MC/ARM/type-directive-print.ll
Modified:
    llvm/trunk/lib/MC/MCAsmStreamer.cpp

Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=324731&r1=324730&r2=324731&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Fri Feb  9 05:34:39 2018
@@ -565,7 +565,7 @@ bool MCAsmStreamer::EmitSymbolAttribute(
     case MCSA_ELF_TypeObject:      OS << "object"; break;
     case MCSA_ELF_TypeTLS:         OS << "tls_object"; break;
     case MCSA_ELF_TypeCommon:      OS << "common"; break;
-    case MCSA_ELF_TypeNoType:      OS << "no_type"; break;
+    case MCSA_ELF_TypeNoType:      OS << "notype"; break;
     case MCSA_ELF_TypeGnuUniqueObject: OS << "gnu_unique_object"; break;
     }
     EmitEOL();

Added: llvm/trunk/test/MC/ARM/type-directive-print.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/type-directive-print.ll?rev=324731&view=auto
==============================================================================
--- llvm/trunk/test/MC/ARM/type-directive-print.ll (added)
+++ llvm/trunk/test/MC/ARM/type-directive-print.ll Fri Feb  9 05:34:39 2018
@@ -0,0 +1,17 @@
+; RUN: llc < %s -mtriple=armv7a | FileCheck %s
+
+module asm ".type test_notype, %notype"
+module asm ".type test_function, %function"
+module asm ".type test_object, %object"
+module asm ".type test_common, %common"
+module asm ".type test_tls_object, %tls_object"
+module asm ".type test_gnu_indirect_function, %gnu_indirect_function"
+module asm ".type test_gnu_unique_object, %gnu_unique_object"
+
+; CHECK: .type test_notype,%notype
+; CHECK: .type test_function,%function
+; CHECK: .type test_object,%object
+; CHECK: .type test_common,%common
+; CHECK: .type test_tls_object,%tls_object
+; CHECK: .type test_gnu_indirect_function,%gnu_indirect_function
+; CHECK: .type test_gnu_unique_object,%gnu_unique_object




More information about the llvm-commits mailing list