Skip to content

Commit ce88842

Browse files
committed
espresso: Enable multitarget for native projects and add 'sulong-bitcode' compiler as toolchain
1 parent 791a0fb commit ce88842

File tree

2 files changed

+91
-11
lines changed

2 files changed

+91
-11
lines changed

espresso/mx.espresso/suite.py

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -248,18 +248,27 @@
248248
"windows": {
249249
"<others>": {
250250
"cflags": ["-g", "-O3", "-Wall"],
251+
"multitarget": {
252+
"libc": ["default"],
253+
},
251254
},
252255
},
253256
"linux-musl": {
254257
"<others>": {
255258
"cflags": ["-Wall", "-Werror", "-Wno-error=cpp"],
256-
"toolchain": "sulong:SULONG_BOOTSTRAP_TOOLCHAIN",
259+
"multitarget": {
260+
"libc": ["musl", "default"],
261+
"compiler": ["sulong-bitcode", "host", "*"]
262+
},
257263
},
258264
},
259265
"<others>": {
260266
"<others>": {
261267
"cflags": ["-Wall", "-Werror"],
262-
"toolchain": "sulong:SULONG_BOOTSTRAP_TOOLCHAIN",
268+
"multitarget": {
269+
"libc": ["glibc", "musl", "default"],
270+
"compiler": ["sulong-bitcode", "host", "*"]
271+
},
263272
},
264273
},
265274
},
@@ -312,7 +321,9 @@
312321
"-Wl,-current_version,1.0.0",
313322
"-Wl,-compatibility_version,1.0.0"
314323
],
315-
"toolchain": "sulong:SULONG_BOOTSTRAP_TOOLCHAIN",
324+
"multitarget": {
325+
"compiler": ["sulong-bitcode", "host", "*"]
326+
},
316327
},
317328
},
318329
"linux": {
@@ -322,7 +333,10 @@
322333
"-Wl,-soname,libjvm.so",
323334
"-Wl,--version-script,<path:espresso:com.oracle.truffle.espresso.mokapot>/mapfile-vers",
324335
],
325-
"toolchain": "sulong:SULONG_BOOTSTRAP_TOOLCHAIN",
336+
"multitarget": {
337+
"libc": ["glibc", "musl", "default"],
338+
"compiler": ["sulong-bitcode", "host", "*"]
339+
},
326340
},
327341
},
328342
"linux-musl": {
@@ -332,12 +346,18 @@
332346
"-Wl,-soname,libjvm.so",
333347
"-Wl,--version-script,<path:espresso:com.oracle.truffle.espresso.mokapot>/mapfile-vers",
334348
],
335-
"toolchain": "sulong:SULONG_BOOTSTRAP_TOOLCHAIN",
349+
"multitarget": {
350+
"libc": ["musl", "default"],
351+
"compiler": ["sulong-bitcode", "host", "*"]
352+
},
336353
},
337354
},
338355
"windows": {
339356
"<others>": {
340357
"cflags": ["-g", "-O3", "-Wall"],
358+
"multitarget": {
359+
"libc": ["default"],
360+
},
341361
},
342362
}
343363
},
@@ -558,7 +578,7 @@
558578
"dependency:espresso:ESPRESSO_STANDALONE_COMMON/*",
559579
],
560580
"<jdk_lib_dir>/truffle/": [
561-
"dependency:espresso:com.oracle.truffle.espresso.mokapot/<lib:jvm>",
581+
"dependency:espresso:com.oracle.truffle.espresso.mokapot/*/<multitarget_libc_selection>/<lib:jvm>",
562582
],
563583
"lib/jvm.cfg": {
564584
"source_type": "string",
@@ -621,7 +641,7 @@
621641
],
622642
"languages/java/lib/": [
623643
# Copy of libjvm.so, accessible by Sulong via the default Truffle file system.
624-
"dependency:espresso:com.oracle.truffle.espresso.mokapot/<lib:jvm>",
644+
"dependency:espresso:com.oracle.truffle.espresso.mokapot/*/<multitarget_libc_selection>/<lib:jvm>",
625645
],
626646
"languages/java/": [
627647
{
@@ -706,7 +726,7 @@
706726
"layout": {
707727
"META-INF/resources/java/espresso-libs/<os>/<arch>/lib/": [
708728
# Copy of libjvm.so, accessible by Sulong via the default Truffle file system.
709-
"dependency:espresso:com.oracle.truffle.espresso.mokapot/<lib:jvm>",
729+
"dependency:espresso:com.oracle.truffle.espresso.mokapot/*/<multitarget_libc_selection>/<lib:jvm>",
710730
],
711731
"META-INF/resources/java/espresso-libs/<os>/<arch>/": "dependency:espresso:ESPRESSO_SUPPORT/*",
712732
},
@@ -751,7 +771,7 @@
751771
"platforms": "local",
752772
"layout": {
753773
"lib/": [
754-
"dependency:espresso:com.oracle.truffle.espresso.native/<lib:nespresso>",
774+
"dependency:espresso:com.oracle.truffle.espresso.native/*/<multitarget_libc_selection>/<lib:nespresso>",
755775
"dependency:espresso:ESPRESSO_POLYGLOT/*",
756776
"dependency:espresso:HOTSWAP/*",
757777
"dependency:espresso:CONTINUATIONS/*",
@@ -778,7 +798,7 @@
778798
"./": "dependency:espresso:ESPRESSO_SUPPORT/*",
779799
"lib/": [
780800
# Copy of libjvm.so, accessible by Sulong via the default Truffle file system.
781-
"dependency:espresso:com.oracle.truffle.espresso.mokapot/<lib:jvm>",
801+
"dependency:espresso:com.oracle.truffle.espresso.mokapot/*/<multitarget_libc_selection>/<lib:jvm>",
782802
]
783803
},
784804
"maven": False,
@@ -790,7 +810,7 @@
790810
"platformDependent": True,
791811
"layout": {
792812
"truffle/": [
793-
"dependency:espresso:com.oracle.truffle.espresso.mokapot/<lib:jvm>",
813+
"dependency:espresso:com.oracle.truffle.espresso.mokapot/*/<multitarget_libc_selection>/<lib:jvm>",
794814
],
795815
},
796816
"maven": False,

sulong/mx.sulong/suite.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2259,6 +2259,66 @@
22592259
"license": "BSD-new",
22602260
},
22612261

2262+
"SULONG_NINJA_TOOLCHAIN": {
2263+
"native" : True,
2264+
"platformDependent" : True,
2265+
"native_toolchain": {
2266+
"kind": "ninja",
2267+
"compiler": "sulong-bitcode",
2268+
# empty, so it defaults everything to host properties
2269+
"target": {},
2270+
},
2271+
2272+
"os_arch": {
2273+
"windows": {
2274+
"<others>": {
2275+
"layout": {
2276+
"toolchain.ninja" : {
2277+
"source_type": "string",
2278+
"value": '''
2279+
include <ninja-toolchain:MSVC_NINJA_TOOLCHAIN>
2280+
CL=<path:SULONG_BOOTSTRAP_TOOLCHAIN>\\bin\\<cmd:clang-cl>
2281+
LINK=<path:SULONG_BOOTSTRAP_TOOLCHAIN>\\bin\\<cmd:lld-link>
2282+
LIB=<path:SULONG_BOOTSTRAP_TOOLCHAIN>\\bin\\<cmd:llvm-lib>
2283+
ML=<path:SULONG_BOOTSTRAP_TOOLCHAIN>\\bin\\<cmd:llvm-ml>
2284+
CFLAGS=
2285+
CXXFLAGS=
2286+
LDFLAGS=
2287+
'''
2288+
},
2289+
},
2290+
"dependencies": [
2291+
"SULONG_BOOTSTRAP_TOOLCHAIN",
2292+
"mx:MSVC_NINJA_TOOLCHAIN",
2293+
],
2294+
},
2295+
},
2296+
"<others>": {
2297+
"<others>": {
2298+
"layout": {
2299+
"toolchain.ninja" : {
2300+
"source_type": "string",
2301+
"value": '''
2302+
include <ninja-toolchain:GCC_NINJA_TOOLCHAIN>
2303+
CC=<path:SULONG_BOOTSTRAP_TOOLCHAIN>/bin/gcc
2304+
CXX=<path:SULONG_BOOTSTRAP_TOOLCHAIN>/bin/g++
2305+
AR=<path:SULONG_BOOTSTRAP_TOOLCHAIN>/bin/ar
2306+
CFLAGS=
2307+
CXXFLAGS=
2308+
LDFLAGS=
2309+
'''
2310+
},
2311+
},
2312+
"dependencies": [
2313+
"SULONG_BOOTSTRAP_TOOLCHAIN",
2314+
"mx:GCC_NINJA_TOOLCHAIN",
2315+
],
2316+
},
2317+
},
2318+
},
2319+
"maven" : False,
2320+
},
2321+
22622322
"SULONG_BOOTSTRAP_TOOLCHAIN_NO_HOME": {
22632323
"description" : "Bootstrap toolchain without an llvm.home. Use for bootstrapping libraries that should be contained in llvm.home.",
22642324
"native": True,

0 commit comments

Comments
 (0)