Mercurial > mxe-octave
comparison src/llvm-1-llvm-config.patch @ 5597:f367e764ca55
LLVM: Enable exception handling (bug #59599).
* src/llvm.mk: Update download URL. Add build dependency. Enable exception
handling. Minor clean-up.
* src/llvm-1-llvm-config.patch: Fixes for cross-compiling.
* src/mingw-llvm-1-config.patch: Remove patch.
* dist-files.mk: Update list of files.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Sat, 05 Dec 2020 20:56:44 +0100 |
parents | |
children | 76a8a2d86ab8 |
comparison
equal
deleted
inserted
replaced
5596:f62e01947a77 | 5597:f367e764ca55 |
---|---|
1 If `llvm-config` is build as native version on the build system with a | |
2 cross-compile target system (i.e. as a build-tool for other project that want | |
3 to cross-compile), expose the settings for the target of the cross-compiler. | |
4 Also use the file naming conventions for the target of the cross-compiler. | |
5 | |
6 diff --git "a/include/llvm/Config/llvm-config.h.cmake" "b/include/llvm/Config/llvm-config.h.cmake" | |
7 index 872a315..9ad3055 100644 | |
8 --- "a/include/llvm/Config/llvm-config.h.cmake" | |
9 +++ "b/include/llvm/Config/llvm-config.h.cmake" | |
10 @@ -65,6 +65,9 @@ | |
11 /* Define if we have the perf JIT-support library */ | |
12 #cmakedefine01 LLVM_USE_PERF | |
13 | |
14 +/* Define if this is a native build for a cross-compiler */ | |
15 +#cmakedefine LLVM_TARGET_IS_CROSSCOMPILE_HOST ${LLVM_TARGET_IS_CROSSCOMPILE_HOST} | |
16 + | |
17 /* Major version of the LLVM API */ | |
18 #define LLVM_VERSION_MAJOR ${LLVM_VERSION_MAJOR} | |
19 | |
20 diff --git "a/tools/llvm-config/llvm-config.cpp" "b/tools/llvm-config/llvm-config.cpp" | |
21 index bec89fe..a1be375 100644 | |
22 --- "a/tools/llvm-config/llvm-config.cpp" | |
23 +++ "b/tools/llvm-config/llvm-config.cpp" | |
24 @@ -37,7 +37,12 @@ using namespace llvm; | |
25 | |
26 // Include the build time variables we can report to the user. This is generated | |
27 // at build time from the BuildVariables.inc.in file by the build system. | |
28 -#include "BuildVariables.inc" | |
29 +#if defined(LLVM_TARGET_IS_CROSSCOMPILE_HOST) | |
30 +// include the .inc file with the settings for the cross-compiler | |
31 +# include "../../../tools/llvm-config/BuildVariables.inc" | |
32 +#else | |
33 +# include "BuildVariables.inc" | |
34 +#endif | |
35 | |
36 // Include the component table. This creates an array of struct | |
37 // AvailableComponent entries, which record the component name, library name, | |
38 @@ -352,14 +352,16 @@ int main(int argc, char **argv) { | |
39 StringRef SharedExt, SharedVersionedExt, SharedDir, SharedPrefix, StaticExt, | |
40 StaticPrefix, StaticDir = "lib", DirSep = "/"; | |
41 const Triple HostTriple(Triple::normalize(LLVM_HOST_TRIPLE)); | |
42 - if (HostTriple.isOSWindows()) { | |
43 + const Triple TargetTriple(Triple::normalize(LLVM_DEFAULT_TARGET_TRIPLE)); | |
44 + if (TargetTriple.isOSWindows()) { | |
45 SharedExt = "dll"; | |
46 SharedVersionedExt = LLVM_DYLIB_VERSION ".dll"; | |
47 - if (HostTriple.isOSCygMing()) { | |
48 + if (TargetTriple.isOSCygMing()) { | |
49 StaticExt = "a"; | |
50 StaticPrefix = "lib"; | |
51 } else { | |
52 StaticExt = "lib"; | |
53 + if (HostTriple.isOSWindows()) { | |
54 DirSep = "\\"; | |
55 std::replace(ActiveObjRoot.begin(), ActiveObjRoot.end(), '/', '\\'); | |
56 std::replace(ActivePrefix.begin(), ActivePrefix.end(), '/', '\\'); | |
57 @@ -368,10 +370,11 @@ int main(int argc, char **argv) { | |
58 std::replace(ActiveCMakeDir.begin(), ActiveCMakeDir.end(), '/', '\\'); | |
59 std::replace(ActiveIncludeOption.begin(), ActiveIncludeOption.end(), '/', | |
60 '\\'); | |
61 + } | |
62 } | |
63 SharedDir = ActiveBinDir; | |
64 StaticDir = ActiveLibDir; | |
65 - } else if (HostTriple.isOSDarwin()) { | |
66 + } else if (TargetTriple.isOSDarwin()) { | |
67 SharedExt = "dylib"; | |
68 SharedVersionedExt = LLVM_DYLIB_VERSION ".dylib"; | |
69 StaticExt = "a"; | |
70 @@ -670,7 +673,7 @@ int main(int argc, char **argv) { | |
71 } else if (PrintLibs) { | |
72 // On Windows, output full path to library without parameters. | |
73 // Elsewhere, if this is a typical library name, include it using -l. | |
74 - if (HostTriple.isWindowsMSVCEnvironment()) { | |
75 + if (TargetTriple.isWindowsMSVCEnvironment()) { | |
76 OS << GetComponentLibraryPath(Lib, Shared); | |
77 } else { | |
78 StringRef LibName; | |
79 |