Page MenuHomeFreeBSD

make cross build from arm64 work..
ClosedPublic

Authored by jmg on Feb 24 2023, 6:47 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 14, 9:25 PM
Unknown Object (File)
Sat, Apr 6, 4:29 PM
Unknown Object (File)
Mar 12 2024, 10:32 PM
Unknown Object (File)
Mar 12 2024, 10:32 PM
Unknown Object (File)
Mar 8 2024, 7:27 AM
Unknown Object (File)
Mar 8 2024, 7:16 AM
Unknown Object (File)
Feb 10 2024, 11:19 AM
Unknown Object (File)
Jan 11 2024, 8:02 AM
Subscribers

Details

Summary

If you try to build amd64 from an an arm64 machine, you'll get:
ld: error: undefined hidden symbol: blake3_hash_many_neon

and that is because when _ARCH != arm64, the neon file isn't
compiled/linked, but when building the cross tool, it detects
it's on arm64 and automatically enables it.

This copies want is done for the AVX and other x86 specific
optimizations.

With this change, I was successful in building (and booting) an
amd64 world from an arm64 box...

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jmg requested review of this revision.Feb 24 2023, 6:47 PM
lib/clang/libllvm/Makefile
35

mild curiosity, I wonder why they ended up with other than -DBLAKE3_NO_NEON

LGTM. Please MFC.

lib/clang/libllvm/Makefile
35

This was brought in separately in https://github.com/llvm/llvm-project/commit/34362f96d2c0b:

To accomodate macOS universal configuration include the assembly files and blake3_neon.c without a CMake check but instead guard their source with architecture "#ifdef" checks.

In LLVM there is an eclectic mix of the styles:

  • #define FOO or #undef FOO, then check with #ifdef FOO or #ifndef FOO
  • #define FOO 0 or #define FOO 1, then check with #if FOO or #if !FOO

I'd rather just use one style, but currently it's hit and miss... :)

This revision is now accepted and ready to land.Feb 24 2023, 7:17 PM
imp accepted this revision.EditedFeb 24 2023, 10:06 PM

Seems to check out.

contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_dispatch.c:#if BLAKE3_USE_NEON == 1
contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_dispatch.c:#if BLAKE3_USE_NEON == 1
contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_impl.h:#if !defined(BLAKE3_USE_NEON) 
contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_impl.h:  // If BLAKE3_USE_NEON not manually set, autodetect based on AArch64ness
contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_impl.h:    #define BLAKE3_USE_NEON 1
contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_impl.h:    #define BLAKE3_USE_NEON 0
contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_impl.h:#elif BLAKE3_USE_NEON == 1
contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_impl.h:#if BLAKE3_USE_NEON == 1
contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_neon.c:#if BLAKE3_USE_NEON
contrib/llvm-project/llvm/lib/Support/BLAKE3/blake3_neon.c:#endif // BLAKE3_USE_NEON

and

#if !defined(BLAKE3_USE_NEON)
  // If BLAKE3_USE_NEON not manually set, autodetect based on AArch64ness                                                                                                                                                                     
  #if defined(IS_AARCH64)
    #define BLAKE3_USE_NEON 1
  #else
    #define BLAKE3_USE_NEON 0
  #endif
#endif

so yea, we really need it and there's no other clever way around it.

This revision was automatically updated to reflect the committed changes.