1 # REQUIRES: system-linux
3 # Check that BOLT recognizes PT_GNU_RELRO segment and marks respective sections
6 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-linux %s -o %t.o -relax-relocations
7 # RUN: ld.lld %t.o -o %t.exe -q --no-relax
8 # RUN: llvm-readelf -We %t.exe | FileCheck --check-prefix=READELF %s
9 # Unfortunately there's no direct way to extract a segment to section mapping
10 # for a given section from readelf. Use the fool-proof way of matching
11 # readelf output line-by-line.
12 # READELF: Program Headers:
13 # READELF-NEXT: Type Offset {{.*}}
18 # READELF-NEXT: GNU_RELRO
19 # (GNU_RELRO is segment 4)
21 # READELF: Section to Segment mapping:
24 # RUN: llvm-bolt %t.exe --relocs -o /dev/null -v=1 \
25 # RUN: |& FileCheck --check-prefix=BOLT %s
26 # BOLT: BOLT-INFO: marking .got as GNU_RELRO
29 .type _start, %function
32 jmp
*foo@GOTPCREL
(%rip
)
35 .size _start, .-_start