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)
Sat, Apr 20, 2:54 PM
Unknown Object (File)
Apr 12 2024, 2:47 AM
Unknown Object (File)
Apr 12 2024, 2:47 AM
Unknown Object (File)
Apr 12 2024, 2:47 AM
Unknown Object (File)
Apr 12 2024, 2:47 AM
Unknown Object (File)
Apr 12 2024, 2:47 AM
Unknown Object (File)
Apr 12 2024, 2:47 AM
Unknown Object (File)
Apr 12 2024, 2:31 AM

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.