Support for generating ELF objects on Windows.
authorAndrew Kaylor <andrew.kaylor@intel.com>
Tue, 2 Oct 2012 18:38:34 +0000 (18:38 +0000)
committerAndrew Kaylor <andrew.kaylor@intel.com>
Tue, 2 Oct 2012 18:38:34 +0000 (18:38 +0000)
This adds 'elf' as a recognized target triple environment value and overrides the default generated object format on Windows platforms if that value is present.  This patch also enables MCJIT tests on Windows using the new environment value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165030 91177308-0d34-0410-b5e6-96231b3b80d8

57 files changed:
include/llvm/ADT/Triple.h
lib/ExecutionEngine/TargetSelect.cpp
lib/MC/MCObjectFileInfo.cpp
lib/Support/Triple.cpp
lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
lib/Target/X86/X86Subtarget.h
test/ExecutionEngine/MCJIT/2002-12-16-ArgTest.ll
test/ExecutionEngine/MCJIT/2003-01-04-ArgumentBug.ll
test/ExecutionEngine/MCJIT/2003-01-04-LoopTest.ll
test/ExecutionEngine/MCJIT/2003-01-04-PhiTest.ll
test/ExecutionEngine/MCJIT/2003-01-09-SARTest.ll
test/ExecutionEngine/MCJIT/2003-01-10-FUCOM.ll
test/ExecutionEngine/MCJIT/2003-01-15-AlignmentTest.ll
test/ExecutionEngine/MCJIT/2003-05-06-LivenessClobber.ll
test/ExecutionEngine/MCJIT/2003-05-07-ArgumentTest.ll
test/ExecutionEngine/MCJIT/2003-05-11-PHIRegAllocBug.ll
test/ExecutionEngine/MCJIT/2003-06-04-bzip2-bug.ll
test/ExecutionEngine/MCJIT/2003-06-05-PHIBug.ll
test/ExecutionEngine/MCJIT/2003-08-15-AllocaAssertion.ll
test/ExecutionEngine/MCJIT/2003-08-21-EnvironmentTest.ll
test/ExecutionEngine/MCJIT/2003-08-23-RegisterAllocatePhysReg.ll
test/ExecutionEngine/MCJIT/2003-10-18-PHINode-ConstantExpr-CondCode-Failure.ll
test/ExecutionEngine/MCJIT/2005-12-02-TailCallBug.ll
test/ExecutionEngine/MCJIT/2007-12-10-APIntLoadStore.ll
test/ExecutionEngine/MCJIT/2008-06-05-APInt-OverAShr.ll
test/ExecutionEngine/MCJIT/2010-01-15-UndefValue.ll
test/ExecutionEngine/MCJIT/fpbitcast.ll
test/ExecutionEngine/MCJIT/hello.ll
test/ExecutionEngine/MCJIT/hello2.ll
test/ExecutionEngine/MCJIT/lit.local.cfg
test/ExecutionEngine/MCJIT/pr13727.ll
test/ExecutionEngine/MCJIT/simplesttest.ll
test/ExecutionEngine/MCJIT/simpletest.ll
test/ExecutionEngine/MCJIT/stubs.ll
test/ExecutionEngine/MCJIT/test-arith.ll
test/ExecutionEngine/MCJIT/test-branch.ll
test/ExecutionEngine/MCJIT/test-call-no-external-funcs.ll
test/ExecutionEngine/MCJIT/test-call.ll
test/ExecutionEngine/MCJIT/test-cast.ll
test/ExecutionEngine/MCJIT/test-common-symbols.ll
test/ExecutionEngine/MCJIT/test-constantexpr.ll
test/ExecutionEngine/MCJIT/test-fp-no-external-funcs.ll
test/ExecutionEngine/MCJIT/test-fp.ll
test/ExecutionEngine/MCJIT/test-global-init-nonzero.ll
test/ExecutionEngine/MCJIT/test-global.ll
test/ExecutionEngine/MCJIT/test-loadstore.ll
test/ExecutionEngine/MCJIT/test-local.ll
test/ExecutionEngine/MCJIT/test-logical.ll
test/ExecutionEngine/MCJIT/test-loop.ll
test/ExecutionEngine/MCJIT/test-phi.ll
test/ExecutionEngine/MCJIT/test-ret.ll
test/ExecutionEngine/MCJIT/test-return.ll
test/ExecutionEngine/MCJIT/test-setcond-fp.ll
test/ExecutionEngine/MCJIT/test-setcond-int.ll
test/ExecutionEngine/MCJIT/test-shift.ll
test/lit.cfg

index 7ff90552c07f2afc30a86cf271c065785d545e18..a0527683f675be6c23be470d12d793da5c6253d9 100644 (file)
@@ -111,7 +111,8 @@ public:
     GNUEABIHF,
     EABI,
     MachO,
-    Android
+    Android,
+    ELF
   };
 
 private:
index 7cdd669028b876c15f317de1b64ca00368e226ec..8b6104fdca9cb15209b05e8ba06181f9c0a133d3 100644 (file)
 using namespace llvm;
 
 TargetMachine *EngineBuilder::selectTarget() {
-  Triple TT(LLVM_HOSTTRIPLE);
+  Triple TT;
+
+  // MCJIT can generate code for remote targets, but the old JIT and Interpreter
+  // must use the host architecture.
+  if (UseMCJIT && WhichEngine != EngineKind::Interpreter && M)
+    TT.setTriple(M->getTargetTriple());
+  else
+    TT.setTriple(LLVM_HOSTTRIPLE);
   return selectTarget(TT, MArch, MCPU, MAttrs);
 }
 
index 8053624831bdf7e0cf608fd10c15ced73346c62d..c59477f6dd50456a47ed8733c97861762e76bedb 100644 (file)
@@ -565,6 +565,7 @@ void MCObjectFileInfo::InitMCObjectFileInfo(StringRef TT, Reloc::Model relocm,
     Env = IsMachO;
     InitMachOMCObjectFileInfo(T);
   } else if ((Arch == Triple::x86 || Arch == Triple::x86_64) &&
+             (T.getEnvironment() != Triple::ELF) &&
              (T.getOS() == Triple::MinGW32 || T.getOS() == Triple::Cygwin ||
               T.getOS() == Triple::Win32)) {
     Env = IsCOFF;
index 32f4074b15fa4d80104c21dbf11ef99d0283a33e..abfaecc279099fe20f7421150fb7c0d05dcc7c82 100644 (file)
@@ -142,6 +142,7 @@ const char *Triple::getEnvironmentTypeName(EnvironmentType Kind) {
   case EABI: return "eabi";
   case MachO: return "macho";
   case Android: return "android";
+  case ELF: return "elf";
   }
 
   llvm_unreachable("Invalid EnvironmentType!");
@@ -314,6 +315,7 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) {
     .StartsWith("gnu", Triple::GNU)
     .StartsWith("macho", Triple::MachO)
     .StartsWith("android", Triple::Android)
+    .StartsWith("elf", Triple::ELF)
     .Default(Triple::UnknownEnvironment);
 }
 
index 68464ed5cddfed1ebfe975f9f4f9fbf871dcfe86..3809f3d38530e7988c04be03e800f6ab92c366ab 100644 (file)
@@ -453,7 +453,7 @@ MCAsmBackend *llvm::createX86_32AsmBackend(const Target &T, StringRef TT, String
   if (TheTriple.isOSDarwin() || TheTriple.getEnvironment() == Triple::MachO)
     return new DarwinX86_32AsmBackend(T, CPU);
 
-  if (TheTriple.isOSWindows())
+  if (TheTriple.isOSWindows() && TheTriple.getEnvironment() != Triple::ELF)
     return new WindowsX86AsmBackend(T, false, CPU);
 
   uint8_t OSABI = MCELFObjectTargetWriter::getOSABI(TheTriple.getOS());
@@ -466,7 +466,7 @@ MCAsmBackend *llvm::createX86_64AsmBackend(const Target &T, StringRef TT, String
   if (TheTriple.isOSDarwin() || TheTriple.getEnvironment() == Triple::MachO)
     return new DarwinX86_64AsmBackend(T, CPU);
 
-  if (TheTriple.isOSWindows())
+  if (TheTriple.isOSWindows() && TheTriple.getEnvironment() != Triple::ELF)
     return new WindowsX86AsmBackend(T, true, CPU);
 
   uint8_t OSABI = MCELFObjectTargetWriter::getOSABI(TheTriple.getOS());
index 02b586bb7cf0a6d26f349c1c91487d41dd2ef777..c48f7706e246bcb4519483890804a297caeb9ec6 100644 (file)
@@ -384,11 +384,15 @@ static MCAsmInfo *createX86MCAsmInfo(const Target &T, StringRef TT) {
       MAI = new X86_64MCAsmInfoDarwin(TheTriple);
     else
       MAI = new X86MCAsmInfoDarwin(TheTriple);
+  } else if (TheTriple.getEnvironment() == Triple::ELF) {
+    // Force the use of an ELF container.
+    MAI = new X86ELFMCAsmInfo(TheTriple);
   } else if (TheTriple.getOS() == Triple::Win32) {
     MAI = new X86MCAsmInfoMicrosoft(TheTriple);
   } else if (TheTriple.getOS() == Triple::MinGW32 || TheTriple.getOS() == Triple::Cygwin) {
     MAI = new X86MCAsmInfoGNUCOFF(TheTriple);
   } else {
+    // The default is ELF.
     MAI = new X86ELFMCAsmInfo(TheTriple);
   }
 
@@ -470,7 +474,7 @@ static MCStreamer *createMCStreamer(const Target &T, StringRef TT,
   if (TheTriple.isOSDarwin() || TheTriple.getEnvironment() == Triple::MachO)
     return createMachOStreamer(Ctx, MAB, _OS, _Emitter, RelaxAll);
 
-  if (TheTriple.isOSWindows())
+  if (TheTriple.isOSWindows() && TheTriple.getEnvironment() != Triple::ELF)
     return createWinCOFFStreamer(Ctx, MAB, *_Emitter, _OS, RelaxAll);
 
   return createELFStreamer(Ctx, MAB, _OS, _Emitter, RelaxAll, NoExecStack);
index ed243ec5d10ae0c18b4815aca4f3b318d7767a72..f723c66b729cc9a1e482684c26b37a53be7a3039 100644 (file)
@@ -237,10 +237,10 @@ public:
   bool isTargetSolaris() const {
     return TargetTriple.getOS() == Triple::Solaris;
   }
-
-  // ELF is a reasonably sane default and the only other X86 targets we
-  // support are Darwin and Windows. Just use "not those".
-  bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); }
+  bool isTargetELF() const {
+    return (TargetTriple.getEnvironment() == Triple::ELF ||
+            TargetTriple.isOSBinFormatELF());
+  }
   bool isTargetLinux() const { return TargetTriple.getOS() == Triple::Linux; }
   bool isTargetNaCl() const {
     return TargetTriple.getOS() == Triple::NativeClient;
@@ -251,7 +251,10 @@ public:
   bool isTargetMingw() const { return TargetTriple.getOS() == Triple::MinGW32; }
   bool isTargetCygwin() const { return TargetTriple.getOS() == Triple::Cygwin; }
   bool isTargetCygMing() const { return TargetTriple.isOSCygMing(); }
-  bool isTargetCOFF() const { return TargetTriple.isOSBinFormatCOFF(); }
+  bool isTargetCOFF() const {
+    return (TargetTriple.getEnvironment() != Triple::ELF &&
+            TargetTriple.isOSBinFormatCOFF());
+  }
   bool isTargetEnvMacho() const { return TargetTriple.isEnvironmentMachO(); }
 
   bool isTargetWin64() const {
index 46273d3400952f30fe37ba85f3be5966f25aac8f..28cc54a868061e8af2b7b81aa11be5b2984477df 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 @.LC0 = internal global [10 x i8] c"argc: %d\0A\00"            ; <[10 x i8]*> [#uses=1]
 
index 88bfbb3c09bb224abc853bb9e6759d401299ae45..9f895983fdb16d9f0121f0761c0a05bc3926fc36 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 define i32 @foo(i32 %X, i32 %Y, double %A) {
        %cond212 = fcmp une double %A, 1.000000e+00             ; <i1> [#uses=1]
index d5f860d17048d62dd549eff9528c78150b297915..997b2a9037ee312bfcd2d34f23ab0a2649457e27 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 define i32 @main() {
        call i32 @mylog( i32 4 )                ; <i32>:1 [#uses=0]
index 721f2e8859dcdf9a9c00cdfac182168eb9839d8f..ba35b5bcc436e54167817d860832d0b63a133c2c 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 define i32 @main() {
 ; <label>:0
index d17df997c817cb3b5a0ceac57269dc2144025207..f3c88adf84355da9724e73c20f92e7ffb4ca9c43 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 ; We were accidentally inverting the signedness of right shifts.  Whoops.
 
index e55cb06aa1e6bb6e9fdd45df668dea52cae657fb..f925e79f24849b2952defa3ccff6bfbd49bab336 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 define i32 @main() {
        %X = fadd double 0.000000e+00, 1.000000e+00             ; <double> [#uses=1]
index 663dc40010795633ec43dc9d1f97ef01bd1887cf..5b426f6c330b5a17620db7ae7b62695d18264676 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 define i32 @bar(i8* %X) {
         ; pointer should be 4 byte aligned!
index e95294be74a41081c4e2312a4fef590570e15639..c0a7393f8244f8dcf299934f0631fa9ae9c06554 100644 (file)
@@ -1,6 +1,6 @@
 ; This testcase should return with an exit code of 1.
 ;
-; RUN: not %lli -use-mcjit %s
+; RUN: not %lli -mtriple=%mcjit_triple -use-mcjit %s
 
 @test = global i64 0           ; <i64*> [#uses=1]
 
index a237194ea48f3bf036a73a6ee16ffc3f4c7f493b..d3e6204a85be1a708982fb3d55d47c61acaae99a 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s test
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s test
 
 declare i32 @puts(i8*)
 
index 70464a3ffcb7976e5c431c88228c9522c513bdb2..55a169754104444edea6dade71f84819f8d18248 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 target datalayout = "e-p:32:32"
 
index 58d423f924418efebc76933ff6cdda21ae324692..79c6e7fe4caee850b41a92b60c329f3e9b53a932 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 ; Testcase distilled from 256.bzip2.
 
index a22fe07b0859917baaf84992ca6834ad53eb88a4..ffd6df6e5e2544be599d0fbe891e656445449208 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 ; Testcase distilled from 256.bzip2.
 
index b3c6d8abbc064bd46e3ceabe0284b6461e2e6438..90839e96986ff559c265025f4e73d158f7623991 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 ; This testcase failed to work because two variable sized allocas confused the
 ; local register allocator.
index bd32f3037ddcf53db8dd4c31617cb28c67eba8bd..29ef2c556cd01e6d6c4224552cf386036d95def4 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 ;
 ; Regression Test: EnvironmentTest.ll
index 1959534b877af7891cc7a1a151111e056f92ef1e..2adb608acbb186a659611b247f3c6d24676e203b 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 ; This testcase exposes a bug in the local register allocator where it runs out
 ; of registers (due to too many overlapping live ranges), but then attempts to
index 1f8343fc43f553794b55e0f6e72494a8c8ba5932..91bde46903614a29d63fb5a214858e47d5b6fe60 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 @A = global i32 0              ; <i32*> [#uses=1]
 
index 79a7d583ce616f78c633ce7878e6fc466f1d3317..a7462d9e698a7e0f208be3edf6eb5d6fa0b8f43e 100644 (file)
@@ -1,5 +1,5 @@
 ; PR672
-; RUN: %lli -use-mcjit %s
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s
 ; XFAIL: mcjit-ia32
 
 define i32 @main() {
index 52cef4d35ca65ece678270afbe4f3414758829bd..2406596602522fa841d2741d35be3c099e52c31b 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit -force-interpreter %s
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit -force-interpreter %s
 ; PR1836
 
 define i32 @main() {
index a6e917f457b3c3a3e9df3eb7ef228161b56efc25..d429d519e04f08157bd752e782f750ef4f0eb01b 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit -force-interpreter=true %s | grep 1
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit -force-interpreter=true %s | grep 1
 
 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
 target triple = "i686-pc-linux-gnu"
index 524a724c474bac1a8f6922c9a83a7497640cadf5..a6d18e7919ccb7e7646a85ebd88b33b01706fc6f 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit -force-interpreter=true %s
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit -force-interpreter=true %s > /dev/null
 
 define i32 @main() {
        %a = add i32 0, undef
index 9da908f8cff1acc4a4aeff599c4f27d72e1a61af..bb4957e9e66edf3568711e4f66a94ffa80ff9d63 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit -force-interpreter=true %s | grep 40091eb8
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit -force-interpreter=true %s | grep 40091eb8
 ;
 define i32 @test(double %x) {
 entry:
index a52b6d48af293b3a401aaee257445a4eeecad6b6..ceb9c12ab4bd80fb058ad84f9383d2ad83801839 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 @.LC0 = internal global [12 x i8] c"Hello World\00"            ; <[12 x i8]*> [#uses=1]
 
index 670a6dd671cecef691bf6d4acb69ba60717a9b6a..756fcadb1cafaf149358f3af1c5b98c825cdb3ec 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 @X = global i32 7              ; <i32*> [#uses=0]
 @msg = internal global [13 x i8] c"Hello World\0A\00"          ; <[13 x i8]*> [#uses=1]
index 2980ce70811c1f5debd81064529eb5fb4ba44c06..985496ffde0d8b3b07f9e2821ffb9309f4ce6668 100644 (file)
@@ -16,5 +16,5 @@ else:
 if root.host_arch not in ['x86', 'x86_64', 'ARM', 'Mips']:
     config.unsupported = True
 
-if root.host_os in ['Win32', 'Cygwin', 'MingW', 'Windows', 'Darwin']:
+if root.host_os in ['Cygwin', 'MingW', 'Darwin']:
     config.unsupported = True
index 5fa68f9b8723307e1573619e97fafbb62f4be3d2..c33bf328108723c358c02159bf9ba1247fba0e7a 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit -O0 -disable-lazy-compilation=false %s
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit -O0 -disable-lazy-compilation=false %s
 
 ; The intention of this test is to verify that symbols mapped to COMMON in ELF
 ; work as expected.
index a6688c237c0e51a1d772bfdeb85802c226d82782..02ad0061fd13f2c9297ce2e441833309a8a85617 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 define i32 @main() {
        ret i32 0
index 4562aa6012ef655d325bd2d7961ea9ba325d5c07..958b783067e48fcf1b744fd8e3452da112bfb89a 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 define i32 @bar() {
        ret i32 0
index b285b0eadb3fce356049014e334d6d371d8c2ed7..9e5d5b2e4186a28f71e40f9a174b4ec62d3936b0 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit -disable-lazy-compilation=false %s
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit -disable-lazy-compilation=false %s
 
 define i32 @main() nounwind {
 entry:
index 31777604d577f941fecdff01b71d70998741fd94..b73227fe635eafa61b1593029693b737bd16605b 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 define i32 @main() {
        %A = add i8 0, 12               ; <i8> [#uses=1]
index 702c11022094ff5ec4caafc6613cbf03c7a11e34..8f3c7279051eeb2d583fbc1981ad85022d4b26b7 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 ; test unconditional branch
 define i32 @main() {
index 6f284055fd92fdcb84dfa5b9d5cc28fbb551e595..20150b2de626cbee7e2cd3b86e082970efc05287 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 define i32 @_Z14func_exit_codev() nounwind uwtable {
 entry:
index 7a244ee505813e8522e9963fc0c2fd958a0b2f4a..51d19fe991787a9928dcd05232c843f1e6e9a200 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 declare void @exit(i32)
 
index 75e7d1b423f391d5321f931cc0b1173f4bb71283..dcc97f466568ce04b7ad730092d9d6c3db41038d 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 define i32 @foo() {
        ret i32 0
index ac1d9acd954ef3bcdc250c2eaf785fa262e9cf9c..8c8190291f18fc923ed00f9d811055bccf17cb3c 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit -O0 -disable-lazy-compilation=false %s
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit -O0 -disable-lazy-compilation=false %s
 
 ; The intention of this test is to verify that symbols mapped to COMMON in ELF
 ; work as expected.
index 6b46639c51f9e0f9e4c1467e194a367dd5eb3cce..56c1290448adeac26528a2fad281f18cb2f2ae25 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 ; This tests to make sure that we can evaluate weird constant expressions
 
index 35491df791770e1b21c6e411fd2a0b1234b619ae..7af1d8b53910701462804608b0aa40382ffb3280 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 define double @test(double* %DP, double %Arg) {
        %D = load double* %DP           ; <double> [#uses=1]
index 6fc5a501f6e6480c148fbee33acd277ae4e005b3..f7e6fb9ba18e2f6647b9f0e4e29c15f7b2074993 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 define double @test(double* %DP, double %Arg) {
        %D = load double* %DP           ; <double> [#uses=1]
index 4a790c6ff17435c1497e2629fd1abe91e0b7e455..ec6cbad2f14ec6e24ebd65b7848ea6f3b57706d9 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 @count = global i32 1, align 4
 
index 94e0250769ec03afbcdcfd2ef5d7dcdfd791f823..e7972f978e95c552ba24ca33a3aeb4edacd6cb99 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 @count = global i32 0, align 4
 
index e9171490e35235a3a7bb8bd39da40d2876d8a9a2..f450d0ab528b1af1820a755728d5eb31c6857a4e 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 define void @test(i8* %P, i16* %P.upgrd.1, i32* %P.upgrd.2, i64* %P.upgrd.3) {
        %V = load i8* %P                ; <i8> [#uses=1]
index 4f5ae47dd048074d9d6c948d945021347a1537a6..d4e9f444e426948c3de81a0c5c454856d05770b8 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 define i32 @main() nounwind uwtable {
 entry:
index 0540c22fc62973466af9cc7e5e44a7f9ccbcb493..32f45ef119e6d78e485b98f442a459906489c9db 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 define i32 @main() {
        %A = and i8 4, 8                ; <i8> [#uses=2]
index b1dbf408996be168cf5ce92168358bc6faf99bc6..ebc689664d6554652e8f3a963b63300d8e5747bd 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 define i32 @main() {
 ; <label>:0
index fbc080862c835248a163ace73241c050febdeae2..1408533d7ae9061e1576788375476c9e9f832b75 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 ; test phi node
 @Y = global i32 6              ; <i32*> [#uses=1]
index 1b90ee0750691f892f134af275bf79c27f49741b..af282926907fb3b706d63381e8546a897d28d076 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 ; test return instructions
 define void @test1() {
index 9c399cab38d9c9453d70967d3d8f712217e1ec90..67f7107c3d7dd551eba3e3d382f4e6473d0134c3 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 define i32 @main() nounwind uwtable {
 entry:
index 030ff317560b5a21919e310a71f5e6a4f7e9b381..a8f4bd8529f8bb9aee06e741a457dca41d4e57b0 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 
 define i32 @main() {
index 1113efee510febe7d031daca000bf72da27bfdf9..ed52b5065c84429270d4939e1a54eadbc3e4cc24 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 define i32 @main() {
        %int1 = add i32 0, 0            ; <i32> [#uses=6]
index 2da824fecce9840f0062b7b05e10472d0a37dbf5..5a5c10d560506b2283d2ecb7f5b809fd53731c57 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -use-mcjit %s > /dev/null
+; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
 
 define i32 @main() {
        %shamt = add i8 0, 1            ; <i8> [#uses=8]
index b7c5f3ef38c6af1ff705f6a1d60254019048b377..348ac8f622c7b8605ebca6990f9991aee8473273 100644 (file)
@@ -139,6 +139,13 @@ if config.test_exec_root is None:
 
 ###
 
+# Provide a target triple for mcjit tests
+mcjit_triple = config.target_triple
+# Force ELF format on Windows
+if 'win32' in mcjit_triple.lower():
+  mcjit_triple += "-elf"
+config.substitutions.append( ('%mcjit_triple', mcjit_triple) )
+
 # When running under valgrind, we mangle '-vg' or '-vg_leak' onto the end of the
 # triple so we can check it with XFAIL and XTARGET.
 config.target_triple += lit.valgrindTriple