1 ## This test shows that when symbol/section names are optimized in the string
2 ## table to share the same entry, due to tail merging, llvm-objcopy operations
3 ## function correctly without corrupting the names of unchanged sections/symbols.
5 # RUN: yaml2obj %s -o %t.o
6 ## Sanity check that the strings have been pooled.
7 # RUN: llvm-readobj %t.o --string-dump .strtab --string-dump .shstrtab \
8 # RUN: | FileCheck %s --check-prefix=VALIDATE --implicit-check-not=bar --implicit-check-not=.blag
10 # VALIDATE: String dump of section '.strtab':
12 # VALIDATE: String dump of section '.shstrtab':
13 # VALIDATE: .blam.blah.blag
15 ## Case 1: Basic copy.
16 # RUN: llvm-objcopy %t.o %t.copy
17 # RUN: llvm-readobj --section-headers --symbols %t.copy | FileCheck %s --check-prefix=COPY
20 # COPY: Name: .blam.blah.blag (
21 # COPY: Name: .blah.blag (
25 # COPY: Name: foobar (
26 # COPY: Name: bazfoobar (
28 ## Case 2: Rename section.
29 # RUN: llvm-objcopy %t.o %t.rename-section --rename-section .blah.blag=.blob.blab
30 # RUN: llvm-readobj --section-headers %t.rename-section \
31 # RUN: | FileCheck %s --check-prefix=RENAME-SECTION
33 # RENAME-SECTION: Sections [
34 # RENAME-SECTION: Name: .blam.blah.blag (
35 # RENAME-SECTION: Name: .blob.blab (
36 # RENAME-SECTION: Name: .blag (
38 ## Case 3: Rename symbol.
39 # RUN: llvm-objcopy %t.o %t.rename-symbol --redefine-sym foobar=raboof
40 # RUN: llvm-readobj --symbols %t.rename-symbol \
41 # RUN: | FileCheck %s --check-prefix=RENAME-SYMBOL
43 # RENAME-SYMBOL: Symbols [
44 # RENAME-SYMBOL: Name: bar (
45 # RENAME-SYMBOL: Name: raboof (
46 # RENAME-SYMBOL: Name: bazfoobar (
48 ## Case 4: Remove section.
49 # RUN: llvm-objcopy %t.o %t.remove-section -R .blah.blag
50 # RUN: llvm-readobj --section-headers %t.remove-section \
51 # RUN: | FileCheck %s --check-prefix=REMOVE-SECTION --implicit-check-not .blah.blag
53 # REMOVE-SECTION: Sections [
54 # REMOVE-SECTION: Name: .blam.blah.blag (
55 # REMOVE-SECTION: Name: .blag (
57 ## Case 5: Remove symbol.
58 # RUN: llvm-objcopy %t.o %t.remove-symbol -N foobar
59 # RUN: llvm-readobj --symbols %t.remove-symbol \
60 # RUN: | FileCheck %s --check-prefix=REMOVE-SYMBOL --implicit-check-not foobar
62 # REMOVE-SYMBOL: Symbols [
63 # REMOVE-SYMBOL: Name: bar (
64 # REMOVE-SYMBOL: Name: bazfoobar (
73 - Name: .blam.blah.blag