Skip to content

Commit 0c789ef

Browse files
authored
Merge pull request #393 from lauromoura/ubuntu-21.10-buildfix
Ubuntu 21.10 buildfix
2 parents 5a1c250 + 25a3754 commit 0c789ef

6 files changed

+379
-1
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
From 03bc0ee07fb6e293d081ffd8af1654788b434f6a Mon Sep 17 00:00:00 2001
2+
From: Ilya Lipnitskiy <[email protected]>
3+
Date: Thu, 11 Feb 2021 20:59:25 -0800
4+
Subject: [PATCH] libfakeroot.c: define _STAT_VER if not already defined
5+
MIME-Version: 1.0
6+
Content-Type: text/plain; charset=UTF-8
7+
Content-Transfer-Encoding: 8bit
8+
9+
glibc 2.33 does does declare `_STAT_VER` anymore.
10+
11+
Based on patch from Jan Pazdziora:
12+
https://lists.fedoraproject.org/archives/list/[email protected]/message/SMQ3RYXEYTVZH6PLQMKNB3NM4XLPMNZO/
13+
14+
Backported from: feda578ca3608b7fc9a28a3a91293611c0ef47b7
15+
16+
Signed-off-by: Ilya Lipnitskiy <[email protected]>
17+
Signed-off-by: Jörg Krause <[email protected]>
18+
---
19+
libfakeroot.c | 10 ++++++++++
20+
1 file changed, 10 insertions(+)
21+
22+
diff --git a/libfakeroot.c b/libfakeroot.c
23+
index 3e80e38..14cdbc4 100644
24+
--- a/libfakeroot.c
25+
+++ b/libfakeroot.c
26+
@@ -90,6 +90,16 @@
27+
#define SEND_GET_XATTR64(a,b,c) send_get_xattr64(a,b)
28+
#endif
29+
30+
+#ifndef _STAT_VER
31+
+ #if defined (__aarch64__)
32+
+ #define _STAT_VER 0
33+
+ #elif defined (__x86_64__)
34+
+ #define _STAT_VER 1
35+
+ #else
36+
+ #define _STAT_VER 3
37+
+ #endif
38+
+#endif
39+
+
40+
/*
41+
These INT_* (which stands for internal) macros should always be used when
42+
the fakeroot library owns the storage of the stat variable.
43+
--
44+
2.30.1
45+
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
From feda578ca3608b7fc9a28a3a91293611c0ef47b7 Mon Sep 17 00:00:00 2001
2+
From: Ilya Lipnitskiy <[email protected]>
3+
Date: Thu, 11 Feb 2021 21:00:04 -0800
4+
Subject: [PATCH] libfakeroot.c: add wrappers for new glibc 2.33+ symbols
5+
MIME-Version: 1.0
6+
Content-Type: text/plain; charset=UTF-8
7+
Content-Transfer-Encoding: 8bit
8+
9+
This patch add wrappers for newly exported symbols in glibc 2.33.
10+
11+
Backported from: feda578ca3608b7fc9a28a3a91293611c0ef47b7
12+
13+
Signed-off-by: Ilya Lipnitskiy <[email protected]>
14+
Signed-off-by: Jörg Krause <[email protected]>
15+
---
16+
libfakeroot.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
17+
1 file changed, 48 insertions(+)
18+
19+
diff --git a/libfakeroot.c b/libfakeroot.c
20+
index 14cdbc4..d75c51f 100644
21+
--- a/libfakeroot.c
22+
+++ b/libfakeroot.c
23+
@@ -1352,6 +1352,54 @@ int renameat(int olddir_fd, const char *oldpath,
24+
#endif /* HAVE_FSTATAT */
25+
26+
27+
+#if defined(__GLIBC__) && __GLIBC_PREREQ(2,33)
28+
+/* Glibc 2.33 exports symbols for these functions in the shared lib */
29+
+ int lstat(const char *file_name, struct stat *statbuf) {
30+
+ return WRAP_LSTAT LSTAT_ARG(_STAT_VER, file_name, statbuf);
31+
+ }
32+
+ int stat(const char *file_name, struct stat *st) {
33+
+ return WRAP_STAT STAT_ARG(_STAT_VER, file_name, st);
34+
+ }
35+
+ int fstat(int fd, struct stat *st) {
36+
+ return WRAP_FSTAT FSTAT_ARG(_STAT_VER, fd, st);
37+
+ }
38+
+
39+
+ #ifdef HAVE_FSTATAT
40+
+ int fstatat(int dir_fd, const char *path, struct stat *st, int flags) {
41+
+ return WRAP_FSTATAT FSTATAT_ARG(_STAT_VER, dir_fd, path, st, flags);
42+
+ }
43+
+ #endif
44+
+
45+
+ #ifdef STAT64_SUPPORT
46+
+ int lstat64(const char *file_name, struct stat64 *st) {
47+
+ return WRAP_LSTAT64 LSTAT64_ARG(_STAT_VER, file_name, st);
48+
+ }
49+
+ int stat64(const char *file_name, struct stat64 *st) {
50+
+ return WRAP_STAT64 STAT64_ARG(_STAT_VER, file_name, st);
51+
+ }
52+
+ int fstat64(int fd, struct stat64 *st) {
53+
+ return WRAP_FSTAT64 FSTAT64_ARG(_STAT_VER, fd, st);
54+
+ }
55+
+
56+
+ #ifdef HAVE_FSTATAT
57+
+ int fstatat64(int dir_fd, const char *path, struct stat64 *st, int flags) {
58+
+ return WRAP_FSTATAT64 FSTATAT64_ARG(_STAT_VER, dir_fd, path, st, flags);
59+
+ }
60+
+ #endif
61+
+ #endif
62+
+
63+
+ int mknod(const char *pathname, mode_t mode, dev_t dev) {
64+
+ return WRAP_MKNOD MKNOD_ARG(_STAT_VER, pathname, mode, &dev);
65+
+ }
66+
+
67+
+ #if defined(HAVE_FSTATAT) && defined(HAVE_MKNODAT)
68+
+ int mknodat(int dir_fd, const char *pathname, mode_t mode, dev_t dev) {
69+
+ return WRAP_MKNODAT MKNODAT_ARG(_STAT_VER, dir_fd, pathname, mode, &dev);
70+
+ }
71+
+ #endif
72+
+#endif /* GLIBC_PREREQ */
73+
+
74+
+
75+
#ifdef FAKEROOT_FAKENET
76+
pid_t fork(void)
77+
{
78+
--
79+
2.30.1
80+
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
From 432dd46e662772020306a2ce8b1be38321697e69 Mon Sep 17 00:00:00 2001
2+
From: Ilya Lipnitskiy <[email protected]>
3+
Date: Sat, 13 Feb 2021 19:32:08 -0800
4+
Subject: [PATCH] configure.ac: fix __xmknod{,at} pointer argument
5+
MIME-Version: 1.0
6+
Content-Type: text/plain; charset=UTF-8
7+
Content-Transfer-Encoding: 8bit
8+
9+
Switch default to assume * and not the absence of *.
10+
11+
On glibc 2.33+, there is no definition for these functions in header
12+
files, so the compile test doesn't work. But, we can default to using
13+
the pointer (as is the case with newer glibc), and use the header file
14+
on older platforms to fail the test and use no pointer.
15+
16+
Backported from: c3eebec293e35b997bb46c22fb5a4e114afb5e7f
17+
18+
Signed-off-by: Ilya Lipnitskiy <[email protected]>
19+
Signed-off-by: Jörg Krause <[email protected]>
20+
---
21+
configure.ac | 16 ++++++++--------
22+
1 file changed, 8 insertions(+), 8 deletions(-)
23+
24+
diff --git a/configure.ac b/configure.ac
25+
index 73415d2..d85566f 100644
26+
--- a/configure.ac
27+
+++ b/configure.ac
28+
@@ -183,13 +183,13 @@ AC_MSG_CHECKING([for type of arg of __xmknod])
29+
]], [[
30+
int __xmknod ( int ver,
31+
const char *pathname ,
32+
- mode_t mode , dev_t dev);
33+
+ mode_t mode , dev_t *dev);
34+
]])],[
35+
- AC_DEFINE(XMKNOD_FRTH_ARG,)
36+
- AC_MSG_RESULT([no extra *])
37+
- ],[
38+
AC_DEFINE(XMKNOD_FRTH_ARG,[*])
39+
AC_MSG_RESULT([needs *])
40+
+ ],[
41+
+ AC_DEFINE(XMKNOD_FRTH_ARG,)
42+
+ AC_MSG_RESULT([no extra *])
43+
44+
])
45+
46+
@@ -210,13 +210,13 @@ AC_MSG_CHECKING([for type of arg of __xmknodat])
47+
int __xmknodat ( int ver,
48+
int dirfd,
49+
const char *pathname ,
50+
- mode_t mode , dev_t dev);
51+
+ mode_t mode , dev_t *dev);
52+
]])],[
53+
- AC_DEFINE(XMKNODAT_FIFTH_ARG,)
54+
- AC_MSG_RESULT([no extra *])
55+
- ],[
56+
AC_DEFINE(XMKNODAT_FIFTH_ARG,[*])
57+
AC_MSG_RESULT([needs *])
58+
+ ],[
59+
+ AC_DEFINE(XMKNODAT_FIFTH_ARG,)
60+
+ AC_MSG_RESULT([no extra *])
61+
62+
])
63+
64+
--
65+
2.30.1
66+

package/fakeroot/fakeroot.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ HOST_FAKEROOT_DEPENDENCIES = host-acl
1515
HOST_FAKEROOT_CONF_ENV = \
1616
ac_cv_header_sys_capability_h=no \
1717
ac_cv_func_capset=no
18-
# 0003-Select-TCP-when-lack-of-SYSV-IPC.patch touches configure.ac
18+
# patching configure.ac in patch 0003
1919
HOST_FAKEROOT_AUTORECONF = YES
2020
FAKEROOT_LICENSE = GPL-3.0+
2121
FAKEROOT_LICENSE_FILES = COPYING
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
From 811c8d628045c3d248144fc560a4bf80209ca16e Mon Sep 17 00:00:00 2001
2+
From: Romain Naour <[email protected]>
3+
Date: Thu, 21 May 2020 15:58:02 +0200
4+
Subject: [PATCH] gcc/Makefile.in: move SELFTEST_DEPS before including language
5+
makefile fragments
6+
7+
As reported by several Buildroot users [1][2][3], the gcc build
8+
may fail while running selftests makefile target.
9+
10+
The problem only occurs when ccache is used with gcc 9 and 10,
11+
probably due to a race condition.
12+
13+
While debuging with "make -p" we can notice that s-selftest-c target
14+
contain only "cc1" as dependency instead of cc1 and SELFTEST_DEPS [4].
15+
16+
s-selftest-c: cc1
17+
18+
While the build is failing, the s-selftest-c dependencies recipe is
19+
still running and reported as a bug by make.
20+
21+
"Dependencies recipe running (THIS IS A BUG)."
22+
23+
A change [5] in gcc 9 seems to introduce the problem since we can't
24+
reproduce this problem with gcc 8.
25+
26+
As suggested by Yann E. MORIN [6], move SELFTEST_DEPS before
27+
including language makefile fragments.
28+
29+
With the fix applied, the s-seltest-c dependency contains
30+
SELFTEST_DEPS value.
31+
32+
s-selftest-c: cc1 xgcc specs stmp-int-hdrs ../../gcc/testsuite/selftests
33+
34+
[1] http://lists.busybox.net/pipermail/buildroot/2020-May/282171.html
35+
[2] http://lists.busybox.net/pipermail/buildroot/2020-May/282766.html
36+
[3] https://github.com/cirosantilli/linux-kernel-module-cheat/issues/108
37+
[4] https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/c/Make-lang.in;h=bfae6fd2549c4f728816cd355fa9739dcc08fcde;hb=033eb5671769a4c681a44aad08a454e667e08502#l120
38+
[5] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=033eb5671769a4c681a44aad08a454e667e08502
39+
[6] http://lists.busybox.net/pipermail/buildroot/2020-May/283213.html
40+
41+
Upstream status: https://gcc.gnu.org/pipermail/gcc-patches/2020-May/546248.html
42+
43+
Signed-off-by: Romain Naour <[email protected]>
44+
Cc: Ben Dakin-Norris <[email protected]>
45+
Cc: Maxim Kochetkov <[email protected]>
46+
Cc: Thomas Petazzoni <[email protected]>
47+
Cc: Yann E. MORIN <[email protected]>
48+
Cc: Cc: David Malcolm <[email protected]>
49+
---
50+
This patch should be backported to gcc 10 and gcc 9.
51+
---
52+
gcc/Makefile.in | 6 ++++--
53+
1 file changed, 4 insertions(+), 2 deletions(-)
54+
55+
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
56+
index abae872cd63..e2ef3c46afc 100644
57+
--- a/gcc/Makefile.in
58+
+++ b/gcc/Makefile.in
59+
@@ -1686,6 +1686,10 @@ $(FULL_DRIVER_NAME): ./xgcc
60+
rm -f $@
61+
$(LN_S) $< $@
62+
63+
+# SELFTEST_DEPS need to be set before including language makefile fragments.
64+
+# Otherwise $(SELFTEST_DEPS) is empty when used from various <LANG>/Make-lang.in.
65+
+SELFTEST_DEPS = $(GCC_PASSES) stmp-int-hdrs $(srcdir)/testsuite/selftests
66+
+
67+
#
68+
# Language makefile fragments.
69+
70+
@@ -1950,8 +1954,6 @@ DEVNULL=$(if $(findstring mingw,$(build)),nul,/dev/null)
71+
SELFTEST_FLAGS = -nostdinc $(DEVNULL) -S -o $(DEVNULL) \
72+
-fself-test=$(srcdir)/testsuite/selftests
73+
74+
-SELFTEST_DEPS = $(GCC_PASSES) stmp-int-hdrs $(srcdir)/testsuite/selftests
75+
-
76+
# Run the selftests during the build once we have a driver and the frontend,
77+
# so that self-test failures are caught as early as possible.
78+
# Use "s-selftest-FE" to ensure that we only run the selftests if the
79+
--
80+
2.25.4
81+
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
c-stack: stop using SIGSTKSZ
2+
3+
It’s been proposed to stop making SIGSTKSZ an integer constant:
4+
https://sourceware.org/pipermail/libc-alpha/2020-September/118028.html
5+
Also, using SIGSTKSZ in #if did not conform to current POSIX.
6+
Also, avoiding SIGSTKSZ makes the code simpler and easier to grok.
7+
* lib/c-stack.c (SIGSTKSZ): Remove.
8+
(alternate_signal_stack): Now a 64 KiB array, for simplicity.
9+
All uses changed.
10+
11+
[Retrieved (and backported) from:
12+
https://git.savannah.gnu.org/cgit/gnulib.git/patch/?id=f9e2b20a12a230efa30f1d479563ae07d276a94b]
13+
Signed-off-by: Fabrice Fontaine <[email protected]>
14+
15+
diff -Nura m4-1.4.18.orig/lib/c-stack.c m4-1.4.18/lib/c-stack.c
16+
--- m4-1.4.18.orig/lib/c-stack.c 2021-04-11 19:12:14.086494029 +0200
17+
+++ m4-1.4.18/lib/c-stack.c 2021-04-11 19:48:46.316862760 +0200
18+
@@ -50,15 +50,16 @@
19+
#if ! HAVE_STACK_T && ! defined stack_t
20+
typedef struct sigaltstack stack_t;
21+
#endif
22+
-#ifndef SIGSTKSZ
23+
-# define SIGSTKSZ 16384
24+
-#elif HAVE_LIBSIGSEGV && SIGSTKSZ < 16384
25+
-/* libsigsegv 2.6 through 2.8 have a bug where some architectures use
26+
- more than the Linux default of an 8k alternate stack when deciding
27+
- if a fault was caused by stack overflow. */
28+
-# undef SIGSTKSZ
29+
-# define SIGSTKSZ 16384
30+
-#endif
31+
+
32+
+/* Storage for the alternate signal stack.
33+
+ 64 KiB is not too large for Gnulib-using apps, and is large enough
34+
+ for all known platforms. Smaller sizes may run into trouble.
35+
+ For example, libsigsegv 2.6 through 2.8 have a bug where some
36+
+ architectures use more than the Linux default of an 8 KiB alternate
37+
+ stack when deciding if a fault was caused by stack overflow. */
38+
+static max_align_t alternate_signal_stack[(64 * 1024
39+
+ + sizeof (max_align_t) - 1)
40+
+ / sizeof (max_align_t)];
41+
42+
#include <stdlib.h>
43+
#include <string.h>
44+
@@ -128,19 +129,6 @@
45+
#if (HAVE_SIGALTSTACK && HAVE_DECL_SIGALTSTACK \
46+
&& HAVE_STACK_OVERFLOW_HANDLING) || HAVE_LIBSIGSEGV
47+
48+
-/* Storage for the alternate signal stack. */
49+
-static union
50+
-{
51+
- char buffer[SIGSTKSZ];
52+
-
53+
- /* These other members are for proper alignment. There's no
54+
- standard way to guarantee stack alignment, but this seems enough
55+
- in practice. */
56+
- long double ld;
57+
- long l;
58+
- void *p;
59+
-} alternate_signal_stack;
60+
-
61+
static void
62+
null_action (int signo __attribute__ ((unused)))
63+
{
64+
@@ -205,8 +193,8 @@
65+
66+
/* Always install the overflow handler. */
67+
if (stackoverflow_install_handler (overflow_handler,
68+
- alternate_signal_stack.buffer,
69+
- sizeof alternate_signal_stack.buffer))
70+
+ alternate_signal_stack,
71+
+ sizeof alternate_signal_stack))
72+
{
73+
errno = ENOTSUP;
74+
return -1;
75+
@@ -279,14 +267,14 @@
76+
stack_t st;
77+
struct sigaction act;
78+
st.ss_flags = 0;
79+
+ st.ss_sp = alternate_signal_stack;
80+
+ st.ss_size = sizeof alternate_signal_stack;
81+
# if SIGALTSTACK_SS_REVERSED
82+
/* Irix mistakenly treats ss_sp as the upper bound, rather than
83+
lower bound, of the alternate stack. */
84+
- st.ss_sp = alternate_signal_stack.buffer + SIGSTKSZ - sizeof (void *);
85+
- st.ss_size = sizeof alternate_signal_stack.buffer - sizeof (void *);
86+
-# else
87+
- st.ss_sp = alternate_signal_stack.buffer;
88+
- st.ss_size = sizeof alternate_signal_stack.buffer;
89+
+ st.ss_size -= sizeof (void *);
90+
+ char *ss_sp = st.ss_sp;
91+
+ st.ss_sp = ss_sp + st.ss_size;
92+
# endif
93+
r = sigaltstack (&st, NULL);
94+
if (r != 0)
95+
diff -Nura m4-1.4.18.orig/lib/c-stack.h m4-1.4.18/lib/c-stack.h
96+
--- m4-1.4.18.orig/lib/c-stack.h 2021-04-11 19:12:14.098494042 +0200
97+
+++ m4-1.4.18/lib/c-stack.h 2021-04-11 19:17:42.138848378 +0200
98+
@@ -34,7 +34,7 @@
99+
A null ACTION acts like an action that does nothing.
100+
101+
ACTION must be async-signal-safe. ACTION together with its callees
102+
- must not require more than SIGSTKSZ bytes of stack space. Also,
103+
+ must not require more than 64 KiB bytes of stack space. Also,
104+
ACTION should not call longjmp, because this implementation does
105+
not guarantee that it is safe to return to the original stack.
106+

0 commit comments

Comments
 (0)