[PATCH] [x86_64] Don't truncate PC-relative relocations in ELF EH frames to 32 bits

Akos Kiss akiss at inf.u-szeged.hu
Mon Nov 3 00:44:04 PST 2014


Hi joerg,

When using LLVM in WebKit's FTL JIT (on x86_64/Linux/ELF), WebKit crashes with errors like:

ASSERTION FAILED: cfiLength
../../Source/JavaScriptCore/ftl/FTLUnwindInfo.cpp(430) : void JSC::FTL::{anonymous}::findFDE(uintptr_t, uintptr_t, uint32_t, JSC::FTL::{anonymous}::FDE_Info*, JSC::FTL::{anonymous}::CIE_Info*)
1   0x7f5bd4ceabf4 /home/akiss/devel/WebKit/WebKitBuild/Debug/lib/libjavascriptcoregtk-4.0.so.18(WTFCrash+0x1e) [0x7f5bd4ceabf4]
2   0x7f5bd4c94b05 /home/akiss/devel/WebKit/WebKitBuild/Debug/lib/libjavascriptcoregtk-4.0.so.18(+0x12ceb05) [0x7f5bd4c94b05]
3   0x7f5bd4c952b3 /home/akiss/devel/WebKit/WebKitBuild/Debug/lib/libjavascriptcoregtk-4.0.so.18(_ZN3JSC3FTL10UnwindInfo5parseEPvmPFlPNS_9ExecStateEE+0xa9) [0x7f5bd4c952b3]

The root cause of the errors turns out to be that the addresses in the Frame Description Entries (FDEs) of the EH frames are encoded in 32-bit PC-relative format. However, quite often the EH frames can get far away in the memory from the associated code and so the correct relative addresses cannot be computed/stored in 32 bits.

This patch defines the address encoding on x86_64 to be dwarf::DW_EH_PE_pcrel, which is 8 bytes there (instead of dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4, which is explicitly 4 bytes) so that the relative addresses don't get truncated.

http://reviews.llvm.org/D6079

Files:
  lib/MC/MCObjectFileInfo.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6079.15685.patch
Type: text/x-patch
Size: 446 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141103/3914cf0b/attachment.bin>


More information about the llvm-commits mailing list