forked from OSchip/llvm-project
[BOLT] Emit ICF symbols for large functions
Summary: In non-relocation mode, make sure we emit extra symbols for a folded function even if the function was not overwritten due to its large size. (cherry picked from FBD21080467)
This commit is contained in:
parent
606532bdf1
commit
10245b5c5b
|
@ -3800,17 +3800,19 @@ void RewriteInstance::updateELFSymbolTable(
|
|||
// Create a new symbol based on the existing symbol.
|
||||
auto NewSymbol = Symbol;
|
||||
|
||||
// If the symbol matched a function that was not emitted, leave the
|
||||
// symbol unchanged.
|
||||
if (Function && Function->isEmitted()) {
|
||||
NewSymbol.st_value = Function->getOutputAddress();
|
||||
NewSymbol.st_size = Function->getOutputSize();
|
||||
NewSymbol.st_shndx = Function->getCodeSection()->getIndex();
|
||||
if (Function) {
|
||||
// If the symbol matched a function that was not emitted, leave the
|
||||
// symbol unchanged.
|
||||
if (Function->isEmitted()) {
|
||||
NewSymbol.st_value = Function->getOutputAddress();
|
||||
NewSymbol.st_size = Function->getOutputSize();
|
||||
NewSymbol.st_shndx = Function->getCodeSection()->getIndex();
|
||||
}
|
||||
|
||||
// Add new symbols to the symbol table if necessary.
|
||||
if (!PatchExisting)
|
||||
addExtraSymbols(*Function, NewSymbol);
|
||||
} else if (!Function) {
|
||||
} else {
|
||||
// Check if the function symbol matches address inside a function, i.e.
|
||||
// it marks a secondary entry point.
|
||||
Function = (Symbol.getType() == ELF::STT_FUNC)
|
||||
|
|
Loading…
Reference in New Issue