resolves https://github.com/llvm/llvm-project/issues/201701 by moving
the `.eh_frame_hdr` section-header entry before `.eh_frame` before
assigning final section indices.
This lets BOLT binaries work with existing [libdw library logic
expecting the index before the
table](67199e1c97/libdw/dwarf_getcfi_elf.c (L301)),
preventing linear `.eh_frame` scanning.
21 lines
725 B
Text
21 lines
725 B
Text
# Check that llvm-bolt overwrites .eh_frame_hdr in-place and keeps the
|
|
# .eh_frame_hdr section header before .eh_frame when it has to create a new
|
|
# header.
|
|
|
|
REQUIRES: system-linux
|
|
|
|
RUN: %clang %cflags %p/Inputs/hello.c -o %t -Wl,-q
|
|
RUN: llvm-bolt %t -o %t.bolt --use-old-text \
|
|
RUN: | FileCheck %s --check-prefix=CHECK-BOLT
|
|
RUN: llvm-readelf -WS %t.bolt | FileCheck %s
|
|
RUN: touch %t.empty
|
|
RUN: llvm-objcopy --update-section .eh_frame_hdr=%t.empty %t %t.small-hdr
|
|
RUN: llvm-bolt %t.small-hdr -o %t.small-hdr.bolt
|
|
RUN: llvm-readelf -WS %t.small-hdr.bolt | FileCheck %s --check-prefix=ORDER
|
|
|
|
CHECK-BOLT: rewriting .eh_frame_hdr in-place
|
|
|
|
CHECK-NOT: .bolt.org.eh_frame_hdr
|
|
|
|
ORDER: ] .eh_frame_hdr
|
|
ORDER-NEXT: ] .eh_frame
|