Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing symbols on aarch64-unknown-linux-musl #201

Closed
Amanieu opened this issue Oct 8, 2017 · 7 comments · Fixed by #377
Closed

Missing symbols on aarch64-unknown-linux-musl #201

Amanieu opened this issue Oct 8, 2017 · 7 comments · Fixed by #377

Comments

@Amanieu
Copy link
Member

Amanieu commented Oct 8, 2017

When compiling a simple hello world crate for aarch64-unknown-linux-musl, I get the following error:

          /home/amanieu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/liblibc-3c62182e850a1e7a.rlib(vfprintf.o): In function `fmt_fp':
          vfprintf.c:(.text.fmt_fp+0x178): undefined reference to `__addtf3'
          vfprintf.c:(.text.fmt_fp+0x20c): undefined reference to `__multf3'
          vfprintf.c:(.text.fmt_fp+0x240): undefined reference to `__subtf3'
          vfprintf.c:(.text.fmt_fp+0x250): undefined reference to `__addtf3'
          vfprintf.c:(.text.fmt_fp+0x278): undefined reference to `__addtf3'
          vfprintf.c:(.text.fmt_fp+0x284): undefined reference to `__subtf3'
          vfprintf.c:(.text.fmt_fp+0x33c): undefined reference to `__subtf3'
          vfprintf.c:(.text.fmt_fp+0x344): undefined reference to `__multf3'
          vfprintf.c:(.text.fmt_fp+0x4e8): undefined reference to `__multf3'
          vfprintf.c:(.text.fmt_fp+0x548): undefined reference to `__subtf3'
          vfprintf.c:(.text.fmt_fp+0x550): undefined reference to `__multf3'
          vfprintf.c:(.text.fmt_fp+0x828): undefined reference to `__addtf3'
          /home/amanieu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/liblibc-3c62182e850a1e7a.rlib(frexpl.o): In function `frexpl':
          frexpl.c:(.text.frexpl+0x38): undefined reference to `__multf3'
          collect2: error: ld returned 1 exit status

It would seem that the __addtf3, __subtf3 and __multf3 symbols are used by musl but are not provided by compiler-builtins.

@asonix
Copy link

asonix commented Dec 12, 2017

Alright, it seems based on this link that __addtf3, and the other tf3 functions are expecting long double or a 'triple float'. On aarch64, this occupies 128 bits (as demonstrated by my really basic C program I just compiled on a pine64)

asonix@pine64:~$ cat test.c 
#include <stdio.h>

int main() {
	float x = 2.0;
	double y = 2.0;
	long double z = 2.0;

	printf("float: %lu\n", sizeof(x));
	printf("double: %lu\n", sizeof(y));
	printf("long double: %lu\n", sizeof(z));
	return 0;
}
asonix@pine64:~$ gcc test.c -o test.bin
asonix@pine64:~$ ./test.bin 
float: 4
double: 8
long double: 16
asonix@pine64:~$ 

Whether this means that long doubles occupy the whole 128 bits, or just part of them I am unsure, but my guess would be to implement these with f128s

Edit:
Well, since f128s don't exist anymore I guess this is blocked

bors added a commit to rust-lang/libc that referenced this issue Jul 9, 2018
Link to libgcc when statically linking musl

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.

Fixes:
rust-lang/rust#46651
rust-lang/compiler-builtins#201
rust-lang/compiler-builtins#217
@Amanieu
Copy link
Member Author

Amanieu commented Jul 9, 2018

Fixed by rust-lang/libc#1034.

@Amanieu
Copy link
Member Author

Amanieu commented Jul 22, 2018

Reopening due to rust-lang/libc#1045

@Amanieu Amanieu reopened this Jul 22, 2018
@bbqsrc
Copy link

bbqsrc commented Aug 17, 2018

This bit me recently, and the workaround here is a temporary but functional fix, though it does leave a dry taste in the mouth.

@ciofeca
Copy link

ciofeca commented Oct 27, 2018

Fresh install of Rust 1.30 on x86_64, tried to compile, errors still there. Sigh!

sameo pushed a commit to rust-vmm/kvm that referenced this issue Apr 8, 2019
The linker was unable to find __addtf3, __multf3 and __subtf3.

Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

A permanent fix is yet to be implemented in the Rust compiler.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
sameo pushed a commit to sameo/vm-virtio that referenced this issue May 21, 2019
The linker can't find the flotaing point builtins.

Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
sameo pushed a commit to sameo/vm-virtio that referenced this issue May 27, 2019
The linker can't find the flotaing point builtins.

Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
sameo pushed a commit to sameo/vm-virtio that referenced this issue May 29, 2019
The linker can't find the floating point builtins.

Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
sameo pushed a commit to sameo/vm-virtio that referenced this issue May 29, 2019
The linker can't find the floating point builtins.

Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
petrutlucian94 pushed a commit to petrutlucian94/vm-memory that referenced this issue May 30, 2019
The linker was unable to find __addtf3, __multf3 and __subtf3.

Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

A permanent fix is yet to be implemented in the Rust compiler.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
petrutlucian94 pushed a commit to petrutlucian94/vm-memory that referenced this issue May 30, 2019
The linker was unable to find __addtf3, __multf3 and __subtf3.

Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

A permanent fix is yet to be implemented in the Rust compiler.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
petrutlucian94 pushed a commit to petrutlucian94/vm-memory that referenced this issue May 30, 2019
The linker was unable to find __addtf3, __multf3 and __subtf3.

Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

A permanent fix is yet to be implemented in the Rust compiler.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
jiangliu pushed a commit to rust-vmm/vm-memory that referenced this issue May 30, 2019
The linker was unable to find __addtf3, __multf3 and __subtf3.

Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

A permanent fix is yet to be implemented in the Rust compiler.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
bonzini pushed a commit to bonzini/vmm-sys-util that referenced this issue Jun 4, 2019
The linker was unable to find __addtf3, __multf3 and __subtf3.

Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

A permanent fix is yet to be implemented in the Rust compiler.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
bonzini pushed a commit to bonzini/vmm-sys-util that referenced this issue Jun 4, 2019
The linker was unable to find __addtf3, __multf3 and __subtf3.

Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

A permanent fix is yet to be implemented in the Rust compiler.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
bonzini pushed a commit to bonzini/vmm-sys-util that referenced this issue Jun 4, 2019
The linker was unable to find __addtf3, __multf3 and __subtf3.

Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

A permanent fix is yet to be implemented in the Rust compiler.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
sameo pushed a commit to rust-vmm/vmm-sys-util that referenced this issue Jun 4, 2019
The linker was unable to find __addtf3, __multf3 and __subtf3.

Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

A permanent fix is yet to be implemented in the Rust compiler.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
acatangiu pushed a commit to firecracker-microvm/versionize that referenced this issue Apr 27, 2020
The linker was unable to find __addtf3, __multf3 and __subtf3.

Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

A permanent fix is yet to be implemented in the Rust compiler.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
@parched
Copy link
Contributor

parched commented Jun 24, 2020

@Amanieu can we fix this by applying your libc patch again and making all symbols in this crate weak symbols?

ebeasant-arm added a commit to ebeasant-arm/oak that referenced this issue Jun 24, 2020
When building for aarch64, cross or native,
linking with musl will fail due to missing symbols.

This change only affects Rust code targetting:
    - aarch64-unknown-linux-musl

Workaround for:
rust-lang/compiler-builtins#201
@Amanieu
Copy link
Member Author

Amanieu commented Jun 25, 2020

I think we can link libgcc as static-nobundle which should avoid the link error.

tiziano88 pushed a commit to project-oak/oak that referenced this issue Jun 26, 2020
When building for aarch64, cross or native,
linking with musl will fail due to missing symbols.

This change only affects Rust code targetting:
    - aarch64-unknown-linux-musl

Workaround for:
rust-lang/compiler-builtins#201
andreeaflorescu added a commit to danielverkamp/vm-fdt that referenced this issue Apr 6, 2021
The linker was unable to find __addtf3, __multf3 and __subtf3.

Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

A permanent fix is yet to be implemented in the Rust compiler.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
andreeaflorescu added a commit to danielverkamp/vm-fdt that referenced this issue Apr 7, 2021
The linker was unable to find __addtf3, __multf3 and __subtf3.

Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

A permanent fix is yet to be implemented in the Rust compiler.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
danielverkamp pushed a commit to danielverkamp/vm-fdt that referenced this issue Apr 8, 2021
The linker was unable to find __addtf3, __multf3 and __subtf3.

Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

A permanent fix is yet to be implemented in the Rust compiler.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
danielverkamp pushed a commit to danielverkamp/vm-fdt that referenced this issue Apr 8, 2021
The linker was unable to find __addtf3, __multf3 and __subtf3.

Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

A permanent fix is yet to be implemented in the Rust compiler.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
danielverkamp pushed a commit to danielverkamp/vm-fdt that referenced this issue Apr 9, 2021
The linker was unable to find __addtf3, __multf3 and __subtf3.

Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

A permanent fix is yet to be implemented in the Rust compiler.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
danielverkamp pushed a commit to danielverkamp/vm-fdt that referenced this issue Apr 9, 2021
The linker was unable to find __addtf3, __multf3 and __subtf3.

Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

A permanent fix is yet to be implemented in the Rust compiler.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
danielverkamp pushed a commit to danielverkamp/vm-fdt that referenced this issue Apr 16, 2021
The linker was unable to find __addtf3, __multf3 and __subtf3.

Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

A permanent fix is yet to be implemented in the Rust compiler.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
danielverkamp pushed a commit to danielverkamp/vm-fdt that referenced this issue Apr 16, 2021
The linker was unable to find __addtf3, __multf3 and __subtf3.

Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

A permanent fix is yet to be implemented in the Rust compiler.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
danielverkamp pushed a commit to danielverkamp/vm-fdt that referenced this issue Apr 21, 2021
The linker was unable to find __addtf3, __multf3 and __subtf3.

Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

A permanent fix is yet to be implemented in the Rust compiler.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
danielverkamp pushed a commit to danielverkamp/vm-fdt that referenced this issue Apr 21, 2021
The linker was unable to find __addtf3, __multf3 and __subtf3.

Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

A permanent fix is yet to be implemented in the Rust compiler.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
andreeaflorescu added a commit to rust-vmm/vm-fdt that referenced this issue Apr 28, 2021
The linker was unable to find __addtf3, __multf3 and __subtf3.

Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

A permanent fix is yet to be implemented in the Rust compiler.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
andreeaflorescu added a commit to andreeaflorescu/crate-template that referenced this issue May 25, 2021
Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

A permanent fix is yet to be implemented in the Rust compiler.

Fixes: rust-vmm#10

Signed-off-by: Andreea Florescu <fandree@amazon.com>
andreeaflorescu added a commit to rust-vmm/crate-template that referenced this issue May 25, 2021
Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

A permanent fix is yet to be implemented in the Rust compiler.

Fixes: #10

Signed-off-by: Andreea Florescu <fandree@amazon.com>
alindima added a commit to alindima/seccompiler that referenced this issue Jun 11, 2021
Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

A permanent fix is yet to be implemented in the Rust compiler.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
Signed-off-by: alindima <alindima@amazon.com>
alindima added a commit to alindima/seccompiler that referenced this issue Jun 11, 2021
Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

A permanent fix is yet to be implemented in the Rust compiler.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
Signed-off-by: alindima <alindima@amazon.com>
alindima added a commit to alindima/seccompiler that referenced this issue Jun 11, 2021
Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

A permanent fix is yet to be implemented in the Rust compiler.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
Signed-off-by: alindima <alindima@amazon.com>
alexandruag pushed a commit to rust-vmm/seccompiler that referenced this issue Jun 16, 2021
Added target-feature=+crt-static and link-arg=-lgcc as a temporary
workaround. This seems to be the accepted fix in the Rust community:
rust-lang/compiler-builtins#201

A permanent fix is yet to be implemented in the Rust compiler.

Signed-off-by: Andreea Florescu <fandree@amazon.com>
Signed-off-by: alindima <alindima@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants