[PATCH] D25240: [ELF] Emit warning instead of error, when undefined symbol is not really used.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 4 09:20:45 PDT 2016


ruiu added inline comments.


> Relocations.cpp:560
>      uint32_t Type = RI.getType(Config->Mips64EL);
> +    Body.IsRelocTarget = true;
>  

I don't think you need to record whether a symbol is used or not here to use the information later. Instead, you could print out a warning message directly from this context.

> Writer.cpp:320
>  
> +  bool Unused = !Sym->IsRelocTarget && !Sym->symbol()->includeInDynsym();
>    if (Sym->File)

Instead of adding a new bit to the symbol, I'd do this here.

  // Ignore symbols in garbage-collected sections.
  // We could report them, but we don't because GNU linkers don't.
  if (Sym->symbol()->includeInDynsym())
    if (auto *D = dyn_cast<DefinedRegular<ELFT>(Sym))
      if (!D->Section.Live)
        return;

Repository:
  rL LLVM

https://reviews.llvm.org/D25240





More information about the llvm-commits mailing list