mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 08:11:12 +00:00
Make link paths generic and add libgcc_s
This commit is contained in:
parent
f02515c0d1
commit
6e130d51bc
2 changed files with 10 additions and 4 deletions
|
@ -122,6 +122,11 @@ fn link_linux(
|
|||
host_input_path: &Path,
|
||||
dest_filename: &Path,
|
||||
) -> io::Result<Child> {
|
||||
let lib_path = if Path::new("/usr/lib/x86_64-linux-gnu").exists() {
|
||||
Path::new("/usr/lib/x86_64-linux-gnu")
|
||||
} else {
|
||||
Path::new("/usr/lib")
|
||||
};
|
||||
// NOTE: order of arguments to `ld` matters here!
|
||||
// The `-l` flags should go after the `.o` arguments
|
||||
Command::new("ld")
|
||||
|
@ -130,9 +135,9 @@ fn link_linux(
|
|||
.args(&[
|
||||
"-arch",
|
||||
arch_str(target),
|
||||
"/usr/lib/x86_64-linux-gnu/crti.o",
|
||||
"/usr/lib/x86_64-linux-gnu/crtn.o",
|
||||
"/usr/lib/x86_64-linux-gnu/Scrt1.o",
|
||||
lib_path.join("crti.o").to_str().unwrap(),
|
||||
lib_path.join("crtn.o").to_str().unwrap(),
|
||||
lib_path.join("Scrt1.o").to_str().unwrap(),
|
||||
"-dynamic-linker",
|
||||
"/lib64/ld-linux-x86-64.so.2",
|
||||
// Inputs
|
||||
|
@ -149,7 +154,7 @@ fn link_linux(
|
|||
"-lc_nonshared",
|
||||
"-lc++",
|
||||
"-lunwind",
|
||||
// "-lgcc", // TODO will eventually need compiler_rt from gcc or something - see https://github.com/rtfeldman/roc/pull/554#discussion_r496370840
|
||||
"/usr/lib/libgcc_s.so.1",
|
||||
// Output
|
||||
"-o",
|
||||
binary_path.to_str().unwrap(), // app
|
||||
|
|
1
examples/.gitignore
vendored
1
examples/.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
app
|
||||
host.o
|
||||
c_host.o
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue