Index: lib/MC/MCObjectFileInfo.cpp =================================================================== --- lib/MC/MCObjectFileInfo.cpp +++ lib/MC/MCObjectFileInfo.cpp @@ -273,6 +273,11 @@ case Triple::mips64el: FDECFIEncoding = dwarf::DW_EH_PE_sdata8; break; + case Triple::x86_64: + FDECFIEncoding = dwarf::DW_EH_PE_pcrel | + (CMModel != CodeModel::Large + ? dwarf::DW_EH_PE_sdata4 : dwarf::DW_EH_PE_sdata8); + break; default: FDECFIEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4; break; Index: test/CodeGen/X86/code-model-eh-frame.ll =================================================================== --- test/CodeGen/X86/code-model-eh-frame.ll +++ test/CodeGen/X86/code-model-eh-frame.ll @@ -0,0 +1,15 @@ +; RUN: llc < %s -filetype=obj -code-model=small \ +; RUN: | llvm-objdump -r - \ +; RUN: | FileCheck -check-prefix SMALL %s +; RUN: llc < %s -filetype=obj -code-model=large \ +; RUN: | llvm-objdump -r - \ +; RUN: | FileCheck -check-prefix LARGE %s + +; SMALL: R_X86_64_PC32 +; LARGE: R_X86_64_PC64 + +target triple = "x86_64-unknown-linux-gnu" + +define void @test() { + ret void +}