mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
use getHostTriple instead of getDefaultTargetTriple in getClosestTargetForJIT
Get back getHostTriple. For JIT compilation, use the host triple instead of the default target: this fixes some JIT testcases that used to fail when the compiler has been configured as a cross compiler. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147542 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b0e7af7797
commit
8a86887ba3
@ -1484,6 +1484,8 @@ AC_DEFINE_UNQUOTED(LLVM_MANDIR, "$LLVM_MANDIR",
|
|||||||
[Installation directory for man pages])
|
[Installation directory for man pages])
|
||||||
AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME",
|
AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME",
|
||||||
[Time at which LLVM was configured])
|
[Time at which LLVM was configured])
|
||||||
|
AC_DEFINE_UNQUOTED(LLVM_HOST_TRIPLE, "$host",
|
||||||
|
[Host triple LLVM will run on])
|
||||||
AC_DEFINE_UNQUOTED(LLVM_DEFAULT_TARGET_TRIPLE, "$target",
|
AC_DEFINE_UNQUOTED(LLVM_DEFAULT_TARGET_TRIPLE, "$target",
|
||||||
[Target triple LLVM will generate code for by default])
|
[Target triple LLVM will generate code for by default])
|
||||||
|
|
||||||
|
@ -288,13 +288,16 @@ include(CheckCXXCompilerFlag)
|
|||||||
check_cxx_compiler_flag("-Wno-variadic-macros" SUPPORTS_NO_VARIADIC_MACROS_FLAG)
|
check_cxx_compiler_flag("-Wno-variadic-macros" SUPPORTS_NO_VARIADIC_MACROS_FLAG)
|
||||||
|
|
||||||
include(GetTargetTriple)
|
include(GetTargetTriple)
|
||||||
|
get_target_triple(LLVM_HOST_TRIPLE)
|
||||||
get_target_triple(LLVM_DEFAULT_TARGET_TRIPLE)
|
get_target_triple(LLVM_DEFAULT_TARGET_TRIPLE)
|
||||||
|
|
||||||
|
set(HOST_TRIPLE "${LLVM_HOST_TRIPLE}")
|
||||||
set(TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}")
|
set(TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}")
|
||||||
|
|
||||||
# Determine the native architecture.
|
# Determine the native architecture.
|
||||||
string(TOLOWER "${LLVM_TARGET_ARCH}" LLVM_NATIVE_ARCH)
|
string(TOLOWER "${LLVM_TARGET_ARCH}" LLVM_NATIVE_ARCH)
|
||||||
if( LLVM_NATIVE_ARCH STREQUAL "host" )
|
if( LLVM_NATIVE_ARCH STREQUAL "host" )
|
||||||
|
string(REGEX MATCH "^[^-]*" LLVM_NATIVE_ARCH ${LLVM_HOST_TRIPLE})
|
||||||
string(REGEX MATCH "^[^-]*" LLVM_NATIVE_ARCH ${LLVM_DEFAULT_TARGET_TRIPLE})
|
string(REGEX MATCH "^[^-]*" LLVM_NATIVE_ARCH ${LLVM_DEFAULT_TARGET_TRIPLE})
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
5
configure
vendored
5
configure
vendored
@ -20912,6 +20912,11 @@ cat >>confdefs.h <<_ACEOF
|
|||||||
_ACEOF
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define LLVM_HOST_TRIPLE "$host"
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
cat >>confdefs.h <<_ACEOF
|
||||||
#define LLVM_DEFAULT_TARGET_TRIPLE "$target"
|
#define LLVM_DEFAULT_TARGET_TRIPLE "$target"
|
||||||
_ACEOF
|
_ACEOF
|
||||||
|
@ -560,6 +560,9 @@
|
|||||||
/* Has gcc/MSVC atomic intrinsics */
|
/* Has gcc/MSVC atomic intrinsics */
|
||||||
#cmakedefine01 LLVM_HAS_ATOMICS
|
#cmakedefine01 LLVM_HAS_ATOMICS
|
||||||
|
|
||||||
|
/* Host triple LLVM will run on */
|
||||||
|
#cmakedefine LLVM_HOST_TRIPLE "${LLVM_HOST_TRIPLE}"
|
||||||
|
|
||||||
/* Installation directory for include files */
|
/* Installation directory for include files */
|
||||||
#cmakedefine LLVM_INCLUDEDIR "${LLVM_INCLUDEDIR}"
|
#cmakedefine LLVM_INCLUDEDIR "${LLVM_INCLUDEDIR}"
|
||||||
|
|
||||||
|
@ -558,6 +558,9 @@
|
|||||||
/* Has gcc/MSVC atomic intrinsics */
|
/* Has gcc/MSVC atomic intrinsics */
|
||||||
#undef LLVM_HAS_ATOMICS
|
#undef LLVM_HAS_ATOMICS
|
||||||
|
|
||||||
|
/* Host triple LLVM will run on */
|
||||||
|
#undef LLVM_HOST_TRIPLE
|
||||||
|
|
||||||
/* Installation directory for include files */
|
/* Installation directory for include files */
|
||||||
#undef LLVM_INCLUDEDIR
|
#undef LLVM_INCLUDEDIR
|
||||||
|
|
||||||
|
@ -40,6 +40,9 @@
|
|||||||
/* Has gcc/MSVC atomic intrinsics */
|
/* Has gcc/MSVC atomic intrinsics */
|
||||||
#cmakedefine01 LLVM_HAS_ATOMICS
|
#cmakedefine01 LLVM_HAS_ATOMICS
|
||||||
|
|
||||||
|
/* Host triple LLVM will run on */
|
||||||
|
#cmakedefine LLVM_HOST_TRIPLE "${LLVM_HOST_TRIPLE}"
|
||||||
|
|
||||||
/* Installation directory for include files */
|
/* Installation directory for include files */
|
||||||
#cmakedefine LLVM_INCLUDEDIR "${LLVM_INCLUDEDIR}"
|
#cmakedefine LLVM_INCLUDEDIR "${LLVM_INCLUDEDIR}"
|
||||||
|
|
||||||
|
@ -40,6 +40,9 @@
|
|||||||
/* Has gcc/MSVC atomic intrinsics */
|
/* Has gcc/MSVC atomic intrinsics */
|
||||||
#undef LLVM_HAS_ATOMICS
|
#undef LLVM_HAS_ATOMICS
|
||||||
|
|
||||||
|
/* Host triple LLVM will run on */
|
||||||
|
#undef LLVM_HOST_TRIPLE
|
||||||
|
|
||||||
/* Installation directory for include files */
|
/* Installation directory for include files */
|
||||||
#undef LLVM_INCLUDEDIR
|
#undef LLVM_INCLUDEDIR
|
||||||
|
|
||||||
|
@ -33,6 +33,14 @@ namespace sys {
|
|||||||
return !isLittleEndianHost();
|
return !isLittleEndianHost();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// getHostTriple() - Return the host where the compiler will be running.
|
||||||
|
///
|
||||||
|
/// The host triple is a string in the format of:
|
||||||
|
/// CPU_TYPE-VENDOR-OPERATING_SYSTEM
|
||||||
|
/// or
|
||||||
|
/// CPU_TYPE-VENDOR-KERNEL-OPERATING_SYSTEM
|
||||||
|
std::string getHostTriple();
|
||||||
|
|
||||||
/// getDefaultTargetTriple() - Return the default target triple the compiler
|
/// getDefaultTargetTriple() - Return the default target triple the compiler
|
||||||
/// has been configured to produce code for.
|
/// has been configured to produce code for.
|
||||||
///
|
///
|
||||||
|
@ -1373,6 +1373,7 @@ public:
|
|||||||
<< " Built " << __DATE__ << " (" << __TIME__ << ").\n"
|
<< " Built " << __DATE__ << " (" << __TIME__ << ").\n"
|
||||||
#endif
|
#endif
|
||||||
<< " Default target: " << sys::getDefaultTargetTriple() << '\n'
|
<< " Default target: " << sys::getDefaultTargetTriple() << '\n'
|
||||||
|
<< " Host: " << sys::getHostTriple() << '\n'
|
||||||
<< " Host CPU: " << CPU << '\n';
|
<< " Host CPU: " << CPU << '\n';
|
||||||
}
|
}
|
||||||
void operator=(bool OptionWasSpecified) {
|
void operator=(bool OptionWasSpecified) {
|
||||||
|
@ -84,7 +84,7 @@ void TargetRegistry::RegisterTarget(Target &T,
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Target *TargetRegistry::getClosestTargetForJIT(std::string &Error) {
|
const Target *TargetRegistry::getClosestTargetForJIT(std::string &Error) {
|
||||||
const Target *TheTarget = lookupTarget(sys::getDefaultTargetTriple(), Error);
|
const Target *TheTarget = lookupTarget(sys::getHostTriple(), Error);
|
||||||
|
|
||||||
if (TheTarget && !TheTarget->hasJIT()) {
|
if (TheTarget && !TheTarget->hasJIT()) {
|
||||||
Error = "No JIT compatible target available for this host";
|
Error = "No JIT compatible target available for this host";
|
||||||
|
@ -35,13 +35,9 @@ static std::string getOSVersion() {
|
|||||||
return info.release;
|
return info.release;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string sys::getDefaultTargetTriple() {
|
std::string getTriple(StringRef &TripleString) {
|
||||||
StringRef TargetTripleString(LLVM_DEFAULT_TARGET_TRIPLE);
|
std::pair<StringRef, StringRef> ArchSplit = TripleString.split('-');
|
||||||
std::pair<StringRef, StringRef> ArchSplit = TargetTripleString.split('-');
|
|
||||||
|
|
||||||
// Normalize the arch, since the target triple may not actually match the target.
|
|
||||||
std::string Arch = ArchSplit.first;
|
std::string Arch = ArchSplit.first;
|
||||||
|
|
||||||
std::string Triple(Arch);
|
std::string Triple(Arch);
|
||||||
Triple += '-';
|
Triple += '-';
|
||||||
Triple += ArchSplit.second;
|
Triple += ArchSplit.second;
|
||||||
@ -61,3 +57,13 @@ std::string sys::getDefaultTargetTriple() {
|
|||||||
|
|
||||||
return Triple;
|
return Triple;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string sys::getDefaultTargetTriple() {
|
||||||
|
StringRef TargetTripleString(LLVM_DEFAULT_TARGET_TRIPLE);
|
||||||
|
return getTriple(TargetTripleString);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string sys::getHostTriple() {
|
||||||
|
StringRef HostTripleString(LLVM_HOST_TRIPLE);
|
||||||
|
return getTriple(HostTripleString);
|
||||||
|
}
|
||||||
|
@ -20,3 +20,7 @@ using namespace llvm;
|
|||||||
std::string sys::getDefaultTargetTriple() {
|
std::string sys::getDefaultTargetTriple() {
|
||||||
return LLVM_DEFAULT_TARGET_TRIPLE;
|
return LLVM_DEFAULT_TARGET_TRIPLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string sys::getHostTriple() {
|
||||||
|
return LLVM_HOST_TRIPLE;
|
||||||
|
}
|
||||||
|
@ -1390,6 +1390,8 @@ AC_DEFINE_UNQUOTED(LLVM_MANDIR, "$LLVM_MANDIR",
|
|||||||
[Installation directory for man pages])
|
[Installation directory for man pages])
|
||||||
AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME",
|
AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME",
|
||||||
[Time at which LLVM was configured])
|
[Time at which LLVM was configured])
|
||||||
|
AC_DEFINE_UNQUOTED(LLVM_HOST_TRIPLE, "$host",
|
||||||
|
[Host triple LLVM will run on])
|
||||||
AC_DEFINE_UNQUOTED(LLVM_DEFAULT_TARGET_TRIPLE, "$target",
|
AC_DEFINE_UNQUOTED(LLVM_DEFAULT_TARGET_TRIPLE, "$target",
|
||||||
[Target triple LLVM will generate code for by default])
|
[Target triple LLVM will generate code for by default])
|
||||||
|
|
||||||
|
13
projects/sample/configure
vendored
13
projects/sample/configure
vendored
@ -8854,7 +8854,7 @@ dgux*)
|
|||||||
shlibpath_var=LD_LIBRARY_PATH
|
shlibpath_var=LD_LIBRARY_PATH
|
||||||
;;
|
;;
|
||||||
|
|
||||||
freebsd1*)
|
freebsd1.*)
|
||||||
dynamic_linker=no
|
dynamic_linker=no
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@ -8877,7 +8877,7 @@ freebsd* | dragonfly*)
|
|||||||
objformat=`/usr/bin/objformat`
|
objformat=`/usr/bin/objformat`
|
||||||
else
|
else
|
||||||
case $host_os in
|
case $host_os in
|
||||||
freebsd[123]*) objformat=aout ;;
|
freebsd[123].*) objformat=aout ;;
|
||||||
*) objformat=elf ;;
|
*) objformat=elf ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
@ -8895,7 +8895,7 @@ freebsd* | dragonfly*)
|
|||||||
esac
|
esac
|
||||||
shlibpath_var=LD_LIBRARY_PATH
|
shlibpath_var=LD_LIBRARY_PATH
|
||||||
case $host_os in
|
case $host_os in
|
||||||
freebsd2*)
|
freebsd2.*)
|
||||||
shlibpath_overrides_runpath=yes
|
shlibpath_overrides_runpath=yes
|
||||||
;;
|
;;
|
||||||
freebsd3.[01]* | freebsdelf3.[01]*)
|
freebsd3.[01]* | freebsdelf3.[01]*)
|
||||||
@ -10409,7 +10409,7 @@ else
|
|||||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||||
lt_status=$lt_dlunknown
|
lt_status=$lt_dlunknown
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 10423 "configure"
|
#line 10412 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
|
|
||||||
#if HAVE_DLFCN_H
|
#if HAVE_DLFCN_H
|
||||||
@ -20818,6 +20818,11 @@ cat >>confdefs.h <<_ACEOF
|
|||||||
_ACEOF
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define LLVM_HOST_TRIPLE "$host"
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
cat >>confdefs.h <<_ACEOF
|
||||||
#define LLVM_DEFAULT_TARGET_TRIPLE "$target"
|
#define LLVM_DEFAULT_TARGET_TRIPLE "$target"
|
||||||
_ACEOF
|
_ACEOF
|
||||||
|
Loading…
Reference in New Issue
Block a user