Page MenuHomeFreeBSD

lang/rust: fix build on ppc64 and armv6/7
AbandonedPublic

Authored by mikael on Apr 17 2019, 5:44 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Dec 24, 5:01 AM
Unknown Object (File)
Sun, Dec 8, 10:16 PM
Unknown Object (File)
Thu, Nov 28, 7:22 PM
Unknown Object (File)
Oct 4 2024, 9:00 PM
Unknown Object (File)
Sep 29 2024, 4:25 AM
Unknown Object (File)
Sep 26 2024, 10:06 AM
Unknown Object (File)
Sep 24 2024, 6:00 AM
Unknown Object (File)
Sep 23 2024, 8:55 PM

Details

Reviewers
None
Group Reviewers
rust
Summary

std_detect is missing on these arches.

Test Plan

untested on amd64

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

mikael updated this revision to Diff 56300.
mikael edited the test plan for this revision. (Show Details)
  • FreeBSD >= 12 should try elf_aux_info before KERN_PROC_AUXV, similar to how getauxval is tried before /proc/self/auxv on Linux
  • AT_HWCAP is nop on powerpc64 on FreeBSD < 12, see rS332859; previous versions can use hw.cpu_features and hw.cpu_features2
  • Upstreaming is necessary to avoid bitrot

Sorry, I don't know Rust to review the actual code.

lang/rust/files/patch-stdsimd
166

Why not aux.hwcap2? 0x80000000 in AT_HWCAP refers to PPC_FEATURE_32, not PPC_FEATURE2_ARCH_2_07.

  • FreeBSD >= 12 should try elf_aux_info before KERN_PROC_AUXV, similar to how getauxval is tried before /proc/self/auxv on Linux

man elf_aux_info
No manual entry for elf_aux_info
-> not implemented

  • AT_HWCAP is nop on powerpc64 on FreeBSD < 12, see rS332859; previous versions can use hw.cpu_features and hw.cpu_features2

It'll add a lot of code for a dead branch and only for one arch, it's not worth the effort.

  • Upstreaming is necessary to avoid bitrot

sure.

Sorry, I don't know Rust to review the actual code.

that makes two of us

lang/rust/files/patch-stdsimd
166

congrats, you've found a bug in the linux code

fix hwcap2 on arm.rs and ppc

In D19940#428596, @mikael.urankar_gmail.com wrote:
  • FreeBSD >= 12 should try elf_aux_info before KERN_PROC_AUXV, similar to how getauxval is tried before /proc/self/auxv on Linux

man elf_aux_info
No manual entry for elf_aux_info
-> not implemented

See multimedia/libvpx/files/patch-vpx__ports_{arm,ppc}__cpudetect.c for NEON and VSX examples. As the 2nd argument to elf_aux_info is a pointer one has to be a bit more careful with types i.e., libc sanity checks aren't foolproof to avoid a crash.

CC @mmel per rS324815 and @ian per planned manpage.

lang/rust/files/patch-stdsimd
166

2 was added to the wrong place: auxv2.hwcap -> auxv.hwcap2.

Can you send it upstream please? It's necessary anyway and they maybe able to review the actual Rust code.

I can confirm that with the attached patch I can build rust on stable/12 on powerpc64.

In D19940#428596, @mikael.urankar_gmail.com wrote:
  • FreeBSD >= 12 should try elf_aux_info before KERN_PROC_AUXV, similar to how getauxval is tried before /proc/self/auxv on Linux

man elf_aux_info
No manual entry for elf_aux_info
-> not implemented

See multimedia/libvpx/files/patch-vpx__ports_{arm,ppc}__cpudetect.c for NEON and VSX examples. As the 2nd argument to elf_aux_info is a pointer one has to be a bit more careful with types i.e., libc sanity checks aren't foolproof to avoid a crash.

CC @mmel per rS324815 and @ian per planned manpage.

I had completely forgotten about writing that manpage. Better late than never, I guess, I just did it. See D20063

I can confirm that with the attached patch I can build rust on stable/12 on powerpc64.

Ok. I've batched this up with the Rust 1.34.1 update and test builds were fine on amd64/i386, so I have no objections to add these patches to the port.