@@ -149,7 +149,6 @@ static Defined *addOptionalRegular(Ctx &ctx, StringRef name, SectionBase *sec,
149149 if (!s || s->isDefined () || s->isCommon ())
150150 return nullptr ;
151151
152- ctx.synthesizedSymbols .push_back (s);
153152 s->resolve (ctx, Defined{ctx, ctx.internalFile , StringRef (), STB_GLOBAL,
154153 stOther, STT_NOTYPE, val,
155154 /* size=*/ 0 , sec});
@@ -283,7 +282,6 @@ static void demoteDefined(Defined &sym, DenseMap<SectionBase *, size_t> &map) {
283282static void demoteSymbolsAndComputeIsPreemptible (Ctx &ctx) {
284283 llvm::TimeTraceScope timeScope (" Demote symbols" );
285284 DenseMap<InputFile *, DenseMap<SectionBase *, size_t >> sectionIndexMap;
286- bool hasDynSymTab = ctx.arg .hasDynSymTab ;
287285 for (Symbol *sym : ctx.symtab ->getSymbols ()) {
288286 if (auto *d = dyn_cast<Defined>(sym)) {
289287 if (d->section && !d->section ->isLive ())
@@ -296,12 +294,11 @@ static void demoteSymbolsAndComputeIsPreemptible(Ctx &ctx) {
296294 sym->type )
297295 .overwrite (*sym);
298296 sym->versionId = VER_NDX_GLOBAL;
299- if (sym->includeInDynsym (ctx))
300- sym->isExported = true ;
301297 }
302298 }
303299
304- if (hasDynSymTab)
300+ sym->isExported = sym->includeInDynsym (ctx);
301+ if (ctx.arg .hasDynSymTab )
305302 sym->isPreemptible = sym->isExported && computeIsPreemptible (ctx, *sym);
306303 }
307304}
@@ -1839,11 +1836,6 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
18391836 }
18401837 }
18411838
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-
18471839 demoteSymbolsAndComputeIsPreemptible (ctx);
18481840
18491841 if (ctx.arg .copyRelocs && ctx.arg .discard != DiscardPolicy::None)
0 commit comments