[PATCH] D42475: [ELF] Add warnings for various symbols that cannot be ordered

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 6 09:35:15 PST 2018


James Henderson via Phabricator <reviews at reviews.llvm.org> writes:


> Index: ELF/Config.h
> ===================================================================
> --- ELF/Config.h
> +++ ELF/Config.h
> @@ -70,13 +70,20 @@
>    size_t NameOff = 0; // Offset in the string table
>  };
>  
> +// This struct contains information about entries in the symbol order file.
> +struct SymbolOrderEntry {
> +  int Priority;
> +  bool Present;
> +};
> +
>  // This struct contains the global configuration for the linker.
>  // Most fields are direct mapping from the command line options
>  // and such fields have the same name as the corresponding options.
>  // Most fields are initialized by the driver.
>  struct Configuration {
>    uint8_t OSABI = 0;
>    llvm::CachePruningPolicy ThinLTOCachePolicy;
> +  llvm::MapVector<StringRef, SymbolOrderEntry> SymbolOrderingFile;

This is a pretty arbitrary middle ground in the parsing. In particular,
the Present bool is only needed immediately after parsing to print a
warning.

I experimented a bit and I think it is best to:

* Keep SymbolOrderingFile a std::vector<llvm::StringRef>.
* Read it as it is currently read in Driver.cpp.
* Move SymbolOrderEntry and getSymbolOrderingFile to Writer.cpp

Thanks,
Rafael


More information about the llvm-commits mailing list