Re: New kernel-toolchain buildkernel problem for amd64 -> aarch64 cross build ( after -r336348 ) : ld used for addf_data only can target: elf_x86_64_fbsd elf_i386_fbsd

From: Bryan Drewery <bdrewery_at_FreeBSD.org>
Date: Mon, 16 Jul 2018 15:31:50 -0700
On 7/16/18 1:21 PM, Mark Millard wrote:
> I attempted a from-scratch (. . ./arm64.aarch64/ empty) kernel-toolchain buildkernel
> targeting aarch64 from amd64 based on head -r336349 . It failed by ending up
> using an ld that can only target elf_x86_64_fbsd elf_i386_fbsd :

I probably extended the LLVM_TARGET_ALL=no in cross-compiler too far. I
thought I had left that out for kernel-toolchain but apparently not.

Try this patch and kernel-toolchain after applying please:
http://people.freebsd.org/~bdrewery/patches/cross-compiler-fix.diff

> 
> . . .
> --- buildkernel ---
> Building /usr/obj/cortexA53_clang/arm64.aarch64/usr/src/arm64.aarch64/sys/GENERIC-NODBG/modules/usr/src/sys/modules/accf_data/accf_data.kld
> --- accf_data.kld ---
> ld: unrecognised emulation mode: aarch64elf
> Supported emulations: elf_x86_64_fbsd elf_i386_fbsd
> *** [accf_data.kld] Error code 1
> 
> make[4]: stopped in /usr/src/sys/modules/accf_data
> .ERROR_TARGET='accf_data.kld'
> .ERROR_META_FILE='/usr/obj/cortexA53_clang/arm64.aarch64/usr/src/arm64.aarch64/sys/GENERIC-NODBG/modules/usr/src/sys/modules/accf_data/accf_data.kld.meta'
> .MAKE.LEVEL='4'
> MAKEFILE=''
> .MAKE.MODE='meta missing-filemon=yes missing-meta=yes silent=yes verbose'
> _ERROR_CMD='ld -m aarch64elf -d -warn-common -r -d -o accf_data.kld accf_data.o; ctfmerge -L VERSION -g -o accf_data.kld accf_data.o; :> export_syms; awk -f /usr/src/sys/conf/kmod_syms.awk accf_data.kld  export_syms | xargs -J% objcopy % accf_data.kld;'
> .CURDIR='/usr/src/sys/modules/accf_data'
> .MAKE='make'
> .OBJDIR='/usr/obj/cortexA53_clang/arm64.aarch64/usr/src/arm64.aarch64/sys/GENERIC-NODBG/modules/usr/src/sys/modules/accf_data'
> .TARGETS='all'
> DESTDIR=''
> LD_LIBRARY_PATH=''
> MACHINE='arm64'
> MACHINE_ARCH='aarch64'
> MAKEOBJDIRPREFIX='/usr/obj/cortexA53_clang/arm64.aarch64/usr/src/arm64.aarch64/sys/GENERIC-NODBG/modules'
> MAKESYSPATH='/usr/src/share/mk'
> MAKE_VERSION='20180512'
> PATH='/usr/obj/cortexA53_clang/arm64.aarch64/usr/src/arm64.aarch64/tmp/legacy/usr/sbin:/usr/obj/cortexA53_clang/arm64.aarch64/usr/src/arm64.aarch64/tmp/legacy/usr/bin:/usr/obj/cortexA53_clang/arm64.aarch64/usr/src/arm64.aarch64/tmp/legacy/bin:/usr/obj/cortexA53_clang/arm64.aarch64/usr/src/arm64.aarch64/tmp/usr/sbin:/usr/obj/cortexA53_clang/arm64.aarch64/usr/src/arm64.aarch64/tmp/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin'
> SRCTOP='/usr/src'
> OBJTOP='/usr/obj/cortexA53_clang/arm64.aarch64/usr/src/arm64.aarch64/sys/GENERIC-NODBG/modules/usr/src'
> .MAKE.MAKEFILES='/usr/src/share/mk/sys.mk /usr/src/share/mk/local.sys.env.mk /usr/src/share/mk/src.sys.env.mk /root/src.configs/src.conf.cortexA53-clang-bootstrap.amd64-host /usr/src/share/mk/bsd.mkopt.mk /usr/src/share/mk/src.sys.obj.mk /usr/src/share/mk/auto.obj.mk /usr/src/share/mk/bsd.suffixes.mk /root/src.configs/make.conf /usr/src/share/mk/local.sys.mk /usr/src/share/mk/src.sys.mk /dev/null /usr/src/sys/modules/accf_data/Makefile /usr/src/share/mk/bsd.kmod.mk /usr/src/sys/conf/kmod.mk /usr/src/share/mk/bsd.init.mk /usr/src/share/mk/bsd.opts.mk /usr/src/share/mk/bsd.cpu.mk /usr/src/share/mk/local.init.mk /usr/src/share/mk/src.init.mk /usr/src/sys/modules/accf_data/../Makefile.inc /usr/src/share/mk/bsd.own.mk /usr/src/share/mk/bsd.compiler.mk /usr/src/share/mk/bsd.linker.mk /usr/src/sys/conf/kern.opts.mk /usr/src/sys/conf/config.mk /usr/src/share/mk/bsd.links.mk /usr/src/share/mk/bsd.dep.mk /usr/src/share/mk/bsd.clang-analyze.mk /usr/src/share/mk/bsd.obj.mk /usr/src/share/mk/bsd.subdir.mk /usr/src/sys/conf/kern.mk'
> .PATH='. /usr/src/sys/modules/accf_data /usr/src/sys/netinet /usr/obj/cortexA53_clang/arm64.aarch64/usr/src/arm64.aarch64/sys/GENERIC-NODBG'
> 1 error
> 
> 
> 
> Detailed context:
> 
> # uname -apKU
> FreeBSD FBSDUSSD 12.0-CURRENT FreeBSD 12.0-CURRENT  r336349M  amd64 amd64 1200073 1200073
> 
> The "M" is mostly for powerpc* family experiments:
> 
> # svnlite status /usr/src/ | sort
> ?       /usr/src/sys/amd64/conf/GENERIC-DBG
> ?       /usr/src/sys/amd64/conf/GENERIC-NODBG
> ?       /usr/src/sys/arm/conf/GENERIC-DBG
> ?       /usr/src/sys/arm/conf/GENERIC-NODBG
> ?       /usr/src/sys/arm64/conf/GENERIC-DBG
> ?       /usr/src/sys/arm64/conf/GENERIC-NODBG
> ?       /usr/src/sys/powerpc/conf/GENERIC64vtsc-DBG
> ?       /usr/src/sys/powerpc/conf/GENERIC64vtsc-NODBG
> ?       /usr/src/sys/powerpc/conf/GENERICvtsc-DBG
> ?       /usr/src/sys/powerpc/conf/GENERICvtsc-NODBG
> M       /usr/src/Makefile.libcompat
> M       /usr/src/contrib/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
> M       /usr/src/contrib/llvm/tools/lld/ELF/Arch/PPC64.cpp
> M       /usr/src/crypto/openssl/crypto/armcap.c
> M       /usr/src/lib/libkvm/kvm_powerpc.c
> M       /usr/src/lib/libkvm/kvm_private.c
> M       /usr/src/release/Makefile.vm
> M       /usr/src/release/scripts/mk-vmimage.sh
> M       /usr/src/release/tools/vmimage.subr
> M       /usr/src/secure/lib/libcrypto/Makefile
> M       /usr/src/stand/defs.mk
> M       /usr/src/stand/powerpc/boot1.chrp/Makefile
> M       /usr/src/stand/powerpc/kboot/Makefile
> M       /usr/src/sys/arm64/arm64/identcpu.c
> M       /usr/src/sys/conf/kmod.mk
> M       /usr/src/sys/conf/ldscript.powerpc
> M       /usr/src/sys/powerpc/aim/mmu_oea64.c
> M       /usr/src/sys/powerpc/ofw/ofw_machdep.c
> 
> # more /usr/src/sys/arm64/conf/GENERIC-NODBG
> #
> # GENERIC -- Custom configuration for the arm64/aarch64
> #
> 
> include "GENERIC"
> 
> ident   GENERIC-NODBG
> 
> makeoptions     DEBUG=-g                # Build kernel with gdb(1) debug symbols
> 
> options         ALT_BREAK_TO_DEBUGGER
> 
> options         KDB                     # Enable kernel debugger support
> 
> # For minimum debugger support (stable branch) use:
> #options        KDB_TRACE               # Print a stack trace for a panic
> options         DDB                     # Enable the kernel debugger
> 
> # Extra stuff:
> #options        VERBOSE_SYSINIT         # Enable verbose sysinit messages
> #options        BOOTVERBOSE=1
> #options        BOOTHOWTO=RB_VERBOSE
> #options        KTR
> #options        KTR_MASK=KTR_TRAP
> ##options       KTR_CPUMASK=0xF
> #options        KTR_VERBOSE
> 
> # Disable any extra checking for. . .
> nooptions       DEADLKRES               # Enable the deadlock resolver
> nooptions       INVARIANTS              # Enable calls of extra sanity checking
> nooptions       INVARIANT_SUPPORT       # Extra sanity checks of internal structures, required by INVARIANTS
> nooptions       WITNESS                 # Enable checks to detect deadlocks and cycles
> nooptions       WITNESS_SKIPSPIN        # Don't run witness on spinlocks for speed
> nooptions       DIAGNOSTIC
> nooptions       MALLOC_DEBUG_MAXZONES   # Separate malloc(9) zones
> nooptions       BUF_TRACKING
> nooptions       FULL_BUF_TRACKING
> 
> 
> # more ~/sys_build_scripts.amd64-host/make_cortexA53_nodebug_clang_bootstrap-amd64-host.sh -j4 kernel-toolchain buildkernel
> kldload -n filemon && \
> script ~/sys_typescripts/typescript_make_cortexA53_nodebug_clang_bootstrap-amd64-host-$(date +%Y-%m-%d:%H:%M:%S) \
> env __MAKE_CONF="/root/src.configs/make.conf" SRCCONF="/dev/null" SRC_ENV_CONF="/root/src.configs/src.conf.cortexA53-clang-bootstrap.amd64-host" \
> WITH_META_MODE=yes \
> MAKEOBJDIRPREFIX="/usr/obj/cortexA53_clang/arm64.aarch64" \
> make $*
> 
> 
> # more ~/src.configs/src.conf.cortexA53-clang-bootstrap.amd64-host
> TO_TYPE=aarch64
> TOOLS_TO_TYPE=${TO_TYPE}
> VERSION_CONTEXT=12.0
> #
> KERNCONF=GENERIC-NODBG
> TARGET=arm64
> .if ${.MAKE.LEVEL} == 0
> TARGET_ARCH=${TO_TYPE}
> .export TARGET_ARCH
> .endif
> #
> WITH_CROSS_COMPILER=
> WITHOUT_SYSTEM_COMPILER=
> WITHOUT_SYSTEM_LINKER=
> #
> WITH_LIBCPLUSPLUS=
> WITH_LLD_BOOTSTRAP=
> WITHOUT_BINUTILS_BOOTSTRAP=
> WITH_ELFTOOLCHAIN_BOOTSTRAP=
> WITH_CLANG_BOOTSTRAP=
> WITH_CLANG=
> WITH_CLANG_IS_CC=
> WITH_CLANG_FULL=
> WITH_CLANG_EXTRAS=
> WITH_LLD=
> WITH_LLD_IS_LD=
> WITH_LLDB=
> #
> WITH_BOOT=
> WITHOUT_LIB32=
> #
> WITHOUT_GCC_BOOTSTRAP=
> WITHOUT_GCC=
> WITHOUT_GCC_IS_CC=
> WITHOUT_GNUCXX=
> #
> NO_WERROR=
> #WERROR=
> MALLOC_PRODUCTION=
> #
> WITH_REPRODUCIBLE_BUILD=
> WITH_DEBUG_FILES=
> #
> #CROSS_BINUTILS_PREFIX=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/
> XCFLAGS+= -mcpu=cortex-a53
> XCXXFLAGS+= -mcpu=cortex-a53
> # There is no XCPPFLAGS but XCPP gets XCFLAGS content.
> ACFLAGS.arm64cpuid.S+=  -mcpu=cortex-a53+crypto
> ACFLAGS.aesv8-armx.S+=  -mcpu=cortex-a53+crypto
> ACFLAGS.ghashv8-armx.S+=        -mcpu=cortex-a53+crypto
> 
> 
> # more ~/src.configs/make.conf
> CFLAGS.gcc+= -v
> 
> 
> 
> ===
> Mark Millard
> marklmi at yahoo.com
> ( dsl-only.net went
> away in early 2018-Mar)
> 


-- 
Regards,
Bryan Drewery


Received on Mon Jul 16 2018 - 20:32:02 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:17 UTC