File tree Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -19,10 +19,10 @@ FLAGS:
19
19
20
20
OPTIONS:
21
21
-o, --output <output> Output bc file
22
+ --target <target> Set compilation target
22
23
23
24
ARGS:
24
25
<input> Input wasm file
25
-
26
26
```
27
27
28
28
# Installation from Source
@@ -46,7 +46,6 @@ sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-$LLVM_VER
46
46
sudo update-alternatives --install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-$LLVM_VERSION 100
47
47
```
48
48
4 . [ Install the C++ Standard Library for LLVM] ( https://libcxx.llvm.org/ )
49
-
50
49
5 . Clone and build silverfish
51
50
``` sh
52
51
git clone https://github.com/gwsystems/silverfish.git
Original file line number Diff line number Diff line change @@ -53,11 +53,16 @@ pub fn process_to_llvm(
53
53
let llvm_ctx = & * LLVMCtx :: new ( ) ;
54
54
let llvm_module = & * LLVMModule :: new ( & wasm_module. source_name , llvm_ctx) ;
55
55
56
- // Setup to compile to the local target
57
- // FIXME: Should be able to use the local default target, but that doesn't work properly on OSX
58
- llvm_module. set_target ( "x86_64-apple-macosx10.15.0" ) ;
59
- // llvm_module.set_target("thumbv7m-none-unknown-eabi");
60
- // llvm_module.set_target("i686-pc-linux-gnu");
56
+ // Accept --target to compile for specific target, otherwise omit target
57
+ // triple from bytecode, this defaults to the host target in LLVM
58
+ if let Some ( ref target) = opt. target {
59
+ llvm_module. set_target ( target) ;
60
+ } else {
61
+ // INFO: Target overrides for development:
62
+ // llvm_module.set_target("x86_64-apple-macosx10.15.0");
63
+ // llvm_module.set_target("thumbv7m-none-unknown-eabi");
64
+ // llvm_module.set_target("i686-pc-linux-gnu");
65
+ }
61
66
62
67
// Remap WASM generated names to exported names
63
68
for e in wasm_module. exports {
Original file line number Diff line number Diff line change @@ -42,6 +42,10 @@ pub struct Opt {
42
42
/// Don't generate native globals, let the runtime handle it
43
43
#[ structopt( long = "runtime-globals" ) ]
44
44
use_runtime_global_handling : bool ,
45
+
46
+ /// Set compilation target
47
+ #[ structopt( long = "target" ) ]
48
+ target : Option < String > ,
45
49
}
46
50
47
51
fn main ( ) -> io:: Result < ( ) > {
You can’t perform that action at this time.
0 commit comments