From nobody Wed Oct 05 16:29:42 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MjKm72pYdz4V8XR; Wed, 5 Oct 2022 16:29:43 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MjKm71Kxsz3mk2; Wed, 5 Oct 2022 16:29:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664987383; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=J32z61Up/cpq1qJhqGnM2AaDKw1JhAy/Un+AFkgTk+U=; b=Q3fCGUDks6wzChCcj15eG4DgHDdPXCxdx4mL1QmJthtdN8h6cbrj10FdUx8SzqhWUUJZbP c2un1TeZkOrKPl9qIOi+I35xzc0j5cDp2QORb3y5LFdI4UyL6ndM6EDP8aCKwTs7NVEd5F pPSKYvnk9BKnFdTZlPBJQICT9HQfOdx3X4uiV8LESEWTaiNd5BpI9qCyC0l3dSwIM36mRd zhsB+iWGgBUrlHSbVWSar7fSYM904RoHjpQyFhwAUTNrWiPTNkIEhrRWT3VMddmGhFJT4a USIaNOEx/YPEhAr0LB/o6/yGWlHHZIXK1y5q6r+zCB+D4oN6SL1RV+nvBjKexA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MjKm66rpzzxxX; Wed, 5 Oct 2022 16:29:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 295GTg5q041029; Wed, 5 Oct 2022 16:29:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 295GTgR3041028; Wed, 5 Oct 2022 16:29:42 GMT (envelope-from git) Date: Wed, 5 Oct 2022 16:29:42 GMT Message-Id: <202210051629.295GTgR3041028@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: 426fc376afaf - main - bsd.cpu.mk: Introduce MACHINE_ABI List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 426fc376afaf39c1e754e263588534fdedb1b5ec Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664987383; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=J32z61Up/cpq1qJhqGnM2AaDKw1JhAy/Un+AFkgTk+U=; b=nG2EM5eKES6teAYva7gk8D0gUBiLCAixWX0GJW+QFbj3bovzc+8QJJpSsbAVCEK0WWpnCE VrScXTDgORTWNcqBa9jTGAB6V5rkyYAljA1nZy/ew+WubL/XRkrcSxht8K/J8k77jzMIrL 4DGUdf30I2pU8rXV3zS3MhxHJEMvCVuKJ91lmMoHsAd3eHIHruMk29iT3grX1wt9xvtpkQ wxGqHkTxQy4l69eEPg4Rp3dRHe6Qcsi8Fkl+d2NV2icbyQGaL1tNgeLouz1y6UXUCokV72 8EmianjjJhTpdZJwuaVckaCsHcN0ncZJwkmjWOC0hwsVuK+R6o0rqnv39QYkog== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664987383; a=rsa-sha256; cv=none; b=H+AoVTDS/VJ+NhZHjq2UEAnFH5AKKHmXS9x2UslWH7vRkegsO9J51yAYCs5q5bA5cy68vJ KewdZq91MV/RSRJOhekDO/8jer2n3cZdsV4ASXnxq7g6B0BHn03/OHlZC3yktkw8TBtGba R9CSGbLUA7mOnRhxVmAoorq3gKnzaot5+RNjsY4KRp050HRBkO6GHmOsNCWO+aPIPfpTGP h/fr31Ln3I/eola4kn5rYzQ0AmFeNMYKONUfOUNP8r6TJF8eCxqG8v7Zmoq71bdUkvr9vq WWDG3Fpn6Vuagewuw/GFqLlsJUUDQS6WS/xpFAWlt3G3/3eKRAbf4/N6d8hxuQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=426fc376afaf39c1e754e263588534fdedb1b5ec commit 426fc376afaf39c1e754e263588534fdedb1b5ec Author: Brooks Davis AuthorDate: 2022-10-05 16:26:30 +0000 Commit: Brooks Davis CommitDate: 2022-10-05 16:27:44 +0000 bsd.cpu.mk: Introduce MACHINE_ABI MACHINE_ABI is a list of properties of the ABI used for MACHINE_ARCH. It should be used in place of long conditionals on MACHINE_ARCH where practical. The following properties are indicated with one of the follow values: Byte order: big-endian, little-endian Floating point ABI: soft-float, hard-float Size of long (size_t, etc): long32, long64 Pointer type: ptr32, ptr64 Size of time_t: time32, time64 For example, i386 targets will be: MACHINE_ABI= big-endian hard-float long32 ptr32 time32 Reviewed by: imp Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D36421 --- share/mk/bsd.compat.mk | 8 +++++++- share/mk/bsd.cpu.mk | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/share/mk/bsd.compat.mk b/share/mk/bsd.compat.mk index f7b40ce47532..9a59020b4df2 100644 --- a/share/mk/bsd.compat.mk +++ b/share/mk/bsd.compat.mk @@ -66,6 +66,12 @@ LIB32WMAKEFLAGS+= OBJCOPY="${XOBJCOPY}" LIB32CFLAGS= -DCOMPAT_32BIT LIB32DTRACE= ${DTRACE} -32 LIB32WMAKEFLAGS+= -DCOMPAT_32BIT +LIB32_MACHINE_ABI= ${MACHINE_ABI:N*64} long32 ptr32 +.if ${COMPAT_ARCH} == "amd64" +LIB32_MACHINE_ABI+= time32 +.else +LIB32_MACHINE_ABI+= time64 +.endif # ------------------------------------------------------------------- # In the program linking case, select LIBCOMPAT @@ -95,7 +101,7 @@ _LIBCOMPAT:= ${WANT_COMPAT} # Set defaults based on type. libcompat= ${_LIBCOMPAT:tl} _LIBCOMPAT_MAKEVARS= _OBJTOP TMP CPUFLAGS CFLAGS CXXFLAGS LDFLAGS \ - _MACHINE _MACHINE_ARCH \ + _MACHINE _MACHINE_ARCH _MACHINE_ABI \ WMAKEENV WMAKEFLAGS WMAKE WORLDTMP .for _var in ${_LIBCOMPAT_MAKEVARS} .if !empty(LIB${_LIBCOMPAT}${_var}) diff --git a/share/mk/bsd.cpu.mk b/share/mk/bsd.cpu.mk index 610f45969b4d..db5fa08df4bc 100644 --- a/share/mk/bsd.cpu.mk +++ b/share/mk/bsd.cpu.mk @@ -362,3 +362,41 @@ CFLAGS_NO_SIMD += ${CFLAGS_NO_SIMD.${COMPILER_TYPE}} CFLAGS += ${CFLAGS.${MACHINE_ARCH}} CXXFLAGS += ${CXXFLAGS.${MACHINE_ARCH}} +# +# MACHINE_ABI is a list of properties about the ABI used for MACHINE_ARCH. +# The following properties are indicated with one of the follow values: +# +# Byte order: big-endian, little-endian +# Floating point ABI: soft-float, hard-float +# Size of long (size_t, etc): long32, long64 +# Pointer type: ptr32, ptr64 +# Size of time_t: time32, time64 +# +.if (${MACHINE} == "arm" && (defined(CPUTYPE) && ${CPUTYPE:M*soft*})) || \ + (${MACHINE_ARCH} == "powerpc" && (defined(CPUTYPE) && ${CPUTYPE} == "e500")) || \ + ${MACHINE_ARCH:Mriscv*sf*} +MACHINE_ABI+= soft-float +.else +MACHINE_ABI+= hard-float +.endif +# Currently all 64-bit architectures include 64 in their name (see arch(7)). +.if ${MACHINE_ARCH:M*64*} +MACHINE_ABI+= long64 +.else +MACHINE_ABI+= long32 +.endif +.if ${MACHINE_ABI:Mlong64} +MACHINE_ABI+= ptr64 +.else +MACHINE_ABI+= ptr32 +.endif +.if ${MACHINE_ARCH} == "i386" +MACHINE_ABI+= time32 +.else +MACHINE_ABI+= time64 +.endif +.if ${MACHINE_ARCH:Mpowerpc*} && !${MACHINE_ARCH:M*le} +MACHINE_ABI+= big-endian +.else +MACHINE_ABI+= little-endian +.endif