To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

Commit ab6f62f7 authored by Isaac Oscar Gariano's avatar Isaac Oscar Gariano
Browse files

Added link-statically flag

parent e65543c1
...@@ -60,11 +60,13 @@ pub fn link_primordial(funcs: Vec<MuName>, out: &str, vm: &VM) -> PathBuf { ...@@ -60,11 +60,13 @@ pub fn link_primordial(funcs: Vec<MuName>, out: &str, vm: &VM) -> PathBuf {
ret.push(dest); ret.push(dest);
// include mu static lib // include mu static lib
/*ret.push(get_path_under_zebu(if cfg!(debug_assertions) { if vm.vm_options.flag_link_staticly {
"target/debug/libmu.a" ret.push(get_path_under_zebu(if cfg!(debug_assertions) {
} else { "target/debug/libmu.a"
"target/release/libmu.a" } else {
}));*/ "target/release/libmu.a"
}));
}
ret ret
}; };
...@@ -73,6 +75,7 @@ pub fn link_primordial(funcs: Vec<MuName>, out: &str, vm: &VM) -> PathBuf { ...@@ -73,6 +75,7 @@ pub fn link_primordial(funcs: Vec<MuName>, out: &str, vm: &VM) -> PathBuf {
out_path.push(out); out_path.push(out);
link_executable_internal( link_executable_internal(
!vm.vm_options.flag_link_staticly,
files, files,
&vm.vm_options.flag_bootimage_external_lib, &vm.vm_options.flag_bootimage_external_lib,
&vm.vm_options.flag_bootimage_external_libpath, &vm.vm_options.flag_bootimage_external_libpath,
...@@ -116,12 +119,14 @@ pub fn link_test_primordial(funcs: Vec<MuName>, out: &str, vm: &VM) -> PathBuf { ...@@ -116,12 +119,14 @@ pub fn link_test_primordial(funcs: Vec<MuName>, out: &str, vm: &VM) -> PathBuf {
// include the primordial C main // include the primordial C main
ret.push(dest); ret.push(dest);
/*// include mu static lib // include mu static lib
ret.push(get_path_under_zebu(if cfg!(debug_assertions) { if vm.vm_options.flag_link_staticly {
"target/debug/libmu.a" ret.push(get_path_under_zebu(if cfg!(debug_assertions) {
} else { "target/debug/libmu.a"
"target/release/libmu.a" } else {
}));*/ "target/release/libmu.a"
}));
}
ret ret
}; };
...@@ -130,6 +135,7 @@ pub fn link_test_primordial(funcs: Vec<MuName>, out: &str, vm: &VM) -> PathBuf { ...@@ -130,6 +135,7 @@ pub fn link_test_primordial(funcs: Vec<MuName>, out: &str, vm: &VM) -> PathBuf {
out_path.push(out); out_path.push(out);
link_executable_internal( link_executable_internal(
!vm.vm_options.flag_link_staticly,
files, files,
&vm.vm_options.flag_bootimage_external_lib, &vm.vm_options.flag_bootimage_external_lib,
&vm.vm_options.flag_bootimage_external_libpath, &vm.vm_options.flag_bootimage_external_libpath,
...@@ -139,6 +145,7 @@ pub fn link_test_primordial(funcs: Vec<MuName>, out: &str, vm: &VM) -> PathBuf { ...@@ -139,6 +145,7 @@ pub fn link_test_primordial(funcs: Vec<MuName>, out: &str, vm: &VM) -> PathBuf {
/// invokes the C compiler to link code into an executable /// invokes the C compiler to link code into an executable
fn link_executable_internal( fn link_executable_internal(
link_dynamicly: bool,
files: Vec<PathBuf>, files: Vec<PathBuf>,
lib: &Vec<String>, lib: &Vec<String>,
libpath: &Vec<String>, libpath: &Vec<String>,
...@@ -156,16 +163,18 @@ fn link_executable_internal( ...@@ -156,16 +163,18 @@ fn link_executable_internal(
cc.arg(format!("-l{}", l)); cc.arg(format!("-l{}", l));
} }
cc.arg(format!( if link_dynamicly {
"-L{}", cc.arg(format!(
get_path_under_zebu(if cfg!(debug_assertions) { "-L{}",
"target/debug" get_path_under_zebu(if cfg!(debug_assertions) {
} else { "target/debug"
"target/release" } else {
}).to_str() "target/release"
.unwrap() }).to_str()
)); .unwrap()
));
cc.arg("-lmu");
}
// dylibs used for linux // dylibs used for linux
if cfg!(target_os = "linux") { if cfg!(target_os = "linux") {
cc.arg("-ldl"); cc.arg("-ldl");
...@@ -173,7 +182,6 @@ fn link_executable_internal( ...@@ -173,7 +182,6 @@ fn link_executable_internal(
cc.arg("-lm"); cc.arg("-lm");
cc.arg("-lpthread"); cc.arg("-lpthread");
cc.arg("-lz"); cc.arg("-lz");
cc.arg("-lmu");
} else if cfg!(target_os = "macos") { } else if cfg!(target_os = "macos") {
cc.arg("-liconv"); cc.arg("-liconv");
cc.arg("-framework"); cc.arg("-framework");
...@@ -185,9 +193,7 @@ fn link_executable_internal( ...@@ -185,9 +193,7 @@ fn link_executable_internal(
cc.arg("-lresolv"); cc.arg("-lresolv");
cc.arg("-lc"); cc.arg("-lc");
cc.arg("-lm"); cc.arg("-lm");
cc.arg("-lmu");
} }
// all the source code // all the source code
for file in files { for file in files {
info!("link with {:?}", file.as_path()); info!("link with {:?}", file.as_path());
......
...@@ -36,7 +36,7 @@ Compiler: ...@@ -36,7 +36,7 @@ Compiler:
AOT Compiler: AOT Compiler:
--aot-emit-dir=<dir> the emit directory for ahead-of-time compiling [default: emit] --aot-emit-dir=<dir> the emit directory for ahead-of-time compiling [default: emit]
--link_staticly link boot image to libmu staticly (defaults to dynamic)
--bootimage-external-lib=<lib> ... library that will be linked against when making bootimage [default: ] --bootimage-external-lib=<lib> ... library that will be linked against when making bootimage [default: ]
--bootimage-external-libpath=<path> ... path for the libraries during bootimage generation [default: ] --bootimage-external-libpath=<path> ... path for the libraries during bootimage generation [default: ]
...@@ -60,11 +60,12 @@ pub struct VMOptions { ...@@ -60,11 +60,12 @@ pub struct VMOptions {
// AOT compiler // AOT compiler
pub flag_aot_emit_dir: String, // +0 pub flag_aot_emit_dir: String, // +0
pub flag_link_staticly: bool, // +100
pub flag_bootimage_external_lib: Vec<String>, // +24 pub flag_bootimage_external_lib: Vec<String>, // +24
pub flag_bootimage_external_libpath: Vec<String>, // +48 pub flag_bootimage_external_libpath: Vec<String>, // +48
// GC // GC
pub flag_gc_disable_collection: bool, // +100 pub flag_gc_disable_collection: bool, // +101
pub flag_gc_immixspace_size: usize, // +72 pub flag_gc_immixspace_size: usize, // +72
pub flag_gc_lospace_size: usize, // +80 pub flag_gc_lospace_size: usize, // +80
pub flag_gc_nthreads: usize, // +88 pub flag_gc_nthreads: usize, // +88
...@@ -82,6 +83,7 @@ rodal_struct!(VMOptions { ...@@ -82,6 +83,7 @@ rodal_struct!(VMOptions {
flag_disable_inline, flag_disable_inline,
flag_disable_regalloc_validate, flag_disable_regalloc_validate,
flag_emit_debug_info, flag_emit_debug_info,
flag_link_staticly,
flag_gc_disable_collection flag_gc_disable_collection
}); });
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment