[llvm] r222760 - Reapply 222538 and update tests to explicitly request small code model

Joerg Sonnenberger joerg at bec.de
Tue Nov 25 05:37:56 PST 2014


Author: joerg
Date: Tue Nov 25 07:37:55 2014
New Revision: 222760

URL: http://llvm.org/viewvc/llvm-project?rev=222760&view=rev
Log:
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

Modified:
    llvm/trunk/lib/MC/MCObjectFileInfo.cpp
    llvm/trunk/test/MC/ELF/cfi-adjust-cfa-offset.s
    llvm/trunk/test/MC/ELF/cfi-advance-loc2.s
    llvm/trunk/test/MC/ELF/cfi-def-cfa-offset.s
    llvm/trunk/test/MC/ELF/cfi-def-cfa-register.s
    llvm/trunk/test/MC/ELF/cfi-def-cfa.s
    llvm/trunk/test/MC/ELF/cfi-escape.s
    llvm/trunk/test/MC/ELF/cfi-offset.s
    llvm/trunk/test/MC/ELF/cfi-register.s
    llvm/trunk/test/MC/ELF/cfi-rel-offset.s
    llvm/trunk/test/MC/ELF/cfi-rel-offset2.s
    llvm/trunk/test/MC/ELF/cfi-remember.s
    llvm/trunk/test/MC/ELF/cfi-restore.s
    llvm/trunk/test/MC/ELF/cfi-same-value.s
    llvm/trunk/test/MC/ELF/cfi-signal-frame.s
    llvm/trunk/test/MC/ELF/cfi-undefined.s
    llvm/trunk/test/MC/ELF/cfi-window-save.s
    llvm/trunk/test/MC/ELF/cfi-zero-addr-delta.s
    llvm/trunk/test/MC/ELF/cfi.s
    llvm/trunk/test/MC/ELF/pr19430.s
    llvm/trunk/test/MC/X86/fde-reloc.s

Modified: llvm/trunk/lib/MC/MCObjectFileInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectFileInfo.cpp?rev=222760&r1=222759&r2=222760&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCObjectFileInfo.cpp (original)
+++ llvm/trunk/lib/MC/MCObjectFileInfo.cpp Tue Nov 25 07:37:55 2014
@@ -273,6 +273,17 @@ void MCObjectFileInfo::InitELFMCObjectFi
   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;

Modified: llvm/trunk/test/MC/ELF/cfi-adjust-cfa-offset.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/cfi-adjust-cfa-offset.s?rev=222760&r1=222759&r2=222760&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/cfi-adjust-cfa-offset.s (original)
+++ llvm/trunk/test/MC/ELF/cfi-adjust-cfa-offset.s Tue Nov 25 07:37:55 2014
@@ -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

Modified: llvm/trunk/test/MC/ELF/cfi-advance-loc2.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/cfi-advance-loc2.s?rev=222760&r1=222759&r2=222760&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/cfi-advance-loc2.s (original)
+++ llvm/trunk/test/MC/ELF/cfi-advance-loc2.s Tue Nov 25 07:37:55 2014
@@ -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
 

Modified: llvm/trunk/test/MC/ELF/cfi-def-cfa-offset.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/cfi-def-cfa-offset.s?rev=222760&r1=222759&r2=222760&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/cfi-def-cfa-offset.s (original)
+++ llvm/trunk/test/MC/ELF/cfi-def-cfa-offset.s Tue Nov 25 07:37:55 2014
@@ -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

Modified: llvm/trunk/test/MC/ELF/cfi-def-cfa-register.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/cfi-def-cfa-register.s?rev=222760&r1=222759&r2=222760&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/cfi-def-cfa-register.s (original)
+++ llvm/trunk/test/MC/ELF/cfi-def-cfa-register.s Tue Nov 25 07:37:55 2014
@@ -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

Modified: llvm/trunk/test/MC/ELF/cfi-def-cfa.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/cfi-def-cfa.s?rev=222760&r1=222759&r2=222760&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/cfi-def-cfa.s (original)
+++ llvm/trunk/test/MC/ELF/cfi-def-cfa.s Tue Nov 25 07:37:55 2014
@@ -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

Modified: llvm/trunk/test/MC/ELF/cfi-escape.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/cfi-escape.s?rev=222760&r1=222759&r2=222760&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/cfi-escape.s (original)
+++ llvm/trunk/test/MC/ELF/cfi-escape.s Tue Nov 25 07:37:55 2014
@@ -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

Modified: llvm/trunk/test/MC/ELF/cfi-offset.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/cfi-offset.s?rev=222760&r1=222759&r2=222760&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/cfi-offset.s (original)
+++ llvm/trunk/test/MC/ELF/cfi-offset.s Tue Nov 25 07:37:55 2014
@@ -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

Modified: llvm/trunk/test/MC/ELF/cfi-register.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/cfi-register.s?rev=222760&r1=222759&r2=222760&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/cfi-register.s (original)
+++ llvm/trunk/test/MC/ELF/cfi-register.s Tue Nov 25 07:37:55 2014
@@ -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

Modified: llvm/trunk/test/MC/ELF/cfi-rel-offset.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/cfi-rel-offset.s?rev=222760&r1=222759&r2=222760&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/cfi-rel-offset.s (original)
+++ llvm/trunk/test/MC/ELF/cfi-rel-offset.s Tue Nov 25 07:37:55 2014
@@ -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

Modified: llvm/trunk/test/MC/ELF/cfi-rel-offset2.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/cfi-rel-offset2.s?rev=222760&r1=222759&r2=222760&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/cfi-rel-offset2.s (original)
+++ llvm/trunk/test/MC/ELF/cfi-rel-offset2.s Tue Nov 25 07:37:55 2014
@@ -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

Modified: llvm/trunk/test/MC/ELF/cfi-remember.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/cfi-remember.s?rev=222760&r1=222759&r2=222760&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/cfi-remember.s (original)
+++ llvm/trunk/test/MC/ELF/cfi-remember.s Tue Nov 25 07:37:55 2014
@@ -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

Modified: llvm/trunk/test/MC/ELF/cfi-restore.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/cfi-restore.s?rev=222760&r1=222759&r2=222760&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/cfi-restore.s (original)
+++ llvm/trunk/test/MC/ELF/cfi-restore.s Tue Nov 25 07:37:55 2014
@@ -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

Modified: llvm/trunk/test/MC/ELF/cfi-same-value.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/cfi-same-value.s?rev=222760&r1=222759&r2=222760&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/cfi-same-value.s (original)
+++ llvm/trunk/test/MC/ELF/cfi-same-value.s Tue Nov 25 07:37:55 2014
@@ -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

Modified: llvm/trunk/test/MC/ELF/cfi-signal-frame.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/cfi-signal-frame.s?rev=222760&r1=222759&r2=222760&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/cfi-signal-frame.s (original)
+++ llvm/trunk/test/MC/ELF/cfi-signal-frame.s Tue Nov 25 07:37:55 2014
@@ -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

Modified: llvm/trunk/test/MC/ELF/cfi-undefined.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/cfi-undefined.s?rev=222760&r1=222759&r2=222760&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/cfi-undefined.s (original)
+++ llvm/trunk/test/MC/ELF/cfi-undefined.s Tue Nov 25 07:37:55 2014
@@ -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

Modified: llvm/trunk/test/MC/ELF/cfi-window-save.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/cfi-window-save.s?rev=222760&r1=222759&r2=222760&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/cfi-window-save.s (original)
+++ llvm/trunk/test/MC/ELF/cfi-window-save.s Tue Nov 25 07:37:55 2014
@@ -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.

Modified: llvm/trunk/test/MC/ELF/cfi-zero-addr-delta.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/cfi-zero-addr-delta.s?rev=222760&r1=222759&r2=222760&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/cfi-zero-addr-delta.s (original)
+++ llvm/trunk/test/MC/ELF/cfi-zero-addr-delta.s Tue Nov 25 07:37:55 2014
@@ -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
 

Modified: llvm/trunk/test/MC/ELF/cfi.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/cfi.s?rev=222760&r1=222759&r2=222760&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/cfi.s (original)
+++ llvm/trunk/test/MC/ELF/cfi.s Tue Nov 25 07:37:55 2014
@@ -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

Modified: llvm/trunk/test/MC/ELF/pr19430.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/pr19430.s?rev=222760&r1=222759&r2=222760&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/pr19430.s (original)
+++ llvm/trunk/test/MC/ELF/pr19430.s Tue Nov 25 07:37:55 2014
@@ -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.
 

Modified: llvm/trunk/test/MC/X86/fde-reloc.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/fde-reloc.s?rev=222760&r1=222759&r2=222760&view=diff
==============================================================================
--- llvm/trunk/test/MC/X86/fde-reloc.s (original)
+++ llvm/trunk/test/MC/X86/fde-reloc.s Tue Nov 25 07:37:55 2014
@@ -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





More information about the llvm-commits mailing list