-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ELF] - Implemented --retain-symbols-file option
--retain-symbols-file=filename Retain only the symbols listed in the file filename, discarding all others. filename is simply a flat file, with one symbol name per line. This option is especially useful in environments (such as VxWorks) where a large global symbol table is accumulated gradually, to conserve run-time memory. Note: though documentation says "--retain-symbols-file does not discard undefined symbols, or symbols needed for relocations.", both bfd and gold do that, and this patch too, like testcase show. Differential revision: https://reviews.llvm.org/D27716 llvm-svn: 290122
- Loading branch information
George Rimar
committed
Dec 19, 2016
1 parent
086c90b
commit 2bb88ab
Showing
5 changed files
with
89 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # REQUIRES: x86 | ||
| # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t | ||
| # RUN: echo "bar" > %t_retain.txt | ||
| # RUN: echo "foo" >> %t_retain.txt | ||
| # RUN: ld.lld -shared --retain-symbols-file=%t_retain.txt %t -o %t2 | ||
| # RUN: llvm-readobj -s -sd -t %t2 | FileCheck %s | ||
|
|
||
| ## Check separate form. | ||
| # RUN: ld.lld -shared --retain-symbols-file %t_retain.txt %t -o %t2 | ||
| # RUN: llvm-readobj -s -sd -t %t2 | FileCheck %s | ||
|
|
||
| # CHECK: Symbols [ | ||
| # CHECK-NEXT: Symbol { | ||
| # CHECK-NEXT: Name: (0) | ||
| # CHECK: Symbol { | ||
| # CHECK-NEXT: Name: bar | ||
| # CHECK: Symbol { | ||
| # CHECK-NEXT: Name: foo | ||
| # CHECK-NOT: Symbol | ||
|
|
||
| .text | ||
| .globl _start | ||
| _start: | ||
| call zed@PLT | ||
| call und@PLT | ||
|
|
||
| .globl foo | ||
| .type foo,@function | ||
| foo: | ||
| retq | ||
|
|
||
| .globl bar | ||
| .type bar,@function | ||
| bar: | ||
| retq | ||
|
|
||
| .globl zed | ||
| .type zed,@function | ||
| zed: | ||
| retq | ||
|
|
||
| .type loc,@function | ||
| loc: | ||
| retq |