44 lines · plain
1# REQUIRES: system-linux2 3## Check that BOLT recognizes PT_GNU_RELRO segment and marks respective sections4## accordingly.5 6# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-linux %s -o %t.o7# RUN: ld.lld %t.o -o %t.exe -q --no-relax8# RUN: llvm-readelf -We %t.exe | FileCheck --check-prefix=READELF %s9# Unfortunately there's no direct way to extract a segment to section mapping10# for a given section from readelf. Use the fool-proof way of matching11# readelf output line-by-line.12# READELF: Program Headers:13# READELF-NEXT: Type Offset {{.*}}14# READELF-NEXT: PHDR15# READELF-NEXT: LOAD16# READELF-NEXT: LOAD17# READELF-NEXT: LOAD18# READELF-NEXT: GNU_RELRO19# (GNU_RELRO is segment 4)20 21# READELF: Section to Segment mapping:22# READELF: 04 .got23 24# RUN: llvm-bolt %t.exe --relocs -o %t.null -v=1 \25# RUN: 2>&1 | FileCheck --check-prefix=BOLT %s26# BOLT: BOLT-INFO: marking .got as GNU_RELRO27 28 .globl _start29 .type _start, %function30_start:31 .cfi_startproc32 jmp *foo@GOTPCREL(%rip)33 ret34 .cfi_endproc35 .size _start, .-_start36 37 .globl foo38 .type foo, %function39foo:40 .cfi_startproc41 ret42 .cfi_endproc43 .size foo, .-foo44