mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-18 18:42:46 +02:00
[IRObjectFile] Handle undefined weak symbols in RecordStreamer.
Differential Revision: https://reviews.llvm.org/D24594 llvm-svn: 281629
This commit is contained in:
parent
08b3f8b372
commit
3f060f1af6
@ -113,10 +113,13 @@ void IRObjectFile::CollectAsmUndefinedRefs(
|
||||
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));
|
||||
}
|
||||
|
@ -23,8 +23,10 @@ void RecordStreamer::markDefined(const MCSymbol &Symbol) {
|
||||
case Used:
|
||||
S = Defined;
|
||||
break;
|
||||
case GlobalWeak:
|
||||
case DefinedWeak:
|
||||
break;
|
||||
case UndefinedWeak:
|
||||
S = DefinedWeak;
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,15 +36,16 @@ void RecordStreamer::markGlobal(const MCSymbol &Symbol,
|
||||
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 MCSymbol &Symbol) {
|
||||
case DefinedGlobal:
|
||||
case Defined:
|
||||
case Global:
|
||||
case GlobalWeak:
|
||||
case DefinedWeak:
|
||||
case UndefinedWeak:
|
||||
break;
|
||||
|
||||
case NeverSeen:
|
||||
|
@ -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;
|
||||
|
@ -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-freebsd11.0"
|
||||
|
||||
module asm ".weak __libc_blah"
|
||||
module asm ".equ __libc_blah, blah"
|
||||
module asm ".globl blah"
|
||||
module asm "blah: ret"
|
||||
|
10
test/Object/X86/nm-undefinedweak.test
Normal file
10
test/Object/X86/nm-undefinedweak.test
Normal file
@ -0,0 +1,10 @@
|
||||
; RUN: llvm-as %s -o=%t1
|
||||
; RUN: llvm-nm %t1 | FileCheck %s
|
||||
|
||||
; 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 patatino"
|
Loading…
Reference in New Issue
Block a user