mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-13 09:33:50 +00:00
Fix the FDE encoding to be relative on ELF.
This is a very late complement to r130637 which fixed this on x86_64. Fixes pr15448. Since it looks like that every elf architecture uses this encoding when using cfi, make it the default for elf. Just exclude mips64el. It has a lovely .ll -> .o test (ef_frame.ll) that tests that nothing changes in the binary content of the .eh_frame produced by llc. Oblige it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177141 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0cfb42adb5
commit
7a86ffb19f
@ -223,6 +223,11 @@ void MCObjectFileInfo::InitMachOMCObjectFileInfo(Triple T) {
|
||||
}
|
||||
|
||||
void MCObjectFileInfo::InitELFMCObjectFileInfo(Triple T) {
|
||||
// FIXME: Check this. Mips64el is using the base values, which is most likely
|
||||
// incorrect.
|
||||
if (T.getArch() != Triple::mips64el)
|
||||
FDECFIEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4;
|
||||
|
||||
if (T.getArch() == Triple::x86) {
|
||||
PersonalityEncoding = (RelocM == Reloc::PIC_)
|
||||
? dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4
|
||||
@ -230,15 +235,13 @@ void MCObjectFileInfo::InitELFMCObjectFileInfo(Triple T) {
|
||||
LSDAEncoding = (RelocM == Reloc::PIC_)
|
||||
? dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4
|
||||
: dwarf::DW_EH_PE_absptr;
|
||||
FDEEncoding = FDECFIEncoding = (RelocM == Reloc::PIC_)
|
||||
FDEEncoding = (RelocM == Reloc::PIC_)
|
||||
? dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4
|
||||
: dwarf::DW_EH_PE_absptr;
|
||||
TTypeEncoding = (RelocM == Reloc::PIC_)
|
||||
? dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4
|
||||
: dwarf::DW_EH_PE_absptr;
|
||||
} else if (T.getArch() == Triple::x86_64) {
|
||||
FDECFIEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4;
|
||||
|
||||
if (RelocM == Reloc::PIC_) {
|
||||
PersonalityEncoding = dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |
|
||||
((CMModel == CodeModel::Small || CMModel == CodeModel::Medium)
|
||||
@ -261,8 +264,6 @@ void MCObjectFileInfo::InitELFMCObjectFileInfo(Triple T) {
|
||||
? dwarf::DW_EH_PE_udata4 : dwarf::DW_EH_PE_absptr;
|
||||
}
|
||||
} else if (T.getArch() == Triple::aarch64) {
|
||||
FDECFIEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4;
|
||||
|
||||
// The small model guarantees static code/data size < 4GB, but not where it
|
||||
// will be in memory. Most of these could end up >2GB away so even a signed
|
||||
// pc-relative 32-bit address is insufficient, theoretically.
|
||||
@ -282,7 +283,6 @@ void MCObjectFileInfo::InitELFMCObjectFileInfo(Triple T) {
|
||||
} else if (T.getArch() == Triple::ppc64) {
|
||||
PersonalityEncoding = dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |
|
||||
dwarf::DW_EH_PE_udata8;
|
||||
FDECFIEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4;
|
||||
LSDAEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_udata8;
|
||||
FDEEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_udata8;
|
||||
TTypeEncoding = dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |
|
||||
|
11
test/MC/ELF/fde-reloc.s
Normal file
11
test/MC/ELF/fde-reloc.s
Normal file
@ -0,0 +1,11 @@
|
||||
// RUN: llvm-mc -filetype=obj %s -o - -triple x86_64-pc-linux | llvm-objdump -r - | FileCheck --check-prefix=X86-64 %s
|
||||
// RUN: llvm-mc -filetype=obj %s -o - -triple i686-pc-linux | llvm-objdump -r - | FileCheck --check-prefix=I686 %s
|
||||
|
||||
// PR15448
|
||||
|
||||
func:
|
||||
.cfi_startproc
|
||||
.cfi_endproc
|
||||
|
||||
// X86-64: R_X86_64_PC32
|
||||
// I686: R_386_PC32
|
Loading…
x
Reference in New Issue
Block a user