Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ELF: Set FDE count in .eh_frame_hdr correctly.
It is possible to have FDEs with duplicate PCs if ICF was able to merge functions with FDEs, or if the input files for some reason contained duplicate FDEs. We previously weren't handling this correctly when producing the contents of the .eh_frame_hdr section; we were dropping entries and leaving null entries at the end of the section, which confused consumers of unwind data, such as the backtrace() function. Fix the bug by setting the FDE count to the number of FDEs actually emitted into .eh_frame_hdr, rather than the number of FDEs in .eh_frame. Differential Revision: http://reviews.llvm.org/D18911 llvm-svn: 265957
- Loading branch information
Showing
2 changed files
with
37 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# REQUIRES: x86 | ||
|
||
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t | ||
# RUN: ld.lld %t -o %t2 --icf=all --eh-frame-hdr | ||
# RUN: llvm-objdump -s %t2 | FileCheck %s | ||
|
||
# CHECK: Contents of section .eh_frame_hdr: | ||
# CHECK-NEXT: 101a0 011b033b b4ffffff 01000000 600e0000 | ||
# ^ FDE count | ||
# CHECK-NEXT: 101b0 e8ffffff 00000000 00000000 | ||
# ^ FDE for f2 | ||
|
||
.globl _start, f1, f2 | ||
_start: | ||
ret | ||
|
||
.section .text.f1, "ax" | ||
f1: | ||
.cfi_startproc | ||
ret | ||
.cfi_endproc | ||
|
||
.section .text.f2, "ax" | ||
f2: | ||
.cfi_startproc | ||
ret | ||
.cfi_endproc |