Skip to content

Commit 2c47c28

Browse files
committed
Add tests for llvm-readobj and llvm-objcopy
1 parent 25c34c0 commit 2c47c28

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed

llvm/test/tools/llvm-objcopy/ELF/rename-section-flag-osproc-mask.test

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,28 @@ Sections:
121121
# ARM-NEXT: SHF_ARM_PURECODE (0x20000000)
122122
# ARM-NEXT: SHF_WRITE (0x1)
123123
# ARM-NEXT: ]
124+
125+
# ===== aarch64 =====
126+
127+
# RUN: yaml2obj --docnum=5 %s -o %t-aarch64.o
128+
# RUN: llvm-objcopy --rename-section=.foo=.bar,alloc %t-aarch64.o
129+
# RUN: llvm-readobj --sections %t-aarch64.o | FileCheck %s --check-prefix=AARCH64
130+
131+
--- !ELF
132+
FileHeader:
133+
Class: ELFCLASS64
134+
Data: ELFDATA2LSB
135+
Type: ET_REL
136+
Machine: EM_AARCH64
137+
Sections:
138+
- Name: .foo
139+
Type: SHT_PROGBITS
140+
Flags: [ SHF_AARCH64_PURECODE ]
141+
142+
# AARCH64: Name: .bar
143+
# AARCH64-NEXT: Type: SHT_PROGBITS
144+
# AARCH64-NEXT: Flags [
145+
# AARCH64-NEXT: SHF_AARCH64_PURECODE (0x20000000)
146+
# AARCH64-NEXT: SHF_ALLOC (0x2)
147+
# AARCH64-NEXT: SHF_WRITE (0x1)
148+
# AARCH64-NEXT: ]

llvm/test/tools/llvm-readobj/ELF/gnu-sections.test

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,15 @@ Symbols:
110110
# ARM-NEXT: L (link order), O (extra OS processing required), G (group), T (TLS),
111111
# ARM-NEXT: C (compressed), x (unknown), o (OS specific), E (exclude),
112112
# ARM-NEXT: R (retain), y (purecode), p (processor specific)
113+
114+
## For an EM_AARCH64 target we print "y" for the SHF_AARCH64_PURECODE section flag.
115+
## Check we mention it in the flag key.
116+
117+
# RUN: yaml2obj -DMACHINE=EM_AARCH64 %s -o %t-aarch64.o
118+
# RUN: llvm-readelf -S %t-arm.o | FileCheck %s --check-prefix=AARCH64 --strict-whitespace --match-full-lines
119+
120+
# AARCH64:Key to Flags:
121+
# AARCH64-NEXT: W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
122+
# AARCH64-NEXT: L (link order), O (extra OS processing required), G (group), T (TLS),
123+
# AARCH64-NEXT: C (compressed), x (unknown), o (OS specific), E (exclude),
124+
# AARCH64-NEXT: R (retain), y (purecode), p (processor specific)

llvm/test/tools/llvm-readobj/ELF/section-arch-flags.test

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,25 @@ Sections:
138138
- Name: foo
139139
Type: SHT_PROGBITS
140140
Flags: [ SHF_ARM_PURECODE ]
141+
142+
# RUN: yaml2obj --docnum 6 %s -o %t-aarch64.o
143+
# RUN: llvm-readobj -S %t-aarch64.o | FileCheck --check-prefix=AARCH64-LLVM %s
144+
# RUN: llvm-readelf -S %t-aarch64.o | FileCheck --check-prefix=AARCH64-GNU %s
145+
146+
# AARCH64-LLVM: Flags [ (0x20000000)
147+
# AARCH64-LLVM-NEXT: SHF_AARCH64_PURECODE (0x20000000)
148+
# AARCH64-LLVM-NEXT: ]
149+
150+
# AARCH64-GNU: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
151+
# AARCH64-GNU: [ 1] foo PROGBITS 0000000000000000 000040 000000 00 y 0 0 0
152+
153+
--- !ELF
154+
FileHeader:
155+
Class: ELFCLASS64
156+
Data: ELFDATA2LSB
157+
Type: ET_REL
158+
Machine: EM_AARCH64
159+
Sections:
160+
- Name: foo
161+
Type: SHT_PROGBITS
162+
Flags: [ SHF_AARCH64_PURECODE ]

0 commit comments

Comments
 (0)