From owner-svn-src-head@freebsd.org Tue Dec 24 16:03:34 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C21F51EBC58; Tue, 24 Dec 2019 16:03:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47j1Gt4nsgz3ywR; Tue, 24 Dec 2019 16:03:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9FC092914; Tue, 24 Dec 2019 16:03:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBOG3YKD026293; Tue, 24 Dec 2019 16:03:34 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBOG3Ya5026291; Tue, 24 Dec 2019 16:03:34 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201912241603.xBOG3Ya5026291@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 24 Dec 2019 16:03:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356054 - in head: share/mk stand X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head: share/mk stand X-SVN-Commit-Revision: 356054 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Dec 2019 16:03:34 -0000 Author: jhibbits Date: Tue Dec 24 16:03:33 2019 New Revision: 356054 URL: https://svnweb.freebsd.org/changeset/base/356054 Log: [PowerPC64] Use ld.bfd to build LIB32 and STAND - when using llvm Summary: This patch is to support ongoing work for replacing "GCC/BFD" by "CLANG/LLD" on target PowerPC64 [1], by proposing a way to specify and/or locate a secondary ld.bfd linker. This is necessary as LLD currently doesn't support PowerPC 32 bits, so we keep using BFD for the 32 bit stuff on PowePC64(LIB32 compatibility and STAND/slof/loader.) - creates LD_BFD variable pointing to ld.bfd - use LD_BFD as linker for LIB32/compat - Default behavior for other platforms aren't changed. [1] https://wiki.freebsd.org/powerpc/llvm-elfv2 Submitted by: alfredo.junior_eldorado.org.br Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D20261 Modified: head/share/mk/bsd.compat.mk head/share/mk/bsd.cpu.mk head/stand/defs.mk Modified: head/share/mk/bsd.compat.mk ============================================================================== --- head/share/mk/bsd.compat.mk Tue Dec 24 15:56:24 2019 (r356053) +++ head/share/mk/bsd.compat.mk Tue Dec 24 16:03:33 2019 (r356054) @@ -47,11 +47,20 @@ LIB32CPUFLAGS= -mcpu=powerpc .else LIB32CPUFLAGS= -mcpu=${COMPAT_CPUTYPE} .endif + +.if ${COMPAT_COMPILER_TYPE} == "gcc" LIB32CPUFLAGS+= -m32 +.else +LIB32CPUFLAGS+= -target powerpc-unknown-freebsd13.0 + +# Use BFD to workaround ld.lld issues on PowerPC 32 bit +LIB32CPUFLAGS+= -fuse-ld=${LD_BFD} +.endif + LIB32_MACHINE= powerpc LIB32_MACHINE_ARCH= powerpc LIB32WMAKEFLAGS= \ - LD="${XLD} -m elf32ppc_fbsd" + LD="${LD_BFD} -m elf32ppc_fbsd" .elif ${COMPAT_ARCH:Mmips64*} != "" HAS_COMPAT=32 Modified: head/share/mk/bsd.cpu.mk ============================================================================== --- head/share/mk/bsd.cpu.mk Tue Dec 24 15:56:24 2019 (r356053) +++ head/share/mk/bsd.cpu.mk Tue Dec 24 16:03:33 2019 (r356054) @@ -412,3 +412,17 @@ CFLAGS_NO_SIMD += ${CFLAGS_NO_SIMD.${COMPILER_TYPE}} # These come from make.conf or the command line or the environment. CFLAGS += ${CFLAGS.${MACHINE_ARCH}} CXXFLAGS += ${CXXFLAGS.${MACHINE_ARCH}} + + +# Defines a variable for Binutils linker, to be used to workaround some +# issue with LLVM LLD (i.e. support for PowerPC32 bit on PowerPC64) +# +# This is an unavoidable cross coupling with Makefile.inc1 and +# normal builds works when CROSS_BINUTILS_PREFIX and could be removed +# when LLD PowerPC 32 bit support is completed +.if defined(CROSS_BINUTILS_PREFIX) +LD_BFD=${LOCALBASE}/bin/${CROSS_BINUTILS_PREFIX}-ld.bfd +.else +LD_BFD=${OBJTOP}/tmp/usr/bin/ld.bfd +.endif + Modified: head/stand/defs.mk ============================================================================== --- head/stand/defs.mk Tue Dec 24 15:56:24 2019 (r356053) +++ head/stand/defs.mk Tue Dec 24 16:03:33 2019 (r356054) @@ -99,6 +99,10 @@ CFLAGS+= -DLOADER_DISK_SUPPORT # or powerpc64. .if ${MACHINE_ARCH} == "powerpc64" CFLAGS+= -m32 -mcpu=powerpc +# Use ld.bfd to workaround ld.lld issues on PowerPC 32 bit +.if "${COMPILER_TYPE}" == "clang" && "${LINKER_TYPE}" == "lld" +CFLAGS+= -fuse-ld=${LD_BFD} +.endif .endif # For amd64, there's a bit of mixed bag. Some of the tree (i386, lib*32) is