109 lines · plain
1// This test checks that the constant island is aligned after BOLT tool.2 3# RUN: split-file %s %t4 5// For the first test case, in case the nop before .Lci will be removed6// the pointer to exit function won't be aligned and the test will fail.7 8# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown \9# RUN: %t/xword_align.s -o %t_xa.o10# RUN: %clang %cflags -fPIC -pie %t_xa.o -o %t_xa.exe -Wl,-q \11# RUN: -nostartfiles -nodefaultlibs -Wl,-z,notext12# RUN: llvm-bolt %t_xa.exe -o %t_xa.bolt --use-old-text=0 --lite=0 \13# RUN: --trap-old-code14# RUN: llvm-objdump -d --disassemble-symbols='$d' %t_xa.bolt | FileCheck %s15 16// For the second and third test cases, we want to set an alignment based17// on various heuristics.18 19# RUN: %clang %cflags -pie %t/page_align.s -o %t_pa.exe -Wl,-q \20# RUN: -Wl,--init=_foo -Wl,--fini=_foo21# RUN: llvm-bolt %t_pa.exe -o %t_pa.bolt22# RUN: llvm-objdump -t %t_pa.exe | grep _const_island23# RUN: llvm-objdump -t %t_pa.bolt | grep _const_island | FileCheck %s \24# RUN: --check-prefix=PAGE25 26# RUN: %clang %cflags -pie %t/64B_align.s -o %t_64B.exe -Wl,-q \27# RUN: -Wl,--init=_foo -Wl,--fini=_foo28# RUN: llvm-bolt %t_64B.exe -o %t_64B.bolt29# RUN: llvm-objdump -t %t_64B.exe | grep _const_island30# RUN: llvm-objdump -t %t_64B.bolt | grep _const_island | FileCheck %s \31# RUN: --check-prefix=64BYTE32 33;--- xword_align.s34.text35.align 436.global37.type dummy, %function38dummy:39 add x0, x0, #140 ret41 42.global43.type exitOk, %function44exitOk:45 mov x0, #046 ret47 48.global _start49.type _start, %function50_start:51 adrp x0, .Lci52 ldr x0, [x0, #:lo12:.Lci]53 blr x054 mov x0, #155 ret56 nop57# CHECK: {{0|8}} <$d>:58.Lci:59 .xword exitOk60 .xword 061 62;--- page_align.s63 .text64 .global _foo65 .type _foo, %function66_foo:67 ret68 69 .text70 .global _const_island71 .align 1272# PAGE: {{[0-9a-f]*}}000 g73_const_island:74 .rept 0x2510075 .byte 0xbb76 .endr77 78 .global _start79 .type _start, %function80_start:81 ret82 83 # Dummy relocation to force relocation mode84 .reloc 0, R_AARCH64_NONE85 86;--- 64B_align.s87 .text88 .global _foo89 .type _foo, %function90_foo:91 ret92 93 .text94 .global _const_island95 .align 696# 64BYTE: {{[0-9a-f]*}}{{0|4|8|c}}0 g97_const_island:98 .rept 0x204899 .byte 0xbb100 .endr101 102 .global _start103 .type _start, %function104_start:105 ret106 107 # Dummy relocation to force relocation mode108 .reloc 0, R_AARCH64_NONE109