[PATCH] D40240: Garbage-collected symbols shouldn't make DSOs alive.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 20 11:10:04 PST 2017


The name of the review suggests a change in behavior, but there are no
test changes. It looks like this is just refactoring, in which case
please change the description.

> -  bool AsNeeded = false;
> -  bool IsUsed = false;
> -  bool isNeeded() const { return !AsNeeded || IsUsed; }
> +  bool IsNeeded;

Nice :-)

>  if (auto *Sym = dyn_cast<SharedSymbol>(&B))
>    if (!Sym->isWeak())
>      cast<SharedFile<ELFT>>(Sym->File)->IsNeeded = true;

This part is dead on this patch. Please leave it for the followup.


>   auto MarkSymbol = [&](Symbol *Sym) {
>+    if (auto *S = dyn_cast_or_null<SharedSymbol>(Sym))
>+      if (!S->isWeak())
>+        cast<SharedFile<ELFT>>(S->File)->IsNeeded = true;

The isWeak is here to handle a weak undefined, correct? Could you add a
test showing it is necessary?

This marks all strong undefined symbols that resolved to a shared as
needed. Is that intentional to make this patch a nop?

Cheers,
Rafael


More information about the llvm-commits mailing list