mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-09 13:33:17 +00:00
It could come about that we parse the inline ASM before we get a potential
definition for it. In that case, we want to wait for the potential definition before we create a symbol for it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153859 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a4bd58b0f0
commit
1fcbca05db
@ -399,6 +399,18 @@ void LTOModule::addAsmGlobalSymbol(const char *name,
|
|||||||
|
|
||||||
NameAndAttributes &info = _undefines[entry.getKey().data()];
|
NameAndAttributes &info = _undefines[entry.getKey().data()];
|
||||||
|
|
||||||
|
if (info.symbol == 0) {
|
||||||
|
// If we haven't seen this symbol before, save it and we may see it again.
|
||||||
|
StringMap<NameAndAttributes>::value_type
|
||||||
|
&asm_entry = _asm_defines.GetOrCreateValue(name);
|
||||||
|
NameAndAttributes &asm_info = _asm_defines[asm_entry.getKey().data()];
|
||||||
|
asm_info.name = name;
|
||||||
|
asm_info.attributes = scope;
|
||||||
|
asm_info.isFunction = false;
|
||||||
|
asm_info.symbol = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (info.isFunction)
|
if (info.isFunction)
|
||||||
addDefinedFunctionSymbol(cast<Function>(info.symbol));
|
addDefinedFunctionSymbol(cast<Function>(info.symbol));
|
||||||
else
|
else
|
||||||
@ -452,6 +464,20 @@ void LTOModule::addPotentialUndefinedSymbol(GlobalValue *decl, bool isFunc) {
|
|||||||
if (entry.getValue().name)
|
if (entry.getValue().name)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
StringMap<NameAndAttributes>::value_type &asm_entry =
|
||||||
|
_asm_defines.GetOrCreateValue(name);
|
||||||
|
|
||||||
|
if (asm_entry.getValue().name != 0) {
|
||||||
|
if (isFunc)
|
||||||
|
addDefinedFunctionSymbol(cast<Function>(decl));
|
||||||
|
else
|
||||||
|
addDefinedDataSymbol(decl);
|
||||||
|
|
||||||
|
_symbols.back().attributes &= ~LTO_SYMBOL_SCOPE_MASK;
|
||||||
|
_symbols.back().attributes |= asm_entry.getValue().attributes;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
NameAndAttributes info;
|
NameAndAttributes info;
|
||||||
|
|
||||||
info.name = entry.getKey().data();
|
info.name = entry.getKey().data();
|
||||||
|
@ -53,6 +53,7 @@ private:
|
|||||||
// _defines and _undefines only needed to disambiguate tentative definitions
|
// _defines and _undefines only needed to disambiguate tentative definitions
|
||||||
StringSet _defines;
|
StringSet _defines;
|
||||||
llvm::StringMap<NameAndAttributes> _undefines;
|
llvm::StringMap<NameAndAttributes> _undefines;
|
||||||
|
llvm::StringMap<NameAndAttributes> _asm_defines;
|
||||||
std::vector<const char*> _asm_undefines;
|
std::vector<const char*> _asm_undefines;
|
||||||
llvm::MCContext _context;
|
llvm::MCContext _context;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user