[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
build system: HOSTCC -m64?
From: |
Michael Tokarev |
Subject: |
build system: HOSTCC -m64? |
Date: |
Sun, 1 Dec 2024 08:54:48 +0300 |
User-agent: |
Mozilla Thunderbird |
Hi!
I initially sent this to skiboot@ list, but it never appeared there.
Truing qemu-ppc too.
I stumbled across a somewhat stupid "issue", - while building skiboot
as part of qemu package build in debian, I tried running the build on
an i386 host (usually I do this on amd64 or aarch64 host). And skiboot
build failed:
In file included from /usr/lib/gcc/i686-linux-gnu/12/include/stdint.h:9,
from roms/skiboot/ccan/short_types/short_types.h:4,
from roms/skiboot/extract-gcov.c:5:
/usr/include/stdint.h:26:10: fatal error: bits/libc-header-start.h: No such
file or directory
This is ${HOSTCC}, not ${CC} - which is supposed to be a compiler for
native architecture - it is building a helper binary to generate some
build-time tables, so any native/default architecture is fine.
However, skiboot build procedure tries to force -m64 flag to the
default/native ${HOSTCC}:
Makefile.main: HOSTCFLAGS += $(call try-cflag,$(HOSTCC),-m64)
And on i386, native gcc does support this option. But it does no
necessary have all the headers/libraries to actually build any 64bit
executable - which is exactly the case here.
This -m64 flag has been introduced by this commit:
commit 241daa24feaf9c9aa84ac45887b67ceb6918980a
Author: Stewart Smith <stewart@linux.vnet.ibm.com>
Date: Tue Oct 25 19:43:53 2016 +1100
extract-gcov: build with -m64 if compiler supports it
Fixes build break on 32bit ppc64 (e.g. PowerMac G5, where user space
is mostly 32bit).
Fixes: https://github.com/open-power/skiboot/issues/42
Reported-by: Andrei Warkenti <andrey.warkentin@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
diff --git a/Makefile.main b/Makefile.main
index 86a54be45..7918a180b 100644
--- a/Makefile.main
+++ b/Makefile.main
@@ -35,6 +35,7 @@ HOSTCC=gcc
HOSTEND=$(shell uname -m | sed -e 's/^i.*86$$/LITTLE/' -e 's/^x86.*/LITTLE/'
-e 's/^ppc64le/LITTLE/' -e 's/^ppc.*/BIG/')
HOSTCFLAGS=-O1 $(CWARNS) -DHAVE_$(HOSTEND)_ENDIAN -MMD
HOSTCFLAGS += $(call try-cflag,$(HOSTCC),-std=gnu11)
+HOSTCFLAGS += $(call try-cflag,$(HOSTCC),-m64)
HOSTCFLAGS += $(call try-cflag,$(HOSTCC),-Wjump-misses-init) \
$(call try-cflag,$(HOSTCC),-Wsuggest-attribute=const) \
$(call try-cflag,$(HOSTCC),-Wsuggest-attribute=noreturn) \
which seems a bit wrong, since checking just for the -m64
*option* is obviously not enough. Also, even if the compiler
can actually produce a 64bit executable, it isn't necessary
for this executable to be able to *run* on this platform, -
gcc might be configured to produce either 32 or 64 bit code
even on ppc platform, and we might be running on a hardware
not capable to run 64bit code.
Now, having in mind diminishing role of 32bit platforms, I'm
not sure what to do with this one.. :)
Thanks,
/mjt
- build system: HOSTCC -m64?,
Michael Tokarev <=