diff mbox series

[4/4] Build skiboot little-endian by default when FSP=0

Message ID 20220408153137.996621-5-npiggin@gmail.com
State New
Headers show
Series Build with little endian where possible | expand

Checks

Context Check Description
snowpatch_ozlabs/github-Docker_builds_and_checks success Successfully ran 7 jobs.

Commit Message

Nicholas Piggin April 8, 2022, 3:31 p.m. UTC
Little-endian has a simpler calling convention, it's smaller, uses less
stack, and is faster. With a new OPAL ABI, it can avoid heavy-weight
endian flips when called from an LE OS.

FSP code (namely hservice runtime interface calls and host interface
callbacks) does not work with LE or ELFv2, so check for conflicting
options and abort the build.

This reduces skiboot.lid.xz size by 10KiB.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 Makefile | 30 +++++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index f3942c442..610f039f3 100644
--- a/Makefile
+++ b/Makefile
@@ -48,19 +48,35 @@  KERNEL ?=
 #
 STACK_CHECK ?= $(DEBUG)
 
+# Try to build without FSP code
+CONFIG_FSP?=1
+# Try to build without POWER8 support
+CONFIG_P8?=1
+
+# FSP (hservices) code does not work with LE at the moment.
+BIG_ENDIAN ?= $(CONFIG_FSP)
+ifeq ($(BIG_ENDIAN),1)
+LITTLE_ENDIAN = 0
+else
+LITTLE_ENDIAN ?= 1
+endif
+
 #
 # Experimental (unsupported) build options
 #
-# Little-endian does not yet build. Include it here to set ELF ABI.
-LITTLE_ENDIAN ?= 0
-# ELF v2 ABI is more efficient and compact
+# ELF v2 ABI is more efficient and compact.
+# This can be set for big-endian builds. Clearing it for LE probably won't work.
 ELF_ABI_v2 ?= $(LITTLE_ENDIAN)
+
+# FSP does not work with LE or ELFv2
+ifeq ($(ELF_ABI_v2),1)
+ifeq ($(CONFIG_FSP),1)
+$(error FSP support is incompatible with little-endian and ELFv2 build options)
+endif
+endif
+
 # Discard unreferenced code and data at link-time
 DEAD_CODE_ELIMINATION ?= 0
-# Try to build without FSP code
-CONFIG_FSP?=1
-# Try to build without POWER8 support
-CONFIG_P8?=1
 
 #
 # Where is the source directory, must be a full path (no ~)