llvm-project
42 строки · 1.7 Кб
1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o
3
4# RUN: not %lld -dylib -o %t %t.o -sectalign __TEXT __text asdf 2>&1 \
5# RUN: | FileCheck --check-prefix=NONUM -DNUM=asdf %s
6# RUN: not %lld -dylib -o %t %t.o -sectalign __TEXT __text 0x0X4 2>&1 \
7# RUN: | FileCheck --check-prefix=NONUM -DNUM=0x0X4 %s
8# NONUM: error: -sectalign: failed to parse '[[NUM]]' as number
9
10# RUN: not %lld -dylib -o %t %t.o -sectalign __TEXT __text 16 2>&1 \
11# RUN: | FileCheck --check-prefix=NOPOW -DNUM=16 %s
12# RUN: not %lld -dylib -o %t %t.o -sectalign __TEXT __text 0x16 2>&1 \
13# RUN: | FileCheck --check-prefix=NOPOW -DNUM=0x16 %s
14# RUN: not %lld -dylib -o %t %t.o -sectalign __TEXT __text 0 2>&1 \
15# RUN: | FileCheck --check-prefix=NOPOW -DNUM=0 %s
16# NOPOW: error: -sectalign: '[[NUM]]' (in base 16) not a power of two
17
18## __DATA_CONST tests that the flag applies to names after section renaming.
19# RUN: %lld -dylib -o %t %t.o -sectalign __TEXT __text 20 \
20# RUN: -sectalign __DATA_CONST __const 0x40
21# RUN: llvm-readobj --section-headers %t \
22# RUN: | FileCheck -DSECT=__text -DSEG=__TEXT -DALIGN=5 %s
23# RUN: llvm-readobj --section-headers %t \
24# RUN: | FileCheck -DSECT=__const -DSEG=__DATA_CONST -DALIGN=6 %s
25
26# RUN: %lld -dylib -o %t %t.o -rename_section __TEXT __text __TxT __foo \
27# RUN: -sectalign __TxT __foo 0x40
28# RUN: llvm-readobj --section-headers %t \
29# RUN: | FileCheck -DSECT=__foo -DSEG=__TxT -DALIGN=6 %s
30
31# CHECK: Name: [[SECT]]
32# CHECK-NEXT: Segment: [[SEG]]
33# CHECK-NEXT: Address:
34# CHECK-NEXT: Size:
35# CHECK-NEXT: Offset:
36# CHECK-NEXT: Alignment: [[ALIGN]]
37
38.section __TEXT,__text
39.space 1
40
41.section __DATA,__const
42.space 1
43