Skip to content

Commit

Permalink
Merge branch 'freebsd/current/master' into hardened/current/master
Browse files Browse the repository at this point in the history
* freebsd/current/master:
  bnxt: Add support for new phy_types and speeds - Part #2
  Only chain non-LRO mbufs when LRO is not possible
  Add an UPDATING entry for the posix_fallocate/ZFS change, r325320
  Centralize all 32-bit builds on 64-bit platform stuff.
  Prefer bsd.init.mk to src.opts.mk
  MACHINE can never be powerpc64, so cleanup code that thinks it can.
  Move machine and other link creation to defs.mk
  Prefer bsd.init.mk to other constructs.
  Use DO32 for all the places that we need to flag we're building a 32 bit version of a library. Use a generic name since this may be usefule elsewhere.
  Define LIBFICL32 to be libficl.a on i386 and libficl32.a on amd64.
  Powerpc is a 32-bit boot loader.
  • Loading branch information
opntr-auto committed Nov 6, 2017
2 parents 3840e90 + 0d88d48 commit 5e65577
Show file tree
Hide file tree
Showing 41 changed files with 176 additions and 403 deletions.
7 changes: 7 additions & 0 deletions UPDATING
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:

****************************** SPECIAL WARNING: ******************************

20171106:
The naive and non-compliant support of posix_fallocate(2) in ZFS
has been removed as of r325320. The system call now returns EINVAL
when used on a ZFS file. Although the new behavior complies with the
standard, some consumers are not prepared to cope with it.
One known victim is lld prior to r325420.

20171102:
Building in a FreeBSD src checkout will automatically create object
directories now rather than store files in the current directory if
Expand Down
6 changes: 2 additions & 4 deletions sys/boot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ SUBDIR+= man

.include <bsd.arch.inc.mk>

# Pick the machine-dependent subdir based on the target architecture.
ADIR= ${MACHINE:S/powerpc64/powerpc/}
.if exists(${.CURDIR}/${ADIR}/.)
SUBDIR+= ${ADIR}
.if exists(${.CURDIR}/${MACHINE}/.)
SUBDIR+= ${MACHINE}
.endif

.include <bsd.subdir.mk>
2 changes: 0 additions & 2 deletions sys/boot/Makefile.inc
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# $FreeBSD$

.include <src.opts.mk>

.include "defs.mk"

.if !defined(__BOOT_MAKEFILE_INC__)
Expand Down
1 change: 0 additions & 1 deletion sys/boot/Makefile.powerpc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
SUBDIR+= fdt
.endif

SUBDIR+= libsa32
SUBDIR+= ofw
SUBDIR+= uboot
59 changes: 59 additions & 0 deletions sys/boot/defs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ BINDIR?= /boot
# NB: The makefiles depend on these being empty when we don't build forth.
.if ${MK_FORTH} != "no"
LIBFICL= ${BOOTOBJ}/ficl/libficl.a
.if ${MACHINE} == "i386"
LIBFICL32= ${LIBFICL}
.else
LIBFICL32= ${BOOTOBJ}/ficl32/libficl.a
.endif
.endif
LIBSA= ${BOOTOBJ}/libsa/libsa.a
.if ${MACHINE} == "i386"
LIBSA32= ${LIBSA}
Expand Down Expand Up @@ -86,4 +90,59 @@ CFLAGS+= -DLOADER_GELI_SUPPORT
.endif
.endif

# All PowerPC builds are 32 bit. We have no 64-bit loaders on powerpc
# or powerpc64.
.if ${MACHINE_ARCH} == "powerpc64"
CFLAGS+= -m32 -mcpu=powerpc
.endif

# For amd64, there's a bit of mixed bag. Some of the tree (i386, lib*32) is
# build 32-bit and some 64-bit (lib*, efi). Centralize all the 32-bit magic here
# and activate it when DO32 is explicitly defined to be 1.
.if ${MACHINE_ARCH} == "amd64" && ${DO32:U0} == 1
CFLAGS+= -m32 -mcpu=i386
# LD_FLAGS is passed directly to ${LD}, not via ${CC}:
LD_FLAGS+= -m elf_i386_fbsd
AFLAGS+= --32
.endif

_ILINKS=machine
.if ${MACHINE} != ${MACHINE_CPUARCH} && ${MACHINE} != "arm64"
_ILINKS+=${MACHINE_CPUARCH}
.endif
.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
_ILINKS+=x86
.endif
CLEANFILES+=${_ILINKS}

all: ${PROG}

beforedepend: ${_ILINKS}
beforebuild: ${_ILINKS}

# Ensure that the links exist without depending on it when it exists which
# causes all the modules to be rebuilt when the directory pointed to changes.
.for _link in ${_ILINKS}
.if !exists(${.OBJDIR}/${_link})
${OBJS}: ${_link}
.endif
.endfor

.NOPATH: ${_ILINKS}

${_ILINKS}:
@case ${.TARGET} in \
machine) \
if [ ${DO32:U0} -eq 0 ]; then \
path=${SYSDIR}/${MACHINE}/include ; \
else \
path=${SYSDIR}/${MACHINE:C/amd64/i386/}/include ; \
fi ;; \
*) \
path=${SYSDIR}/${.TARGET:T}/include ;; \
esac ; \
path=`(cd $$path && /bin/pwd)` ; \
${ECHO} ${.TARGET:T} "->" $$path ; \
ln -fhs $$path ${.TARGET:T}

.endif # __BOOT_DEFS_MK__
2 changes: 1 addition & 1 deletion sys/boot/efi/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# $FreeBSD$

.include <src.opts.mk>
.include <bsd.init.mk>

# In-tree GCC does not support __attribute__((ms_abi)), but gcc newer
# than 4.5 supports it.
Expand Down
15 changes: 0 additions & 15 deletions sys/boot/efi/boot1/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -129,18 +129,3 @@ boot1.efifat: boot1.efi
CLEANFILES= boot1.efi boot1.efifat

.include <bsd.prog.mk>

beforedepend ${OBJS}: machine

CLEANFILES+= machine

machine: .NOMETA
ln -sf ${SYSDIR}/${MACHINE}/include machine

.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
beforedepend ${OBJS}: x86
CLEANFILES+= x86

x86: .NOMETA
ln -sf ${SYSDIR}/x86/include x86
.endif
7 changes: 0 additions & 7 deletions sys/boot/efi/fdt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,4 @@ CFLAGS+= -I${FDTSRC}
# Pick up the bootstrap header for some interface items
CFLAGS+= -I${LDRSRC} -I${SYSDIR} -I.

machine: .NOMETA
ln -sf ${SYSDIR}/${MACHINE}/include machine

CLEANFILES+= machine

.include <bsd.lib.mk>

beforedepend ${OBJS}: machine
15 changes: 0 additions & 15 deletions sys/boot/efi/loader/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -137,18 +137,3 @@ DPADD= ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA} \
LDADD= ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBZFSBOOT} ${LIBSA}

.include <bsd.prog.mk>

beforedepend ${OBJS}: machine

CLEANFILES+= machine

machine: .NOMETA
ln -sf ${SYSDIR}/${MACHINE}/include machine

.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
beforedepend ${OBJS}: x86
CLEANFILES+= x86

x86: .NOMETA
ln -sf ${SYSDIR}/x86/include x86
.endif
4 changes: 0 additions & 4 deletions sys/boot/fdt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ CFLAGS+= -ffreestanding
CFLAGS+= -msoft-float
.endif

.if ${MACHINE_ARCH} == "powerpc64"
CFLAGS+= -m32
.endif

CFLAGS+= -Wformat -Wall

.if ${MACHINE_CPUARCH} == "aarch64"
Expand Down
25 changes: 2 additions & 23 deletions sys/boot/ficl.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

.include "defs.mk"

.if ${MACHINE_CPUARCH} == "amd64" && defined(FICL32)
.if ${MACHINE_CPUARCH} == "amd64" && ${DO32:U0} == 1
FICL_CPUARCH= i386
.elif ${MACHINE_ARCH:Mmips64*} != ""
FICL_CPUARCH= mips64
Expand All @@ -14,31 +14,10 @@ FICL_CPUARCH= ${MACHINE_CPUARCH}

.PATH: ${FICLSRC} ${FICLSRC}/${FICL_CPUARCH}

.if ${MACHINE_CPUARCH} == "amd64"
.if defined(FICL32)
CFLAGS+= -m32 -I.
.else
.if ${MACHINE_CPUARCH} == "amd64" && ${DO32:U0} == 0
CFLAGS+= -fPIC
.endif
.endif

.if ${MACHINE_ARCH} == "powerpc64"
CFLAGS+= -m32 -mcpu=powerpc -I.
.endif

CFLAGS+= -I${FICLSRC} -I${FICLSRC}/${FICL_CPUARCH} -I${LDRSRC}
CFLAGS+= -DBOOT_FORTH
CFLAGS+= -DBF_DICTSIZE=15000

.if ${MACHINE_CPUARCH} == "amd64" && defined(FICL32)
.if !exists(machine)
${SRCS:M*.c:R:S/$/.o/g}: machine

beforedepend ${OBJS}: machine
.endif

machine: .NOMETA
ln -sf ${SYSDIR}/i386/include machine

CLEANFILES+= machine
.endif
5 changes: 1 addition & 4 deletions sys/boot/ficl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ BASE_SRCS= dict.c ficl.c fileaccess.c float.c loader.c math64.c \

SRCS= ${BASE_SRCS} sysdep.c softcore.c
CLEANFILES= softcore.c testmain testmain.o
.if ${MACHINE_CPUARCH} == "i386" || \
(${MACHINE_CPUARCH} == "amd64" && defined(FICL32))
CFLAGS+= -march=i386
.endif

.if defined(HAVE_PNP)
CFLAGS+= -DHAVE_PNP
.endif
Expand Down
2 changes: 1 addition & 1 deletion sys/boot/ficl32/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# $FreeBSD$

FICL32=
DO32=1

.include "${.CURDIR}/../ficl/Makefile"
5 changes: 2 additions & 3 deletions sys/boot/geli/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@

MAN=

.include <src.opts.mk>
MK_SSP= no
.include <bsd.init.mk>
MK_SSP= no

LIB= geliboot
INTERNALLIB=
Expand All @@ -15,7 +14,7 @@ NO_PIC=
.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
CFLAGS+= -march=i386
.endif
.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc64"
.if ${MACHINE_ARCH} == "amd64"
CFLAGS+= -m32
.endif

Expand Down
2 changes: 1 addition & 1 deletion sys/boot/i386/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# $FreeBSD$

.include <src.opts.mk>
.include <bsd.init.mk>

SUBDIR= mbr pmbr boot0 boot0sio btx boot2 cdboot gptboot \
libi386 libfirewire loader
Expand Down
6 changes: 1 addition & 5 deletions sys/boot/i386/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ LDFLAGS_BIN=-e start -Ttext ${ORG} -Wl,-N,-S,--oformat,binary
LD_FLAGS_BIN=-static -N --gc-sections

.if ${MACHINE_CPUARCH} == "amd64"
CFLAGS+= -m32
ACFLAGS+= -m32
# LD_FLAGS is passed directly to ${LD}, not via ${CC}:
LD_FLAGS+= -m elf_i386_fbsd
AFLAGS+= --32
DO32=1
.endif

.include "../Makefile.inc"
7 changes: 0 additions & 7 deletions sys/boot/i386/boot2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,6 @@ boot2.h: boot1.out
ORG1=`printf "%d" ${ORG1}` \
REL1=`printf "%d" ${REL1}` > ${.TARGET}

.if ${MACHINE_CPUARCH} == "amd64"
beforedepend boot2.s: machine
CLEANFILES+= machine
machine: ${SYSDIR}/i386/include .NOMETA
ln -sf ${.ALLSRC} ${.TARGET}
.endif

.include <bsd.prog.mk>

# XXX: clang integrated-as doesn't grok .codeNN directives yet
Expand Down
7 changes: 0 additions & 7 deletions sys/boot/i386/gptboot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,6 @@ gptboot.out: ${BTXCRT} gptboot.o sio.o crc32.o drv.o cons.o util.o ${OPENCRYPTO_

gptboot.o: ${SASRC}/ufsread.c

.if ${MACHINE_CPUARCH} == "amd64"
beforedepend gptboot.o: machine
CLEANFILES+= machine
machine: .NOMETA
ln -sf ${SYSDIR}/i386/include machine
.endif

.include <bsd.prog.mk>

# XXX: clang integrated-as doesn't grok .codeNN directives yet
Expand Down
7 changes: 0 additions & 7 deletions sys/boot/i386/gptzfsboot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,6 @@ gptzfsboot.out: ${BTXCRT} zfsboot.o sio.o gpt.o drv.o cons.o util.o \

zfsboot.o: ${ZFSSRC}/zfsimpl.c

.if ${MACHINE_CPUARCH} == "amd64"
beforedepend zfsboot.o: machine
CLEANFILES+= machine
machine: .NOMETA
ln -sf ${SYSDIR}/i386/include machine
.endif

.include <bsd.prog.mk>

# XXX: clang integrated-as doesn't grok .codeNN directives yet
Expand Down
11 changes: 0 additions & 11 deletions sys/boot/i386/libfirewire/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,4 @@ CFLAGS+= -I${BOOTSRC}/i386/libi386

CFLAGS+= -Wformat -Wall

.if ${MACHINE_CPUARCH} == "amd64"
CLEANFILES+= machine
machine: .NOMETA
ln -sf ${SYSDIR}/i386/include machine
.endif

.include <bsd.lib.mk>

.if ${MACHINE_CPUARCH} == "amd64"
beforedepend ${OBJS}: machine
.endif

10 changes: 0 additions & 10 deletions sys/boot/i386/libi386/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,8 @@ CFLAGS+= -I${BOOTSRC}/ficl -I${BOOTSRC}/ficl/i386 \
# Handle FreeBSD specific %b and %D printf format specifiers
CFLAGS+= ${FORMAT_EXTENSIONS}

.if ${MACHINE_CPUARCH} == "amd64"
CLEANFILES+= machine
machine: .NOMETA
ln -sf ${SYSDIR}/i386/include machine
.endif

.include <bsd.lib.mk>

# XXX: clang integrated-as doesn't grok .codeNN directives yet
CFLAGS.amd64_tramp.S= ${CLANG_NO_IAS}
CFLAGS.multiboot_tramp.S= ${CLANG_NO_IAS}

.if ${MACHINE_CPUARCH} == "amd64"
beforedepend ${OBJS}: machine
.endif
19 changes: 4 additions & 15 deletions sys/boot/i386/loader/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -101,22 +101,11 @@ FILES+= loader.rc menu.rc
# XXX crt0.o needs to be first for pxeboot(8) to work
OBJS= ${BTXCRT}

# XXX not happy with this construct, revisit
.if ${MACHINE_CPUARCH} == "amd64"
FICL= ${LIBFICL32}
.else
FICL= ${LIBFICL}
.endif

DPADD= ${FICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32}
LDADD= ${FICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32}

.include <bsd.prog.mk>
DPADD= ${LIBFICL32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32}
LDADD= ${LIBFICL32} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32}

.if ${MACHINE_CPUARCH} == "amd64"
beforedepend ${OBJS}: machine
CLEANFILES+= machine
CFLAGS+= -DLOADER_PREFER_AMD64
machine: .NOMETA
ln -sf ${SYSDIR}/i386/include machine
.endif

.include <bsd.prog.mk>
Loading

0 comments on commit 5e65577

Please sign in to comment.