@@ -498,6 +498,11 @@ void BinaryFunction::print(raw_ostream &OS, std::string Annotation) {
498498 if (!IslandOffset)
499499 return ;
500500
501+ // Print label if it exists at this offset.
502+ if (const BinaryData *BD =
503+ BC.getBinaryDataAtAddress (getAddress () + *IslandOffset))
504+ OS << BD->getName () << " :\n " ;
505+
501506 const size_t IslandSize = getSizeOfDataInCodeAt (*IslandOffset);
502507 BC.printData (OS, BC.extractData (getAddress () + *IslandOffset, IslandSize),
503508 *IslandOffset);
@@ -1066,7 +1071,7 @@ size_t BinaryFunction::getSizeOfDataInCodeAt(uint64_t Offset) const {
10661071 auto Iter = Islands->CodeOffsets .upper_bound (Offset);
10671072 if (Iter != Islands->CodeOffsets .end ())
10681073 return *Iter - Offset;
1069- return getSize () - Offset;
1074+ return getMaxSize () - Offset;
10701075}
10711076
10721077std::optional<uint64_t >
@@ -4254,21 +4259,21 @@ void BinaryFunction::updateOutputValues(const BOLTLinker &Linker) {
42544259
42554260 if (BC.HasRelocations || isInjected ()) {
42564261 if (hasConstantIsland ()) {
4257- const auto DataAddress =
4258- Linker.lookupSymbol (getFunctionConstantIslandLabel ()->getName ());
4259- assert (DataAddress && " Cannot find function CI symbol" );
4260- setOutputDataAddress (*DataAddress );
4262+ const auto IslandLabelSymInfo =
4263+ Linker.lookupSymbolInfo (getFunctionConstantIslandLabel ()->getName ());
4264+ assert (IslandLabelSymInfo && " Cannot find function CI symbol" );
4265+ setOutputDataAddress (IslandLabelSymInfo-> Address );
42614266 for (auto It : Islands->Offsets ) {
42624267 const uint64_t OldOffset = It.first ;
42634268 BinaryData *BD = BC.getBinaryDataAtAddress (getAddress () + OldOffset);
42644269 if (!BD)
42654270 continue ;
42664271
42674272 MCSymbol *Symbol = It.second ;
4268- const auto NewAddress = Linker.lookupSymbol (Symbol->getName ());
4269- assert (NewAddress && " Cannot find CI symbol" );
4273+ const auto SymInfo = Linker.lookupSymbolInfo (Symbol->getName ());
4274+ assert (SymInfo && " Cannot find CI symbol" );
42704275 auto &Section = *getCodeSection ();
4271- const auto NewOffset = *NewAddress - Section.getOutputAddress ();
4276+ const auto NewOffset = SymInfo-> Address - Section.getOutputAddress ();
42724277 BD->setOutputLocation (Section, NewOffset);
42734278 }
42744279 }
@@ -4293,10 +4298,10 @@ void BinaryFunction::updateOutputValues(const BOLTLinker &Linker) {
42934298 FF.setAddress (ColdStartSymbolInfo->Address );
42944299 FF.setImageSize (ColdStartSymbolInfo->Size );
42954300 if (hasConstantIsland ()) {
4296- const auto DataAddress = Linker.lookupSymbol (
4301+ const auto SymInfo = Linker.lookupSymbolInfo (
42974302 getFunctionColdConstantIslandLabel ()->getName ());
4298- assert (DataAddress && " Cannot find cold CI symbol" );
4299- setOutputColdDataAddress (*DataAddress );
4303+ assert (SymInfo && " Cannot find cold CI symbol" );
4304+ setOutputColdDataAddress (SymInfo-> Address );
43004305 }
43014306 }
43024307 }
0 commit comments