|
2 | 2 | # RUN: rm -rf %t && split-file %s %t && cd %t
|
3 | 3 | # RUN: llvm-mc -filetype=obj -triple=armv7-linux-gnueabi a.s -o a.o
|
4 | 4 |
|
5 |
| -## If we don't merge adjacent duplicate entries, __code_size will be negative and |
6 |
| -## . += __code_size will trigger a "move location counter backward" error. |
| 5 | +## If we don't merge adjacent duplicate entries, code_size will be negative (huge uint64_t value). |
| 6 | +## The ASSERT will fail and . += code_size will trigger a "move location counter backward" error. |
7 | 7 | ## LLD may report more errors further down, but there is only one "move location counter backward" error.
|
8 | 8 | # RUN: not ld.lld -z norelro -z max-page-size=4096 -T a.t a.o --no-merge-exidx-entries 2>&1 | \
|
9 | 9 | # RUN: FileCheck %s --check-prefix=ERR --implicit-check-not=error:
|
10 | 10 |
|
11 | 11 | # ERR: error: a.t:9: unable to move location counter (0x1000) backward to 0xf6c for section 'dummy1'
|
12 | 12 | # ERR-NEXT: error: a.t:10: unable to move location counter (0x2000) backward to 0x1f6c for section 'dummy2'
|
| 13 | +# ERR-NEXT: error: assert failed |
13 | 14 | # ERR-NEXT: error: a.t:14: unable to move location counter (0x4104) backward to 0x4070 for section 'code.unused_space'
|
14 | 15 | # ERR-NEXT: error: section '.ARM.exidx' will not fit in region 'CODE': overflowed by 148 bytes
|
15 | 16 | # ERR-NEXT: error: section dummy1 at 0x1000 of size 0xffffffffffffff6c exceeds available address space
|
@@ -62,5 +63,5 @@ SECTIONS {
|
62 | 63 | .text : { *(.text .text.*) } > CODE
|
63 | 64 | .ARM.exidx : { *(.ARM.exidx .ARM.exidx.*) } > CODE
|
64 | 65 | code_size = code_end - .;
|
65 |
| - code.unused_space (NOLOAD) : { . += code_size; } > CODE |
| 66 | + code.unused_space (NOLOAD) : { ASSERT(code_size < 16, "assert failed"); . += code_size; } > CODE |
66 | 67 | }
|
0 commit comments