@@ -556,7 +556,7 @@ Error RewriteInstance::discoverStorage() {
556
556
if (Error E = SectionNameOrErr.takeError ())
557
557
return E;
558
558
StringRef SectionName = SectionNameOrErr.get ();
559
- if (SectionName == " .text " ) {
559
+ if (SectionName == BC-> getMainCodeSectionName () ) {
560
560
BC->OldTextSectionAddress = Section.getAddress ();
561
561
BC->OldTextSectionSize = Section.getSize ();
562
562
@@ -1864,7 +1864,8 @@ Error RewriteInstance::readSpecialSections() {
1864
1864
" Use -update-debug-sections to keep it.\n " ;
1865
1865
}
1866
1866
1867
- HasTextRelocations = (bool )BC->getUniqueSectionByName (" .rela.text" );
1867
+ HasTextRelocations = (bool )BC->getUniqueSectionByName (
1868
+ " .rela" + std::string (BC->getMainCodeSectionName ()));
1868
1869
HasSymbolTable = (bool )BC->getUniqueSectionByName (" .symtab" );
1869
1870
EHFrameSection = BC->getUniqueSectionByName (" .eh_frame" );
1870
1871
BuildIDSection = BC->getUniqueSectionByName (" .note.gnu.build-id" );
@@ -3441,7 +3442,8 @@ void RewriteInstance::emitAndLink() {
3441
3442
ErrorOr<BinarySection &> TextSection =
3442
3443
BC->getUniqueSectionByName (BC->getMainCodeSectionName ());
3443
3444
if (BC->HasRelocations && TextSection)
3444
- BC->renameSection (*TextSection, getOrgSecPrefix () + " .text" );
3445
+ BC->renameSection (*TextSection,
3446
+ getOrgSecPrefix () + BC->getMainCodeSectionName ());
3445
3447
3446
3448
// ////////////////////////////////////////////////////////////////////////////
3447
3449
// Assign addresses to new sections.
0 commit comments