@@ -556,7 +556,7 @@ Error RewriteInstance::discoverStorage() {
556556 if (Error E = SectionNameOrErr.takeError ())
557557 return E;
558558 StringRef SectionName = SectionNameOrErr.get ();
559- if (SectionName == " .text " ) {
559+ if (SectionName == BC-> getMainCodeSectionName () ) {
560560 BC->OldTextSectionAddress = Section.getAddress ();
561561 BC->OldTextSectionSize = Section.getSize ();
562562
@@ -1864,7 +1864,8 @@ Error RewriteInstance::readSpecialSections() {
18641864 " Use -update-debug-sections to keep it.\n " ;
18651865 }
18661866
1867- HasTextRelocations = (bool )BC->getUniqueSectionByName (" .rela.text" );
1867+ HasTextRelocations = (bool )BC->getUniqueSectionByName (
1868+ " .rela" + std::string (BC->getMainCodeSectionName ()));
18681869 HasSymbolTable = (bool )BC->getUniqueSectionByName (" .symtab" );
18691870 EHFrameSection = BC->getUniqueSectionByName (" .eh_frame" );
18701871 BuildIDSection = BC->getUniqueSectionByName (" .note.gnu.build-id" );
@@ -3441,7 +3442,8 @@ void RewriteInstance::emitAndLink() {
34413442 ErrorOr<BinarySection &> TextSection =
34423443 BC->getUniqueSectionByName (BC->getMainCodeSectionName ());
34433444 if (BC->HasRelocations && TextSection)
3444- BC->renameSection (*TextSection, getOrgSecPrefix () + " .text" );
3445+ BC->renameSection (*TextSection,
3446+ getOrgSecPrefix () + BC->getMainCodeSectionName ());
34453447
34463448 // ////////////////////////////////////////////////////////////////////////////
34473449 // Assign addresses to new sections.
0 commit comments