[PATCH] D27716: [ELF] - Implemented --retain-symbols-file option

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 16 00:18:56 PST 2016

ruiu added inline comments.

Comment at: ELF/Options.td:179-180
+def retain_symbols_file: J<"retain-symbols-file=">, MetaVarName<"<file>">,
+  HelpText<"Retain only the symbols listed in the file">;
I guess you also want to add S<"retain-symbols-file">? Please check GNU ld if it accepts that.

Comment at: ELF/Writer.cpp:425
+  // If --retain-symbols-file used, we do not keep include unlisted symbols.
+  if (Config->Discard == DiscardPolicy::RetainFile)
  // If --retain-symbols-file is given, we'll keep only symbols listed in that file.

Comment at: ELF/Writer.cpp:427
+  if (Config->Discard == DiscardPolicy::RetainFile)
+    if (!Config->RetainSymbolsFile.count(CachedHashString(B.getName())))
+      return false;
Does this compile? You are still using CachedHashString.


More information about the llvm-commits mailing list