forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge bitcoin#22365: guix: Avoid relying on newer symbols by rebasing…
… our cross toolchains on older glibcs 647f7e5 guix: Also sort SHA256SUMS.part (Carl Dong) dc4137a guix: Build depends/qt with our platform definition (Carl Dong) 16b0a93 guix: Rebase toolchain on glibc 2.24 (2.27 for riscv64) (Carl Dong) Pull request description: After this PR, we'll have the following: - riscv64 -> build with a toolchain targeting glibc 2.27 - everything else -> builds with a toolchain targeting glibc 2.24, but will not have symbols > 2.17 (checked by `symbol-check.py`) ACKs for top commit: achow101: reACK 647f7e5 hebasto: ACK 647f7e5 MarcoFalke: review ACK 647f7e5 fanquake: ACK 647f7e5 - documentation can be fixed shortly. Tree-SHA512: ddff57a5d7c053687b0a273720d4ad7d28c6fc8816226d4304869284d017af5e3630d4b57565d91e74f2e1b7583c9c83ee8b2e5e70e41d619ab618e602c97a94
- Loading branch information
Showing
8 changed files
with
522 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
contrib/guix/patches/glibc-2.24-elfm-loadaddr-dynamic-rewrite.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
commit 6b02af31e9a721bb15a11380cd22d53b621711f8 | ||
Author: Szabolcs Nagy <[email protected]> | ||
Date: Wed Oct 18 17:26:23 2017 +0100 | ||
|
||
[AARCH64] Rewrite elf_machine_load_address using _DYNAMIC symbol | ||
|
||
This patch rewrites aarch64 elf_machine_load_address to use special _DYNAMIC | ||
symbol instead of _dl_start. | ||
|
||
The static address of _DYNAMIC symbol is stored in the first GOT entry. | ||
Here is the change which makes this solution work (part of binutils 2.24): | ||
https://sourceware.org/ml/binutils/2013-06/msg00248.html | ||
|
||
i386, x86_64 targets use the same method to do this as well. | ||
|
||
The original implementation relies on a trick that R_AARCH64_ABS32 relocation | ||
being resolved at link time and the static address fits in the 32bits. | ||
However, in LP64, normally, the address is defined to be 64 bit. | ||
|
||
Here is the C version one which should be portable in all cases. | ||
|
||
* sysdeps/aarch64/dl-machine.h (elf_machine_load_address): Use | ||
_DYNAMIC symbol to calculate load address. | ||
|
||
diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h | ||
index e86d8b5b63..5a5b8a5de5 100644 | ||
--- a/sysdeps/aarch64/dl-machine.h | ||
+++ b/sysdeps/aarch64/dl-machine.h | ||
@@ -49,26 +49,11 @@ elf_machine_load_address (void) | ||
/* To figure out the load address we use the definition that for any symbol: | ||
dynamic_addr(symbol) = static_addr(symbol) + load_addr | ||
|
||
- The choice of symbol is arbitrary. The static address we obtain | ||
- by constructing a non GOT reference to the symbol, the dynamic | ||
- address of the symbol we compute using adrp/add to compute the | ||
- symbol's address relative to the PC. | ||
- This depends on 32bit relocations being resolved at link time | ||
- and that the static address fits in the 32bits. */ | ||
- | ||
- ElfW(Addr) static_addr; | ||
- ElfW(Addr) dynamic_addr; | ||
- | ||
- asm (" \n" | ||
-" adrp %1, _dl_start; \n" | ||
-" add %1, %1, #:lo12:_dl_start \n" | ||
-" ldr %w0, 1f \n" | ||
-" b 2f \n" | ||
-"1: \n" | ||
-" .word _dl_start \n" | ||
-"2: \n" | ||
- : "=r" (static_addr), "=r" (dynamic_addr)); | ||
- return dynamic_addr - static_addr; | ||
+ _DYNAMIC sysmbol is used here as its link-time address stored in | ||
+ the special unrelocated first GOT entry. */ | ||
+ | ||
+ extern ElfW(Dyn) _DYNAMIC[] attribute_hidden; | ||
+ return (ElfW(Addr)) &_DYNAMIC - elf_machine_dynamic (); | ||
} | ||
|
||
/* Set up the loaded object described by L so its unrelocated PLT |
98 changes: 98 additions & 0 deletions
98
contrib/guix/patches/glibc-2.24-no-build-time-cxx-header-run.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
commit dc23a45db566095e83ff0b7a57afc87fb5ca89a1 | ||
Author: Florian Weimer <[email protected]> | ||
Date: Wed Sep 21 10:45:32 2016 +0200 | ||
|
||
Avoid running $(CXX) during build to obtain header file paths | ||
|
||
This reduces the build time somewhat and is particularly noticeable | ||
during rebuilds with few code changes. | ||
|
||
diff --git a/Makerules b/Makerules | ||
index 7e4077ee50..c338850de5 100644 | ||
--- a/Makerules | ||
+++ b/Makerules | ||
@@ -121,14 +121,10 @@ ifneq (,$(CXX)) | ||
# will be used instead of /usr/include/stdlib.h and /usr/include/math.h. | ||
before-compile := $(common-objpfx)cstdlib $(common-objpfx)cmath \ | ||
$(before-compile) | ||
-cstdlib=$(shell echo "\#include <cstdlib>" | $(CXX) -M -MP -x c++ - \ | ||
- | sed -n "/cstdlib:/{s/:$$//;p}") | ||
-$(common-objpfx)cstdlib: $(cstdlib) | ||
+$(common-objpfx)cstdlib: $(c++-cstdlib-header) | ||
$(INSTALL_DATA) $< $@T | ||
$(move-if-change) $@T $@ | ||
-cmath=$(shell echo "\#include <cmath>" | $(CXX) -M -MP -x c++ - \ | ||
- | sed -n "/cmath:/{s/:$$//;p}") | ||
-$(common-objpfx)cmath: $(cmath) | ||
+$(common-objpfx)cmath: $(c++-cmath-header) | ||
$(INSTALL_DATA) $< $@T | ||
$(move-if-change) $@T $@ | ||
endif | ||
diff --git a/config.make.in b/config.make.in | ||
index 95c6f36876..04a8b3ed7f 100644 | ||
--- a/config.make.in | ||
+++ b/config.make.in | ||
@@ -45,6 +45,8 @@ defines = @DEFINES@ | ||
sysheaders = @sysheaders@ | ||
sysincludes = @SYSINCLUDES@ | ||
c++-sysincludes = @CXX_SYSINCLUDES@ | ||
+c++-cstdlib-header = @CXX_CSTDLIB_HEADER@ | ||
+c++-cmath-header = @CXX_CMATH_HEADER@ | ||
all-warnings = @all_warnings@ | ||
enable-werror = @enable_werror@ | ||
|
||
diff --git a/configure b/configure | ||
index 17625e1041..6ff252744b 100755 | ||
--- a/configure | ||
+++ b/configure | ||
@@ -635,6 +635,8 @@ BISON | ||
INSTALL_INFO | ||
PERL | ||
BASH_SHELL | ||
+CXX_CMATH_HEADER | ||
+CXX_CSTDLIB_HEADER | ||
CXX_SYSINCLUDES | ||
SYSINCLUDES | ||
AUTOCONF | ||
@@ -5054,6 +5056,18 @@ fi | ||
|
||
|
||
|
||
+# Obtain some C++ header file paths. This is used to make a local | ||
+# copy of those headers in Makerules. | ||
+if test -n "$CXX"; then | ||
+ find_cxx_header () { | ||
+ echo "#include <$1>" | $CXX -M -MP -x c++ - | sed -n "/$1:/{s/:\$//;p}" | ||
+ } | ||
+ CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)" | ||
+ CXX_CMATH_HEADER="$(find_cxx_header cmath)" | ||
+fi | ||
+ | ||
+ | ||
+ | ||
# Test if LD_LIBRARY_PATH contains the notation for the current directory | ||
# since this would lead to problems installing/building glibc. | ||
# LD_LIBRARY_PATH contains the current directory if one of the following | ||
diff --git a/configure.ac b/configure.ac | ||
index 33bcd62180..9938ab0dc2 100644 | ||
--- a/configure.ac | ||
+++ b/configure.ac | ||
@@ -1039,6 +1039,18 @@ fi | ||
AC_SUBST(SYSINCLUDES) | ||
AC_SUBST(CXX_SYSINCLUDES) | ||
|
||
+# Obtain some C++ header file paths. This is used to make a local | ||
+# copy of those headers in Makerules. | ||
+if test -n "$CXX"; then | ||
+ find_cxx_header () { | ||
+ echo "#include <$1>" | $CXX -M -MP -x c++ - | sed -n "/$1:/{s/:\$//;p}" | ||
+ } | ||
+ CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)" | ||
+ CXX_CMATH_HEADER="$(find_cxx_header cmath)" | ||
+fi | ||
+AC_SUBST(CXX_CSTDLIB_HEADER) | ||
+AC_SUBST(CXX_CMATH_HEADER) | ||
+ | ||
# Test if LD_LIBRARY_PATH contains the notation for the current directory | ||
# since this would lead to problems installing/building glibc. | ||
# LD_LIBRARY_PATH contains the current directory if one of the following |
70 changes: 70 additions & 0 deletions
70
contrib/guix/patches/glibc-2.27-riscv64-Use-__has_include__-to-include-asm-syscalls.h.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
From 562c52cc81a4e456a62e6455feb32732049e9070 Mon Sep 17 00:00:00 2001 | ||
From: "H.J. Lu" <[email protected]> | ||
Date: Mon, 31 Dec 2018 09:26:42 -0800 | ||
Subject: [PATCH] riscv: Use __has_include__ to include <asm/syscalls.h> [BZ | ||
#24022] | ||
|
||
<asm/syscalls.h> has been removed by | ||
|
||
commit 27f8899d6002e11a6e2d995e29b8deab5aa9cc25 | ||
Author: David Abdurachmanov <[email protected]> | ||
Date: Thu Nov 8 20:02:39 2018 +0100 | ||
|
||
riscv: add asm/unistd.h UAPI header | ||
|
||
Marcin Juszkiewicz reported issues while generating syscall table for riscv | ||
using 4.20-rc1. The patch refactors our unistd.h files to match some other | ||
architectures. | ||
|
||
- Add asm/unistd.h UAPI header, which has __ARCH_WANT_NEW_STAT only for 64-bit | ||
- Remove asm/syscalls.h UAPI header and merge to asm/unistd.h | ||
- Adjust kernel asm/unistd.h | ||
|
||
So now asm/unistd.h UAPI header should show all syscalls for riscv. | ||
|
||
<asm/syscalls.h> may be restored by | ||
|
||
Subject: [PATCH] riscv: restore asm/syscalls.h UAPI header | ||
Date: Tue, 11 Dec 2018 09:09:35 +0100 | ||
|
||
UAPI header asm/syscalls.h was merged into UAPI asm/unistd.h header, | ||
which did resolve issue with missing syscalls macros resulting in | ||
glibc (2.28) build failure. It also broke glibc in a different way: | ||
asm/syscalls.h is being used by glibc. I noticed this while doing | ||
Fedora 30/Rawhide mass rebuild. | ||
|
||
The patch returns asm/syscalls.h header and incl. it into asm/unistd.h. | ||
I plan to send a patch to glibc to use asm/unistd.h instead of | ||
asm/syscalls.h | ||
|
||
In the meantime, we use __has_include__, which was added to GCC 5, to | ||
check if <asm/syscalls.h> exists before including it. Tested with | ||
build-many-glibcs.py for riscv against kernel 4.19.12 and 4.20-rc7. | ||
|
||
[BZ #24022] | ||
* sysdeps/unix/sysv/linux/riscv/flush-icache.c: Check if | ||
<asm/syscalls.h> exists with __has_include__ before including it. | ||
--- | ||
sysdeps/unix/sysv/linux/riscv/flush-icache.c | 6 +++++- | ||
1 file changed, 5 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/sysdeps/unix/sysv/linux/riscv/flush-icache.c b/sysdeps/unix/sysv/linux/riscv/flush-icache.c | ||
index d612ef4c6c..0b2042620b 100644 | ||
--- a/sysdeps/unix/sysv/linux/riscv/flush-icache.c | ||
+++ b/sysdeps/unix/sysv/linux/riscv/flush-icache.c | ||
@@ -21,7 +21,11 @@ | ||
#include <stdlib.h> | ||
#include <atomic.h> | ||
#include <sys/cachectl.h> | ||
-#include <asm/syscalls.h> | ||
+#if __has_include__ (<asm/syscalls.h>) | ||
+# include <asm/syscalls.h> | ||
+#else | ||
+# include <asm/unistd.h> | ||
+#endif | ||
|
||
typedef int (*func_type) (void *, void *, unsigned long int); | ||
|
||
-- | ||
2.31.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
By default, 'RTDLLIST' in 'ldd' refers to 'lib64/ld-linux-x86-64.so', whereas | ||
it's in 'lib/' for us. This patch fixes that. | ||
|
||
--- glibc-2.17/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed 2012-12-25 04:02:13.000000000 +0100 | ||
+++ glibc-2.17/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed 2013-09-15 23:08:03.000000000 +0200 | ||
@@ -1,3 +1,3 @@ | ||
/LD_TRACE_LOADED_OBJECTS=1/a\ | ||
add_env="$add_env LD_LIBRARY_VERSION=\\$verify_out" | ||
-s_^\(RTLDLIST=\)\(.*lib\)\(\|64\|x32\)\(/[^/]*\)\(-x86-64\|-x32\)\(\.so\.[0-9.]*\)[ ]*$_\1"\2\4\6 \264\4-x86-64\6 \2x32\4-x32\6"_ | ||
+s_^\(RTLDLIST=\)\(.*lib\)\(\|64\|x32\)\(/[^/]*\)\(-x86-64\|-x32\)\(\.so\.[0-9.]*\)[ ]*$_\1"\2\4\6 \2\4-x86-64\6 \2x32\4-x32\6"_ |
Oops, something went wrong.