Skip to content

Commit

Permalink
Link to libgcc when statically linking musl
Browse files Browse the repository at this point in the history
  • Loading branch information
Amanieu committed Jul 5, 2018
1 parent 9363342 commit 8ed29b9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/librustc_target/spec/linux_musl_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ pub fn opts() -> TargetOptions {
base.pre_link_objects_exe_crt.push("crti.o".to_string());
base.post_link_objects_crt.push("crtn.o".to_string());

// On some architectures (e.g. aarch64) musl depends on some libgcc
// functions (__addtf3, __multf3, __subtf3) for long double arithmetic that
// it uses internally. Unfortunately we don't provide these functions in
// compiler-builtins, so we instead need to get them from libgcc.
//
// This is not a problem if we are linking to libc dynamically since the
// libgcc dependency will automatically get picked up by the linker then.
base.post_link_objects_crt.push("-lgcc".to_string());

// These targets statically link libc by default
base.crt_static_default = true;
// These targets allow the user to choose between static and dynamic linking.
Expand Down

0 comments on commit 8ed29b9

Please sign in to comment.