|
6 | 6 | # RUN: ld.lld -shared --gc-sections a.o -o a.so
|
7 | 7 | # RUN: llvm-readelf -x .gcc_except_table -x .debug_rnglists -x .debug_loclists a.so | FileCheck %s
|
8 | 8 |
|
9 |
| -# RUN: llvm-mc --filetype=obj --triple=loongarch32 --mattr=+relax a.s -o a32.o |
10 |
| -# RUN: llvm-readobj -r -x .gcc_except_table -x .debug_rnglists -x .debug_loclists a32.o | FileCheck %s --check-prefix=REL |
11 |
| -# RUN: ld.lld -shared --gc-sections a32.o -o a32.so |
12 |
| -# RUN: llvm-readelf -x .gcc_except_table -x .debug_rnglists -x .debug_loclists a32.so | FileCheck %s |
13 |
| - |
14 |
| -# RUN: llvm-mc --filetype=obj --triple=loongarch32 --mattr=+relax extraspace.s -o extraspace32.o |
15 | 9 | # RUN: llvm-mc --filetype=obj --triple=loongarch64 --mattr=+relax extraspace.s -o extraspace64.o
|
16 |
| -# RUN: not ld.lld -shared extraspace32.o 2>&1 | FileCheck %s --check-prefix=ERROR |
17 | 10 | # RUN: not ld.lld -shared extraspace64.o 2>&1 | FileCheck %s --check-prefix=ERROR
|
18 | 11 | # ERROR: error: extraspace{{.*}}.o:(.rodata+0x0): extra space for uleb128
|
19 | 12 |
|
|
22 | 15 | .cfi_lsda 0x1b,.LLSDA0
|
23 | 16 | .cfi_endproc
|
24 | 17 |
|
| 18 | +.globl _start |
| 19 | +_start: |
| 20 | +foo: |
| 21 | + nop |
| 22 | + |
25 | 23 | .section .text.w,"axR"
|
26 |
| -break 0; break 0; break 0; w1: |
27 |
| - .p2align 4 # 4 bytes after relaxation |
28 |
| -w2: break 0 |
| 24 | +w1: |
| 25 | + call36 foo # 4 bytes after relaxation |
| 26 | +w2: |
29 | 27 |
|
30 | 28 | .section .text.x,"ax"
|
31 |
| -break 0; break 0; break 0; x1: |
32 |
| - .p2align 4 # 4 bytes after relaxation |
33 |
| -x2: break 0 |
| 29 | +x1: |
| 30 | + call36 foo # 4 bytes after relaxation |
| 31 | +x2: |
34 | 32 |
|
35 | 33 | .section .gcc_except_table,"a"
|
36 | 34 | .LLSDA0:
|
37 |
| -.uleb128 w2-w1+116 # initial value: 0x0080 |
38 |
| -.uleb128 w1-w2+141 # initial value: 0x0080 |
39 |
| -.uleb128 w2-w1+16372 # initial value: 0x008080 |
40 |
| -.uleb128 w1-w2+16397 # initial value: 0x008080 |
41 |
| -.uleb128 w2-w1+2097140 # initial value: 0x00808080 |
42 |
| -.uleb128 w1-w2+2097165 # initial value: 0x00808080 |
| 35 | +.reloc ., R_LARCH_ADD_ULEB128, w1+130 |
| 36 | +.reloc ., R_LARCH_SUB_ULEB128, w2-1 # non-zero addend for SUB |
| 37 | +.byte 0x7b |
| 38 | +.uleb128 w2-w1+120 |
| 39 | +.uleb128 w1-w2+137 |
| 40 | +.uleb128 w2-w1+16376 |
| 41 | +.uleb128 w1-w2+16393 |
| 42 | +.uleb128 w2-w1+2097144 |
| 43 | +.uleb128 w1-w2+2097161 |
43 | 44 |
|
44 | 45 | .section .debug_rnglists
|
45 |
| -.uleb128 w2-w1+116 # initial value: 0x0080 |
46 |
| -.uleb128 w1-w2+141 # initial value: 0x0080 |
47 |
| -.uleb128 w2-w1+16372 # initial value: 0x008080 |
48 |
| -.uleb128 w1-w2+16397 # initial value: 0x008080 |
49 |
| -.uleb128 w2-w1+2097140 # initial value: 0x00808080 |
50 |
| -.uleb128 w1-w2+2097165 # initial value: 0x00808080 |
| 46 | +.reloc ., R_LARCH_ADD_ULEB128, w1+130 |
| 47 | +.reloc ., R_LARCH_SUB_ULEB128, w2-1 # non-zero addend for SUB |
| 48 | +.byte 0x7b |
| 49 | +.uleb128 w2-w1+120 |
| 50 | +.uleb128 w1-w2+137 |
| 51 | +.uleb128 w2-w1+16376 |
| 52 | +.uleb128 w1-w2+16393 |
| 53 | +.uleb128 w2-w1+2097144 |
| 54 | +.uleb128 w1-w2+2097161 |
51 | 55 |
|
52 | 56 | .section .debug_loclists
|
| 57 | +.reloc ., R_LARCH_ADD_ULEB128, w2+3 |
| 58 | +.reloc ., R_LARCH_SUB_ULEB128, w1+4 # SUB with a non-zero addend |
| 59 | +.byte 0 |
53 | 60 | .uleb128 x2-x1 # references discarded symbols
|
54 | 61 |
|
55 |
| -# REL: Section ({{.*}}) .rela.debug_rnglists { |
56 |
| -# REL-NEXT: 0x0 R_LARCH_ADD_ULEB128 w2 0x74 |
57 |
| -# REL-NEXT: 0x0 R_LARCH_SUB_ULEB128 w1 0x0 |
58 |
| -# REL-NEXT: 0x2 R_LARCH_ADD_ULEB128 w1 0x8D |
59 |
| -# REL-NEXT: 0x2 R_LARCH_SUB_ULEB128 w2 0x0 |
60 |
| -# REL-NEXT: 0x4 R_LARCH_ADD_ULEB128 w2 0x3FF4 |
61 |
| -# REL-NEXT: 0x4 R_LARCH_SUB_ULEB128 w1 0x0 |
62 |
| -# REL-NEXT: 0x7 R_LARCH_ADD_ULEB128 w1 0x400D |
63 |
| -# REL-NEXT: 0x7 R_LARCH_SUB_ULEB128 w2 0x0 |
64 |
| -# REL-NEXT: 0xA R_LARCH_ADD_ULEB128 w2 0x1FFFF4 |
65 |
| -# REL-NEXT: 0xA R_LARCH_SUB_ULEB128 w1 0x0 |
66 |
| -# REL-NEXT: 0xE R_LARCH_ADD_ULEB128 w1 0x20000D |
67 |
| -# REL-NEXT: 0xE R_LARCH_SUB_ULEB128 w2 0x0 |
68 |
| -# REL-NEXT: } |
69 |
| -# REL: Section ({{.*}}) .rela.debug_loclists { |
70 |
| -# REL-NEXT: 0x0 R_LARCH_ADD_ULEB128 x2 0x0 |
71 |
| -# REL-NEXT: 0x0 R_LARCH_SUB_ULEB128 x1 0x0 |
72 |
| -# REL-NEXT: } |
73 |
| - |
74 |
| -# REL: Hex dump of section '.gcc_except_table': |
75 |
| -# REL-NEXT: 0x00000000 80008000 80800080 80008080 80008080 . |
76 |
| -# REL-NEXT: 0x00000010 8000 . |
77 |
| -# REL: Hex dump of section '.debug_rnglists': |
78 |
| -# REL-NEXT: 0x00000000 80008000 80800080 80008080 80008080 . |
79 |
| -# REL-NEXT: 0x00000010 8000 . |
80 |
| -# REL: Hex dump of section '.debug_loclists': |
81 |
| -# REL-NEXT: 0x00000000 00 . |
| 62 | +# REL: Hex dump of section '.gcc_except_table': |
| 63 | +# REL-NEXT: 0x00000000 7b800080 00808000 80800080 80800080 { |
| 64 | +# REL-NEXT: 0x00000010 808000 . |
| 65 | +# REL: Hex dump of section '.debug_rnglists': |
| 66 | +# REL-NEXT: 0x00000000 7b800080 00808000 80800080 80800080 { |
| 67 | +# REL-NEXT: 0x00000010 808000 . |
| 68 | +# REL: Hex dump of section '.debug_loclists': |
| 69 | +# REL-NEXT: 0x00000000 0000 . |
82 | 70 |
|
83 | 71 | # CHECK: Hex dump of section '.gcc_except_table':
|
84 |
| -# CHECK-NEXT: 0x[[#%x,]] f8008901 f8ff0089 8001f8ff ff008980 . |
85 |
| -# CHECK-NEXT: 0x[[#%x,]] 8001 . |
| 72 | +# CHECK-NEXT: 0x00000238 7afc0085 01fcff00 858001fc ffff0085 z |
| 73 | +# CHECK-NEXT: 0x00000248 808001 . |
86 | 74 | # CHECK: Hex dump of section '.debug_rnglists':
|
87 |
| -# CHECK-NEXT: 0x00000000 f8008901 f8ff0089 8001f8ff ff008980 . |
88 |
| -# CHECK-NEXT: 0x00000010 8001 . |
| 75 | +# CHECK-NEXT: 0x00000000 7afc0085 01fcff00 858001fc ffff0085 z |
| 76 | +# CHECK-NEXT: 0x00000010 808001 . |
89 | 77 | # CHECK: Hex dump of section '.debug_loclists':
|
90 |
| -# CHECK-NEXT: 0x00000000 00 . |
| 78 | +# CHECK-NEXT: 0x00000000 0300 . |
91 | 79 |
|
92 | 80 | #--- extraspace.s
|
93 | 81 | .text
|
|
0 commit comments