mirror of
https://github.com/intel/llvm.git
synced 2026-01-20 10:58:11 +08:00
Handle copy relocations in symbol assignments.
When a linker script has "foo = bar" and bar is the result of a copy relocation foo should point to the same location in .bss. This is part of a growing evidence that copy relocations should be implemented by using replaceSymbol to replace the SharedSymbol with a Defined. llvm-svn: 319449
This commit is contained in:
@@ -976,8 +976,13 @@ ExprValue LinkerScript::getSymbolValue(StringRef Name, const Twine &Loc) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (auto *Sym = dyn_cast_or_null<Defined>(Symtab->find(Name)))
|
||||
return {Sym->Section, false, Sym->Value, Loc};
|
||||
if (Symbol *Sym = Symtab->find(Name)) {
|
||||
if (auto *DS = dyn_cast<Defined>(Sym))
|
||||
return {DS->Section, false, DS->Value, Loc};
|
||||
if (auto *SS = dyn_cast<SharedSymbol>(Sym))
|
||||
if (!ErrorOnMissingSection || SS->CopyRelSec)
|
||||
return {SS->CopyRelSec, false, 0, Loc};
|
||||
}
|
||||
|
||||
error(Loc + ": symbol not found: " + Name);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user