Reapply 222538 and update tests to explicitly request small code model

and PIC:

Allow FDE references outside the +/-2GB range supported by PC relative
offsets for code models other than small/medium. For JIT application,
memory layout is less controlled and can result in truncations
otherwise.

Patch from Akos Kiss.

Differential Revision: http://reviews.llvm.org/D6079


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222760 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Joerg Sonnenberger 2014-11-25 13:37:55 +00:00
parent e97049e7f2
commit 21bcdeb1d6
21 changed files with 71 additions and 20 deletions

View File

@ -273,6 +273,17 @@ void MCObjectFileInfo::InitELFMCObjectFileInfo(Triple T) {
case Triple::mips64el:
FDECFIEncoding = dwarf::DW_EH_PE_sdata8;
break;
case Triple::x86_64:
if (RelocM == Reloc::PIC_) {
FDECFIEncoding = dwarf::DW_EH_PE_pcrel |
((CMModel == CodeModel::Small || CMModel == CodeModel::Medium)
? dwarf::DW_EH_PE_sdata4 : dwarf::DW_EH_PE_sdata8);
} else {
FDECFIEncoding =
(CMModel == CodeModel::Small || CMModel == CodeModel::Medium)
? dwarf::DW_EH_PE_udata4 : dwarf::DW_EH_PE_absptr;
}
break;
default:
FDECFIEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4;
break;

View File

@ -1,4 +1,6 @@
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s -sr -sd | FileCheck %s
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - \
// RUN: -relocation-model=pic -code-model=small \
// RUN: | llvm-readobj -s -sr -sd | FileCheck %s
f:
.cfi_startproc

View File

@ -1,4 +1,6 @@
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s -sr -sd | FileCheck %s
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - \
// RUN: -relocation-model=pic -code-model=small \
// RUN: | llvm-readobj -s -sr -sd | FileCheck %s
// test that this produces a correctly encoded cfi_advance_loc2

View File

@ -1,4 +1,6 @@
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s -sr -sd | FileCheck %s
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - \
// RUN: -relocation-model=pic -code-model=small \
// RUN: | llvm-readobj -s -sr -sd | FileCheck %s
f:
.cfi_startproc

View File

@ -1,4 +1,6 @@
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s -sr -sd | FileCheck %s
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - \
// RUN: -relocation-model=pic -code-model=small \
// RUN: | llvm-readobj -s -sr -sd | FileCheck %s
f:
.cfi_startproc

View File

@ -1,4 +1,6 @@
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s -sr -sd | FileCheck %s
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - \
// RUN: -relocation-model=pic -code-model=small \
// RUN: | llvm-readobj -s -sr -sd | FileCheck %s
f:
.cfi_startproc

View File

@ -1,4 +1,6 @@
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s -sr -sd | FileCheck %s
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - \
// RUN: -relocation-model=pic -code-model=small \
// RUN: | llvm-readobj -s -sr -sd | FileCheck %s
f:
.cfi_startproc

View File

@ -1,4 +1,6 @@
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s -sr -sd | FileCheck %s
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - \
// RUN: -relocation-model=pic -code-model=small \
// RUN: | llvm-readobj -s -sr -sd | FileCheck %s
f:
.cfi_startproc

View File

@ -1,4 +1,6 @@
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s -sr -sd | FileCheck %s
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - \
// RUN: -relocation-model=pic -code-model=small \
// RUN: | llvm-readobj -s -sr -sd | FileCheck %s
f:
.cfi_startproc

View File

@ -1,4 +1,6 @@
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s -sr -sd | FileCheck %s
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - \
// RUN: -relocation-model=pic -code-model=small \
// RUN: | llvm-readobj -s -sr -sd | FileCheck %s
f:
.cfi_startproc

View File

@ -1,4 +1,6 @@
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s -sr -sd | FileCheck %s
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - \
// RUN: -relocation-model=pic -code-model=small \
// RUN: | llvm-readobj -s -sr -sd | FileCheck %s
f:
.cfi_startproc

View File

@ -1,4 +1,6 @@
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s -sr -sd | FileCheck %s
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - \
// RUN: -relocation-model=pic -code-model=small \
// RUN: | llvm-readobj -s -sr -sd | FileCheck %s
f:
.cfi_startproc

View File

@ -1,4 +1,6 @@
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s -sr -sd | FileCheck %s
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - \
// RUN: -relocation-model=pic -code-model=small \
// RUN: | llvm-readobj -s -sr -sd | FileCheck %s
f:
.cfi_startproc

View File

@ -1,4 +1,6 @@
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s -sr -sd | FileCheck %s
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - \
// RUN: -relocation-model=pic -code-model=small \
// RUN: | llvm-readobj -s -sr -sd | FileCheck %s
f:
.cfi_startproc

View File

@ -1,4 +1,6 @@
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s -sd | FileCheck %s
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - \
// RUN: -relocation-model=pic -code-model=small \
// RUN: | llvm-readobj -s -sd | FileCheck %s
f:
.cfi_startproc

View File

@ -1,4 +1,6 @@
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s -sr -sd | FileCheck %s
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - \
// RUN: -relocation-model=pic -code-model=small \
// RUN: | llvm-readobj -s -sr -sd | FileCheck %s
f:
.cfi_startproc

View File

@ -1,4 +1,6 @@
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s -sr -sd | FileCheck %s
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - \
// RUN: -relocation-model=pic -code-model=small \
// RUN: | llvm-readobj -s -sr -sd | FileCheck %s
# Should use SPARC as the target to test this. However, SPARC does not
# use MC yet.

View File

@ -1,4 +1,6 @@
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s -sr -sd | FileCheck %s
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - \
// RUN: -relocation-model=pic -code-model=small \
// RUN: | llvm-readobj -s -sr -sd | FileCheck %s
// Test that we don't produce a DW_CFA_advance_loc 0

View File

@ -1,4 +1,6 @@
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -s -sr -sd | FileCheck %s
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - \
// RUN: -relocation-model=pic -code-model=small \
// RUN: | llvm-readobj -s -sr -sd | FileCheck %s
f1:
.cfi_startproc

View File

@ -1,4 +1,6 @@
// RUN: llvm-mc -triple x86_64-pc-linux-gnu %s -filetype=obj -o - | llvm-readobj -r | FileCheck %s
// RUN: llvm-mc -triple x86_64-pc-linux-gnu %s -filetype=obj -o - \
// RUN: -relocation-model=pic -code-model=small \
// RUN: | llvm-readobj -r | FileCheck %s
// Test that we can use .cfi_startproc without a global symbol.

View File

@ -1,4 +1,6 @@
// 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 x86_64-pc-linux \
// RUN: -relocation-model=pic -code-model=small \
// RUN: | 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