File tree Expand file tree Collapse file tree 3 files changed +10
-15
lines changed Expand file tree Collapse file tree 3 files changed +10
-15
lines changed Original file line number Diff line number Diff line change 8181#include " SymbolTable.h"
8282#include " Symbols.h"
8383#include " SyntheticSections.h"
84+ #include " Target.h"
8485#include " llvm/ADT/ArrayRef.h"
8586#include " llvm/BinaryFormat/ELF.h"
8687#include " llvm/Object/ELF.h"
@@ -484,16 +485,7 @@ void ICF<ELFT>::applySafeThunksToRange(size_t begin, size_t end) {
484485 return ;
485486
486487 // Find the symbol to create the thunk for.
487- Symbol *masterSym = nullptr ;
488- for (Symbol *sym : masterIsec->file ->getSymbols ()) {
489- if (auto *d = dyn_cast<Defined>(sym)) {
490- if (d->section == masterIsec) {
491- masterSym = sym;
492- break ;
493- }
494- }
495- }
496-
488+ Symbol *masterSym = masterIsec->getEnclosingSymbol (0 );
497489 if (!masterSym)
498490 return ;
499491
@@ -514,8 +506,11 @@ void ICF<ELFT>::applySafeThunksToRange(size_t begin, size_t end) {
514506
515507 for (Symbol *sym : thunk->file ->getSymbols ())
516508 if (auto *d = dyn_cast<Defined>(sym))
517- if (d->section == isec)
518- d->size = thunkSize;
509+ if (d->section == isec) {
510+ d->value = 0 ;
511+ if (d->size != 0 )
512+ d->size = thunkSize;
513+ }
519514 }
520515}
521516
Original file line number Diff line number Diff line change 99#ifndef LLD_ELF_ICF_H
1010#define LLD_ELF_ICF_H
1111
12- #include " Target.h"
1312namespace lld ::elf {
1413struct Ctx ;
15- class TargetInfo ;
1614
1715template <class ELFT > void doIcf (Ctx &);
1816}
Original file line number Diff line number Diff line change @@ -108,7 +108,9 @@ class TargetInfo {
108108 llvm_unreachable (" target does not support ICF safe thunks" );
109109 }
110110 // Returns the size of the safe thunk in ICF for the target.
111- virtual uint32_t getICFSafeThunkSize () const { return 0 ; }
111+ virtual uint32_t getICFSafeThunkSize () const {
112+ llvm_unreachable (" target does not support ICF safe thunks" );
113+ }
112114
113115 virtual ~TargetInfo ();
114116
You can’t perform that action at this time.
0 commit comments