WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

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 {
ret.push(dest);
// include mu static lib
/*ret.push(get_path_under_zebu(if cfg!(debug_assertions) {
"target/debug/libmu.a"
} else {
"target/release/libmu.a"
}));*/
if vm.vm_options.flag_link_staticly {
ret.push(get_path_under_zebu(if cfg!(debug_assertions) {
"target/debug/libmu.a"
} else {
"target/release/libmu.a"
}));
}
ret
};
......@@ -73,6 +75,7 @@ pub fn link_primordial(funcs: Vec<MuName>, out: &str, vm: &VM) -> PathBuf {
out_path.push(out);
link_executable_internal(
!vm.vm_options.flag_link_staticly,
files,
&vm.vm_options.flag_bootimage_external_lib,
&vm.vm_options.flag_bootimage_external_libpath,
......@@ -116,12 +119,14 @@ pub fn link_test_primordial(funcs: Vec<MuName>, out: &str, vm: &VM) -> PathBuf {
// include the primordial C main
ret.push(dest);
/*// include mu static lib
ret.push(get_path_under_zebu(if cfg!(debug_assertions) {
"target/debug/libmu.a"
} else {
"target/release/libmu.a"
}));*/
// include mu static lib
if vm.vm_options.flag_link_staticly {
ret.push(get_path_under_zebu(if cfg!(debug_assertions) {
"target/debug/libmu.a"
} else {
"target/release/libmu.a"
}));
}
ret
};
......@@ -130,6 +135,7 @@ pub fn link_test_primordial(funcs: Vec<MuName>, out: &str, vm: &VM) -> PathBuf {
out_path.push(out);
link_executable_internal(
!vm.vm_options.flag_link_staticly,
files,
&vm.vm_options.flag_bootimage_external_lib,
&vm.vm_options.flag_bootimage_external_libpath,
......@@ -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
fn link_executable_internal(
link_dynamicly: bool,
files: Vec<PathBuf>,
lib: &Vec<String>,
libpath: &Vec<String>,
......@@ -156,16 +163,18 @@ fn link_executable_internal(
cc.arg(format!("-l{}", l));
}
cc.arg(format!(
"-L{}",
get_path_under_zebu(if cfg!(debug_assertions) {
"target/debug"
} else {
"target/release"
}).to_str()
.unwrap()
));
if link_dynamicly {
cc.arg(format!(
"-L{}",
get_path_under_zebu(if cfg!(debug_assertions) {
"target/debug"
} else {
"target/release"
}).to_str()
.unwrap()
));
cc.arg("-lmu");
}
// dylibs used for linux
if cfg!(target_os = "linux") {
cc.arg("-ldl");
......@@ -173,7 +182,6 @@ fn link_executable_internal(
cc.arg("-lm");
cc.arg("-lpthread");
cc.arg("-lz");
cc.arg("-lmu");
} else if cfg!(target_os = "macos") {
cc.arg("-liconv");
cc.arg("-framework");
......@@ -185,9 +193,7 @@ fn link_executable_internal(
cc.arg("-lresolv");
cc.arg("-lc");
cc.arg("-lm");
cc.arg("-lmu");
}
// all the source code
for file in files {
info!("link with {:?}", file.as_path());
......
......@@ -36,7 +36,7 @@ Compiler:
AOT Compiler:
--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-libpath=<path> ... path for the libraries during bootimage generation [default: ]
......@@ -60,11 +60,12 @@ pub struct VMOptions {
// AOT compiler
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_libpath: Vec<String>, // +48
// 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_lospace_size: usize, // +80
pub flag_gc_nthreads: usize, // +88
......@@ -82,6 +83,7 @@ rodal_struct!(VMOptions {
flag_disable_inline,
flag_disable_regalloc_validate,
flag_emit_debug_info,
flag_link_staticly,
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