[llvm] r281629 - [IRObjectFile] Handle undefined weak symbols in RecordStreamer.
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 15 10:54:23 PDT 2016
Author: davide
Date: Thu Sep 15 12:54:22 2016
New Revision: 281629
URL: http://llvm.org/viewvc/llvm-project?rev=281629&view=rev
Log:
[IRObjectFile] Handle undefined weak symbols in RecordStreamer.
Differential Revision: https://reviews.llvm.org/D24594
Added:
llvm/trunk/test/Object/X86/nm-undefinedweak.test
- copied, changed from r281517, llvm/trunk/test/Object/X86/nm-bitcodeweak.test
Modified:
llvm/trunk/lib/Object/IRObjectFile.cpp
llvm/trunk/lib/Object/RecordStreamer.cpp
llvm/trunk/lib/Object/RecordStreamer.h
llvm/trunk/test/Object/X86/nm-bitcodeweak.test
Modified: llvm/trunk/lib/Object/IRObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/IRObjectFile.cpp?rev=281629&r1=281628&r2=281629&view=diff
==============================================================================
--- llvm/trunk/lib/Object/IRObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/IRObjectFile.cpp Thu Sep 15 12:54:22 2016
@@ -113,10 +113,13 @@ void IRObjectFile::CollectAsmUndefinedRe
Res |= BasicSymbolRef::SF_Undefined;
Res |= BasicSymbolRef::SF_Global;
break;
- case RecordStreamer::GlobalWeak:
+ case RecordStreamer::DefinedWeak:
Res |= BasicSymbolRef::SF_Weak;
Res |= BasicSymbolRef::SF_Global;
break;
+ case RecordStreamer::UndefinedWeak:
+ Res |= BasicSymbolRef::SF_Weak;
+ Res |= BasicSymbolRef::SF_Undefined;
}
AsmUndefinedRefs(Key, BasicSymbolRef::Flags(Res));
}
Modified: llvm/trunk/lib/Object/RecordStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/RecordStreamer.cpp?rev=281629&r1=281628&r2=281629&view=diff
==============================================================================
--- llvm/trunk/lib/Object/RecordStreamer.cpp (original)
+++ llvm/trunk/lib/Object/RecordStreamer.cpp Thu Sep 15 12:54:22 2016
@@ -23,8 +23,10 @@ void RecordStreamer::markDefined(const M
case Used:
S = Defined;
break;
- case GlobalWeak:
+ case DefinedWeak:
break;
+ case UndefinedWeak:
+ S = DefinedWeak;
}
}
@@ -34,15 +36,16 @@ void RecordStreamer::markGlobal(const MC
switch (S) {
case DefinedGlobal:
case Defined:
- S = (Attribute == MCSA_Weak) ? GlobalWeak : DefinedGlobal;
+ S = (Attribute == MCSA_Weak) ? DefinedWeak : DefinedGlobal;
break;
case NeverSeen:
case Global:
case Used:
- S = (Attribute == MCSA_Weak) ? GlobalWeak : Global;
+ S = (Attribute == MCSA_Weak) ? UndefinedWeak : Global;
break;
- case GlobalWeak:
+ case UndefinedWeak:
+ case DefinedWeak:
break;
}
}
@@ -53,7 +56,8 @@ void RecordStreamer::markUsed(const MCSy
case DefinedGlobal:
case Defined:
case Global:
- case GlobalWeak:
+ case DefinedWeak:
+ case UndefinedWeak:
break;
case NeverSeen:
Modified: llvm/trunk/lib/Object/RecordStreamer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/RecordStreamer.h?rev=281629&r1=281628&r2=281629&view=diff
==============================================================================
--- llvm/trunk/lib/Object/RecordStreamer.h (original)
+++ llvm/trunk/lib/Object/RecordStreamer.h Thu Sep 15 12:54:22 2016
@@ -15,7 +15,8 @@
namespace llvm {
class RecordStreamer : public MCStreamer {
public:
- enum State { NeverSeen, Global, GlobalWeak, Defined, DefinedGlobal, Used };
+ enum State { NeverSeen, Global, Defined, DefinedGlobal, DefinedWeak, Used,
+ UndefinedWeak};
private:
StringMap<State> Symbols;
Modified: llvm/trunk/test/Object/X86/nm-bitcodeweak.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/X86/nm-bitcodeweak.test?rev=281629&r1=281628&r2=281629&view=diff
==============================================================================
--- llvm/trunk/test/Object/X86/nm-bitcodeweak.test (original)
+++ llvm/trunk/test/Object/X86/nm-bitcodeweak.test Thu Sep 15 12:54:22 2016
@@ -1,6 +1,7 @@
; RUN: llvm-as %s -o=%t1
; RUN: llvm-nm %t1 | FileCheck %s
+; Check that __libc_blah is reported as defined weak.
; CHECK: W __libc_blah
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
@@ -8,3 +9,5 @@ target triple = "x86_64-unknown-freebsd1
module asm ".weak __libc_blah"
module asm ".equ __libc_blah, blah"
+module asm ".globl blah"
+module asm "blah: ret"
Copied: llvm/trunk/test/Object/X86/nm-undefinedweak.test (from r281517, llvm/trunk/test/Object/X86/nm-bitcodeweak.test)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/X86/nm-undefinedweak.test?p2=llvm/trunk/test/Object/X86/nm-undefinedweak.test&p1=llvm/trunk/test/Object/X86/nm-bitcodeweak.test&r1=281517&r2=281629&rev=281629&view=diff
==============================================================================
--- llvm/trunk/test/Object/X86/nm-bitcodeweak.test (original)
+++ llvm/trunk/test/Object/X86/nm-undefinedweak.test Thu Sep 15 12:54:22 2016
@@ -1,10 +1,10 @@
; RUN: llvm-as %s -o=%t1
; RUN: llvm-nm %t1 | FileCheck %s
-; CHECK: W __libc_blah
+; Check that patatino is reported as undefined weak.
+; CHECK: w patatino
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"
+module asm ".weak patatino"
More information about the llvm-commits
mailing list