1 # This reproduces a bug with BOLT non-reloc mode, during emission, if the user
2 # does not use -update-debug-sections. In this bug, if a function gets too large
3 # to occupy its original location, but it has a jump table, BOLT would skip
4 # rewriting the function but it would still overwrite the jump table in a bogus
5 # file offset (offset zero). This will typically corrupt the .interp section,
6 # which is the first section in the binary, depending on the size of the jump
7 # table that was written. If .interp is corrupted, the binary won't run.
9 # REQUIRES: system-linux
11 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
12 # RUN: llvm-strip --strip-unneeded %t.o
13 # RUN: %clang %cflags -no-pie -nostartfiles -nostdlib -lc %t.o -o %t.exe
15 # RUN: llvm-bolt %t.exe -o %t.exe.bolt --relocs=0 --lite=0 \
16 # RUN: --reorder-blocks=reverse
18 # RUN: %t.exe.bolt 1 2 3
23 .type _start, @function
44 .size _start, .-_start
46 # Make the jump table large enough to force the bug to manifest as .interp
47 # being corrupt. Typically .interp will be at offset 0x1c8, so the jump table
48 # needs to be larger than that.
49 .section .rodata,"a",@progbits