summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-04-02 10:01:21 +0000
committerBill Wendling <isanbard@gmail.com>2012-04-02 10:01:21 +0000
commit8ba9405c5ca9d95a61c5d575f16506ddac5d67d3 (patch)
tree327d934f8fbd4d5320b8bcc863529127969af69c
parent94338594efed5575ab83b7d8d4bacb0dbf1778a3 (diff)
downloadllvm-8ba9405c5ca9d95a61c5d575f16506ddac5d67d3.tar.gz
llvm-8ba9405c5ca9d95a61c5d575f16506ddac5d67d3.tar.bz2
llvm-8ba9405c5ca9d95a61c5d575f16506ddac5d67d3.tar.xz
Hack the hack. If we have a situation where an ASM object is defined but isn't
reflected in the LLVM IR (as a declare or something), then treat it like a data object. N.B. This isn't 100% correct. The ASM parser should supply more information so that we know what type of object it is, and what attributes it should have. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153870 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--tools/lto/LTOModule.cpp39
-rw-r--r--tools/lto/LTOModule.h1
2 files changed, 17 insertions, 23 deletions
diff --git a/tools/lto/LTOModule.cpp b/tools/lto/LTOModule.cpp
index 3bd764cb76..963bb53091 100644
--- a/tools/lto/LTOModule.cpp
+++ b/tools/lto/LTOModule.cpp
@@ -400,14 +400,23 @@ void LTOModule::addAsmGlobalSymbol(const char *name,
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;
+ // FIXME: This is trying to take care of module ASM like this:
+ //
+ // module asm ".zerofill __FOO, __foo, _bar_baz_qux, 0"
+ //
+ // but is gross and its mother dresses it funny. Have the ASM parser give us
+ // more details for this type of situation so that we're not guessing so
+ // much.
+
+ // fill information structure
+ info.name = name;
+ info.attributes =
+ LTO_SYMBOL_PERMISSIONS_DATA | LTO_SYMBOL_DEFINITION_REGULAR | scope;
+ info.isFunction = false;
+ info.symbol = 0;
+
+ // add to table of symbols
+ _symbols.push_back(info);
return;
}
@@ -464,20 +473,6 @@ void LTOModule::addPotentialUndefinedSymbol(GlobalValue *decl, bool isFunc) {
if (entry.getValue().name)
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;
info.name = entry.getKey().data();
diff --git a/tools/lto/LTOModule.h b/tools/lto/LTOModule.h
index 6280c6770d..cafb927abf 100644
--- a/tools/lto/LTOModule.h
+++ b/tools/lto/LTOModule.h
@@ -53,7 +53,6 @@ private:
// _defines and _undefines only needed to disambiguate tentative definitions
StringSet _defines;
llvm::StringMap<NameAndAttributes> _undefines;
- llvm::StringMap<NameAndAttributes> _asm_defines;
std::vector<const char*> _asm_undefines;
llvm::MCContext _context;