Skip to content

Commit 6ef0941

Browse files
committed
Add test
1 parent d40b0eb commit 6ef0941

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
.section __TEXT,__text,regular,pure_instructions
2+
.build_version macos, 11, 0
3+
.globl _main ; -- Begin function main
4+
.p2align 2
5+
_main: ; @main
6+
.cfi_startproc
7+
; %bb.0:
8+
sub sp, sp, #32
9+
stp x29, x30, [sp, #16] ; 16-byte Folded Spill
10+
add x29, sp, #16
11+
.cfi_def_cfa w29, 16
12+
.cfi_offset w30, -8
13+
.cfi_offset w29, -16
14+
mov w8, #0 ; =0x0
15+
str w8, [sp, #8] ; 4-byte Folded Spill
16+
stur wzr, [x29, #-4]
17+
adrp x0, __ZL7storage@PAGE
18+
add x0, x0, __ZL7storage@PAGEOFF
19+
bl __Z3fooPKc
20+
ldr w0, [sp, #8] ; 4-byte Folded Reload
21+
ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
22+
add sp, sp, #32
23+
ret
24+
.cfi_endproc
25+
; -- End function
26+
.section __DATA,__storage
27+
__ZL7storage: ; @_ZL7storage
28+
.space 1383 ; 0x567
29+
30+
.subsections_via_symbols
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# REQUIRES: aarch64-registered-target
2+
3+
# RUN: llvm-mc -assemble -triple=arm64-apple-macos11 -filetype=obj %p/Inputs/macho_sections.s -o %t.o
4+
# RUN: llvm-otool -l %t.o | FileCheck %s --check-prefix=ORIG
5+
6+
7+
# RUN: llvm-objcopy %t.o --update-section __DATA,__storage=%p/Inputs/macho_sections.s %t.new.o
8+
# RUN: llvm-otool -l %t.new.o | FileCheck %s --check-prefix=UPDATED
9+
10+
11+
# ORIG: cmd LC_SEGMENT_64
12+
# ORIG-NEXT: cmdsize 312
13+
# ORIG-NEXT: segname
14+
# ORIG-NEXT: vmaddr 0x0000000000000000
15+
# ORIG-NEXT: vmsize 0x00000000000005c0
16+
# ORIG-NEXT: fileoff 472
17+
# ORIG-NEXT: filesize 1472
18+
# ORIG-NEXT: maxprot 0x00000007
19+
# ORIG-NEXT: initprot 0x00000007
20+
# ORIG-NEXT: nsects 3
21+
# ORIG-NEXT: flags 0x0
22+
23+
# ORIG: Section
24+
# ORIG: sectname __storage
25+
# ORIG-NEXT: segname __DATA
26+
# ORIG-NEXT: addr 0x0000000000000034
27+
# ORIG-NEXT: size 0x0000000000000567
28+
29+
30+
### Make sure the file size and segment size have changed
31+
# UPDATED: cmd LC_SEGMENT_64
32+
# UPDATED-NEXT: cmdsize 312
33+
# UPDATED-NEXT: segname
34+
# UPDATED-NEXT: vmaddr 0x0000000000000000
35+
# UPDATED-NEXT: vmsize 0x00000000000005c0
36+
# UPDATED-NEXT: fileoff 472
37+
# UPDATED-NEXT: filesize 1048
38+
# UPDATED-NEXT: maxprot 0x00000007
39+
# UPDATED-NEXT: initprot 0x00000007
40+
# UPDATED-NEXT: nsects 3
41+
# UPDATED-NEXT: flags 0x0
42+
43+
# UPDATED: Section
44+
# UPDATED: sectname __storage
45+
# UPDATED-NEXT: segname __DATA
46+
# UPDATED-NEXT: addr 0x0000000000000034
47+
# UPDATED-NEXT: size 0x00000000000003be
48+

0 commit comments

Comments
 (0)