Skip to content

Commit

Permalink
Add patches to fix dwarf + duo[x]-static builds on new systems
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <[email protected]>
  • Loading branch information
falkTX committed Nov 3, 2024
1 parent 9f92302 commit 10478f6
Show file tree
Hide file tree
Showing 21 changed files with 1,391 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/bootstrap-minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ jobs:
ubuntu_24_04:
strategy:
matrix:
# platform: [modduo, modduo-debug, , modduox, modduox-debug, , ]
platform: [modduo-new, modduo-new-debug, modduo-static, modduox-new, modduox-new-debug, modduox-static, moddwarf, moddwarf-debug, moddwarf-new, moddwarf-new-debug, generic-aarch64, generic-aarch64-debug, generic-x86_64, generic-x86_64-debug]
# platform: [modduo, modduo-debug, modduo-static, , modduox, modduox-debug, modduox-static, , ]
platform: [modduo-new, modduo-new-debug, modduox-new, modduox-new-debug, moddwarf, moddwarf-debug, moddwarf-new, moddwarf-new-debug, generic-aarch64, generic-aarch64-debug, generic-x86_64, generic-x86_64-debug]
runs-on: ubuntu-latest
container:
image: ubuntu:24.04
Expand Down
4 changes: 4 additions & 0 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,17 @@ if [ ! -f ${TOOLCHAIN_BUILD_DIR}/${CT_NG_VERSION}/configure ]; then
mkdir -p ${TOOLCHAIN_BUILD_DIR}/${CT_NG_VERSION}/patches/gcc/linaro-4.9-2017.01

cp -r ${SOURCE_DIR}/patches/${CT_NG_VERSION}/bin-utils-2.26 ${TOOLCHAIN_BUILD_DIR}/${CT_NG_VERSION}/patches/binutils/2.26
cp -r ${SOURCE_DIR}/patches/${CT_NG_VERSION}/glibc-2.21 ${TOOLCHAIN_BUILD_DIR}/${CT_NG_VERSION}/patches/glibc/2.21
cp ${SOURCE_DIR}/patches/${CT_NG_VERSION}/gcc-4.9.3/*.patch ${TOOLCHAIN_BUILD_DIR}/${CT_NG_VERSION}/patches/gcc/4.9.3/
cp ${SOURCE_DIR}/patches/${CT_NG_VERSION}/gcc-linaro-4.9-2017.01/*.patch ${TOOLCHAIN_BUILD_DIR}/${CT_NG_VERSION}/patches/gcc/linaro-4.9-2017.01/
;;

"crosstool-ng-1.24.0")
patch -d ${TOOLCHAIN_BUILD_DIR}/${CT_NG_VERSION} -p1 -i ${SOURCE_DIR}/patches/${CT_NG_VERSION}/001_linaro-2019.12.patch
patch -d ${TOOLCHAIN_BUILD_DIR}/${CT_NG_VERSION} -p1 -i ${SOURCE_DIR}/patches/${CT_NG_VERSION}/002_linaro-gcc7-selects.patch

cp ${SOURCE_DIR}/patches/${CT_NG_VERSION}/glibc-2.21/*.patch ${TOOLCHAIN_BUILD_DIR}/${CT_NG_VERSION}/packages/glibc/2.21/
cp ${SOURCE_DIR}/patches/${CT_NG_VERSION}/glibc-2.27/*.patch ${TOOLCHAIN_BUILD_DIR}/${CT_NG_VERSION}/packages/glibc/2.27/
;;

"crosstool-ng-1.25.0")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
From df1cf48777fe4cd81ad7fb09ecbe5b31432b7c1c Mon Sep 17 00:00:00 2001
From: Yvan Roux <[email protected]>
Date: Fri, 15 Apr 2016 13:29:26 +0200
Subject: [PATCH] Suppress GCC 6 warning about ambiguous 'else' with
-Wparentheses

---
nis/nis_call.c | 20 +++++++++++---------
stdlib/setenv.c | 24 +++++++++++++-----------
2 files changed, 24 insertions(+), 20 deletions(-)

--- a/nis/nis_call.c
+++ b/nis/nis_call.c
@@ -680,16 +680,18 @@
/* Choose which entry should be evicted from the cache. */
loc = &nis_server_cache[0];
if (*loc != NULL)
- for (i = 1; i < 16; ++i)
- if (nis_server_cache[i] == NULL)
- {
+ {
+ for (i = 1; i < 16; ++i)
+ if (nis_server_cache[i] == NULL)
+ {
+ loc = &nis_server_cache[i];
+ break;
+ }
+ else if ((*loc)->uses > nis_server_cache[i]->uses
+ || ((*loc)->uses == nis_server_cache[i]->uses
+ && (*loc)->expires > nis_server_cache[i]->expires))
loc = &nis_server_cache[i];
- break;
- }
- else if ((*loc)->uses > nis_server_cache[i]->uses
- || ((*loc)->uses == nis_server_cache[i]->uses
- && (*loc)->expires > nis_server_cache[i]->expires))
- loc = &nis_server_cache[i];
+ }
old = *loc;
*loc = new;

--- a/stdlib/setenv.c
+++ b/stdlib/setenv.c
@@ -269,18 +269,20 @@
ep = __environ;
if (ep != NULL)
while (*ep != NULL)
- if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
- {
- /* Found it. Remove this pointer by moving later ones back. */
- char **dp = ep;
+ {
+ if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
+ {
+ /* Found it. Remove this pointer by moving later ones back. */
+ char **dp = ep;

- do
- dp[0] = dp[1];
- while (*dp++);
- /* Continue the loop in case NAME appears again. */
- }
- else
- ++ep;
+ do
+ dp[0] = dp[1];
+ while (*dp++);
+ /* Continue the loop in case NAME appears again. */
+ }
+ else
+ ++ep;
+ }

UNLOCK;

Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
commit 5542236837c5c41435f8282ec92799f480c36f18
Author: Paul Eggert <[email protected]>
Date: Tue Jul 21 22:50:29 2015 -0700

Port the 0x7efe...feff pattern to GCC 6.

See Steve Ellcey's bug report in:
https://sourceware.org/ml/libc-alpha/2015-07/msg00673.html
* string/memrchr.c (MEMRCHR):
* string/rawmemchr.c (RAWMEMCHR):
* string/strchr.c (strchr):
* string/strchrnul.c (STRCHRNUL):
Rewrite code to avoid issues with signed shift overflow.

---
string/memrchr.c | 11 ++---------
string/rawmemchr.c | 11 ++---------
string/strchr.c | 9 ++-------
string/strchrnul.c | 9 ++-------
4 files changed, 8 insertions(+), 32 deletions(-)

--- a/string/memrchr.c
+++ b/string/memrchr.c
@@ -96,15 +96,8 @@

The 1-bits make sure that carries propagate to the next 0-bit.
The 0-bits provide holes for carries to fall into. */
-
- if (sizeof (longword) != 4 && sizeof (longword) != 8)
- abort ();
-
-#if LONG_MAX <= LONG_MAX_32_BITS
- magic_bits = 0x7efefeff;
-#else
- magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
-#endif
+ magic_bits = -1;
+ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;

/* Set up a longword, each of whose bytes is C. */
charmask = c | (c << 8);
--- a/string/rawmemchr.c
+++ b/string/rawmemchr.c
@@ -86,15 +86,8 @@

The 1-bits make sure that carries propagate to the next 0-bit.
The 0-bits provide holes for carries to fall into. */
-
- if (sizeof (longword) != 4 && sizeof (longword) != 8)
- abort ();
-
-#if LONG_MAX <= LONG_MAX_32_BITS
- magic_bits = 0x7efefeff;
-#else
- magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
-#endif
+ magic_bits = -1;
+ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;

/* Set up a longword, each of whose bytes is C. */
charmask = c | (c << 8);
--- a/string/strchr.c
+++ b/string/strchr.c
@@ -60,13 +60,8 @@

The 1-bits make sure that carries propagate to the next 0-bit.
The 0-bits provide holes for carries to fall into. */
- switch (sizeof (longword))
- {
- case 4: magic_bits = 0x7efefeffL; break;
- case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
- default:
- abort ();
- }
+ magic_bits = -1;
+ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;

/* Set up a longword, each of whose bytes is C. */
charmask = c | (c << 8);
--- a/string/strchrnul.c
+++ b/string/strchrnul.c
@@ -66,13 +66,8 @@

The 1-bits make sure that carries propagate to the next 0-bit.
The 0-bits provide holes for carries to fall into. */
- switch (sizeof (longword))
- {
- case 4: magic_bits = 0x7efefeffL; break;
- case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
- default:
- abort ();
- }
+ magic_bits = -1;
+ magic_bits = magic_bits / 0xff * 0xfe << 1 >> 1 | 1;

/* Set up a longword, each of whose bytes is C. */
charmask = c | (c << 8);
Loading

0 comments on commit 10478f6

Please sign in to comment.