1 ## Show that if --remove-section is given, llvm-objcopy removes sections
2 ## specified by the option.
4 # RUN: yaml2obj %s -o %t
6 ## Remove only __TEXT,__text section.
7 # RUN: llvm-objcopy --remove-section __TEXT,__text %t %t2
8 # RUN: llvm-readobj --sections --section-data %t2 \
9 # RUN: | FileCheck %s --check-prefixes=COMMON,REMOVE-TEXT-ONLY
11 ## Remove multiple sections.
12 # RUN: llvm-objcopy --remove-section __TEXT,__text --remove-section __DATA,__data %t %t3
13 # RUN: llvm-readobj --sections --section-data %t3 \
14 # RUN: | FileCheck %s --check-prefixes=COMMON,REMOVE-TEXT-AND-DATA
17 # REMOVE-TEXT-ONLY-NEXT: Section {
18 # REMOVE-TEXT-ONLY-NEXT: Index: 0
19 # REMOVE-TEXT-ONLY-NEXT: Name: __data (5F 5F 64 61 74 61 00 00 00 00 00 00 00 00 00 00)
20 # REMOVE-TEXT-ONLY-NEXT: Segment: __DATA (5F 5F 44 41 54 41 00 00 00 00 00 00 00 00 00 00)
21 # REMOVE-TEXT-ONLY-NEXT: Address: 0x4
22 # REMOVE-TEXT-ONLY-NEXT: Size: 0x4
23 # REMOVE-TEXT-ONLY-NEXT: Offset: 264
24 # REMOVE-TEXT-ONLY-NEXT: Alignment: 0
25 # REMOVE-TEXT-ONLY-NEXT: RelocationOffset: 0x0
26 # REMOVE-TEXT-ONLY-NEXT: RelocationCount: 0
27 # REMOVE-TEXT-ONLY-NEXT: Type: Regular (0x0)
28 # REMOVE-TEXT-ONLY-NEXT: Attributes [ (0x0)
29 # REMOVE-TEXT-ONLY-NEXT: ]
30 # REMOVE-TEXT-ONLY-NEXT: Reserved1: 0x0
31 # REMOVE-TEXT-ONLY-NEXT: Reserved2: 0x0
32 # REMOVE-TEXT-ONLY-NEXT: Reserved3: 0x0
33 # REMOVE-TEXT-ONLY-NEXT: SectionData (
34 # REMOVE-TEXT-ONLY-NEXT: 0000: DDAADDAA |....|
35 # REMOVE-TEXT-ONLY-NEXT: )
36 # REMOVE-TEXT-ONLY-NEXT: }
37 # COMMON-NEXT: Section {
38 # REMOVE-TEXT-ONLY-NEXT: Index: 1
39 # REMOVE-TEXT-AND-DATA-NEXT: Index: 0
40 # COMMON-NEXT: Name: __const (5F 5F 63 6F 6E 73 74 00 00 00 00 00 00 00 00 00)
41 # COMMON-NEXT: Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
42 # COMMON-NEXT: Address: 0x8
43 # COMMON-NEXT: Size: 0x4
44 # REMOVE-TEXT-ONLY-NEXT: Offset: 268
45 # REMOVE-TEXT-AND-DATA-NEXT: Offset: 184
46 # COMMON-NEXT: Alignment: 0
47 # COMMON-NEXT: RelocationOffset: 0x0
48 # COMMON-NEXT: RelocationCount: 0
49 # COMMON-NEXT: Type: Regular (0x0)
50 # COMMON-NEXT: Attributes [ (0x0)
52 # COMMON-NEXT: Reserved1: 0x0
53 # COMMON-NEXT: Reserved2: 0x0
54 # COMMON-NEXT: Reserved3: 0x0
55 # COMMON-NEXT: SectionData (
56 # COMMON-NEXT: 0000: EEFFEEFF |....|
61 ## Keep all sections if the specified section name is not present in the
62 ## input. The output file should be the same as the input.
63 # RUN: llvm-objcopy --remove-section __TEXT,__foo %t %t4
70 cpusubtype: 0x00000003
91 addr: 0x0000000000000000
100 reserved2: 0x00000000
101 reserved3: 0x00000000
104 addr: 0x0000000000000004
112 reserved1: 0x00000000
113 reserved2: 0x00000000
114 reserved3: 0x00000000
117 addr: 0x0000000000000008
125 reserved1: 0x00000000
126 reserved2: 0x00000000
127 reserved3: 0x00000000