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: Mark Millard <marklmi_at_yahoo.com>
Date: Mon, 16 Jul 2018 18:46:02 -0700
[ toolchain-metadata.mk is missing when kernel-toolchain is used.
I've no clue if this is intentional or not. ]

On 2018-Jul-16, at 6:13 PM, Mark Millard <marklmi at yahoo.com> wrote:

> On 2018-Jul-16, at 4:47 PM, Bryan Drewery <bdrewery at FreeBSD.org> wrote:
> 
>> On 7/16/2018 3:49 PM, Mark Millard wrote:
>>> 
>>> 
>>> On 2018-Jul-16, at 3:31 PM, Bryan Drewery <bdrewery at FreeBSD.org> wrote:
>>> 
>>>> 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
>>>> . . .
>>> 
>>> Result is unchanged. Details follow.
>> 
>> Ok, I'll look more tomorrow.
>> 
>>> 
>>> With:
>>> 
>>> # svnlite diff /usr/src/Makefile.inc1
>>> Index: /usr/src/Makefile.inc1
>>> ===================================================================
>>> --- /usr/src/Makefile.inc1	(revision 336349)
>>> +++ /usr/src/Makefile.inc1	(working copy)
>>> _at__at_ -666,7 +666,7 _at__at_
>>> BMAKE=		\
>>> 		${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
>>> 		${BSARGS}
>>> -.if empty(.MAKEOVERRIDES:MMK_LLVM_TARGET_ALL)
>>> +.if empty(.MAKEOVERRIDES:MMK_LLVM_TARGET_ALL) && !make(*toolchain*)
>>> BMAKE+=		MK_LLVM_TARGET_ALL=no
>>> .endif
>>> 
>>> used via:
>>> 
>>> # rm -fr /usr/obj/cortexA53_clang/arm64.aarch64/*
>>> # ~/sys_build_scripts.amd64-host/make_cortexA53_nodebug_clang_bootstrap-amd64-host.sh -j4 kernel-toolchain buildkernel
>>> 
>>> I still get:
>>> 
>>> --- 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
>>> 
>>> 
>>> 
>>> Reminder of what my .sh script does:
>>> 
>>> # more ~/sys_build_scripts.amd64-host/make_cortexA53_nodebug_clang_bootstrap-amd64-host.sh
>>> 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 $*
>>> 
>>> (I'll not repeat the other supporting material.)
> 
> In case it helps:
> 
> # ~/sys_build_scripts.amd64-host/make_cortexA53_nodebug_clang_bootstrap-amd64-host.sh test-system-linker
> Script started, output file is /root/sys_typescripts/typescript_make_cortexA53_nodebug_clang_bootstrap-amd64-host-2018-07-16:17:48:38
> USING_SYSTEM_LINKER                = no
> MK_SYSTEM_LINKER                   = no
> MK_LLD_BOOTSTRAP                   = yes
> MK_BINUTILS_BOOTSTRAP              = no
> WANT_LINKER_TYPE                   = lld
> WANT_LINKER_VERSION                = 60001
> WANT_LINKER_VERSION_FILE           = lib/clang/include/lld/Common/Version.inc
> WANT_LINKER_FREEBSD_VERSION        = 335540-1200003
> WANT_LINKER_FREEBSD_VERSION_FILE   = lib/clang/include/lld/Common/Version.inc
> LD                                 = ld
> LINKER_TYPE                        = bfd
> LINKER_FEATURES                    =  filter
> LINKER_VERSION                     = 21750
> LINKER_FREEBSD_VERSION             = 0
> XLD                                = ld
> X_LINKER_TYPE                      = bfd
> X_LINKER_FEATURES                  =  filter
> X_LINKER_VERSION                   = 21750
> X_LINKER_FREEBSD_VERSION           = 0
> 
> Script done, output file is /root/sys_typescripts/typescript_make_cortexA53_nodebug_clang_bootstrap-amd64-host-2018-07-16:17:48:38
> 
> The part after the WANT_<?>'s looks odd to me.
> 
> (I think the above type of output would be good in ci.freebsd.org
> build logs for the likes of FreeBSD-head-*-build . Similarly for
> test-system-compiler output.)
> 
> I get similar oddness for a self-hosted amd64 build via my
> usual .sh and src/make configuration files:
> 
> # ~/sys_build_scripts.amd64-host/make_amd64_nodebug_clang-amd64-host.sh test-system-linker
> Script started, output file is /root/sys_typescripts/typescript_make_amd64_nodebug_clang-amd64-host-2018-07-16:18:00:52
> USING_SYSTEM_LINKER                = no
> MK_SYSTEM_LINKER                   = yes
> MK_LLD_BOOTSTRAP                   = yes
> MK_BINUTILS_BOOTSTRAP              = yes
> WANT_LINKER_TYPE                   = lld
> WANT_LINKER_VERSION                = 60001
> WANT_LINKER_VERSION_FILE           = lib/clang/include/lld/Common/Version.inc
> WANT_LINKER_FREEBSD_VERSION        = 335540-1200003
> WANT_LINKER_FREEBSD_VERSION_FILE   = lib/clang/include/lld/Common/Version.inc
> LD                                 = ld
> LINKER_TYPE                        = bfd
> LINKER_FEATURES                    =  filter
> LINKER_VERSION                     = 21750
> LINKER_FREEBSD_VERSION             = 0
> XLD                                = ld
> X_LINKER_TYPE                      = bfd
> X_LINKER_FEATURES                  =  filter
> X_LINKER_VERSION                   = 21750
> X_LINKER_FREEBSD_VERSION           = 0
> 
> Script done, output file is /root/sys_typescripts/typescript_make_amd64_nodebug_clang-amd64-host-2018-07-16:18:00:52
> 
> 
> (In both contexts test-system-compiler output seemed reasonable to
> me.)

In looking around I find that the kernel-toolchain tree does not
have a toolchain-metadata.mk :

# ls -lTdt /usr/obj/cortexA53_clang/arm64.aarch64/usr/src/arm64.aarch64/*
drwxr-xr-x  7 root  wheel  512 Jul 16 15:41:41 2018 /usr/obj/cortexA53_clang/arm64.aarch64/usr/src/arm64.aarch64/tmp
drwxr-xr-x  3 root  wheel  512 Jul 16 15:41:41 2018 /usr/obj/cortexA53_clang/arm64.aarch64/usr/src/arm64.aarch64/sys

(Of course the build failed and so did not execute everything.)


The buildworld based ones do have such files. For example, the amd64
self-hosted build that used buildworld has:

# more /usr/obj/amd64_clang/amd64.amd64/usr/src/amd64.amd64/toolchain-metadata.mk
.info Using cached toolchain metadata from build at FBSDUSSD on Mon Jul 16 11:49:07 PDT 2018
_LOADED_TOOLCHAIN_METADATA=t
COMPILER_VERSION=60001
X_COMPILER_VERSION=60001
COMPILER_TYPE=clang
X_COMPILER_TYPE=clang
COMPILER_FEATURES= c++11 retpoline
X_COMPILER_FEATURES= c++11 retpoline
COMPILER_FREEBSD_VERSION=1200015
X_COMPILER_FREEBSD_VERSION=1200015
LINKER_VERSION=60001
X_LINKER_VERSION=60001
LINKER_FEATURES= build-id ifunc filter retpoline
X_LINKER_FEATURES= build-id ifunc filter retpoline
LINKER_TYPE=lld
X_LINKER_TYPE=lld
LINKER_FREEBSD_VERSION=335540-1200003
X_LINKER_FREEBSD_VERSION=335540-1200003
.export COMPILER_VERSION  COMPILER_TYPE  COMPILER_FEATURES  COMPILER_FREEBSD_VERSION  LINKER_VERSION  LINKER_FEATURES  LINKER_TYPE  LINKER_FREEBSD_VERSION
.export X_COMPILER_VERSION X_COMPILER_TYPE X_COMPILER_FEATURES X_COMPILER_FREEBSD_VERSION X_LINKER_VERSION X_LINKER_FEATURES X_LINKER_TYPE X_LINKER_FREEBSD_VERSION

(This is despite what test-system-linker showed for that tree.)


===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)
Received on Mon Jul 16 2018 - 23:46:16 UTC

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