Initial Commit

- initial default booting image
This commit is contained in:
2026-11-06 20:45:42 +01:00
commit b8783708ae
15201 changed files with 602532 additions and 0 deletions

View File

@@ -0,0 +1,174 @@
From c6efc293a52fdde7d4876243faaaa768fe052719 Mon Sep 17 00:00:00 2001
From: Waldemar Brodkorb <wbx@openadk.org>
Date: Sat, 15 Aug 2026 18:20:33 +0200
Subject: [PATCH] Fix SSP support for riscv32
On modern 32-bit architectures like RISC-V (riscv32), legacy 32-bit
time syscalls like __NR_gettimeofday are intentionally omitted because
RV32 implements a strict time64-only ABI to avoid the Year 2038 bug.
Therefore, use AT_RANDOM from the auxiliary vector first, as glibc does,
to obtain random data for the stack canary. If AT_RANDOM is unavailable,
fall back to reading random data from /dev/urandom.
Tested with aarch64, riscv32 and riscv32 noMMU targets.
Upstream: https://mailman.openadk.org/mailman3/hyperkitty/list/devel@uclibc-ng.org/thread/WIKMWPXJYAPTVVZ2MMZINUJNPIJXBMOE/
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
extra/Configs/Config.in | 10 -------
ldso/include/dl-syscall.h | 12 --------
ldso/ldso/ldso.c | 4 ++-
libc/misc/internals/__uClibc_main.c | 4 ++-
libc/sysdeps/linux/common/dl-osinfo.h | 40 +++++++++++++++++----------
5 files changed, 32 insertions(+), 38 deletions(-)
diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in
index c3aabf1b4..15a072593 100644
--- a/extra/Configs/Config.in
+++ b/extra/Configs/Config.in
@@ -2211,16 +2211,6 @@ config UCLIBC_HAS_SSP
Most people will answer N.
-config SSP_QUICK_CANARY
- bool "Use simple guard values without accessing /dev/urandom"
- depends on UCLIBC_HAS_SSP
- help
- Use gettimeofday(2) to define the __guard without accessing
- /dev/urandom.
- WARNING: This makes smashing stack protector vulnerable to timing
- attacks.
- Most people will answer N.
-
choice
prompt "Propolice protection blocking signal"
depends on UCLIBC_HAS_SSP
diff --git a/ldso/include/dl-syscall.h b/ldso/include/dl-syscall.h
index c143b8d45..e08b2cd41 100644
--- a/ldso/include/dl-syscall.h
+++ b/ldso/include/dl-syscall.h
@@ -260,18 +260,6 @@ _dl_pread(int fd, void *buf, size_t count, off_t offset)
}
#endif
-#ifdef __UCLIBC_HAS_SSP__
-# include <sys/time.h>
-# define __NR__dl_gettimeofday __NR_gettimeofday
-static __always_inline _syscall2(int, _dl_gettimeofday, struct timeval *, tv,
-# ifdef __USE_BSD
- struct timezone *
-# else
- void *
-# endif
- , tz)
-#endif
-
/* Some architectures always use 12 as page shift for mmap2() eventhough the
* real PAGE_SHIFT != 12. Other architectures use the same value as
* PAGE_SHIFT...
diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c
index 55f7d7e45..96ee3d496 100755
--- a/ldso/ldso/ldso.c
+++ b/ldso/ldso/ldso.c
@@ -1225,7 +1225,9 @@ of this helper program; chances are you did not intend to run this program.\n\
#ifdef __UCLIBC_HAS_SSP__
_dl_debug_early("Setting up SSP guards\n");
/* Set up the stack checker's canary. */
- stack_chk_guard = _dl_setup_stack_chk_guard ();
+ stack_chk_guard = _dl_setup_stack_chk_guard (
+ _dl_auxvt[AT_RANDOM].a_type == AT_RANDOM ?
+ (void *)_dl_auxvt[AT_RANDOM].a_un.a_val : NULL);
# ifdef THREAD_SET_STACK_GUARD
THREAD_SET_STACK_GUARD (stack_chk_guard);
# else
diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c
index 549606505..bbf471b17 100644
--- a/libc/misc/internals/__uClibc_main.c
+++ b/libc/misc/internals/__uClibc_main.c
@@ -296,7 +296,9 @@ void __uClibc_init(void)
#ifndef SHARED
# ifdef __UCLIBC_HAS_SSP__
/* Set up the stack checker's canary. */
- stack_chk_guard = _dl_setup_stack_chk_guard();
+ stack_chk_guard = _dl_setup_stack_chk_guard(
+ _dl_auxvt[AT_RANDOM].a_type == AT_RANDOM ?
+ (void *)_dl_auxvt[AT_RANDOM].a_un.a_val : NULL);
# ifdef THREAD_SET_STACK_GUARD
THREAD_SET_STACK_GUARD (stack_chk_guard);
# else
diff --git a/libc/sysdeps/linux/common/dl-osinfo.h b/libc/sysdeps/linux/common/dl-osinfo.h
index 3110cb05d..0a42ea094 100644
--- a/libc/sysdeps/linux/common/dl-osinfo.h
+++ b/libc/sysdeps/linux/common/dl-osinfo.h
@@ -21,22 +21,42 @@
# ifdef IS_IN_libc
# include <fcntl.h>
# include <unistd.h>
-# include <sys/time.h>
+# include <string.h>
# define OPEN open
# define READ read
# define CLOSE close
-# define GETTIMEOFDAY gettimeofday
+# define MEMCPY memcpy
# else
+# include <dl-string.h>
# define OPEN _dl_open
# define READ _dl_read
# define CLOSE _dl_close
-# define GETTIMEOFDAY _dl_gettimeofday
+# define MEMCPY _dl_memcpy
# endif
-static __always_inline uintptr_t _dl_setup_stack_chk_guard(void)
+static __always_inline uintptr_t
+_dl_setup_stack_chk_guard(void *dl_random)
{
uintptr_t ret;
-# ifndef __SSP_QUICK_CANARY__
+
+ /*
+ * Linux supplies random data through AT_RANDOM.
+ * Use it directly when available.
+ */
+ if (dl_random != NULL) {
+ MEMCPY(&ret, dl_random, sizeof(ret));
+
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+ ret &= ~(uintptr_t)0xff;
+#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+ ret &= ~((uintptr_t)0xff << (8 * (sizeof(ret) - 1)));
+#else
+# error "Unknown byte order"
+#endif
+
+ return ret;
+ }
+
{
int fd = OPEN("/dev/urandom", O_RDONLY, 0);
if (fd >= 0) {
@@ -46,18 +66,10 @@ static __always_inline uintptr_t _dl_setup_stack_chk_guard(void)
return ret;
}
}
-# endif /* !__SSP_QUICK_CANARY__ */
- /* Start with the "terminator canary". */
+ /* Fallback just the "terminator canary". */
ret = 0xFF0A0D00UL;
- /* Everything failed? Or we are using a weakened model of the
- * terminator canary */
- {
- struct timeval tv;
- if (GETTIMEOFDAY(&tv, NULL) != (-1))
- ret ^= tv.tv_usec ^ tv.tv_sec;
- }
return ret;
}
# endif /* libc || rtld */
--
2.47.3

View File

@@ -0,0 +1,237 @@
From dff69277d71965cff0a757a030e03994a4a83aa6 Mon Sep 17 00:00:00 2001
From: Waldemar Brodkorb <wbx@openadk.org>
Date: Tue, 18 Aug 2026 06:02:54 +0200
Subject: [PATCH] ppc: fix e500 fenv support
Upstream: https://gogs.waldemar-brodkorb.de/oss/uclibc-ng/commit/dff69277d71965cff0a757a030e03994a4a83aa6
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
libm/powerpc/e500/fpu/fclrexcpt.c | 1 -
libm/powerpc/e500/fpu/fe_nomask.c | 1 -
libm/powerpc/e500/fpu/fedisblxcpt.c | 1 -
libm/powerpc/e500/fpu/feenablxcpt.c | 1 -
libm/powerpc/e500/fpu/fegetenv.c | 1 -
libm/powerpc/e500/fpu/fegetexcept.c | 1 -
libm/powerpc/e500/fpu/fegetround.c | 1 -
libm/powerpc/e500/fpu/feholdexcpt.c | 2 --
libm/powerpc/e500/fpu/fenv_const.c | 1 -
libm/powerpc/e500/fpu/fesetenv.c | 5 +----
libm/powerpc/e500/fpu/fesetround.c | 2 --
libm/powerpc/e500/fpu/feupdateenv.c | 1 -
libm/powerpc/e500/fpu/fgetexcptflg.c | 1 -
libm/powerpc/e500/fpu/fraiseexcpt.c | 3 ---
libm/powerpc/e500/fpu/fsetexcptflg.c | 1 -
libm/powerpc/e500/fpu/ftestexcept.c | 1 -
16 files changed, 1 insertion(+), 23 deletions(-)
diff --git a/libm/powerpc/e500/fpu/fclrexcpt.c b/libm/powerpc/e500/fpu/fclrexcpt.c
index 805aaa487..02dc4bcf8 100644
--- a/libm/powerpc/e500/fpu/fclrexcpt.c
+++ b/libm/powerpc/e500/fpu/fclrexcpt.c
@@ -1,6 +1,5 @@
/* Clear given exceptions in current floating-point environment.
Copyright (C) 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff --git a/libm/powerpc/e500/fpu/fe_nomask.c b/libm/powerpc/e500/fpu/fe_nomask.c
index d5915165c..fe709803d 100644
--- a/libm/powerpc/e500/fpu/fe_nomask.c
+++ b/libm/powerpc/e500/fpu/fe_nomask.c
@@ -1,6 +1,5 @@
/* Procedure definition for FE_NOMASK_ENV.
Copyright (C) 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff --git a/libm/powerpc/e500/fpu/fedisblxcpt.c b/libm/powerpc/e500/fpu/fedisblxcpt.c
index 0700f4577..0a54df6fb 100644
--- a/libm/powerpc/e500/fpu/fedisblxcpt.c
+++ b/libm/powerpc/e500/fpu/fedisblxcpt.c
@@ -1,6 +1,5 @@
/* Disable floating-point exceptions.
Copyright (C) 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
Contributed by Aldy Hernandez <aldyh@redhat.com>, 2004.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/libm/powerpc/e500/fpu/feenablxcpt.c b/libm/powerpc/e500/fpu/feenablxcpt.c
index 9f03181f4..bc1c30a83 100644
--- a/libm/powerpc/e500/fpu/feenablxcpt.c
+++ b/libm/powerpc/e500/fpu/feenablxcpt.c
@@ -1,6 +1,5 @@
/* Enable floating-point exceptions.
Copyright (C) 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
Contributed by Aldy Hernandez <aldyh@redhat.com>, 2004.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/libm/powerpc/e500/fpu/fegetenv.c b/libm/powerpc/e500/fpu/fegetenv.c
index c1a914dc3..934ac92e9 100644
--- a/libm/powerpc/e500/fpu/fegetenv.c
+++ b/libm/powerpc/e500/fpu/fegetenv.c
@@ -1,7 +1,6 @@
/* Store current floating-point environment.
Copyright (C) 2004 Free Software Foundation, Inc.
Contributed by Aldy Hernandez <aldyh@redhat.com>, 2004
- This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff --git a/libm/powerpc/e500/fpu/fegetexcept.c b/libm/powerpc/e500/fpu/fegetexcept.c
index bf0215d62..b932f8036 100644
--- a/libm/powerpc/e500/fpu/fegetexcept.c
+++ b/libm/powerpc/e500/fpu/fegetexcept.c
@@ -1,6 +1,5 @@
/* Get floating-point exceptions.
Copyright (C) 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
Contributed by Aldy Hernandez <aldyh@redhat.com>, 2004.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/libm/powerpc/e500/fpu/fegetround.c b/libm/powerpc/e500/fpu/fegetround.c
index f501c6ce8..7b54ead30 100644
--- a/libm/powerpc/e500/fpu/fegetround.c
+++ b/libm/powerpc/e500/fpu/fegetround.c
@@ -1,6 +1,5 @@
/* Return current rounding direction.
Copyright (C) 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
Contributed by Aldy Hernandez <aldyh@redhat.com>, 2004.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/libm/powerpc/e500/fpu/feholdexcpt.c b/libm/powerpc/e500/fpu/feholdexcpt.c
index edeb2cf81..2b0c4ca4c 100644
--- a/libm/powerpc/e500/fpu/feholdexcpt.c
+++ b/libm/powerpc/e500/fpu/feholdexcpt.c
@@ -1,6 +1,5 @@
/* Store current floating-point environment and clear exceptions.
Copyright (C) 2004, 2006 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
Contributed by Aldy Hernandez <aldyh@redhat.com>, 2004.
The GNU C Library is free software; you can redistribute it and/or
@@ -41,4 +40,3 @@ feholdexcept (fenv_t *envp)
return 0;
}
-libm_hidden_def (feholdexcept)
diff --git a/libm/powerpc/e500/fpu/fenv_const.c b/libm/powerpc/e500/fpu/fenv_const.c
index 3c9f5578a..cfbff0793 100644
--- a/libm/powerpc/e500/fpu/fenv_const.c
+++ b/libm/powerpc/e500/fpu/fenv_const.c
@@ -1,6 +1,5 @@
/* Constants for fenv_bits.h.
Copyright (C) 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
Contributed by Aldy Hernandez <aldyh@redhat.com>, 2004.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/libm/powerpc/e500/fpu/fesetenv.c b/libm/powerpc/e500/fpu/fesetenv.c
index 392e0c0bf..28d113959 100644
--- a/libm/powerpc/e500/fpu/fesetenv.c
+++ b/libm/powerpc/e500/fpu/fesetenv.c
@@ -1,6 +1,5 @@
/* Install given floating-point environment.
Copyright (C) 1997,99,2000,01,02 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -21,7 +20,7 @@
#include <sys/prctl.h>
int
-__fesetenv (const fenv_t *envp)
+fesetenv (const fenv_t *envp)
{
fenv_union_t u;
INTERNAL_SYSCALL_DECL (err);
@@ -33,5 +32,3 @@ __fesetenv (const fenv_t *envp)
/* Success. */
return 0;
}
-
-libm_hidden_ver (__fesetenv, fesetenv)
diff --git a/libm/powerpc/e500/fpu/fesetround.c b/libm/powerpc/e500/fpu/fesetround.c
index 783541d5b..800a8a4d2 100644
--- a/libm/powerpc/e500/fpu/fesetround.c
+++ b/libm/powerpc/e500/fpu/fesetround.c
@@ -1,6 +1,5 @@
/* Set current rounding direction.
Copyright (C) 2004, 2006 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
Contributed by Aldy Hernandez <aldyh@redhat.com>, 2004.
The GNU C Library is free software; you can redistribute it and/or
@@ -33,4 +32,3 @@ fesetround (int round)
return 0;
}
-libm_hidden_def (fesetround)
diff --git a/libm/powerpc/e500/fpu/feupdateenv.c b/libm/powerpc/e500/fpu/feupdateenv.c
index 47f316318..6c1f8941c 100644
--- a/libm/powerpc/e500/fpu/feupdateenv.c
+++ b/libm/powerpc/e500/fpu/feupdateenv.c
@@ -1,6 +1,5 @@
/* Install given floating-point environment and raise exceptions.
Copyright (C) 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
Contributed by Aldy Hernandez <aldyh@redhat.com>, 2004.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/libm/powerpc/e500/fpu/fgetexcptflg.c b/libm/powerpc/e500/fpu/fgetexcptflg.c
index d27356574..d4847ef6d 100644
--- a/libm/powerpc/e500/fpu/fgetexcptflg.c
+++ b/libm/powerpc/e500/fpu/fgetexcptflg.c
@@ -1,6 +1,5 @@
/* Store current representation for exceptions.
Copyright (C) 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
Contributed by Aldy Hernandez <aldyh@redhat.com>, 2004.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/libm/powerpc/e500/fpu/fraiseexcpt.c b/libm/powerpc/e500/fpu/fraiseexcpt.c
index 0c92b2868..43025fe25 100644
--- a/libm/powerpc/e500/fpu/fraiseexcpt.c
+++ b/libm/powerpc/e500/fpu/fraiseexcpt.c
@@ -1,6 +1,5 @@
/* Raise given exceptions.
Copyright (C) 2004, 2006 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
Contributed by Aldy Hernandez <aldyh@redhat.com>, 2004.
The GNU C Library is free software; you can redistribute it and/or
@@ -24,5 +23,3 @@
#define __FERAISEEXCEPT_INTERNAL feraiseexcept
#include "../spe-raise.c"
-
-libm_hidden_def (feraiseexcept)
diff --git a/libm/powerpc/e500/fpu/fsetexcptflg.c b/libm/powerpc/e500/fpu/fsetexcptflg.c
index 11ea89f16..2fde513a0 100644
--- a/libm/powerpc/e500/fpu/fsetexcptflg.c
+++ b/libm/powerpc/e500/fpu/fsetexcptflg.c
@@ -1,6 +1,5 @@
/* Set floating-point environment exception handling.
Copyright (C) 1997,99,2000,01,04 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff --git a/libm/powerpc/e500/fpu/ftestexcept.c b/libm/powerpc/e500/fpu/ftestexcept.c
index 55f752b25..2c082f509 100644
--- a/libm/powerpc/e500/fpu/ftestexcept.c
+++ b/libm/powerpc/e500/fpu/ftestexcept.c
@@ -1,6 +1,5 @@
/* Test exception in current environment.
Copyright (C) 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
Contributed by Aldy Hernandez <aldyh@redhat.com>, 2004.
The GNU C Library is free software; you can redistribute it and/or
--
2.47.3

View File

@@ -0,0 +1,151 @@
From 1105fd6c97f020f6ca7426e19d29081f404b567d Mon Sep 17 00:00:00 2001
From: Waldemar Brodkorb <wbx@openadk.org>
Date: Tue, 18 Aug 2026 18:13:29 +0200
Subject: [PATCH] fenv: struct rm_ctx should be private and not exposed in a
public header
Upstream: https://gogs.waldemar-brodkorb.de/oss/uclibc-ng/commit/1105fd6c97f020f6ca7426e19d29081f404b567d
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
include/fenv.h | 10 ----------
include/fenv_private.h | 24 ++++++++++++++++++++++++
libm/aarch64/fenv_private.h | 1 +
libm/arc/fenv_private.h | 1 +
libm/arm/fenv_private.h | 1 +
libm/csky/fenv_private.h | 1 +
libm/mips/fenv_private.h | 1 +
libm/sparc/fenv_private.h | 1 +
8 files changed, 30 insertions(+), 10 deletions(-)
create mode 100644 include/fenv_private.h
diff --git a/include/fenv.h b/include/fenv.h
index 4b532c573..34042d5ac 100644
--- a/include/fenv.h
+++ b/include/fenv.h
@@ -1,5 +1,4 @@
/* Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -131,15 +130,6 @@ extern int fedisableexcept (int __excepts) __THROW;
extern int fegetexcept (void) __THROW;
#endif
-/* Rounding mode context. This allows functions to set/restore rounding mode
- only when the desired rounding mode is different from the current rounding
- mode. */
-struct rm_ctx
-{
- fenv_t env;
- bool updated_status;
-};
-
__END_DECLS
#endif /* fenv.h */
diff --git a/include/fenv_private.h b/include/fenv_private.h
new file mode 100644
index 000000000..5e81c71aa
--- /dev/null
+++ b/include/fenv_private.h
@@ -0,0 +1,24 @@
+/* Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* Rounding mode context. This allows functions to set/restore rounding mode
+ only when the desired rounding mode is different from the current rounding
+ mode. */
+struct rm_ctx
+{
+ fenv_t env;
+ bool updated_status;
+};
diff --git a/libm/aarch64/fenv_private.h b/libm/aarch64/fenv_private.h
index 5afb790ea..3eaf0eb3f 100644
--- a/libm/aarch64/fenv_private.h
+++ b/libm/aarch64/fenv_private.h
@@ -19,6 +19,7 @@
#define AARCH64_FENV_PRIVATE_H 1
#include <fenv.h>
+#include <fenv_private.h>
#include <fpu_control.h>
static __always_inline void
diff --git a/libm/arc/fenv_private.h b/libm/arc/fenv_private.h
index 5f74c5e13..2e985722f 100644
--- a/libm/arc/fenv_private.h
+++ b/libm/arc/fenv_private.h
@@ -19,6 +19,7 @@
#define _FENV_PRIVATE_H 1
#include <fenv.h>
+#include <fenv_private.h>
#include "get-rounding-mode.h"
/* The standards only specify one variant of the fenv.h interfaces.
diff --git a/libm/arm/fenv_private.h b/libm/arm/fenv_private.h
index 566bf443c..61418d9f4 100644
--- a/libm/arm/fenv_private.h
+++ b/libm/arm/fenv_private.h
@@ -19,6 +19,7 @@
#define ARM_FENV_PRIVATE_H 1
#include <fenv.h>
+#include <fenv_private.h>
#include <fpu_control.h>
static __always_inline void
diff --git a/libm/csky/fenv_private.h b/libm/csky/fenv_private.h
index f0f48a88a..e6015abee 100644
--- a/libm/csky/fenv_private.h
+++ b/libm/csky/fenv_private.h
@@ -19,6 +19,7 @@
#define CSKY_FENV_PRIVATE_H 1
#include <fenv.h>
+#include <fenv_private.h>
#include <fpu_control.h>
#include "fenv_libc.h"
diff --git a/libm/mips/fenv_private.h b/libm/mips/fenv_private.h
index bc9be3b62..273d6faf8 100644
--- a/libm/mips/fenv_private.h
+++ b/libm/mips/fenv_private.h
@@ -24,6 +24,7 @@
code instead. */
#include <fenv.h>
+#include <fenv_private.h>
#include "fenv_libc.h"
#include <fpu_control.h>
diff --git a/libm/sparc/fenv_private.h b/libm/sparc/fenv_private.h
index b888d8442..c76fbad7f 100644
--- a/libm/sparc/fenv_private.h
+++ b/libm/sparc/fenv_private.h
@@ -2,6 +2,7 @@
#define SPARC_FENV_PRIVATE_H 1
#include <fenv.h>
+#include <fenv_private.h>
#include <fpu_control.h>
/* For internal use only: access the fp state register. */
--
2.47.3

View File

@@ -0,0 +1,116 @@
From 5222fefffa0270c2f2d50961a4b75ef7f5605c29 Mon Sep 17 00:00:00 2001
From: ramin <lordrasmus@gmail.com>
Date: Mon, 24 Aug 2026 13:06:02 +0200
Subject: [PATCH] m68k: use the kernel helper on every core without CAS, not
just ColdFire
The atomic header split the world into ColdFire and "the rest", assuming the
rest was 68020 and up. That holds for the MMU port, but not for the 68000 and
68010, which have no atomic read-modify-write instruction either. Building for
one of them stops at the first cas:
Error: invalid instruction for this architecture; needs 68020 or higher
(68020 [68k, 68ec020], 68030 [68ec030], 68040 [68ec040],
68060 [68ec060]) -- statement `cas.l %d0,%d1,(%a1)' ignored
Reported by Waldemar Brodkorb from a Buildroot autobuilder failure; Buildroot
supports m68000 and has at least one user on it.
Decide by the presence of CAS instead. The instruction came with the 68020, so
the test is the list of the 68020-and-up cores: gcc defines a separate macro
per core and does not imply __mc68020__ on the later ones, and __mc68000__ is
no help because it is defined on every m68k, the 68040 and ColdFire included.
Nothing else changes: the kernel's atomic_cmpxchg_32 is syscall 335 "common"
in arch/m68k/kernel/syscalls/syscall.tbl and has an implementation for the MMU
as well as the noMMU port, so the branch the old cores now take is the one
ColdFire has been using all along - including its documented limit that the
8- and 16-bit variants stay non-atomic, since the helper is 32-bit only.
Checked with a cross gcc over -m68000, -m68010, -m68020, -m68030, -m68040,
-m68060, -mcpu=5206 and -mcpu=5208: the three old cores and both ColdFires
select the helper, the four others select cas, and each branch assembles for
the cores that select it.
Upstream: https://gogs.waldemar-brodkorb.de/oss/uclibc-ng/commit/5222fefffa0270c2f2d50961a4b75ef7f5605c29
Signed-off-by: Ramin Moussavi <ramin.moussavi@yacoub.de>
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
libc/sysdeps/linux/m68k/bits/atomic.h | 32 ++++++++++++++++++---------
1 file changed, 22 insertions(+), 10 deletions(-)
diff --git a/libc/sysdeps/linux/m68k/bits/atomic.h b/libc/sysdeps/linux/m68k/bits/atomic.h
index cf7fd5f65..6acec1ed8 100644
--- a/libc/sysdeps/linux/m68k/bits/atomic.h
+++ b/libc/sysdeps/linux/m68k/bits/atomic.h
@@ -3,13 +3,15 @@
Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- m68k (68020 and up, which is everything the MMU Linux port runs on) has
- the CAS instruction. We implement the compare-and-exchange primitive
- with cas.b/cas.w/cas.l; include/atomic.h derives every higher-level
- operation from it.
+ The CAS instruction arrived with the 68020. Where it exists we implement
+ the compare-and-exchange primitive with cas.b/cas.w/cas.l and let
+ include/atomic.h derive every higher-level operation from it.
- ColdFire has no CAS at all, so there we use the kernel's
- atomic_cmpxchg_32 helper, which exists for exactly this reason.
+ ColdFire, 68000 and 68010 have no atomic read-modify-write instruction at
+ all. There we use the kernel's atomic_cmpxchg_32 helper, which exists for
+ exactly this reason and is available on every m68k (syscall 335, "common"
+ in arch/m68k/kernel/syscalls/syscall.tbl, with an implementation for both
+ the MMU and the noMMU port).
Without this file m68k fell back to the generic non-atomic
bits/atomic.h, whose "atomic" compare-and-exchange is a plain
@@ -22,7 +24,17 @@
#define _M68K_BITS_ATOMIC_H 1
#include <stdint.h>
-#ifdef __mcoldfire__
+
+/* CAS came with the 68020. gcc sets a separate macro per core and does not
+ imply __mc68020__ on the later ones, hence the list; __mc68000__ is no help
+ here, it is defined on every m68k, the 68040 and ColdFire included.
+ Everything without CAS - ColdFire, 68000, 68010 - uses the kernel helper. */
+#if defined __mc68020__ || defined __mc68030__ \
+ || defined __mc68040__ || defined __mc68060__
+# define __M68K_HAVE_CAS 1
+#endif
+
+#ifndef __M68K_HAVE_CAS
# include <sys/syscall.h>
#endif
@@ -58,7 +70,7 @@ typedef uintmax_t uatomic_max_t;
#define atomic_read_barrier() atomic_full_barrier ()
#define atomic_write_barrier() atomic_full_barrier ()
-#ifndef __mcoldfire__
+#ifdef __M68K_HAVE_CAS
/* cas Dc,Du,<ea>: compare <ea> with Dc; if equal store Du, else load <ea>
into Dc. Either way Dc ends up holding the original *MEM, which is the
@@ -87,7 +99,7 @@ typedef uintmax_t uatomic_max_t;
: "memory"); \
__ret; })
-#else /* __mcoldfire__ */
+#else /* !__M68K_HAVE_CAS */
/* d0 = syscall number, d1 = newval, d2 = oldval, a0 = mem; the helper
returns the previous value. The swap happens inside the syscall, so
@@ -116,7 +128,7 @@ typedef uintmax_t uatomic_max_t;
#define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \
__arch_compare_and_exchange_val_8_acq (mem, newval, oldval)
-#endif /* __mcoldfire__ */
+#endif /* __M68K_HAVE_CAS */
/* m68k has no 64-bit CAS; NPTL and include/atomic.h only use int- and
pointer-sized objects, so the bysize dispatch never reaches this. */
--
2.47.3

184
package/uclibc/Config.in Normal file
View File

@@ -0,0 +1,184 @@
config BR2_PACKAGE_UCLIBC_ARCH_SUPPORTS
bool
default y if BR2_aarch64
default y if BR2_aarch64_be
default y if BR2_arcle
default y if BR2_arm
default y if BR2_armeb
default y if BR2_i386
default y if BR2_m68k
default y if BR2_microblaze
default y if BR2_mips
default y if BR2_mipsel
default y if BR2_mips64
default y if BR2_mips64el
default y if BR2_or1k
default y if BR2_powerpc
# see libc/sysdeps/linux/riscv32/sys/asm.h
default y if BR2_RISCV_32 && (BR2_RISCV_ABI_ILP32 || BR2_RISCV_ABI_ILP32D)
# see libc/sysdeps/linux/riscv64/sys/asm.h
default y if BR2_RISCV_64 && (BR2_RISCV_ABI_LP64 || BR2_RISCV_ABI_LP64D)
default y if BR2_sh4
default y if BR2_sh4eb
default y if BR2_sparc
default y if BR2_xtensa
default y if BR2_x86_64
config BR2_PACKAGE_UCLIBC_SUPPORTS
bool
default y if BR2_PACKAGE_UCLIBC_ARCH_SUPPORTS
if BR2_TOOLCHAIN_BUILDROOT_UCLIBC
comment "uClibc Options"
config BR2_PACKAGE_UCLIBC
bool
default y
select BR2_PACKAGE_LINUX_HEADERS
config BR2_UCLIBC_CONFIG
string "uClibc configuration file to use?"
default "package/uclibc/uClibc-ng.config"
help
Some people may wish to use their own modified uClibc
configuration file and will specify their config file
location with this option. See also docs/README in this
package. If unsure, use the default.
config BR2_UCLIBC_CONFIG_FRAGMENT_FILES
string "Additional uClibc configuration fragment files"
help
A space-separated list of configuration fragment files, that
will be merged to the main uClibc configuration file.
config BR2_TOOLCHAIN_BUILDROOT_WCHAR
bool "Enable WCHAR support"
select BR2_USE_WCHAR
help
Enable this option if you want your toolchain to support
wide characters (i.e characters longer than 8 bits, needed
for locale support).
config BR2_TOOLCHAIN_BUILDROOT_LOCALE
bool "Enable toolchain locale/i18n support"
select BR2_TOOLCHAIN_BUILDROOT_WCHAR
select BR2_ENABLE_LOCALE
select BR2_NEEDS_HOST_UTF8_LOCALE
help
Enable this option if you want your toolchain to support
localization and internationalization.
choice
prompt "Thread library implementation"
help
Use this option to select the thread library implementation
that should be used in your toolchain.
config BR2_PTHREADS_NATIVE
bool "Native POSIX Threading (NPTL)"
depends on BR2_USE_MMU || ((BR2_arm || BR2_armeb) && BR2_BINFMT_FDPIC)
select BR2_TOOLCHAIN_HAS_THREADS
select BR2_TOOLCHAIN_HAS_THREADS_NPTL
config BR2_PTHREADS
bool "linuxthreads"
depends on !BR2_aarch64 && !BR2_aarch64_be
select BR2_TOOLCHAIN_HAS_THREADS
config BR2_PTHREADS_NONE
bool "none"
endchoice
config BR2_PTHREAD_DEBUG
bool "Thread library debugging"
depends on BR2_PTHREADS || BR2_PTHREADS_NATIVE
select BR2_TOOLCHAIN_HAS_THREADS_DEBUG
help
Build the thread library with debugging enabled.
config BR2_TOOLCHAIN_BUILDROOT_USE_SSP
bool "Enable stack protection support"
depends on BR2_PACKAGE_HOST_BINUTILS_SUPPORTS_CFI
select BR2_TOOLCHAIN_HAS_SSP
help
Enable stack smashing protection support using GCCs
-fstack-protector-all option in uClibc.
See
http://www.linuxfromscratch.org/hints/downloads/files/ssp.txt
for details.
config BR2_UCLIBC_INSTALL_UTILS
bool "Compile and install uClibc utilities"
default y
help
Enabling this option will compile and install the getconf,
ldconfig and ldd uClibc utilities for the target.
You can save ~32 KiB in target space by disabling them since
they're normally not needed.
# Mapping from the Buildroot architecture configuration options to the
# uClibc architecture names.
config BR2_UCLIBC_TARGET_ARCH
string
default "aarch64" if BR2_aarch64 || BR2_aarch64_be
default "arc" if BR2_arcle
default "arm" if BR2_arm || BR2_armeb
default "m68k" if BR2_m68k
default "microblaze" if BR2_microblaze
default "mips" if BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el
default "or1k" if BR2_or1k
default "powerpc" if BR2_powerpc
default "sh" if BR2_sh
default "sparc" if BR2_sparc
default "xtensa" if BR2_xtensa
default "i386" if BR2_i386
default "x86_64" if BR2_x86_64
default "riscv64" if BR2_RISCV_64
default "riscv32" if BR2_RISCV_32
config BR2_UCLIBC_MIPS_ABI
string
default "O32" if BR2_MIPS_OABI32
default "N32" if BR2_MIPS_NABI32
default "N64" if BR2_MIPS_NABI64
depends on BR2_UCLIBC_TARGET_ARCH = "mips"
config BR2_UCLIBC_MIPS_NAN
string
default "LEGACY" if BR2_MIPS_NAN_LEGACY
default "2008" if BR2_MIPS_NAN_2008
depends on BR2_UCLIBC_TARGET_ARCH = "mips"
config BR2_UCLIBC_SH_TYPE
string
default "SH4" if BR2_sh4 || BR2_sh4eb
depends on BR2_UCLIBC_TARGET_ARCH = "sh"
config BR2_UCLIBC_SPARC_TYPE
string
default "V8" if BR2_sparc_v8
depends on BR2_UCLIBC_TARGET_ARCH = "sparc"
config BR2_UCLIBC_POWERPC_TYPE
string
default "CLASSIC" if !BR2_powerpc_8540 && !BR2_powerpc_8548
default "E500" if BR2_powerpc_8540 || BR2_powerpc_8548
depends on BR2_UCLIBC_TARGET_ARCH = "powerpc"
config BR2_UCLIBC_X86_TYPE
string
default "486" if BR2_x86_i486
default "586" if BR2_x86_i586
default "586MMX" if BR2_x86_pentium_mmx
default "686" if BR2_x86_i686 || BR2_x86_pentiumpro
default "PENTIUMII" if BR2_x86_pentium2
default "PENTIUMIII" if BR2_x86_pentium3
default "PENTIUM4" if BR2_x86_pentium4 || BR2_x86_pentium_m || \
BR2_x86_nocona || BR2_x86_core2 || BR2_x86_corei7
depends on BR2_UCLIBC_TARGET_ARCH = "i386"
endif # BR2_TOOLCHAIN_BUILDROOT_UCLIBC

View File

@@ -0,0 +1,42 @@
DO_C99_MATH=y
DO_XSI_MATH=y
KERNEL_HEADERS="/usr/src/linux/include"
# LDSO_CACHE_SUPPORT is not set
# UCLIBC_STATIC_LDCONFIG is not set
LDSO_RUNPATH=y
LDSO_RUNPATH_OF_EXECUTABLE=y
UCLIBC_HAS_UTMPX=y
UCLIBC_HAS_UTMP=y
UCLIBC_SUSV2_LEGACY=y
UCLIBC_SUSV3_LEGACY=y
UCLIBC_HAS_CONTEXT_FUNCS=y
UCLIBC_SUSV4_LEGACY=y
UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y
UCLIBC_HAS_GETPT=y
UCLIBC_HAS_LIBUTIL=y
UCLIBC_HAS_OBSOLETE_BSD_SIGNAL=y
UCLIBC_HAS_SHA256_CRYPT_IMPL=y
UCLIBC_HAS_SHA512_CRYPT_IMPL=y
UCLIBC_USE_NETLINK=y
UCLIBC_SUPPORT_AI_ADDRCONFIG=y
UCLIBC_HAS_RESOLVER_SUPPORT=y
UCLIBC_HAS_LIBRESOLV_STUB=y
UCLIBC_HAS_LIBNSL_STUB=y
UCLIBC_HAS_CTYPE_CHECKED=y
UCLIBC_HAS_LIBINTL=y
UCLIBC_HAS_HEXADECIMAL_FLOATS=y
UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y
UCLIBC_HAS_STDIO_GETC_MACRO=y
UCLIBC_HAS_STDIO_PUTC_MACRO=y
UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y
UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y
UCLIBC_HAS_PRINTF_M_SPEC=y
UCLIBC_HAS_WORDEXP=y
UCLIBC_HAS_NFTW=y
UCLIBC_HAS_FTW=y
UCLIBC_HAS_GNU_GLOB=y
RUNTIME_PREFIX="/"
DEVEL_PREFIX="/usr/"
UCLIBC_HAS_SSP=y
UCLIBC_BUILD_NOW=y
# DOSTRIP is not set

View File

@@ -0,0 +1,4 @@
# From https://downloads.uclibc-ng.org/releases/1.0.59/uClibc-ng-1.0.59.tar.xz.sha256
sha256 86c6f15971bfb14156850f2e36906dac5a69df7b3e688216d1aea09d2db54174 uClibc-ng-1.0.59.tar.xz
# Locally calculated
sha256 ec60b993835e2c6b79e6d9226345f4e614e686eb57dc13b6420c15a33a8996e5 COPYING.LIB

504
package/uclibc/uclibc.mk Normal file
View File

@@ -0,0 +1,504 @@
################################################################################
#
# uclibc
#
################################################################################
UCLIBC_VERSION = 1.0.59
UCLIBC_SOURCE = uClibc-ng-$(UCLIBC_VERSION).tar.xz
UCLIBC_SITE = https://downloads.uclibc-ng.org/releases/$(UCLIBC_VERSION)
UCLIBC_LICENSE = LGPL-2.1+
UCLIBC_LICENSE_FILES = COPYING.LIB
UCLIBC_INSTALL_STAGING = YES
UCLIBC_CPE_ID_VENDOR = uclibc-ng_project
UCLIBC_CPE_ID_PRODUCT = uclibc-ng
# uclibc is part of the toolchain so disable the toolchain dependency
UCLIBC_ADD_TOOLCHAIN_DEPENDENCY = NO
# Before uClibc is configured, we must have the first stage
# cross-compiler and the kernel headers
UCLIBC_DEPENDENCIES = host-gcc-initial linux-headers
# specifying UCLIBC_CONFIG_FILE on the command-line overrides the .config
# setting.
# check-package disable Ifdef
ifndef UCLIBC_CONFIG_FILE
UCLIBC_CONFIG_FILE = $(call qstrip,$(BR2_UCLIBC_CONFIG))
endif
UCLIBC_KCONFIG_EDITORS = menuconfig nconfig
UCLIBC_KCONFIG_FILE = $(UCLIBC_CONFIG_FILE)
UCLIBC_KCONFIG_FRAGMENT_FILES = $(call qstrip,$(BR2_UCLIBC_CONFIG_FRAGMENT_FILES))
# UCLIBC_MAKE_FLAGS set HOSTCC to the default HOSTCC, which may be
# wrapped with ccache. However, host-ccache may not already be built
# and installed when we apply the configuration, so we override that
# to use the non-ccached host compiler.
UCLIBC_KCONFIG_OPTS = \
$(UCLIBC_MAKE_FLAGS) \
HOSTCC="$(HOSTCC_NOCCACHE)" \
PREFIX=$(STAGING_DIR) \
DEVEL_PREFIX=/usr/ \
RUNTIME_PREFIX=$(STAGING_DIR)/
UCLIBC_TARGET_ARCH = $(call qstrip,$(BR2_UCLIBC_TARGET_ARCH))
UCLIBC_GENERATE_LOCALES = $(call qstrip,$(BR2_GENERATE_LOCALE))
ifeq ($(UCLIBC_GENERATE_LOCALES),)
# We need at least one locale
UCLIBC_LOCALES = en_US
else
# Strip out the encoding part of locale names, if any
UCLIBC_LOCALES = \
$(foreach locale,$(UCLIBC_GENERATE_LOCALES),\
$(firstword $(subst .,$(space),$(locale))))
endif
# noMMU binary formats
ifeq ($(BR2_BINFMT_FDPIC),y)
define UCLIBC_BINFMT_CONFIG
$(call KCONFIG_DISABLE_OPT,UCLIBC_FORMAT_FLAT,$(@D)/.config)
$(call KCONFIG_DISABLE_OPT,UCLIBC_FORMAT_FLAT_SEP_DATA,$(@D)/.config)
$(call KCONFIG_ENABLE_OPT,UCLIBC_FORMAT_FDPIC_ELF,$(@D)/.config)
endef
endif
ifeq ($(BR2_BINFMT_FLAT),y)
define UCLIBC_BINFMT_CONFIG
$(call KCONFIG_ENABLE_OPT,UCLIBC_FORMAT_FLAT)
$(call KCONFIG_DISABLE_OPT,UCLIBC_FORMAT_FLAT_SEP_DATA)
$(call KCONFIG_DISABLE_OPT,UCLIBC_FORMAT_FDPIC_ELF)
endef
endif
#
# 64-bit time_t is enabled by default but needs headers >= 5.1.0
#
ifeq ($(BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_1),)
define UCLIBC_DISABLE_TIME64
$(call KCONFIG_DISABLE_OPT,UCLIBC_USE_TIME64)
endef
endif
#
# AArch64 definitions
#
ifeq ($(UCLIBC_TARGET_ARCH),aarch64)
UCLIBC_ARM64_PAGE_SIZE = CONFIG_AARCH64_PAGE_SIZE_$(call qstrip,$(BR2_ARM64_PAGE_SIZE))
define UCLIBC_AARCH64_PAGE_SIZE_CONFIG
$(SED) '/CONFIG_AARCH64_PAGE_SIZE_*/d' $(@D)/.config
$(call KCONFIG_ENABLE_OPT,$(UCLIBC_ARM64_PAGE_SIZE))
endef
endif # aarch64
#
# ARC definitions
#
ifeq ($(UCLIBC_TARGET_ARCH),arc)
UCLIBC_ARC_PAGE_SIZE = CONFIG_ARC_PAGE_SIZE_$(call qstrip,$(BR2_ARC_PAGE_SIZE))
define UCLIBC_ARC_PAGE_SIZE_CONFIG
$(SED) '/CONFIG_ARC_PAGE_SIZE_*/d' $(@D)/.config
$(call KCONFIG_ENABLE_OPT,$(UCLIBC_ARC_PAGE_SIZE))
endef
ifeq ($(BR2_ARC_ATOMIC_EXT),)
define UCLIBC_ARC_ATOMICS_CONFIG
$(call KCONFIG_DISABLE_OPT,CONFIG_ARC_HAS_ATOMICS)
endef
endif
endif # arc
#
# ARM definitions
#
ifeq ($(UCLIBC_TARGET_ARCH),arm)
define UCLIBC_ARM_ABI_CONFIG
$(SED) '/CONFIG_ARM_.ABI/d' $(@D)/.config
$(call KCONFIG_ENABLE_OPT,CONFIG_ARM_EABI)
endef
ifeq ($(BR2_BINFMT_FLAT),y)
define UCLIBC_ARM_BINFMT_FLAT
$(call KCONFIG_DISABLE_OPT,DOPIC)
endef
endif
# context functions are written with ARM instructions. Therefore, if
# we are using a Thumb2-only platform (i.e, Cortex-M), they must be
# disabled. Thumb1 platforms are not a problem, since they all also
# support the ARM instructions.
ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB2):$(BR2_ARM_CPU_HAS_ARM),y:)
define UCLIBC_ARM_NO_CONTEXT_FUNCS
$(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_CONTEXT_FUNCS)
endef
endif
endif # arm
#
# m68k/coldfire definitions
#
ifeq ($(UCLIBC_TARGET_ARCH),m68k)
# disable DOPIC for flat without separate data
ifeq ($(BR2_BINFMT_FLAT),y)
define UCLIBC_M68K_BINFMT_FLAT
$(call KCONFIG_DISABLE_OPT,DOPIC)
endef
endif
endif # m68k/coldfire
#
# MIPS definitions
#
ifeq ($(UCLIBC_TARGET_ARCH),mips)
UCLIBC_MIPS_ABI = CONFIG_MIPS_$(call qstrip,$(BR2_UCLIBC_MIPS_ABI))_ABI
define UCLIBC_MIPS_ABI_CONFIG
$(SED) '/CONFIG_MIPS_[NO].._ABI/d' $(@D)/.config
$(call KCONFIG_ENABLE_OPT,$(UCLIBC_MIPS_ABI))
endef
UCLIBC_MIPS_NAN = CONFIG_MIPS_NAN_$(call qstrip,$(BR2_UCLIBC_MIPS_NAN))
define UCLIBC_MIPS_NAN_CONFIG
$(SED) '/CONFIG_MIPS_NAN_.*/d' $(@D)/.config
$(call KCONFIG_ENABLE_OPT,$(UCLIBC_MIPS_NAN))
endef
endif # mips
#
# SH definitions
#
ifeq ($(UCLIBC_TARGET_ARCH),sh)
UCLIBC_SH_TYPE = CONFIG_$(call qstrip,$(BR2_UCLIBC_SH_TYPE))
define UCLIBC_SH_TYPE_CONFIG
$(SED) '/CONFIG_SH[234A]*/d' $(@D)/.config
$(call KCONFIG_ENABLE_OPT,$(UCLIBC_SH_TYPE))
endef
endif # sh
#
# SPARC definitions
#
ifeq ($(UCLIBC_TARGET_ARCH),sparc)
UCLIBC_SPARC_TYPE = CONFIG_SPARC_$(call qstrip,$(BR2_UCLIBC_SPARC_TYPE))
define UCLIBC_SPARC_TYPE_CONFIG
$(SED) 's/^\(CONFIG_[^_]*[_]*SPARC[^=]*\)=.*/# \1 is not set/g' \
$(@D)/.config
$(call KCONFIG_ENABLE_OPT,$(UCLIBC_SPARC_TYPE))
endef
endif # sparc
#
# PowerPC definitions
#
ifeq ($(UCLIBC_TARGET_ARCH),powerpc)
UCLIBC_POWERPC_TYPE = CONFIG_$(call qstrip,$(BR2_UCLIBC_POWERPC_TYPE))
define UCLIBC_POWERPC_TYPE_CONFIG
$(call KCONFIG_DISABLE_OPT,CONFIG_GENERIC)
$(call KCONFIG_DISABLE_OPT,CONFIG_E500)
$(call KCONFIG_ENABLE_OPT,$(UCLIBC_POWERPC_TYPE))
endef
endif # powerpc
#
# x86 definitions
#
ifeq ($(UCLIBC_TARGET_ARCH),i386)
UCLIBC_X86_TYPE = CONFIG_$(call qstrip,$(BR2_UCLIBC_X86_TYPE))
define UCLIBC_X86_TYPE_CONFIG
$(call KCONFIG_ENABLE_OPT,$(UCLIBC_X86_TYPE))
endef
endif
#
# Debug
#
ifeq ($(BR2_ENABLE_RUNTIME_DEBUG),y)
define UCLIBC_DEBUG_CONFIG
$(call KCONFIG_ENABLE_OPT,DODEBUG)
endef
endif
#
# Endianness
#
ifeq ($(call qstrip,$(BR2_ENDIAN)),BIG)
define UCLIBC_ENDIAN_CONFIG
$(call KCONFIG_ENABLE_OPT,ARCH_BIG_ENDIAN)
$(call KCONFIG_ENABLE_OPT,ARCH_WANTS_BIG_ENDIAN)
$(call KCONFIG_DISABLE_OPT,ARCH_LITTLE_ENDIAN)
$(call KCONFIG_DISABLE_OPT,ARCH_WANTS_LITTLE_ENDIAN)
endef
else
define UCLIBC_ENDIAN_CONFIG
$(call KCONFIG_ENABLE_OPT,ARCH_LITTLE_ENDIAN)
$(call KCONFIG_ENABLE_OPT,ARCH_WANTS_LITTLE_ENDIAN)
$(call KCONFIG_DISABLE_OPT,ARCH_BIG_ENDIAN)
$(call KCONFIG_DISABLE_OPT,ARCH_WANTS_BIG_ENDIAN)
endef
endif
#
# MMU
#
ifeq ($(BR2_USE_MMU),y)
define UCLIBC_MMU_CONFIG
$(call KCONFIG_ENABLE_OPT,ARCH_HAS_MMU)
$(call KCONFIG_ENABLE_OPT,ARCH_USE_MMU)
endef
else
define UCLIBC_MMU_CONFIG
$(call KCONFIG_DISABLE_OPT,ARCH_HAS_MMU)
$(call KCONFIG_DISABLE_OPT,ARCH_USE_MMU)
endef
endif
#
# IPv6
#
UCLIBC_IPV6_CONFIG = $(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_IPV6)
#
# soft-float
#
ifeq ($(BR2_SOFT_FLOAT),y)
define UCLIBC_FLOAT_CONFIG
$(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_FPU)
$(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_FLOATS)
$(call KCONFIG_ENABLE_OPT,DO_C99_MATH)
endef
else
define UCLIBC_FLOAT_CONFIG
$(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_FPU)
$(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_FLOATS)
$(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_FENV)
endef
endif
#
# SSP
#
ifeq ($(BR2_TOOLCHAIN_BUILDROOT_USE_SSP),y)
define UCLIBC_SSP_CONFIG
$(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_SSP)
$(call KCONFIG_ENABLE_OPT,UCLIBC_BUILD_SSP)
endef
else
define UCLIBC_SSP_CONFIG
$(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_SSP)
$(call KCONFIG_DISABLE_OPT,UCLIBC_BUILD_SSP)
endef
endif
#
# Threads
#
ifeq ($(BR2_PTHREADS_NONE),y)
define UCLIBC_THREAD_CONFIG
$(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_THREADS)
$(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_LINUXTHREADS)
$(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_THREADS_NATIVE)
endef
else ifeq ($(BR2_PTHREADS),y)
define UCLIBC_THREAD_CONFIG
$(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_THREADS)
$(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_LINUXTHREADS)
$(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_THREADS_NATIVE)
endef
else ifeq ($(BR2_PTHREADS_NATIVE),y)
define UCLIBC_THREAD_CONFIG
$(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_THREADS)
$(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_LINUXTHREADS)
$(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_THREADS_NATIVE)
endef
endif
#
# Thread debug
#
ifeq ($(BR2_PTHREAD_DEBUG),y)
UCLIBC_THREAD_DEBUG_CONFIG = $(call KCONFIG_ENABLE_OPT,PTHREADS_DEBUG_SUPPORT)
else
UCLIBC_THREAD_DEBUG_CONFIG = $(call KCONFIG_DISABLE_OPT,PTHREADS_DEBUG_SUPPORT)
endif
#
# Locale
#
ifeq ($(BR2_TOOLCHAIN_BUILDROOT_LOCALE),y)
define UCLIBC_LOCALE_CONFIG
$(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_LOCALE)
$(call KCONFIG_DISABLE_OPT,UCLIBC_BUILD_ALL_LOCALE)
$(call KCONFIG_ENABLE_OPT,UCLIBC_BUILD_MINIMAL_LOCALE)
$(call KCONFIG_SET_OPT,UCLIBC_BUILD_MINIMAL_LOCALES,"$(UCLIBC_LOCALES)")
$(call KCONFIG_DISABLE_OPT,UCLIBC_PREGENERATED_LOCALE_DATA)
$(call KCONFIG_DISABLE_OPT,DOWNLOAD_PREGENERATED_LOCALE_DATA)
$(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_XLOCALE)
$(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_GLIBC_DIGIT_GROUPING)
endef
else
define UCLIBC_LOCALE_CONFIG
$(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_LOCALE)
endef
endif
#
# wchar
#
ifeq ($(BR2_TOOLCHAIN_BUILDROOT_WCHAR),y)
UCLIBC_WCHAR_CONFIG = $(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_WCHAR)
UCLIBC_UCHAR_CONFIG = $(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_UCHAR)
else
UCLIBC_WCHAR_CONFIG = $(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_WCHAR)
endif
#
# static/shared libs
#
ifeq ($(BR2_STATIC_LIBS),y)
UCLIBC_SHARED_LIBS_CONFIG = $(call KCONFIG_DISABLE_OPT,HAVE_SHARED)
else
UCLIBC_SHARED_LIBS_CONFIG = $(call KCONFIG_ENABLE_OPT,HAVE_SHARED)
endif
#
# Commands
#
UCLIBC_EXTRA_CFLAGS = $(TARGET_ABI) $(TARGET_DEBUGGING)
# uClibc-ng does not build with LTO, so explicitly disable it
# when using a compiler that may have support for LTO
ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_7),y)
UCLIBC_EXTRA_CFLAGS += -fno-lto
endif
UCLIBC_MAKE_FLAGS = \
ARCH="$(UCLIBC_TARGET_ARCH)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
UCLIBC_EXTRA_CFLAGS="$(UCLIBC_EXTRA_CFLAGS)" \
HOSTCC="$(HOSTCC)"
define UCLIBC_KCONFIG_FIXUP_CMDS
$(call KCONFIG_SET_OPT,CROSS_COMPILER_PREFIX,"$(TARGET_CROSS)")
$(call KCONFIG_ENABLE_OPT,TARGET_$(UCLIBC_TARGET_ARCH))
$(call KCONFIG_SET_OPT,TARGET_ARCH,"$(UCLIBC_TARGET_ARCH)")
$(call KCONFIG_SET_OPT,KERNEL_HEADERS,"$(LINUX_HEADERS_DIR)/usr/include")
$(call KCONFIG_SET_OPT,RUNTIME_PREFIX,"/")
$(call KCONFIG_SET_OPT,DEVEL_PREFIX,"/usr")
$(call KCONFIG_SET_OPT,SHARED_LIB_LOADER_PREFIX,"/lib")
$(call KCONFIG_DISABLE_OPT,DOSTRIP)
$(UCLIBC_MMU_CONFIG)
$(UCLIBC_BINFMT_CONFIG)
$(UCLIBC_DISABLE_TIME64)
$(UCLIBC_AARCH64_PAGE_SIZE_CONFIG)
$(UCLIBC_ARC_PAGE_SIZE_CONFIG)
$(UCLIBC_ARC_ATOMICS_CONFIG)
$(UCLIBC_ARM_ABI_CONFIG)
$(UCLIBC_ARM_BINFMT_FLAT)
$(UCLIBC_ARM_NO_CONTEXT_FUNCS)
$(UCLIBC_M68K_BINFMT_FLAT)
$(UCLIBC_MIPS_ABI_CONFIG)
$(UCLIBC_MIPS_NAN_CONFIG)
$(UCLIBC_SH_TYPE_CONFIG)
$(UCLIBC_SPARC_TYPE_CONFIG)
$(UCLIBC_POWERPC_TYPE_CONFIG)
$(UCLIBC_X86_TYPE_CONFIG)
$(UCLIBC_DEBUG_CONFIG)
$(UCLIBC_ENDIAN_CONFIG)
$(UCLIBC_IPV6_CONFIG)
$(UCLIBC_FLOAT_CONFIG)
$(UCLIBC_SSP_CONFIG)
$(UCLIBC_THREAD_CONFIG)
$(UCLIBC_THREAD_DEBUG_CONFIG)
$(UCLIBC_LOCALE_CONFIG)
$(UCLIBC_WCHAR_CONFIG)
$(UCLIBC_UCHAR_CONFIG)
$(UCLIBC_SHARED_LIBS_CONFIG)
endef
define UCLIBC_BUILD_CMDS
$(MAKE) -C $(@D) $(UCLIBC_MAKE_FLAGS) headers
$(MAKE) -C $(@D) $(UCLIBC_MAKE_FLAGS)
$(MAKE) -C $(@D)/utils \
PREFIX=$(HOST_DIR) \
HOSTCC="$(HOSTCC)" hostutils
endef
ifeq ($(BR2_UCLIBC_INSTALL_UTILS),y)
define UCLIBC_INSTALL_UTILS_TARGET
$(MAKE1) -C $(@D) \
CC="$(TARGET_CC)" CPP="$(TARGET_CPP)" LD="$(TARGET_LD)" \
ARCH="$(UCLIBC_TARGET_ARCH)" \
PREFIX=$(TARGET_DIR) \
utils install_utils
endef
define UCLIBC_INSTALL_UTILS_STAGING
$(MAKE1) -C $(@D) \
CC="$(TARGET_CC)" CPP="$(TARGET_CPP)" LD="$(TARGET_LD)" \
ARCH="$(UCLIBC_TARGET_ARCH)" \
PREFIX=$(STAGING_DIR) \
utils install_utils
endef
endif
define UCLIBC_INSTALL_TARGET_CMDS
$(MAKE1) -C $(@D) \
$(UCLIBC_MAKE_FLAGS) \
PREFIX=$(TARGET_DIR) \
DEVEL_PREFIX=/usr/ \
RUNTIME_PREFIX=/ \
install_runtime
$(UCLIBC_INSTALL_UTILS_TARGET)
endef
# STATIC has no ld* tools, only getconf
ifeq ($(BR2_STATIC_LIBS),)
define UCLIBC_INSTALL_HOST_UTILS
$(INSTALL) -D -m 0755 $(@D)/utils/ldd.host $(HOST_DIR)/bin/ldd
ln -sf ldd $(HOST_DIR)/bin/$(GNU_TARGET_NAME)-ldd
$(INSTALL) -D -m 0755 $(@D)/utils/ldconfig.host $(HOST_DIR)/bin/ldconfig
ln -sf ldconfig $(HOST_DIR)/bin/$(GNU_TARGET_NAME)-ldconfig
endef
endif
define UCLIBC_INSTALL_STAGING_CMDS
$(MAKE1) -C $(@D) \
$(UCLIBC_MAKE_FLAGS) \
PREFIX=$(STAGING_DIR) \
DEVEL_PREFIX=/usr/ \
RUNTIME_PREFIX=/ \
install_runtime install_dev
$(UCLIBC_INSTALL_HOST_UTILS)
$(UCLIBC_INSTALL_UTILS_STAGING)
endef
# Checks to give errors that the user can understand
# Must be before we call to kconfig-package
ifeq ($(BR2_PACKAGE_UCLIBC)$(BR_BUILDING),yy)
ifeq ($(call qstrip,$(BR2_UCLIBC_CONFIG)),)
$(error No uClibc configuration file specified, check your BR2_UCLIBC_CONFIG setting)
endif
endif
$(eval $(kconfig-package))