summaryrefslogtreecommitdiff
path: root/util/nvramtool/accessors/cmos-hw-unix.c
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2020-12-20 00:40:01 +0300
committerFelix Held <felix-coreboot@felixheld.de>2022-06-23 12:19:52 +0000
commitc3566b67f68f1552c0b16759a7e2fe2a1347d748 (patch)
tree10cd2977cac8dfbb0431f214a4a7a395f36e92ab /util/nvramtool/accessors/cmos-hw-unix.c
parent58c063ebd099e94a45da8c0c6ba48b0128a59b03 (diff)
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 <me@ch1p.io> Reviewed-on: https://review.coreboot.org/c/coreboot/+/48757 Reviewed-by: Paul Menzel <paulepanter@mailbox.org> Reviewed-by: Matt DeVillier <matt.devillier@gmail.com> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'util/nvramtool/accessors/cmos-hw-unix.c')
-rw-r--r--util/nvramtool/accessors/cmos-hw-unix.c2
1 files changed, 1 insertions, 1 deletions
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 <sys/io.h>
#endif
#if (defined(__MACH__) && defined(__APPLE__))