llvm.org GIT mirror llvm / 8ba9405
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 Bill Wendling 8 years ago
2 changed file(s) with 17 addition(s) and 23 deletion(s). Raw diff Collapse all Expand all
399399 NameAndAttributes &info = _undefines[entry.getKey().data()];
400400
401401 if (info.symbol == 0) {
402 // If we haven't seen this symbol before, save it and we may see it again.
403 StringMap::value_type
404 &asm_entry = _asm_defines.GetOrCreateValue(name);
405 NameAndAttributes &asm_info = _asm_defines[asm_entry.getKey().data()];
406 asm_info.name = name;
407 asm_info.attributes = scope;
408 asm_info.isFunction = false;
409 asm_info.symbol = 0;
402 // FIXME: This is trying to take care of module ASM like this:
403 //
404 // module asm ".zerofill __FOO, __foo, _bar_baz_qux, 0"
405 //
406 // but is gross and its mother dresses it funny. Have the ASM parser give us
407 // more details for this type of situation so that we're not guessing so
408 // much.
409
410 // fill information structure
411 info.name = name;
412 info.attributes =
413 LTO_SYMBOL_PERMISSIONS_DATA | LTO_SYMBOL_DEFINITION_REGULAR | scope;
414 info.isFunction = false;
415 info.symbol = 0;
416
417 // add to table of symbols
418 _symbols.push_back(info);
410419 return;
411420 }
412421
462471 // we already have the symbol
463472 if (entry.getValue().name)
464473 return;
465
466 StringMap::value_type &asm_entry =
467 _asm_defines.GetOrCreateValue(name);
468
469 if (asm_entry.getValue().name != 0) {
470 if (isFunc)
471 addDefinedFunctionSymbol(cast(decl));
472 else
473 addDefinedDataSymbol(decl);
474
475 _symbols.back().attributes &= ~LTO_SYMBOL_SCOPE_MASK;
476 _symbols.back().attributes |= asm_entry.getValue().attributes;
477 return;
478 }
479474
480475 NameAndAttributes info;
481476
5252 // _defines and _undefines only needed to disambiguate tentative definitions
5353 StringSet _defines;
5454 llvm::StringMap _undefines;
55 llvm::StringMap _asm_defines;
5655 std::vector _asm_undefines;
5756 llvm::MCContext _context;
5857