mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-16 14:26:17 +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:
@@ -223,6 +223,11 @@ void MCObjectFileInfo::InitMachOMCObjectFileInfo(Triple T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MCObjectFileInfo::InitELFMCObjectFileInfo(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) {
|
if (T.getArch() == Triple::x86) {
|
||||||
PersonalityEncoding = (RelocM == Reloc::PIC_)
|
PersonalityEncoding = (RelocM == Reloc::PIC_)
|
||||||
? dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4
|
? 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_)
|
LSDAEncoding = (RelocM == Reloc::PIC_)
|
||||||
? dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4
|
? dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4
|
||||||
: dwarf::DW_EH_PE_absptr;
|
: 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_pcrel | dwarf::DW_EH_PE_sdata4
|
||||||
: dwarf::DW_EH_PE_absptr;
|
: dwarf::DW_EH_PE_absptr;
|
||||||
TTypeEncoding = (RelocM == Reloc::PIC_)
|
TTypeEncoding = (RelocM == Reloc::PIC_)
|
||||||
? dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4
|
? dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4
|
||||||
: dwarf::DW_EH_PE_absptr;
|
: dwarf::DW_EH_PE_absptr;
|
||||||
} else if (T.getArch() == Triple::x86_64) {
|
} else if (T.getArch() == Triple::x86_64) {
|
||||||
FDECFIEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4;
|
|
||||||
|
|
||||||
if (RelocM == Reloc::PIC_) {
|
if (RelocM == Reloc::PIC_) {
|
||||||
PersonalityEncoding = dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |
|
PersonalityEncoding = dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |
|
||||||
((CMModel == CodeModel::Small || CMModel == CodeModel::Medium)
|
((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;
|
? dwarf::DW_EH_PE_udata4 : dwarf::DW_EH_PE_absptr;
|
||||||
}
|
}
|
||||||
} else if (T.getArch() == Triple::aarch64) {
|
} 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
|
// 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
|
// will be in memory. Most of these could end up >2GB away so even a signed
|
||||||
// pc-relative 32-bit address is insufficient, theoretically.
|
// pc-relative 32-bit address is insufficient, theoretically.
|
||||||
@@ -282,7 +283,6 @@ void MCObjectFileInfo::InitELFMCObjectFileInfo(Triple T) {
|
|||||||
} else if (T.getArch() == Triple::ppc64) {
|
} else if (T.getArch() == Triple::ppc64) {
|
||||||
PersonalityEncoding = dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |
|
PersonalityEncoding = dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |
|
||||||
dwarf::DW_EH_PE_udata8;
|
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;
|
LSDAEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_udata8;
|
||||||
FDEEncoding = 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 |
|
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
|
Reference in New Issue
Block a user