1 ## This test checks the functionality of options --skip-symbol and --skip-symbols.
2 # RUN: yaml2obj %s -o %t.o
3 # RUN: echo 'foo[2-3]' > %t.skip.regex
5 ## Check --skip-symbol functionality when changing symbol bindings.
6 # RUN: llvm-objcopy %t.o %t2.o --localize-hidden --skip-symbol=foo3
7 # RUN: llvm-readelf -s %t2.o | FileCheck %s --check-prefix=LH-SYM
8 # LH-SYM-DAG: LOCAL HIDDEN 1 foo1
9 # LH-SYM-DAG: LOCAL HIDDEN 1 foo2
10 # LH-SYM-DAG: GLOBAL HIDDEN 1 foo3
11 # LH-SYM-DAG: LOCAL HIDDEN 1 foo4
12 # LH-SYM-DAG: LOCAL HIDDEN 1 foo5
14 ## Check --skip-symbols functionality when changing symbol bindings.
15 # RUN: llvm-objcopy %t.o %t1.o --localize-hidden --skip-symbols=%t.skip.regex --regex
16 # RUN: llvm-readelf -s %t1.o | FileCheck %s --check-prefix=LH-SYMS
17 # LH-SYMS-DAG: LOCAL HIDDEN 1 foo1
18 # LH-SYMS-DAG: GLOBAL HIDDEN 1 foo2
19 # LH-SYMS-DAG: GLOBAL HIDDEN 1 foo3
20 # LH-SYMS-DAG: LOCAL HIDDEN 1 foo4
21 # LH-SYMS-DAG: LOCAL HIDDEN 1 foo5
23 ## Check --skip-symbol functionality when changing symbol names.
24 # RUN: echo -e "foo1 bar1\nfoo2 bar2" > %t.renames.list
25 # RUN: llvm-objcopy %t.o %t4.o --redefine-syms=%t.renames.list \
26 # RUN: --skip-symbol='fo*' --wildcard
27 # RUN: llvm-readelf -s %t4.o | FileCheck %s --check-prefix=RS-SYM
34 ## Check --skip-symbols functionality when changing symbol names.
35 # RUN: llvm-objcopy %t.o %t3.o --redefine-syms=%t.renames.list \
36 # RUN: --skip-symbols=%t.skip.regex --regex
37 # RUN: llvm-readelf -s %t3.o | FileCheck %s --check-prefix=RS-SYMS
44 ## Check the functionality when using skip options multiple times.
45 # RUN: echo "foo3" > %t.symbol0.list
46 # RUN: echo "foo4" > %t.symbol1.list
47 # RUN: llvm-objcopy %t.o %t5.o --set-symbol-visibility='foo*'=internal --wildcard \
48 # RUN: --skip-symbol=foo1 --skip-symbol=foo2 \
49 # RUN: --skip-symbols=%t.symbol0.list --skip-symbols=%t.symbol1.list
50 # RUN: llvm-readelf -s %t5.o | FileCheck %s --check-prefix=BOTH
51 # BOTH-DAG: GLOBAL HIDDEN 1 foo1
52 # BOTH-DAG: GLOBAL HIDDEN 1 foo2
53 # BOTH-DAG: GLOBAL HIDDEN 1 foo3
54 # BOTH-DAG: GLOBAL HIDDEN 1 foo4
55 ## Only foo5 is not skipped.
56 # BOTH-DAG: GLOBAL INTERNAL 1 foo5
58 ## Check that using an invalid symbol name regex generates an error.
59 # RUN: echo '*.' > %t.symbols.regex
60 # RUN: not llvm-objcopy %t.o --skip-symbols=%t.symbols.regex --regex 2>&1 | \
61 # RUN: FileCheck %s --check-prefix=SYMBOL
62 # RUN: not llvm-objcopy %t.o --skip-symbol='*.' --regex 2>&1 | \
63 # RUN: FileCheck %s --check-prefix=SYMBOL
64 # SYMBOL: error: cannot compile regular expression '*.': repetition-operator operand invalid
66 ## Check passing an invalid filename generates an error.
67 # RUN: not llvm-objcopy %t.o --skip-symbols=no_file 2>&1 | \
68 # RUN: FileCheck %s --check-prefix=FILE -DMSG=%errc_ENOENT
69 # FILE: error: 'no_file': [[MSG]]
100 Other: [ STV_HIDDEN ]