From c3566b67f68f1552c0b16759a7e2fe2a1347d748 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Sun, 20 Dec 2020 00:40:01 +0300 Subject: nvramtool: Fix building on Linux systems with musl libc Current implementation only supports glibc (by looking for __GLIBC__) and fails to build on systems with alternative libc implementations, such as musl; sys/io.h is never included, there are no outb/inb functions which results in undefined references at linking stage. Using __linux__ instead of __GLIBC__ to test whether the system is Linux seems to be a more proper way to detect Linux and it also fixes nvramtool compilation on musl systems. Tested on Gentoo Linux with musl 1.2.2 (builds and works fine) and Void Linux with glibc (still builds and works fine). Change-Id: Idcdc3a033b40f16a6053209813f1e06209ee459a Signed-off-by: Evgeny Zinoviev Reviewed-on: https://review.coreboot.org/c/coreboot/+/48757 Reviewed-by: Paul Menzel Reviewed-by: Matt DeVillier Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) --- util/nvramtool/accessors/cmos-hw-unix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util/nvramtool') diff --git a/util/nvramtool/accessors/cmos-hw-unix.c b/util/nvramtool/accessors/cmos-hw-unix.c index c66fa3e365..101f0348f2 100644 --- a/util/nvramtool/accessors/cmos-hw-unix.c +++ b/util/nvramtool/accessors/cmos-hw-unix.c @@ -11,7 +11,7 @@ #define INW(x) __extension__ ({ u_int tmp = (x); inw(tmp); }) #define INL(x) __extension__ ({ u_int tmp = (x); inl(tmp); }) #else -#if defined(__GLIBC__) && (defined(__i386__) || defined(__x86_64__)) +#if defined(__linux__) && (defined(__i386__) || defined(__x86_64__)) #include #endif #if (defined(__MACH__) && defined(__APPLE__)) -- cgit v1.2.3