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

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 16 00:41:11 PST 2016


grimar 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">;
+
----------------
ruiu wrote:
> I guess you also want to add S<"retain-symbols-file">? Please check GNU ld if it accepts that.
> .
Yes, bfd accepts S too, with single or double "-":

```
umb at ubuntu:~/LLVM/build$ ld.bfd --retain-symbols-file xx
ld.bfd: xx: No such file or directory
ld.bfd: no input files
umb at ubuntu:~/LLVM/build$ ld.bfd -retain-symbols-file xx
ld.bfd: xx: No such file or directory
ld.bfd: no input files
umb at ubuntu:~/LLVM/build$ ld.bfd -retain-symbols-file=xx
ld.bfd: xx: No such file or directory
ld.bfd: no input files
umb at ubuntu:~/LLVM/build$ ld.bfd --retain-symbols-file=xx
ld.bfd: xx: No such file or directory
ld.bfd: no input files

```

I updated testcase to check both forms.


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


https://reviews.llvm.org/D27716





More information about the llvm-commits mailing list