]> granicus.if.org Git - llvm/commitdiff
[IRObjectFile] Handle .weak in RecordStreamer.
authorDavide Italiano <davide@freebsd.org>
Fri, 17 Jun 2016 18:20:14 +0000 (18:20 +0000)
committerDavide Italiano <davide@freebsd.org>
Fri, 17 Jun 2016 18:20:14 +0000 (18:20 +0000)
Differential Revision:  http://reviews.llvm.org/D21476

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273027 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Object/RecordStreamer.cpp
test/Object/X86/nm-bitcodeweak.test [new file with mode: 0644]

index 42dbd3e0c2d886e174b1435c5d6a732f05bb35a8..74d57dee2da19c4f41bdf483181d4e605c755223 100644 (file)
@@ -84,7 +84,7 @@ void RecordStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
 
 bool RecordStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
                                          MCSymbolAttr Attribute) {
-  if (Attribute == MCSA_Global)
+  if (Attribute == MCSA_Global || Attribute == MCSA_Weak)
     markGlobal(*Symbol);
   return true;
 }
diff --git a/test/Object/X86/nm-bitcodeweak.test b/test/Object/X86/nm-bitcodeweak.test
new file mode 100644 (file)
index 0000000..19af95f
--- /dev/null
@@ -0,0 +1,10 @@
+; RUN: llvm-as %s -o=%t1
+; RUN: llvm-nm %t1 | FileCheck %s
+
+; CHECK: T __libc_blah
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-freebsd11.0"
+
+module asm ".weak __libc_blah"
+module asm ".equ __libc_blah, blah"