[libc] Switch to using the generic `<gpuintrin.h>` implementations (#121810)
[llvm-project.git] / bolt / test / AArch64 / check-init-not-moved.s
blobad4b80d2e60e232b99d07e60cdcfb8e4aebd6abe
1 # Regression test for https://github.com/llvm/llvm-project/issues/100096
2 # static glibc binaries crash on startup because _init is moved and
3 # shares its address with an array end pointer. The GOT rewriting can't
4 # tell the two pointers apart and incorrectly updates the _array_end
5 # address. Test checks that _init is not moved.
7 # RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o
8 # RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -static -Wl,--section-start=.data=0x1000 -Wl,--section-start=.init=0x1004
9 # RUN: llvm-bolt %t.exe -o %t.bolt
10 # RUN: llvm-nm %t.exe | FileCheck --check-prefix=CHECK-ORIGINAL %s
11 # RUN: llvm-nm %t.bolt | FileCheck --check-prefix=CHECK-BOLTED %s
13 .section .data
14 .globl _array_end
15 _array_start:
16 .word 0x0
18 _array_end:
19 .section .init,"ax",@progbits
20 .globl _init
22 # Check that bolt doesn't move _init.
24 # CHECK-ORIGINAL: 0000000000001004 T _init
25 # CHECK-BOLTED: 0000000000001004 T _init
26 _init:
27 ret
29 .section .text,"ax",@progbits
30 .globl _start
32 # Check that bolt is moving some other functions.
34 # CHECK-ORIGINAL: 0000000000001008 T _start
35 # CHECK-BOLTED-NOT: 0000000000001008 T _start
36 _start:
37 bl _init
38 adrp x0, #:got:_array_end
39 ldr x0, [x0, #:gotpage_lo15:_array_end]
40 adrp x0, #:got:_init
41 ldr x0, [x0, #:gotpage_lo15:_init]
42 ret