0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-08 10:31:50 -05:00

guix: remove redundant glibc patches

These should only be relevant for a glibc that is built as part of a
Guix system, and should not be required for a glibc that is just being
built to compile our binaries against. A x86_64 linux bitcoind produced
with Guix using master vs this change has no difference. i.e:

```diff
@@ -20311,15 +20311,15 @@
 This is experimental software.
 The source code is available from %s.
 Please contribute if you find %s useful. Visit %s for further information about the software.
 The %s developers
 The Bitcoin Core developers
 <https://bitcoincore.org/>
 Copyright (C) %i-%i
-v25.99.0-gda0bf1d07639b0490791bbd6aec71bbea8aa2aThe %s developer<https://github.com/bitcoin/bitcDistributed under the MIT software license, see the accompanyingThis is experimeThe source code is available froPlease contribute if you find %s useful. Visit %s for further information about Copyright (C) %ibool BCLog::Logger::StartLogging()
+v25.99.0-gd7700d3a26478d9b1648463c188648c7047b1cThe %s developer<https://github.com/bitcoin/bitcDistributed under the MIT software license, see the accompanyingThis is experimeThe source code is available froPlease contribute if you find %s useful. Visit %s for further information about Copyright (C) %ibool BCLog::Logger::StartLogging()
 std::string BCLog::Logger::LogLevelToStr(BCLog::Level) const
 std::string LogCategoryToStr(BCLog::LogFlags)
 void BCLog::Logger::LogPrintStr(const string&, const string&, const string&, int, BCLog::LogFlags, BCLog::Level)
 void BCLog::Logger::ShrinkDebugFile()
 Failed to shrink debug log file: fseek(...) failed
 logging.cpp
 m_buffering
```

```diff
@@ -1505889,15 +1505889,15 @@
 	call   aa3380 <malloc@plt+0xa4edb0>
 	mov    (%rsp),%rdx
 	movdqa 0x465540(%rip),%xmm0
 	mov    %rax,0x7a0559(%rip)
 	lea    0x7a0552(%rip),%rsi
 	lea    0x3957bb(%rip),%rdi
 	mov    %rdx,0x7a0554(%rip)
-	mov    $0x3038,%edx
+	mov    $0x3036,%edx
 	movups %xmm0,(%rax)
 	movdqa 0x465524(%rip),%xmm0
 	mov    %dx,0x30(%rax)
 	mov    0x7a0529(%rip),%rdx
 	movups %xmm0,0x10(%rax)
 	movdqa 0x46551d(%rip),%xmm0
 	movups %xmm0,0x20(%rax)
```

```diff
@@ -37238,17 +37238,17 @@
   0x00b73730 65202573 20646576 656c6f70 65727300 e %s developers.
   0x00b73740 54686520 42697463 6f696e20 436f7265 The Bitcoin Core
   0x00b73750 20646576 656c6f70 65727300 434f5059  developers.COPY
   0x00b73760 494e4700 3c687474 70733a2f 2f626974 ING.<https://bit
   0x00b73770 636f696e 636f7265 2e6f7267 2f3e0043 coincore.org/>.C
   0x00b73780 6f707972 69676874 20284329 2025692d opyright (C) %i-
   0x00b73790 25690053 61746f73 68690000 00000000 %i.Satoshi......
-  0x00b737a0 7632352e 39392e30 2d676461 30626631 v25.99.0-gda0bf1
-  0x00b737b0 64303736 33396230 34393037 39316262 d07639b0490791bb
-  0x00b737c0 64366165 63373162 62656138 61613261 d6aec71bbea8aa2a
+  0x00b737a0 7632352e 39392e30 2d676437 37303064 v25.99.0-gd7700d
+  0x00b737b0 33613236 34373864 39623136 34383436 3a26478d9b164846
+  0x00b737c0 33633138 38363438 63373034 37623163 3c188648c7047b1c
   0x00b737d0 54686520 25732064 6576656c 6f706572 The %s developer
   0x00b737e0 3c687474 70733a2f 2f676974 6875622e <https://github.
   0x00b737f0 636f6d2f 62697463 6f696e2f 62697463 com/bitcoin/bitc
   0x00b73800 44697374 72696275 74656420 756e6465 Distributed unde
   0x00b73810 72207468 65204d49 5420736f 66747761 r the MIT softwa
   0x00b73820 7265206c 6963656e 73652c20 73656520 re license, see
   0x00b73830 74686520 6163636f 6d70616e 79696e67 the accompanying
```

```diff
@@ -1,5 +1,5 @@

 Hex dump of section '.gnu_debuglink':
   0x00000000 62697463 6f696e64 2e646267 00000000 bitcoind.dbg....
-  0x00000010 6b6e8eda                            kn..
+  0x00000010 345cb865                            4\.e
```
This commit is contained in:
fanquake 2023-05-15 17:07:20 +01:00
parent edd2a86445
commit 3cfe366ec3
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1
3 changed files with 1 additions and 253 deletions

View file

@ -559,9 +559,7 @@ inspecting signatures in Mach-O binaries.")
(sha256
(base32
"0azpb9cvnbv25zg8019rqz48h8i2257ngyjg566dlnp74ivrs9vq"))
(patches (search-our-patches "glibc-ldd-x86_64.patch"
"glibc-versioned-locpath.patch"
"glibc-2.27-riscv64-Use-__has_include-to-include-asm-syscalls.h.patch"
(patches (search-our-patches "glibc-2.27-riscv64-Use-__has_include-to-include-asm-syscalls.h.patch"
"glibc-2.27-fcommon.patch"
"glibc-2.27-guix-prefix.patch"))))))

View file

@ -1,10 +0,0 @@
By default, 'RTDLLIST' in 'ldd' refers to 'lib64/ld-linux-x86-64.so', whereas
it's in 'lib/' for us. This patch fixes that.
--- a/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed
+++ b/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed
@@ -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"_

View file

@ -1,240 +0,0 @@
The format of locale data can be incompatible between libc versions, and
loading incompatible data can lead to 'setlocale' returning EINVAL at best
or triggering an assertion failure at worst. See
https://lists.gnu.org/archive/html/guix-devel/2015-09/msg00717.html
for background information.
To address that, this patch changes libc to honor a new 'GUIX_LOCPATH'
variable, and to look for locale data in version-specific sub-directories of
that variable. So, if GUIX_LOCPATH=/foo:/bar, locale data is searched for in
/foo/X.Y and /bar/X.Y, where X.Y is the libc version number.
That way, a single 'GUIX_LOCPATH' setting can work even if different libc
versions coexist on the system.
--- a/locale/newlocale.c
+++ b/locale/newlocale.c
@@ -30,6 +30,7 @@
/* Lock for protecting global data. */
__libc_rwlock_define (extern , __libc_setlocale_lock attribute_hidden)
+extern error_t compute_locale_search_path (char **, size_t *);
/* Use this when we come along an error. */
#define ERROR_RETURN \
@@ -48,7 +49,6 @@ __newlocale (int category_mask, const char *locale, __locale_t base)
__locale_t result_ptr;
char *locale_path;
size_t locale_path_len;
- const char *locpath_var;
int cnt;
size_t names_len;
@@ -102,17 +102,8 @@ __newlocale (int category_mask, const char *locale, __locale_t base)
locale_path = NULL;
locale_path_len = 0;
- locpath_var = getenv ("LOCPATH");
- if (locpath_var != NULL && locpath_var[0] != '\0')
- {
- if (__argz_create_sep (locpath_var, ':',
- &locale_path, &locale_path_len) != 0)
- return NULL;
-
- if (__argz_add_sep (&locale_path, &locale_path_len,
- _nl_default_locale_path, ':') != 0)
- return NULL;
- }
+ if (compute_locale_search_path (&locale_path, &locale_path_len) != 0)
+ return NULL;
/* Get the names for the locales we are interested in. We either
allow a composite name or a single name. */
diff --git a/locale/setlocale.c b/locale/setlocale.c
index ead030d..0c0e314 100644
--- a/locale/setlocale.c
+++ b/locale/setlocale.c
@@ -215,12 +215,65 @@ setdata (int category, struct __locale_data *data)
}
}
+/* Return in *LOCALE_PATH and *LOCALE_PATH_LEN the locale data search path as
+ a colon-separated list. Return ENOMEN on error, zero otherwise. */
+error_t
+compute_locale_search_path (char **locale_path, size_t *locale_path_len)
+{
+ char* guix_locpath_var = getenv ("GUIX_LOCPATH");
+ char *locpath_var = getenv ("LOCPATH");
+
+ if (guix_locpath_var != NULL && guix_locpath_var[0] != '\0')
+ {
+ /* Entries in 'GUIX_LOCPATH' take precedence over 'LOCPATH'. These
+ entries are systematically prefixed with "/X.Y" where "X.Y" is the
+ libc version. */
+ if (__argz_create_sep (guix_locpath_var, ':',
+ locale_path, locale_path_len) != 0
+ || __argz_suffix_entries (locale_path, locale_path_len,
+ "/" VERSION) != 0)
+ goto bail_out;
+ }
+
+ if (locpath_var != NULL && locpath_var[0] != '\0')
+ {
+ char *reg_locale_path = NULL;
+ size_t reg_locale_path_len = 0;
+
+ if (__argz_create_sep (locpath_var, ':',
+ &reg_locale_path, &reg_locale_path_len) != 0)
+ goto bail_out;
+
+ if (__argz_append (locale_path, locale_path_len,
+ reg_locale_path, reg_locale_path_len) != 0)
+ goto bail_out;
+
+ free (reg_locale_path);
+ }
+
+ if (*locale_path != NULL)
+ {
+ /* Append the system default locale directory. */
+ if (__argz_add_sep (locale_path, locale_path_len,
+ _nl_default_locale_path, ':') != 0)
+ goto bail_out;
+ }
+
+ return 0;
+
+ bail_out:
+ free (*locale_path);
+ *locale_path = NULL;
+ *locale_path_len = 0;
+
+ return ENOMEM;
+}
+
char *
setlocale (int category, const char *locale)
{
char *locale_path;
size_t locale_path_len;
- const char *locpath_var;
char *composite;
/* Sanity check for CATEGORY argument. */
@@ -251,17 +304,10 @@ setlocale (int category, const char *locale)
locale_path = NULL;
locale_path_len = 0;
- locpath_var = getenv ("LOCPATH");
- if (locpath_var != NULL && locpath_var[0] != '\0')
+ if (compute_locale_search_path (&locale_path, &locale_path_len) != 0)
{
- if (__argz_create_sep (locpath_var, ':',
- &locale_path, &locale_path_len) != 0
- || __argz_add_sep (&locale_path, &locale_path_len,
- _nl_default_locale_path, ':') != 0)
- {
- __libc_rwlock_unlock (__libc_setlocale_lock);
- return NULL;
- }
+ __libc_rwlock_unlock (__libc_setlocale_lock);
+ return NULL;
}
if (category == LC_ALL)
diff --git a/string/Makefile b/string/Makefile
index 8424a61..f925503 100644
--- a/string/Makefile
+++ b/string/Makefile
@@ -38,7 +38,7 @@ routines := strcat strchr strcmp strcoll strcpy strcspn \
swab strfry memfrob memmem rawmemchr strchrnul \
$(addprefix argz-,append count create ctsep next \
delete extract insert stringify \
- addsep replace) \
+ addsep replace suffix) \
envz basename \
strcoll_l strxfrm_l string-inlines memrchr \
xpg-strerror strerror_l
diff --git a/string/argz-suffix.c b/string/argz-suffix.c
new file mode 100644
index 0000000..505b0f2
--- /dev/null
+++ b/string/argz-suffix.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ludovic Courtès <ludo@gnu.org>.
+
+ 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/>. */
+
+#include <argz.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+error_t
+__argz_suffix_entries (char **argz, size_t *argz_len, const char *suffix)
+
+{
+ size_t suffix_len = strlen (suffix);
+ size_t count = __argz_count (*argz, *argz_len);
+ size_t new_argz_len = *argz_len + count * suffix_len;
+ char *new_argz = malloc (new_argz_len);
+
+ if (new_argz)
+ {
+ char *p = new_argz, *entry;
+
+ for (entry = *argz;
+ entry != NULL;
+ entry = argz_next (*argz, *argz_len, entry))
+ {
+ p = stpcpy (p, entry);
+ p = stpcpy (p, suffix);
+ p++;
+ }
+
+ free (*argz);
+ *argz = new_argz;
+ *argz_len = new_argz_len;
+
+ return 0;
+ }
+ else
+ return ENOMEM;
+}
+weak_alias (__argz_suffix_entries, argz_suffix_entries)
diff --git a/string/argz.h b/string/argz.h
index bb62a31..d276a35 100644
--- a/string/argz.h
+++ b/string/argz.h
@@ -134,6 +134,16 @@ extern error_t argz_replace (char **__restrict __argz,
const char *__restrict __str,
const char *__restrict __with,
unsigned int *__restrict __replace_count);
+
+/* Suffix each entry of ARGZ & ARGZ_LEN with SUFFIX. Return 0 on success,
+ and ENOMEN if memory cannot be allocated. */
+extern error_t __argz_suffix_entries (char **__restrict __argz,
+ size_t *__restrict __argz_len,
+ const char *__restrict __suffix);
+extern error_t argz_suffix_entries (char **__restrict __argz,
+ size_t *__restrict __argz_len,
+ const char *__restrict __suffix);
+
/* Returns the next entry in ARGZ & ARGZ_LEN after ENTRY, or NULL if there
are no more. If entry is NULL, then the first entry is returned. This