This commit is contained in:
TriForceX
2019-09-25 20:51:37 -03:00
commit 6203ff3e7c
11215 changed files with 428258 additions and 0 deletions

View File

@@ -0,0 +1,169 @@
From 8a73a967e18c55199785bae0f22dc94d9b2f8985 Mon Sep 17 00:00:00 2001
From: Waldemar Brodkorb <wbrodkorb@conet.de>
Date: Tue, 27 Nov 2018 15:41:37 +0100
Subject: [PATCH] statfs.h: sync generic header with glibc
Fix issues with aarch64 and df with mismatching header between kernel
and libc.
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
.../linux/common-generic/bits/statfs.h | 84 +++++++++----------
libc/sysdeps/linux/common/fstatfs.c | 9 --
libc/sysdeps/linux/common/statfs.c | 10 ---
3 files changed, 40 insertions(+), 63 deletions(-)
diff --git a/libc/sysdeps/linux/common-generic/bits/statfs.h b/libc/sysdeps/linux/common-generic/bits/statfs.h
index a2767b49a..23519a57e 100644
--- a/libc/sysdeps/linux/common-generic/bits/statfs.h
+++ b/libc/sysdeps/linux/common-generic/bits/statfs.h
@@ -11,65 +11,61 @@
#include <endian.h>
#include <bits/align64bit.h>
#include <bits/types.h>
+#include <bits/wordsize.h>
+/* 64-bit libc uses the kernel's 'struct statfs', accessed via the
+ statfs() syscall; 32-bit libc uses the kernel's 'struct statfs64'
+ and accesses it via the statfs64() syscall. All the various
+ APIs offered by libc use the kernel shape for their struct statfs
+ structure; the only difference is that 32-bit programs not
+ using __USE_FILE_OFFSET64 only see the low 32 bits of some
+ of the fields (the __fsblkcnt_t and __fsfilcnt_t fields). */
+
+#if defined __USE_FILE_OFFSET64
+# define __field64(type, type64, name) type64 name
+#elif __WORDSIZE == 64
+# define __field64(type, type64, name) type name
+#elif __BYTE_ORDER == __LITTLE_ENDIAN
+# define __field64(type, type64, name) \
+ type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad
+#else
+# define __field64(type, type64, name) \
+ int __##name##_pad __attribute__((__aligned__ (__alignof__ (type64)))); type name
+#endif
struct statfs
{
- __U32_TYPE f_type;
- __U32_TYPE f_bsize;
-#ifndef __USE_FILE_OFFSET64
-# if __BYTE_ORDER == __LITTLE_ENDIAN
- __U32_TYPE f_blocks;
- __U32_TYPE __pad1;
- __U32_TYPE f_bfree;
- __U32_TYPE __pad2;
- __U32_TYPE f_bavail;
- __U32_TYPE __pad3;
- __U32_TYPE f_files;
- __U32_TYPE __pad4;
- __U32_TYPE f_ffree;
- __U32_TYPE __pad5;
-# else
- __U32_TYPE __pad1;
- __U32_TYPE f_blocks;
- __U32_TYPE __pad2;
- __U32_TYPE f_bfree;
- __U32_TYPE __pad3;
- __U32_TYPE f_bavail;
- __U32_TYPE __pad4;
- __U32_TYPE f_files;
- __U32_TYPE __pad5;
- __U32_TYPE f_ffree;
-# endif /* __LITTLE_ENDIAN */
-#else
- __U64_TYPE f_blocks;
- __U64_TYPE f_bfree;
- __U64_TYPE f_bavail;
- __U64_TYPE f_files;
- __U64_TYPE f_ffree;
-#endif /* __USE_FILE_OFFSET64 */
+ __SWORD_TYPE f_type;
+ __SWORD_TYPE f_bsize;
+ __field64(__fsblkcnt_t, __fsblkcnt64_t, f_blocks);
+ __field64(__fsblkcnt_t, __fsblkcnt64_t, f_bfree);
+ __field64(__fsblkcnt_t, __fsblkcnt64_t, f_bavail);
+ __field64(__fsfilcnt_t, __fsfilcnt64_t, f_files);
+ __field64(__fsfilcnt_t, __fsfilcnt64_t, f_ffree);
__fsid_t f_fsid;
- __U32_TYPE f_namelen;
- __U32_TYPE f_frsize;
- __U32_TYPE f_flags;
- __U32_TYPE f_spare[4];
- } __ARCH_64BIT_ALIGNMENT__;
+ __SWORD_TYPE f_namelen;
+ __SWORD_TYPE f_frsize;
+ __SWORD_TYPE f_flags;
+ __SWORD_TYPE f_spare[4];
+ };
+
+#undef __field64
#ifdef __USE_LARGEFILE64
struct statfs64
{
- __U32_TYPE f_type;
- __U32_TYPE f_bsize;
+ __SWORD_TYPE f_type;
+ __SWORD_TYPE f_bsize;
__U64_TYPE f_blocks;
__U64_TYPE f_bfree;
__U64_TYPE f_bavail;
__U64_TYPE f_files;
__U64_TYPE f_ffree;
__fsid_t f_fsid;
- __U32_TYPE f_namelen;
- __U32_TYPE f_frsize;
- __U32_TYPE f_flags;
- __U32_TYPE f_spare[4];
+ __SWORD_TYPE f_namelen;
+ __SWORD_TYPE f_frsize;
+ __SWORD_TYPE f_flags;
+ __SWORD_TYPE f_spare[4];
};
#endif
diff --git a/libc/sysdeps/linux/common/fstatfs.c b/libc/sysdeps/linux/common/fstatfs.c
index fcb0820eb..0b2709ce3 100644
--- a/libc/sysdeps/linux/common/fstatfs.c
+++ b/libc/sysdeps/linux/common/fstatfs.c
@@ -30,15 +30,6 @@ _syscall2(int, __libc_fstatfs, int, fd, struct statfs *, buf)
int __libc_fstatfs (int __fildes, struct statfs *__buf)
{
int err = INLINE_SYSCALL(fstatfs64, 3, __fildes, sizeof(*__buf), __buf);
-
- if (err == 0) {
- /* Did we overflow? */
- if (__buf->__pad1 || __buf->__pad2 || __buf->__pad3 ||
- __buf->__pad4 || __buf->__pad5) {
- __set_errno(EOVERFLOW);
- return -1;
- }
- }
return err;
};
/* Redefined fstatfs because we need it for backwards compatibility */
diff --git a/libc/sysdeps/linux/common/statfs.c b/libc/sysdeps/linux/common/statfs.c
index ab9ec0e56..2990ff3e2 100644
--- a/libc/sysdeps/linux/common/statfs.c
+++ b/libc/sysdeps/linux/common/statfs.c
@@ -18,16 +18,6 @@ extern __typeof(statfs) __libc_statfs attribute_hidden;
int __libc_statfs(const char *path, struct statfs *buf)
{
int err = INLINE_SYSCALL(statfs64, 3, path, sizeof(*buf), buf);
-
- if (err == 0) {
- /* Did we overflow? */
- if (buf->__pad1 || buf->__pad2 || buf->__pad3 ||
- buf->__pad4 || buf->__pad5) {
- __set_errno(EOVERFLOW);
- return -1;
- }
- }
-
return err;
}
# if defined __UCLIBC_LINUX_SPECIFIC__ || defined __UCLIBC_HAS_THREADS_NATIVE__
--
2.19.1

View File

@@ -0,0 +1,93 @@
From 0cae9700a4a421dc22c80d205fbae4d01fdd1356 Mon Sep 17 00:00:00 2001
From: Max Filippov <jcmvbkbc@gmail.com>
Date: Wed, 12 Dec 2018 06:58:01 -0800
Subject: [PATCH] xtensa: add custom bits/poll.h
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Definitions of POLLWRNORM, POLLWRBAND and POLLREMOVE in xtensa linux
kernel are non-standard. Provide bits/poll.h with correct values for
these constants.
This fixes the following strace build errors:
In file included from xlat/pollflags.h:4:0,
from poll.c:34:
./static_assert.h:40:24: error: static assertion failed: "POLLWRBAND != 0x0100"
# define static_assert _Static_assert
^
xlat/pollflags.h:75:1: note: in expansion of macro static_assert
static_assert((POLLWRBAND) == (0x0100), "POLLWRBAND != 0x0100");
^~~~~~~~~~~~~
./static_assert.h:40:24: error: static assertion failed: "POLLREMOVE != 0x0800"
# define static_assert _Static_assert
^
xlat/pollflags.h:117:1: note: in expansion of macro static_assert
static_assert((POLLREMOVE) == (0x0800), "POLLREMOVE != 0x0800");
^~~~~~~~~~~~~
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
libc/sysdeps/linux/xtensa/bits/poll.h | 49 +++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
create mode 100644 libc/sysdeps/linux/xtensa/bits/poll.h
diff --git a/libc/sysdeps/linux/xtensa/bits/poll.h b/libc/sysdeps/linux/xtensa/bits/poll.h
new file mode 100644
index 000000000000..4588cc326006
--- /dev/null
+++ b/libc/sysdeps/linux/xtensa/bits/poll.h
@@ -0,0 +1,49 @@
+/* Copyright (C) 1997, 2001, 2006 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
+ 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/>. */
+
+#ifndef _SYS_POLL_H
+# error "Never use <bits/poll.h> directly; include <sys/poll.h> instead."
+#endif
+
+/* Event types that can be polled for. These bits may be set in `events'
+ to indicate the interesting event types; they will appear in `revents'
+ to indicate the status of the file descriptor. */
+#define POLLIN 0x001 /* There is data to read. */
+#define POLLPRI 0x002 /* There is urgent data to read. */
+#define POLLOUT 0x004 /* Writing now will not block. */
+
+#ifdef __USE_XOPEN
+/* These values are defined in XPG4.2. */
+# define POLLRDNORM 0x040 /* Normal data may be read. */
+# define POLLRDBAND 0x080 /* Priority data may be read. */
+# define POLLWRNORM POLLOUT /* Writing now will not block. */
+# define POLLWRBAND 0x100 /* Priority data may be written. */
+#endif
+
+#ifdef __USE_GNU
+/* These are extensions for Linux. */
+# define POLLMSG 0x400
+# define POLLREMOVE 0x800
+# define POLLRDHUP 0x2000
+#endif
+
+/* Event types always implicitly polled for. These bits need not be set in
+ `events', but they will appear in `revents' to indicate the status of
+ the file descriptor. */
+#define POLLERR 0x008 /* Error condition. */
+#define POLLHUP 0x010 /* Hung up. */
+#define POLLNVAL 0x020 /* Invalid polling request. */
--
2.11.0

View File

@@ -0,0 +1,71 @@
From 1077d5bebffacfd4b09896ed890fb45a5b3c6dc6 Mon Sep 17 00:00:00 2001
From: Max Filippov <jcmvbkbc@gmail.com>
Date: Fri, 10 May 2019 07:13:19 -0700
Subject: [PATCH] preadv/pwritev: fix offset argument type
preadv/pwritev don't provide separate version for 64-bit wide off_t,
and default to 32-bit wide off_t, which results in a mismatch between
declaration and definition for user programs built with
-D_FILE_OFFSET_BITS=64.
Make offset argument of both functions __off64_t.
This fixes test misc/tst-preadvwritev on xtensa.
Backported from: 423e49023eeb ("preadv/pwritev: fix offset argument type")
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
include/sys/uio.h | 4 ++--
libc/sysdeps/linux/common/preadv.c | 2 +-
libc/sysdeps/linux/common/pwritev.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/sys/uio.h b/include/sys/uio.h
index aa766f9b1187..330426fec492 100644
--- a/include/sys/uio.h
+++ b/include/sys/uio.h
@@ -59,7 +59,7 @@ extern ssize_t writev (int __fd, const struct iovec *__iovec, int __count);
This function is a cancellation point and therefore not marked with
__THROW. */
extern ssize_t preadv (int __fd, const struct iovec *__iovec, int __count,
- off_t __offset) __wur;
+ __off64_t __offset) __wur;
/* Write data pointed by the buffers described by IOVEC, which is a
vector of COUNT 'struct iovec's, to file descriptor FD at the given
@@ -71,7 +71,7 @@ extern ssize_t preadv (int __fd, const struct iovec *__iovec, int __count,
This function is a cancellation point and therefore not marked with
__THROW. */
extern ssize_t pwritev (int __fd, const struct iovec *__iovec, int __count,
- off_t __offset) __wur;
+ __off64_t __offset) __wur;
#endif /* Use misc. */
__END_DECLS
diff --git a/libc/sysdeps/linux/common/preadv.c b/libc/sysdeps/linux/common/preadv.c
index fd9dde4b999c..6a07d5df87e0 100644
--- a/libc/sysdeps/linux/common/preadv.c
+++ b/libc/sysdeps/linux/common/preadv.c
@@ -21,7 +21,7 @@
#ifdef __NR_preadv
ssize_t
-preadv (int fd, const struct iovec *vector, int count, off_t offset)
+preadv (int fd, const struct iovec *vector, int count, __off64_t offset)
{
unsigned long pos_l, pos_h;
diff --git a/libc/sysdeps/linux/common/pwritev.c b/libc/sysdeps/linux/common/pwritev.c
index bef5bcf69b46..f07c40e6de3c 100644
--- a/libc/sysdeps/linux/common/pwritev.c
+++ b/libc/sysdeps/linux/common/pwritev.c
@@ -21,7 +21,7 @@
#ifdef __NR_pwritev
ssize_t
-pwritev (int fd, const struct iovec *vector, int count, off_t offset)
+pwritev (int fd, const struct iovec *vector, int count, __off64_t offset)
{
unsigned long pos_l, pos_h;
--
2.11.0

View File

@@ -0,0 +1,40 @@
From 75a1a2a9fec8a310a18ff7d63ead95f3a0d1b11b Mon Sep 17 00:00:00 2001
From: Romain Naour <romain.naour@gmail.com>
Date: Fri, 24 May 2019 12:42:04 +0200
Subject: [PATCH] sparc: remove asm constraint
uClibc-ng don't build with gcc 9.1 [1] due to a new check that
"catch illegal asm constraint usage" [2].
gcc 9.1 print this error:
"invalid hard register usage between earlyclobber operand and input operand"
The asm constraint is present in uClibc since it support sparc (back in 2002)[3].
Note: There is no such constraint is Glibc counterpart code [4].
[1] https://gitlab.com/kubu93/toolchains-builder/-/jobs/205435757
[2] https://github.com/gcc-mirror/gcc/commit/b782636f28f5c378897c238081d28d7a4a6ca578
[3] https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/commit/?id=3b6d086531102b6d09ce852feb1e370d5dca3ce9
[4]
+https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/sparc/sysdep.h;h=981b2a26b7a91093f821c97876
+e55bc4be2d9f8a;hb=HEAD
(cherry picked from commit c2eaf6c30d930b65a8bcf5f912ef8873a6f4eb20)
Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
libc/sysdeps/linux/sparc/bits/syscalls.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libc/sysdeps/linux/sparc/bits/syscalls.h b/libc/sysdeps/linux/sparc/bits/syscalls.h
index 75af7a157..28edc0568 100644
--- a/libc/sysdeps/linux/sparc/bits/syscalls.h
+++ b/libc/sysdeps/linux/sparc/bits/syscalls.h
@@ -33,7 +33,7 @@
register long __g1 __asm__("g1") = sys_num; \
LOAD_ARGS_##nr(args) \
__asm__ __volatile__( __SYSCALL_STRING \
- : "=r" (__res), "=&r" (__o0) \
+ : "=r" (__res), "=r" (__o0) \
: "1" (__o0) ASM_ARGS_##nr, "r" (__g1) \
: __SYSCALL_CLOBBERS ); \
} \
--
2.21.0

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

@@ -0,0 +1,153 @@
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
select BR2_TOOLCHAIN_HAS_THREADS
select BR2_TOOLCHAIN_HAS_THREADS_NPTL
config BR2_PTHREADS
bool "linuxthreads"
depends on BR2_m68k || BR2_microblaze || BR2_or1k || BR2_arm || BR2_armeb || BR2_xtensa
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 "arc" if BR2_arcle || BR2_arceb
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
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 "SH2A" if BR2_sh2a
default "SH4" if BR2_sh4 || BR2_sh4eb
depends on BR2_UCLIBC_TARGET_ARCH = "sh"
config BR2_UCLIBC_SPARC_TYPE
string
default "V7" if BR2_sparc_v7 || BR2_sparc_sparchfleon || BR2_sparc_sparcsfleon
default "V8" if BR2_sparc_v8 || BR2_sparc_sparchfleonv8 || BR2_sparc_sparcsfleonv8
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.31/uClibc-ng-1.0.31.tar.xz.sha256
sha256 2215d7377118434d1697fd575f10d7a6be3f29e460d6b0e1ee9f6f5306288060 uClibc-ng-1.0.31.tar.xz
# Locally calculated
sha256 6095e9ffa777dd22839f7801aa845b31c9ed07f3d6bf8a26dc5d2dec8ccc0ef3 COPYING.LIB

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

@@ -0,0 +1,458 @@
################################################################################
#
# uclibc
#
################################################################################
UCLIBC_VERSION = 1.0.31
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
define UCLIBC_HELP_CMDS
@echo ' uclibc-menuconfig - Run uClibc menuconfig'
endef
# 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.
ifndef UCLIBC_CONFIG_FILE
UCLIBC_CONFIG_FILE = $(call qstrip,$(BR2_UCLIBC_CONFIG))
endif
UCLIBC_KCONFIG_FILE = $(UCLIBC_CONFIG_FILE)
UCLIBC_KCONFIG_FRAGMENT_FILES = $(call qstrip,$(BR2_UCLIBC_CONFIG_FRAGMENT_FILES))
UCLIBC_KCONFIG_OPTS = \
$(UCLIBC_MAKE_FLAGS) \
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_FLAT_ONE),y)
define UCLIBC_BINFMT_CONFIG
$(call KCONFIG_ENABLE_OPT,UCLIBC_FORMAT_FLAT,$(@D)/.config)
$(call KCONFIG_DISABLE_OPT,UCLIBC_FORMAT_FLAT_SEP_DATA,$(@D)/.config)
$(call KCONFIG_DISABLE_OPT,UCLIBC_FORMAT_SHARED_FLAT,$(@D)/.config)
$(call KCONFIG_DISABLE_OPT,UCLIBC_FORMAT_FDPIC_ELF,$(@D)/.config)
endef
endif
ifeq ($(BR2_BINFMT_FLAT_SHARED),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_SHARED_FLAT,$(@D)/.config)
$(call KCONFIG_DISABLE_OPT,UCLIBC_FORMAT_FDPIC_ELF,$(@D)/.config)
endef
endif
#
# 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),$(@D)/.config)
endef
ifeq ($(BR2_ARC_ATOMIC_EXT),)
define UCLIBC_ARC_ATOMICS_CONFIG
$(call KCONFIG_DISABLE_OPT,CONFIG_ARC_HAS_ATOMICS,$(@D)/.config)
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,$(@D)/.config)
endef
ifeq ($(BR2_BINFMT_FLAT),y)
define UCLIBC_ARM_BINFMT_FLAT
$(call KCONFIG_DISABLE_OPT,DOPIC,$(@D)/.config)
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,$(@D)/.config)
endef
endif
endif # arm
#
# m68k/coldfire definitions
#
ifeq ($(UCLIBC_TARGET_ARCH),m68k)
# disable DOPIC for flat without separate data
ifeq ($(BR2_BINFMT_FLAT_ONE),y)
define UCLIBC_M68K_BINFMT_FLAT
$(call KCONFIG_DISABLE_OPT,DOPIC,$(@D)/.config)
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),$(@D)/.config)
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),$(@D)/.config)
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),$(@D)/.config)
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),$(@D)/.config)
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,$(@D)/.config)
$(call KCONFIG_DISABLE_OPT,CONFIG_E500,$(@D)/.config)
$(call KCONFIG_ENABLE_OPT,$(UCLIBC_POWERPC_TYPE),$(@D)/.config)
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),$(@D)/.config)
endef
endif
#
# Debug
#
ifeq ($(BR2_ENABLE_DEBUG),y)
define UCLIBC_DEBUG_CONFIG
$(call KCONFIG_ENABLE_OPT,DODEBUG,$(@D)/.config)
endef
endif
#
# Endianness
#
ifeq ($(call qstrip,$(BR2_ENDIAN)),BIG)
define UCLIBC_ENDIAN_CONFIG
$(call KCONFIG_ENABLE_OPT,ARCH_BIG_ENDIAN,$(@D)/.config)
$(call KCONFIG_ENABLE_OPT,ARCH_WANTS_BIG_ENDIAN,$(@D)/.config)
$(call KCONFIG_DISABLE_OPT,ARCH_LITTLE_ENDIAN,$(@D)/.config)
$(call KCONFIG_DISABLE_OPT,ARCH_WANTS_LITTLE_ENDIAN,$(@D)/.config)
endef
else
define UCLIBC_ENDIAN_CONFIG
$(call KCONFIG_ENABLE_OPT,ARCH_LITTLE_ENDIAN,$(@D)/.config)
$(call KCONFIG_ENABLE_OPT,ARCH_WANTS_LITTLE_ENDIAN,$(@D)/.config)
$(call KCONFIG_DISABLE_OPT,ARCH_BIG_ENDIAN,$(@D)/.config)
$(call KCONFIG_DISABLE_OPT,ARCH_WANTS_BIG_ENDIAN,$(@D)/.config)
endef
endif
#
# MMU
#
ifeq ($(BR2_USE_MMU),y)
define UCLIBC_MMU_CONFIG
$(call KCONFIG_ENABLE_OPT,ARCH_HAS_MMU,$(@D)/.config)
$(call KCONFIG_ENABLE_OPT,ARCH_USE_MMU,$(@D)/.config)
endef
else
define UCLIBC_MMU_CONFIG
$(call KCONFIG_DISABLE_OPT,ARCH_HAS_MMU,$(@D)/.config)
$(call KCONFIG_DISABLE_OPT,ARCH_USE_MMU,$(@D)/.config)
endef
endif
#
# IPv6
#
UCLIBC_IPV6_CONFIG = $(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_IPV6,$(@D)/.config)
#
# soft-float
#
ifeq ($(BR2_SOFT_FLOAT),y)
define UCLIBC_FLOAT_CONFIG
$(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_FPU,$(@D)/.config)
$(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_FLOATS,$(@D)/.config)
$(call KCONFIG_ENABLE_OPT,DO_C99_MATH,$(@D)/.config)
endef
else
define UCLIBC_FLOAT_CONFIG
$(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_FPU,$(@D)/.config)
$(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_FLOATS,$(@D)/.config)
endef
endif
#
# SSP
#
ifeq ($(BR2_TOOLCHAIN_BUILDROOT_USE_SSP),y)
define UCLIBC_SSP_CONFIG
$(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_SSP,$(@D)/.config)
$(call KCONFIG_ENABLE_OPT,UCLIBC_BUILD_SSP,$(@D)/.config)
endef
else
define UCLIBC_SSP_CONFIG
$(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_SSP,$(@D)/.config)
$(call KCONFIG_DISABLE_OPT,UCLIBC_BUILD_SSP,$(@D)/.config)
endef
endif
#
# Threads
#
ifeq ($(BR2_PTHREADS_NONE),y)
define UCLIBC_THREAD_CONFIG
$(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_THREADS,$(@D)/.config)
$(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_LINUXTHREADS,$(@D)/.config)
$(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_THREADS_NATIVE,$(@D)/.config)
endef
else ifeq ($(BR2_PTHREADS),y)
define UCLIBC_THREAD_CONFIG
$(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_THREADS,$(@D)/.config)
$(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_LINUXTHREADS,$(@D)/.config)
$(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_THREADS_NATIVE,$(@D)/.config)
endef
else ifeq ($(BR2_PTHREADS_NATIVE),y)
define UCLIBC_THREAD_CONFIG
$(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_THREADS,$(@D)/.config)
$(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_LINUXTHREADS,$(@D)/.config)
$(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_THREADS_NATIVE,$(@D)/.config)
endef
endif
#
# Thread debug
#
ifeq ($(BR2_PTHREAD_DEBUG),y)
UCLIBC_THREAD_DEBUG_CONFIG = $(call KCONFIG_ENABLE_OPT,PTHREADS_DEBUG_SUPPORT,$(@D)/.config)
else
UCLIBC_THREAD_DEBUG_CONFIG = $(call KCONFIG_DISABLE_OPT,PTHREADS_DEBUG_SUPPORT,$(@D)/.config)
endif
#
# Locale
#
ifeq ($(BR2_TOOLCHAIN_BUILDROOT_LOCALE),y)
define UCLIBC_LOCALE_CONFIG
$(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_LOCALE,$(@D)/.config)
$(call KCONFIG_DISABLE_OPT,UCLIBC_BUILD_ALL_LOCALE,$(@D)/.config)
$(call KCONFIG_ENABLE_OPT,UCLIBC_BUILD_MINIMAL_LOCALE,$(@D)/.config)
$(call KCONFIG_SET_OPT,UCLIBC_BUILD_MINIMAL_LOCALES,"$(UCLIBC_LOCALES)",$(@D)/.config)
$(call KCONFIG_DISABLE_OPT,UCLIBC_PREGENERATED_LOCALE_DATA,$(@D)/.config)
$(call KCONFIG_DISABLE_OPT,DOWNLOAD_PREGENERATED_LOCALE_DATA,$(@D)/.config)
$(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_XLOCALE,$(@D)/.config)
$(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_GLIBC_DIGIT_GROUPING,$(@D)/.config)
endef
else
define UCLIBC_LOCALE_CONFIG
$(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_LOCALE,$(@D)/.config)
endef
endif
#
# wchar
#
ifeq ($(BR2_TOOLCHAIN_BUILDROOT_WCHAR),y)
UCLIBC_WCHAR_CONFIG = $(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_WCHAR,$(@D)/.config)
else
UCLIBC_WCHAR_CONFIG = $(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_WCHAR,$(@D)/.config)
endif
#
# static/shared libs
#
ifeq ($(BR2_STATIC_LIBS),y)
UCLIBC_SHARED_LIBS_CONFIG = $(call KCONFIG_DISABLE_OPT,HAVE_SHARED,$(@D)/.config)
else
UCLIBC_SHARED_LIBS_CONFIG = $(call KCONFIG_ENABLE_OPT,HAVE_SHARED,$(@D)/.config)
endif
#
# Commands
#
UCLIBC_MAKE_FLAGS = \
ARCH="$(UCLIBC_TARGET_ARCH)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
UCLIBC_EXTRA_CFLAGS="$(TARGET_ABI)" \
HOSTCC="$(HOSTCC)"
define UCLIBC_KCONFIG_FIXUP_CMDS
$(call KCONFIG_SET_OPT,CROSS_COMPILER_PREFIX,"$(TARGET_CROSS)",$(@D)/.config)
$(call KCONFIG_ENABLE_OPT,TARGET_$(UCLIBC_TARGET_ARCH),$(@D)/.config)
$(call KCONFIG_SET_OPT,TARGET_ARCH,"$(UCLIBC_TARGET_ARCH)",$(@D)/.config)
$(call KCONFIG_SET_OPT,KERNEL_HEADERS,"$(LINUX_HEADERS_DIR)/usr/include",$(@D)/.config)
$(call KCONFIG_SET_OPT,RUNTIME_PREFIX,"/",$(@D)/.config)
$(call KCONFIG_SET_OPT,DEVEL_PREFIX,"/usr",$(@D)/.config)
$(call KCONFIG_SET_OPT,SHARED_LIB_LOADER_PREFIX,"/lib",$(@D)/.config)
$(UCLIBC_MMU_CONFIG)
$(UCLIBC_BINFMT_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_LARGEFILE_CONFIG)
$(UCLIBC_IPV6_CONFIG)
$(UCLIBC_FLOAT_CONFIG)
$(UCLIBC_SSP_CONFIG)
$(UCLIBC_THREAD_CONFIG)
$(UCLIBC_THREAD_DEBUG_CONFIG)
$(UCLIBC_LOCALE_CONFIG)
$(UCLIBC_WCHAR_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
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_UTILS_STAGING
$(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_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))