[PATCH] D36466: [ELF] - Do not omit common symbols when -Map is given.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 9 16:55:53 PDT 2017


George Rimar via Phabricator <reviews at reviews.llvm.org> writes:

> Index: ELF/MapFile.cpp
> ===================================================================
> --- ELF/MapFile.cpp
> +++ ELF/MapFile.cpp
> @@ -25,6 +25,7 @@
>  #include "OutputSections.h"
>  #include "Strings.h"
>  #include "SymbolTable.h"
> +#include "SyntheticSections.h"
>  #include "Threads.h"
>  
>  #include "llvm/Support/raw_ostream.h"
> @@ -35,8 +36,8 @@
>  using namespace lld;
>  using namespace lld::elf;
>  
> -typedef DenseMap<const SectionBase *, SmallVector<DefinedRegular *, 4>>
> -    SymbolMapTy;
> +typedef DenseMap<const SectionBase *, SmallVector<Defined *, 4>> SymbolMapTy;
> +typedef DenseMap<Defined *, std::string> SymbolStringsMapTy;
>  
>  // Print out the first three columns of a line.
>  static void writeHeader(raw_ostream &OS, uint64_t Addr, uint64_t Size,
> @@ -48,49 +49,57 @@
>  static std::string indent(int Depth) { return std::string(Depth * 8, ' '); }
>  
>  // Returns a list of all symbols that we want to print out.
> -template <class ELFT> static std::vector<DefinedRegular *> getSymbols() {
> -  std::vector<DefinedRegular *> V;
> -  for (ObjFile<ELFT> *File : ObjFile<ELFT>::Instances)
> -    for (SymbolBody *B : File->getSymbols())
> -      if (auto *DR = dyn_cast<DefinedRegular>(B))
> +template <class ELFT> static std::vector<Defined *> getSymbols() {
> +  std::vector<Defined *> V;
> +  for (ObjFile<ELFT> *File : ObjFile<ELFT>::Instances) {
> +    for (SymbolBody *B : File->getSymbols()) {
> +      if (auto *DR = dyn_cast<DefinedRegular>(B)) {
>          if (DR->getFile() == File && !DR->isSection() && DR->Section &&
>              DR->Section->Live)
>            V.push_back(DR);
> +      } else if (auto *DC = dyn_cast<DefinedCommon>(B)) {
> +        if (InX::Common)

When is InX::Common missing?

LGTM with the if removed if appropriated.

Cheers,
Rafael


More information about the llvm-commits mailing list