brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · e7a732f Raw
68 lines · plain
1# REQUIRES: arm2# RUN: rm -rf %t && split-file %s %t && cd %t3# RUN: llvm-mc -filetype=obj -triple=armv7-linux-gnueabi a.s -o a.o4 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## LLD may report more errors further down, but there is only one "move location counter backward" error.8# RUN: not ld.lld -z norelro -z max-page-size=4096 -T a.t a.o --no-merge-exidx-entries 2>&1 | \9# RUN:   FileCheck %s --check-prefix=ERR --implicit-check-not=error:10 11# ERR:      error: a.t:9: unable to move location counter (0x1000) backward to 0xf6c for section 'dummy1'12# ERR-NEXT: error: a.t:10: unable to move location counter (0x2000) backward to 0x1f6c for section 'dummy2'13# ERR-NEXT: error: assert failed14# ERR-NEXT: error: a.t:14: unable to move location counter (0x4104) backward to 0x4070 for section 'code.unused_space'15# ERR-NEXT: error: section '.ARM.exidx' will not fit in region 'CODE': overflowed by 148 bytes16# ERR-NEXT: error: section dummy1 at 0x1000 of size 0xffffffffffffff6c exceeds available address space17# ERR-NEXT: error: section dummy2 at 0x2000 of size 0xffffffffffffff6c exceeds available address space18# ERR-NEXT: error: section code.unused_space at 0x4104 of size 0xffffffffffffff6c exceeds available address space19 20## If we merge adjacent duplicate entries, we will have enough space. Don't report21## a spurious error https://github.com/llvm/llvm-project/issues/6683622# RUN: ld.lld -z norelro -z max-page-size=4096 -T a.t a.o -o a23# RUN: llvm-readelf -S a | FileCheck %s24 25# CHECK:       [Nr] Name              Type            Address  Off    Size   ES Flg Lk Inf Al26# CHECK-NEXT:  [ 0]                   NULL            00000000 000000 000000 00      0   0  027# CHECK-NEXT:  [ 1] dummy1            NOBITS          00001000 001000 00000c 00   A  0   0  128# CHECK-NEXT:  [ 2] dummy2            NOBITS          00002000 001000 00000c 00   A  0   0  129# CHECK-NEXT:  [ 3] .text             PROGBITS        00004000 001000 000054 00  AX  0   0  430# CHECK-NEXT:  [ 4] .ARM.exidx        ARM_EXIDX       00004054 001054 000010 00  AL  3   0  431# CHECK-NEXT:  [ 5] code.unused_space NOBITS          00004064 001064 00000c 00   A  0   0  132 33#--- a.s34.globl _start35_start:36  bx lr37 38.macro A39.section .text.f\@,"ax"40.globl f\@41f\@:42.fnstart43  bx lr44.cantunwind45.fnend46.endm47 48.rept 2049  A50.endr51 52#--- a.t53MEMORY {54  DUMMY1 (RW) : ORIGIN = 0x1000, LENGTH = 0x7055  DUMMY2 (RW) : ORIGIN = 0x2000, LENGTH = 0x7056  CODE (RX) : ORIGIN = 0x4000, LENGTH = 0x7057}58code_end = ORIGIN(CODE) + LENGTH(CODE);59 60SECTIONS {61  dummy1 (NOLOAD) : { . += code_size; } > DUMMY162  dummy2 (NOLOAD) : { . += code_size; } > DUMMY263  .text : { *(.text .text.*) } > CODE64  .ARM.exidx : { *(.ARM.exidx .ARM.exidx.*) } > CODE65  code_size = code_end - .;66  code.unused_space (NOLOAD) : { ASSERT(code_size < 16, "assert failed"); . += code_size; } > CODE67}68