@@ -786,12 +786,11 @@ static void demoteAndCopyLocalSymbols() {
786
786
if (isSbfV3 () &&
787
787
includeInSymtab (*b) &&
788
788
shouldKeepInSymtab (*dr) &&
789
- (b->used || (!config->gcSections && (!config->copyRelocs || config->discard == DiscardPolicy::None)))) {
790
- if (( b->type & STT_FUNC) != 0 ) {
789
+ (b->used || (!config->gcSections && (!config->copyRelocs || config->discard == DiscardPolicy::None))) &&
790
+ b->type == STT_FUNC ) {
791
791
// std::ofstream out("/Users/lucasste/Documents/solana-test/program/demote.txt", std::ios::app);
792
792
// out << "Adding sym: " << b->getName().str() << std::endl;
793
- partitions[b->partition - 1 ].dynSymTab ->addSymbol (b);
794
- }
793
+ partitions[b->partition - 1 ].dynSymTab ->addSymbol (b);
795
794
}
796
795
}
797
796
}
@@ -1712,6 +1711,7 @@ template <class ELFT> void Writer<ELFT>::finalizeAddressDependentContent() {
1712
1711
AArch64Err843419Patcher a64p;
1713
1712
ARMErr657417Patcher a32p;
1714
1713
script->assignAddresses ();
1714
+ bool SbfDuplicateRemoval = false ;
1715
1715
// .ARM.exidx and SHF_LINK_ORDER do not require precise addresses, but they
1716
1716
// do require the relative addresses of OutputSections because linker scripts
1717
1717
// can assign Virtual Addresses to OutputSections that are not monotonically
@@ -1762,6 +1762,15 @@ template <class ELFT> void Writer<ELFT>::finalizeAddressDependentContent() {
1762
1762
}
1763
1763
1764
1764
const Defined *changedSym = script->assignAddresses ();
1765
+
1766
+ if (!SbfDuplicateRemoval && isSbfV3 ()) {
1767
+ for (Partition &part: partitions) {
1768
+ part.dynSymTab ->sortSymbolsByValue ();
1769
+ }
1770
+ SbfDuplicateRemoval = true ;
1771
+ changed = true ;
1772
+ }
1773
+
1765
1774
if (!changed) {
1766
1775
// Some symbols may be dependent on section addresses. When we break the
1767
1776
// loop, the symbol values are finalized because a previous
@@ -2104,7 +2113,7 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
2104
2113
addVerneed (sym);
2105
2114
} else if (isSbfV3 () &&
2106
2115
(sym->used || (!config->gcSections && (!config->copyRelocs || config->discard == DiscardPolicy::None))) &&
2107
- ( sym->type & STT_FUNC) != 0 ) {
2116
+ sym->type == STT_FUNC ) {
2108
2117
partitions[sym->partition - 1 ].dynSymTab ->addSymbol (sym);
2109
2118
}
2110
2119
}
@@ -2300,11 +2309,12 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
2300
2309
if (config->emachine == EM_ARM && !config->isLE && config->armBe8 ) {
2301
2310
addArmInputSectionMappingSymbols ();
2302
2311
sortArmMappingSymbols ();
2303
- } else if (isSbfV3 ()) {
2304
- for (Partition &part: partitions) {
2305
- part.dynSymTab ->sortSymbolsByValue ();
2306
- }
2307
2312
}
2313
+ // else if (isSbfV3()) {
2314
+ // for (Partition &part: partitions) {
2315
+ // part.dynSymTab->sortSymbolsByValue();
2316
+ // }
2317
+ // }
2308
2318
}
2309
2319
2310
2320
// Ensure data sections are not mixed with executable sections when
0 commit comments