File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -297,16 +297,25 @@ static Symbol *getThunkTargetSymbol(ConcatInputSection *isec) {
297297// direct branch thunk rather than containing a full copy of the actual function
298298// body.
299299void ICF::applySafeThunksToRange (size_t begin, size_t end) {
300+ // When creating a unique ICF thunk, use the first section as the section that
301+ // all thunks will branch to.
302+ ConcatInputSection *masterIsec = icfInputs[begin];
303+
304+ // If the first section is not address significant, sorting guarantees that
305+ // there are no address significant functions. So we can skip this range.
306+ if (!masterIsec->keepUnique )
307+ return ;
308+
309+ // Skip anything that is not a code section.
310+ if (!isCodeSection (masterIsec))
311+ return ;
312+
300313 // If the functions we're dealing with are smaller than the thunk size, then
301314 // just leave them all as-is - creating thunks would be a net loss.
302315 uint32_t thunkSize = target->getICFSafeThunkSize ();
303- if (icfInputs[begin] ->data .size () <= thunkSize)
316+ if (masterIsec ->data .size () <= thunkSize)
304317 return ;
305318
306- // When creating a unique ICF thunk, use the first section as the section that
307- // all thunks will branch to.
308- ConcatInputSection *masterIsec = icfInputs[begin];
309-
310319 // Get the symbol that all thunks will branch to.
311320 Symbol *masterSym = getThunkTargetSymbol (masterIsec);
312321
You can’t perform that action at this time.
0 commit comments