@@ -149,7 +149,6 @@ static Defined *addOptionalRegular(Ctx &ctx, StringRef name, SectionBase *sec,
149
149
if (!s || s->isDefined () || s->isCommon ())
150
150
return nullptr ;
151
151
152
- ctx.synthesizedSymbols .push_back (s);
153
152
s->resolve (ctx, Defined{ctx, ctx.internalFile , StringRef (), STB_GLOBAL,
154
153
stOther, STT_NOTYPE, val,
155
154
/* size=*/ 0 , sec});
@@ -283,7 +282,6 @@ static void demoteDefined(Defined &sym, DenseMap<SectionBase *, size_t> &map) {
283
282
static void demoteSymbolsAndComputeIsPreemptible (Ctx &ctx) {
284
283
llvm::TimeTraceScope timeScope (" Demote symbols" );
285
284
DenseMap<InputFile *, DenseMap<SectionBase *, size_t >> sectionIndexMap;
286
- bool hasDynSymTab = ctx.arg .hasDynSymTab ;
287
285
for (Symbol *sym : ctx.symtab ->getSymbols ()) {
288
286
if (auto *d = dyn_cast<Defined>(sym)) {
289
287
if (d->section && !d->section ->isLive ())
@@ -296,12 +294,11 @@ static void demoteSymbolsAndComputeIsPreemptible(Ctx &ctx) {
296
294
sym->type )
297
295
.overwrite (*sym);
298
296
sym->versionId = VER_NDX_GLOBAL;
299
- if (sym->includeInDynsym (ctx))
300
- sym->isExported = true ;
301
297
}
302
298
}
303
299
304
- if (hasDynSymTab)
300
+ sym->isExported = sym->includeInDynsym (ctx);
301
+ if (ctx.arg .hasDynSymTab )
305
302
sym->isPreemptible = sym->isExported && computeIsPreemptible (ctx, *sym);
306
303
}
307
304
}
@@ -1839,11 +1836,6 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
1839
1836
}
1840
1837
}
1841
1838
1842
- // If the previous code block defines any non-hidden symbols (e.g.
1843
- // __global_pointer$), they may be exported.
1844
- for (Symbol *sym : ctx.synthesizedSymbols )
1845
- sym->isExported = sym->includeInDynsym (ctx);
1846
-
1847
1839
demoteSymbolsAndComputeIsPreemptible (ctx);
1848
1840
1849
1841
if (ctx.arg .copyRelocs && ctx.arg .discard != DiscardPolicy::None)
0 commit comments