Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F162691343
D22023.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D22023.diff
View Options
Index: head/share/mk/bsd.README
===================================================================
--- head/share/mk/bsd.README
+++ head/share/mk/bsd.README
@@ -17,6 +17,7 @@
bsd.lib.mk.
bsd.arch.inc.mk - includes arch-specific Makefile.$arch
+bsd.compat.mk - definitions for building programs against compat ABIs
bsd.compiler.mk - defined based on current compiler
bsd.confs.mk - install of configuration files
bsd.cpu.mk - sets CPU/arch-related variables (included from sys.mk)
@@ -378,6 +379,10 @@
MAN Manual pages. If no MAN variable is defined,
"MAN=${PROG}.1" is assumed. See bsd.man.mk for more details.
+NEED_COMPAT Build and link targeting a compatability ABI or fail if it
+ is not available. Supported values are "32", "soft", and
+ "any" being a wildcard.
+
PROG The name of the program to build. If not supplied, nothing
is built.
@@ -439,6 +444,9 @@
SUBDIR A list of subdirectories that should be built as well.
Each of the targets will execute the same target in the
subdirectories.
+
+WANT_COMPAT Similar to NEED_COMPAT, but build with the base ABI if
+ the specified ABI is not available.
The include file <bsd.prog.mk> includes the file named "../Makefile.inc"
if it exists, as well as the include file <bsd.man.mk>.
Index: head/share/mk/bsd.compat.mk
===================================================================
--- head/share/mk/bsd.compat.mk
+++ head/share/mk/bsd.compat.mk
@@ -3,18 +3,16 @@
.if !targets(__<${_this:T}>__)
__<${_this:T}>__:
-# Makefile for the compatibility libraries.
-# - 32-bit compat libraries on MIPS, PowerPC, and AMD64.
-
# -------------------------------------------------------------------
# 32 bit world
.if ${TARGET_ARCH} == "amd64"
+HAS_COMPAT=32
.if empty(TARGET_CPUTYPE)
LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
.else
LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
.endif
-.if ${WANT_COMPILER_TYPE} == gcc || \
+.if (defined(WANT_COMPILER_TYPE) && ${WANT_COMPILER_TYPE} == gcc) || \
(defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc)
.else
LIB32CPUFLAGS+= -target x86_64-unknown-freebsd13.0
@@ -27,6 +25,7 @@
LD="${XLD} -m elf_i386_fbsd -L${LIBCOMPATTMP}/usr/lib32"
.elif ${TARGET_ARCH} == "powerpc64"
+HAS_COMPAT=32
.if empty(TARGET_CPUTYPE)
LIB32CPUFLAGS= -mcpu=powerpc
.else
@@ -38,6 +37,7 @@
LD="${XLD} -m elf32ppc_fbsd"
.elif ${TARGET_ARCH:Mmips64*} != ""
+HAS_COMPAT=32
.if ${WANT_COMPILER_TYPE} == gcc || \
(defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc)
.if empty(TARGET_CPUTYPE)
@@ -71,13 +71,37 @@
# -------------------------------------------------------------------
# soft-fp world
.if ${TARGET_ARCH:Marmv[67]*} != ""
+HAS_COMPAT=SOFT
LIBSOFTCFLAGS= -DCOMPAT_SOFTFP
LIBSOFTCPUFLAGS= -mfloat-abi=softfp
LIBSOFTWMAKEENV= CPUTYPE=soft MACHINE=arm MACHINE_ARCH=${TARGET_ARCH}
LIBSOFTWMAKEFLAGS= -DCOMPAT_SOFTFP
.endif
+# -------------------------------------------------------------------
+# In the program linking case, select LIBCOMPAT
+.if defined(NEED_COMPAT)
+.ifndef HAS_COMPAT
+.error NEED_COMPAT defined, but no LIBCOMPAT is available
+.elif !${HAS_COMPAT:M${NEED_COMPAT}} && ${NEED_COMPAT} != "any"
+.error NEED_COMPAT (${NEED_COMPAT}) defined, but not in HAS_COMPAT ($HAS_COMPAT)
+.elif ${NEED_COMPAT} == "any"
+.endif
+.ifdef WANT_COMPAT
+.error Both WANT_COMPAT and NEED_COMPAT defined
+.endif
+WANT_COMPAT:= ${NEED_COMPAT}
+.endif
+.if defined(HAS_COMPAT) && defined(WANT_COMPAT)
+.if ${WANT_COMPAT} == "any"
+_LIBCOMPAT:= ${HAS_COMPAT:[1]}
+.else
+_LIBCOMPAT:= ${WANT_COMPAT}
+.endif
+.endif
+
+
# -------------------------------------------------------------------
# Generic code for each type.
# Set defaults based on type.
@@ -102,5 +126,11 @@
# -B is needed to find /usr/lib32/crti.o for GCC and /usr/libsoft/crti.o for
# Clang/GCC.
LIBCOMPATCFLAGS+= -B${LIBCOMPATTMP}/usr/lib${libcompat}
+
+.if defined(WANT_COMPAT)
+LIBDIR_BASE:= /usr/lib${libcompat}
+_LIB_OBJTOP= ${LIBCOMPAT_OBJTOP}
+CFLAGS+= ${LIBCOMPATCFLAGS}
+.endif
.endif
Index: head/share/mk/bsd.prog.mk
===================================================================
--- head/share/mk/bsd.prog.mk
+++ head/share/mk/bsd.prog.mk
@@ -2,6 +2,7 @@
# $FreeBSD$
.include <bsd.init.mk>
+.include <bsd.compat.mk>
.include <bsd.compiler.mk>
.include <bsd.linker.mk>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 16, 7:58 PM (11 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35147827
Default Alt Text
D22023.diff (4 KB)
Attached To
Mode
D22023: Optionally build/link programs against the compat ABI.
Attached
Detach File
Event Timeline
Log In to Comment