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

Try to link SSE/AVX code in arm64 kernel when cross compile from x86_64 host #16933

Open
12101111 opened this issue Jan 7, 2025 · 0 comments
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)

Comments

@12101111
Copy link
Contributor

12101111 commented Jan 7, 2025

System information

Type Version/Name
Distribution Name Gentoo Linux
Distribution Version 2.17
Kernel Version 6.13 rc6
Architecture arm64/x86_64
OpenZFS Version 2.3.0 rc5

Describe the problem you're observing

When cross compile from x86_64 for arm64, zfs_config.h contains those flags:

/* Define if host toolchain supports AVX */
#define HAVE_AVX 1

/* Define if host toolchain supports AVX2 */
#define HAVE_AVX2 1
...
/* Define if host toolchain supports SSE */
#define HAVE_SSE 1

/* Define if host toolchain supports SSE2 */
#define HAVE_SSE2 1

/* Define if host toolchain supports SSE3 */
#define HAVE_SSE3 1

/* Define if host toolchain supports SSE4.1 */
#define HAVE_SSE4_1 1

/* Define if host toolchain supports SSE4.2 */
#define HAVE_SSE4_2 1

/* Define if host toolchain supports SSSE3 */
#define HAVE_SSSE3 1

The comment say those flags are for host, not for target

But in (zfs_fletcher.c)[https://github.com/openzfs/zfs/blob/master/module/zcommon/zfs_fletcher.c#L176], those flags are used for kernel code.

Describe how to reproduce the problem

./configure KERNEL_LLVM=1 KERNEL_ARCH=arm64 KERNEL_CROSS_COMPILE=aarch64-unknown-linux-gnu- --with-config=kernel --enable-linux-builtin
./copy-builtin /usr/src/linux

Then enable CONFIG_ZFS=y and compile kernel

make ARCH=arm64 CROSS_COMPILE=aarch64-unknown-linux-gnu- LLVM=1 LLVM_IAS=1 -j32

Include any warning/errors/backtraces from the system logs

  AR      built-in.a
  AR      vmlinux.a
  GEN     .tmp_initcalls.lds
  LD      vmlinux.o
  OBJCOPY modules.builtin.modinfo
  GEN     modules.builtin
  GEN     .vmlinux.objs
  MODPOST Module.symvers
  UPD     include/generated/utsversion.h
  CC      init/version-timestamp.o
  KSYMS   .tmp_vmlinux0.kallsyms.S
  AS      .tmp_vmlinux0.kallsyms.o
  LD      .tmp_vmlinux1
ld.lld: error: undefined symbol: fletcher_4_sse2_ops
>>> referenced by __efistub_vsprintf.c
>>>               vmlinux.o:(fletcher_4_impls)

ld.lld: error: undefined symbol: fletcher_4_ssse3_ops
>>> referenced by __efistub_vsprintf.c
>>>               vmlinux.o:(fletcher_4_impls)

ld.lld: error: undefined symbol: fletcher_4_avx2_ops
>>> referenced by __efistub_vsprintf.c
>>>               vmlinux.o:(fletcher_4_impls)

ld.lld: warning: <internal>:(.eh_frame) is being placed in '.eh_frame'
make[2]: *** [scripts/Makefile.vmlinux:77: vmlinux] Error 1
@12101111 12101111 added the Type: Defect Incorrect behavior (e.g. crash, hang) label Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)
Projects
None yet
Development

No branches or pull requests

1 participant