From 76541eb0a71ab3502d193428b91cac3fd6fd1a17 Mon Sep 17 00:00:00 2001 From: Wojciech Macek Date: Fri, 29 Sep 2017 06:36:19 +0000 Subject: [PATCH] Compile loader as Little-Endian on PPC64/POWER8 Add flag to the makefile to allow loader compilation as Little-Endian 32-bit executable. Usage: make WITH_LOADER_FORCE_LE=yes -C sys/boot all Submitted by: Wojciech Macek Reviewed by: imp, nwhitehorn Obtained from: Semihalf Sponsored by: QCM Technologies Differential revision: https://reviews.freebsd.org/D12421 --- share/mk/src.opts.mk | 1 + sys/boot/Makefile.inc | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index d635bbe5befc..2ddab3aa12e5 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -180,6 +180,7 @@ __DEFAULT_NO_OPTIONS = \ GNU_GREP_COMPAT \ HESIOD \ LIBSOFT \ + LOADER_FORCE_LE \ NAND \ OFED \ OPENLDAP \ diff --git a/sys/boot/Makefile.inc b/sys/boot/Makefile.inc index 1f1ccc292326..f83d266c92e9 100644 --- a/sys/boot/Makefile.inc +++ b/sys/boot/Makefile.inc @@ -1,6 +1,6 @@ # $FreeBSD$ -.include +.include SSP_CFLAGS= @@ -22,3 +22,11 @@ CFLAGS.clang+= -mfpu=none # when this test succeeds rather than require dd to be a bootstrap tool. DD_NOSTATUS!=(dd status=none count=0 2> /dev/null && echo status=none) || true DD=dd ${DD_NOSTATUS} + +.if ${MK_LOADER_FORCE_LE} != "no" + +.if ${MACHINE_ARCH} == "powerpc64" +CFLAGS+= -mlittle-endian +.endif + +.endif