mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 12:43:36 +01:00
[IRObjectFile] Propagate .weak attribute correctly for ASM symbols.
PR: 28256 Differential Revision: http://reviews.llvm.org/D21616 llvm-svn: 273474
This commit is contained in:
parent
3c6fd1837c
commit
792dc4b5c7
@ -116,6 +116,9 @@ void IRObjectFile::CollectAsmUndefinedRefs(
|
||||
Res |= BasicSymbolRef::SF_Undefined;
|
||||
Res |= BasicSymbolRef::SF_Global;
|
||||
break;
|
||||
case RecordStreamer::GlobalWeak:
|
||||
Res |= BasicSymbolRef::SF_Weak;
|
||||
Res |= BasicSymbolRef::SF_Global;
|
||||
}
|
||||
AsmUndefinedRefs(Key, BasicSymbolRef::Flags(Res));
|
||||
}
|
||||
|
@ -23,21 +23,26 @@ void RecordStreamer::markDefined(const MCSymbol &Symbol) {
|
||||
case Used:
|
||||
S = Defined;
|
||||
break;
|
||||
case GlobalWeak:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void RecordStreamer::markGlobal(const MCSymbol &Symbol) {
|
||||
void RecordStreamer::markGlobal(const MCSymbol &Symbol,
|
||||
MCSymbolAttr Attribute) {
|
||||
State &S = Symbols[Symbol.getName()];
|
||||
switch (S) {
|
||||
case DefinedGlobal:
|
||||
case Defined:
|
||||
S = DefinedGlobal;
|
||||
S = (Attribute == MCSA_Weak) ? GlobalWeak : DefinedGlobal;
|
||||
break;
|
||||
|
||||
case NeverSeen:
|
||||
case Global:
|
||||
case Used:
|
||||
S = Global;
|
||||
S = (Attribute == MCSA_Weak) ? GlobalWeak : Global;
|
||||
break;
|
||||
case GlobalWeak:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -48,6 +53,7 @@ void RecordStreamer::markUsed(const MCSymbol &Symbol) {
|
||||
case DefinedGlobal:
|
||||
case Defined:
|
||||
case Global:
|
||||
case GlobalWeak:
|
||||
break;
|
||||
|
||||
case NeverSeen:
|
||||
@ -85,7 +91,7 @@ void RecordStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
|
||||
bool RecordStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
|
||||
MCSymbolAttr Attribute) {
|
||||
if (Attribute == MCSA_Global || Attribute == MCSA_Weak)
|
||||
markGlobal(*Symbol);
|
||||
markGlobal(*Symbol, Attribute);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -15,12 +15,12 @@
|
||||
namespace llvm {
|
||||
class RecordStreamer : public MCStreamer {
|
||||
public:
|
||||
enum State { NeverSeen, Global, Defined, DefinedGlobal, Used };
|
||||
enum State { NeverSeen, Global, GlobalWeak, Defined, DefinedGlobal, Used };
|
||||
|
||||
private:
|
||||
StringMap<State> Symbols;
|
||||
void markDefined(const MCSymbol &Symbol);
|
||||
void markGlobal(const MCSymbol &Symbol);
|
||||
void markGlobal(const MCSymbol &Symbol, MCSymbolAttr Attribute);
|
||||
void markUsed(const MCSymbol &Symbol);
|
||||
void visitUsedSymbol(const MCSymbol &Sym) override;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
; RUN: llvm-as %s -o=%t1
|
||||
; RUN: llvm-nm %t1 | FileCheck %s
|
||||
|
||||
; CHECK: T __libc_blah
|
||||
; CHECK: W __libc_blah
|
||||
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-freebsd11.0"
|
||||
|
Loading…
Reference in New Issue
Block a user