From owner-svn-src-stable-12@freebsd.org Thu May 7 18:47:55 2020 Return-Path: Delivered-To: svn-src-stable-12@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 50F9F2E1625; Thu, 7 May 2020 18:47:55 +0000 (UTC) (envelope-from jhb@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 49J2XC1VyTz4YfB; Thu, 7 May 2020 18:47:55 +0000 (UTC) (envelope-from jhb@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 2EE9E1D936; Thu, 7 May 2020 18:47:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 047Ilt1H001588; Thu, 7 May 2020 18:47:55 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 047IlsaQ001586; Thu, 7 May 2020 18:47:54 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202005071847.047IlsaQ001586@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 7 May 2020 18:47:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r360792 - stable/12/sys/conf X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/12/sys/conf X-SVN-Commit-Revision: 360792 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 May 2020 18:47:55 -0000 Author: jhb Date: Thu May 7 18:47:54 2020 New Revision: 360792 URL: https://svnweb.freebsd.org/changeset/base/360792 Log: MFC 357145: Compile hack.c with normal CFLAGS + -shared -nostdlib. Originally, hack.c was compiled into a shard object with just -shared -nostdlib. This assumed that ${CC} did not require any additional flags for ABIs, cross-building, etc. When kern.post.mk was created in r89509 by reducing duplication in kernel Makefile. files, the -shared flag was moved into a HACK_EXTRA_FLAGS variable so that sparc64 could override it with -Wl,-shared. The sparc64 hack was removed in r111650, but HACK_EXTRA_FLAGS was left in place. Over time, we have started support toolchains that require flags to support alternate ABIs on MIPS and PowerPC and started (ab)using HACK_EXTRA_FLAGS to set only those flags. I need to fix risc-v to pass -mno-relax to the hack.c build for lld in llvm 10, and the patches to support cross-build from non-FreeBSD hosts need to include -target for clang in CFLAGS for hack.c. Rather than adding more hacks into HACK_EXTRA_FLAGS, just use the full set of CFLAGS with hack.c. Modified: stable/12/sys/conf/Makefile.mips stable/12/sys/conf/kern.post.mk Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/Makefile.mips ============================================================================== --- stable/12/sys/conf/Makefile.mips Thu May 7 18:24:32 2020 (r360791) +++ stable/12/sys/conf/Makefile.mips Thu May 7 18:47:54 2020 (r360792) @@ -44,12 +44,9 @@ TRAMPLOADADDR?=0x807963c0 ARCH_FLAGS?=-march=mips32 EXTRA_FLAGS=-fno-pic -mno-abicalls -G0 -DKERNLOADADDR=${KERNLOADADDR} -HACK_EXTRA_FLAGS=-shared - # We add the -fno-pic flag to kernels because otherwise performance # is extremely poor, as well as -mno-abicalls to force no ABI usage. CFLAGS+=${EXTRA_FLAGS} $(ARCH_FLAGS) -HACK_EXTRA_FLAGS+=${EXTRA_FLAGS} $(ARCH_FLAGS) TRAMP_ARCH_FLAGS?=$(ARCH_FLAGS) TRAMP_EXTRA_FLAGS=${EXTRA_FLAGS} ${TRAMP_ARCH_FLAGS} # Kernel code is always compiled with soft-float on MIPS Modified: stable/12/sys/conf/kern.post.mk ============================================================================== --- stable/12/sys/conf/kern.post.mk Thu May 7 18:24:32 2020 (r360791) +++ stable/12/sys/conf/kern.post.mk Thu May 7 18:47:54 2020 (r360792) @@ -192,10 +192,9 @@ kernel-clean: # This is a hack. BFD "optimizes" away dynamic mode if there are no # dynamic references. We could probably do a '-Bforcedynamic' mode like # in the a.out ld. For now, this works. -HACK_EXTRA_FLAGS?= -shared hack.pico: Makefile :> hack.c - ${CC} ${HACK_EXTRA_FLAGS} -nostdlib hack.c -o hack.pico + ${CC} -shared ${CFLAGS} -nostdlib hack.c -o hack.pico rm -f hack.c offset.inc: $S/kern/genoffset.sh genoffset.o