From 82c84fdd23669d23c02a07498c83b83702979829 Mon Sep 17 00:00:00 2001 From: "Michael J. Spencer" Date: Tue, 24 Aug 2010 21:04:52 +0000 Subject: Fix COFF x86-64 relocations. PR7960. Multiple symbol reloc handling part of the patch by Cameron Esfahani. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111963 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/MC/COFF/basic-coff.ll | 10 +++++----- test/MC/COFF/switch-relocations.ll | 34 ++++++++++++++++++++++++++++++++++ test/MC/COFF/symbol-fragment-offset.ll | 10 +++++----- 3 files changed, 44 insertions(+), 10 deletions(-) create mode 100644 test/MC/COFF/switch-relocations.ll (limited to 'test/MC/COFF') diff --git a/test/MC/COFF/basic-coff.ll b/test/MC/COFF/basic-coff.ll index 2178bc8..e1bf11e 100644 --- a/test/MC/COFF/basic-coff.ll +++ b/test/MC/COFF/basic-coff.ll @@ -1,9 +1,9 @@ -; RUN: llc -filetype=obj %s -o %t -; RUN: coff-dump.py %abs_tmp | FileCheck %s +; This test checks that the COFF object emitter works for the most basic +; programs. -; ModuleID = '-' -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f80:128:128-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32" -target triple = "i686-pc-win32" +; RUN: llc -filetype=obj -mtriple i686-pc-win32 %s -o %t +; RUN: coff-dump.py %abs_tmp | FileCheck %s +; RUN: llc -filetype=obj -mtriple x86_64-pc-win32 %s -o %t @.str = private constant [12 x i8] c"Hello World\00" ; <[12 x i8]*> [#uses=1] diff --git a/test/MC/COFF/switch-relocations.ll b/test/MC/COFF/switch-relocations.ll new file mode 100644 index 0000000..300c107 --- /dev/null +++ b/test/MC/COFF/switch-relocations.ll @@ -0,0 +1,34 @@ +; The purpose of this test is to see if the COFF object writer can properly +; relax the fixups that are created for jump tables on x86-64. See PR7960. + +; This test case was reduced from Lua/lapi.c. + +; RUN: llc -filetype=obj -mtriple i686-pc-win32 %s -o %t +; RUN: llc -filetype=obj -mtriple x86_64-pc-win32 %s -o %t + +define void @lua_gc(i32 %what) nounwind { +entry: + switch i32 %what, label %sw.epilog [ + i32 0, label %sw.bb + i32 1, label %sw.bb + i32 2, label %sw.bb + i32 3, label %sw.bb14 + i32 4, label %sw.bb18 + i32 6, label %sw.bb57 + ] + +sw.bb: ; preds = %entry, %entry, %entry + ret void + +sw.bb14: ; preds = %entry + ret void + +sw.bb18: ; preds = %entry + ret void + +sw.bb57: ; preds = %entry + ret void + +sw.epilog: ; preds = %entry + ret void +} diff --git a/test/MC/COFF/symbol-fragment-offset.ll b/test/MC/COFF/symbol-fragment-offset.ll index bf22c4e..25cae5a 100644 --- a/test/MC/COFF/symbol-fragment-offset.ll +++ b/test/MC/COFF/symbol-fragment-offset.ll @@ -1,9 +1,9 @@ -; RUN: llc -filetype=obj %s -o %t -; RUN: coff-dump.py %abs_tmp | FileCheck %s +; The purpose of this test is to see if the COFF object writer is emitting the +; proper relocations for multiple pieces of data in a single data fragment. -; ModuleID = 'coff-fragment-test.c' -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f80:128:128-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32" -target triple = "i686-pc-win32" +; RUN: llc -filetype=obj -mtriple i686-pc-win32 %s -o %t +; RUN: coff-dump.py %abs_tmp | FileCheck %s +; RUN: llc -filetype=obj -mtriple x86_64-pc-win32 %s -o %t @.str = private constant [7 x i8] c"Hello \00" ; <[7 x i8]*> [#uses=1] @str = internal constant [7 x i8] c"World!\00" ; <[7 x i8]*> [#uses=1] -- cgit v1.1