1 # RUN: yaml2obj %s -o %t
2 # RUN: llvm-objcopy %t %t1 \
3 # RUN: --rename-section=.tst1.foo=.tst1.ren.foo \
4 # RUN: --rename-section=.tst1.bar=.tst1.ren.bar \
5 # RUN: --rename-section=.tst2.foo=.tst2.ren.foo \
6 # RUN: --rename-section=.tst3.foo=.tst3.ren.foo \
7 # RUN: --rename-section=.tst4.foo=.tst4.ren.foo \
8 # RUN: --rename-section=.rel.tst4.foo=.tst4.ren.foo.rel \
9 # RUN: --rename-section=.tst6.got.plt=.tst6.ren.got.plt \
10 # RUN: --rename-section=.tst7.rela.plt=.tst7.ren.rela.plt
11 # RUN: llvm-readobj --sections %t1 | FileCheck %s
21 ## Test 1. When a section is renamed, its relocation section should be renamed
23 # CHECK: Name: .tst1.ren.foo{{ }}
24 # CHECK: Name: .rel.tst1.ren.foo{{ }}
25 # CHECK: Name: .rela.tst1.ren.bar{{ }}
26 # CHECK: Name: .tst1.ren.bar{{ }}
32 - Name: .rela.tst1.bar
38 ## Test 2. A relocation section should be renamed together with its target
39 ## section even if its name does not follow the typical pattern.
40 # CHECK: Name: .tst2.ren.foo{{ }}
41 # CHECK: Name: .rel.tst2.ren.foo{{ }}
48 ## Test 3. A relocation section should not be renamed if an unrelated section
49 ## with the same common name is renamed.
50 ## Note that '.rel.tst3.foo' targets '.tst3.bar', not '.tst3.foo'
51 # CHECK: Name: .tst3.ren.foo{{ }}
52 # CHECK: Name: .tst3.bar{{ }}
53 # CHECK: Name: .rel.tst3.foo{{ }}
62 ## Test 4. A relocation section can be renamed with an explicit --rename-section
63 ## command. Explicit renaming overrides implicit one.
64 # CHECK: Name: .tst4.ren.foo{{ }}
65 # CHECK: Name: .tst4.ren.foo.rel{{ }}
72 ## Test 5. Should not rename a relocation section if it or its target are not
73 ## specified in --rename-section.
74 ## Note that this diverges from GNU objcopy.
75 # CHECK: Name: .tst5.foo{{ }}
76 # CHECK: Name: .tst5.foo.rel{{ }}
83 ## Test 6. A dynamic relocation section should not be renamed together with its
85 # CHECK: Name: .tst6.rela.plt{{ }}
86 # CHECK: Name: .tst6.ren.got.plt{{ }}
87 - Name: .tst6.rela.plt
94 ## Test 7. A dynamic relocation section can be renamed with an explicit
95 ## --rename-section command.
96 # CHECK: Name: .tst7.ren.rela.plt{{ }}
97 # CHECK: Name: .tst7.got.plt{{ }}
98 - Name: .tst7.rela.plt
102 - Name: .tst7.got.plt