Skip to content

Commit b49e4c6

Browse files
egtvedtcpackham
authored andcommitted
binutils: add version 2.44
https://lists.gnu.org/archive/html/info-gnu/2025-02/msg00001.html Add the new version rebasing the patches we carry on top. Drop patches to gold, since this linker has been removed from upstream. Add a new Kconfig entry that removes visibility of enabling gold linker when selecting binutils version >= 2.44. Signed-off-by: Hans-Christian Noren Egtvedt <egtvedt@samfundet.no>
1 parent 179fe2d commit b49e4c6

File tree

10 files changed

+569
-2
lines changed

10 files changed

+569
-2
lines changed

config/binutils/binutils.in

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,16 @@ config BINUTILS_GOLD_SUPPORTS_ARCH
1313
default y if ARCH_SPARC
1414
default y if ARCH_X86
1515

16+
# Support for gold was deprecated and removed from binutils 2.44.
17+
config BINUTILS_HAS_GOLD
18+
bool
19+
default y if !BINUTILS_2_44_or_later
20+
default y if !BINUTILS_SRC_RELEASE
21+
1622
config BINUTILS_GOLD_SUPPORT
1723
bool
1824
default y
19-
depends on BINUTILS_GOLD_SUPPORTS_ARCH
25+
depends on BINUTILS_GOLD_SUPPORTS_ARCH && BINUTILS_HAS_GOLD
2026

2127
# Force using the BFD linker if needed. There are two options:
2228
# - For some C libraries (eg. glibc at least), BFD ld must be
@@ -34,6 +40,11 @@ config BINUTILS_DEP_BISON
3440
depends on BINUTILS_2_39_or_later && !CONFIGURE_has_bison_3_0_4_or_newer && (ARCH_X86 || (ARCH_ARM && ARCH_64))
3541
select COMP_TOOLS_BISON
3642

43+
if BINUTILS_2_44_or_later && BINUTILS_GOLD_SUPPORT && !BINUTILS_SRC_RELEASE
44+
comment "WARNING! For binutils >= 2.44 only enable gold support if supplied"
45+
comment "| through custom source tree."
46+
endif
47+
3748
choice
3849
bool
3950
prompt "Linkers to enable"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
From b8fd4192eb490b4dc9db447dd71afaf611dc2a28 Mon Sep 17 00:00:00 2001
2+
From: Chris Packham <judge.packham@gmail.com>
3+
Date: Mon, 8 Aug 2022 20:31:10 +1200
4+
Subject: [PATCH 0/8] sh conf
5+
6+
---
7+
configure | 2 +-
8+
configure.ac | 2 +-
9+
2 files changed, 2 insertions(+), 2 deletions(-)
10+
11+
--- a/configure
12+
+++ b/configure
13+
@@ -4056,7 +4056,7 @@ case "${target}" in
14+
nvptx*-*-*)
15+
noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc"
16+
;;
17+
- sh-*-*)
18+
+ sh*-*-*)
19+
case "${target}" in
20+
sh*-*-elf)
21+
;;
22+
--- a/configure.ac
23+
+++ b/configure.ac
24+
@@ -1278,7 +1278,7 @@ case "${target}" in
25+
nvptx*-*-*)
26+
noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc"
27+
;;
28+
- sh-*-*)
29+
+ sh*-*-*)
30+
case "${target}" in
31+
sh*-*-elf)
32+
;;
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
From aad130ddadd19ae40e5405a7b9ddd5ae1ec138f0 Mon Sep 17 00:00:00 2001
2+
From: Chris Packham <judge.packham@gmail.com>
3+
Date: Mon, 8 Aug 2022 20:36:31 +1200
4+
Subject: [PATCH 1/8] check_ldrunpath_length
5+
6+
---
7+
ld/ldelf.c | 4 ++++
8+
1 file changed, 4 insertions(+)
9+
10+
--- a/ld/ldelf.c
11+
+++ b/ld/ldelf.c
12+
@@ -1134,6 +1134,8 @@ ldelf_handle_dt_needed (struct elf_link_
13+
&& command_line.rpath == NULL)
14+
{
15+
path = (const char *) getenv ("LD_RUN_PATH");
16+
+ if (path && *path == '\0')
17+
+ path = NULL;
18+
if (path
19+
&& ldelf_search_needed (path, &n, force,
20+
is_linux, elfsize))
21+
@@ -1811,6 +1813,8 @@ ldelf_before_allocation (char *audit, ch
22+
rpath = command_line.rpath;
23+
if (rpath == NULL)
24+
rpath = (const char *) getenv ("LD_RUN_PATH");
25+
+ if (rpath && *rpath == '\0')
26+
+ rpath = NULL;
27+
28+
for (abfd = link_info.input_bfds; abfd; abfd = abfd->link.next)
29+
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
From 3a84b957286a337379d36b530358c32576154b00 Mon Sep 17 00:00:00 2001
2+
From: Chris Packham <judge.packham@gmail.com>
3+
Date: Mon, 8 Aug 2022 20:37:24 +1200
4+
Subject: [PATCH 3/8] Don't link to libfl as it's unnecessary
5+
6+
---
7+
binutils/configure | 3 +++
8+
binutils/configure.ac | 3 +++
9+
gas/configure | 3 +++
10+
gas/configure.ac | 3 +++
11+
ld/configure | 3 +++
12+
ld/configure.ac | 3 +++
13+
6 files changed, 18 insertions(+)
14+
15+
--- a/binutils/configure
16+
+++ b/binutils/configure
17+
@@ -12529,6 +12529,7 @@ fi
18+
done
19+
test -n "$YACC" || YACC="yacc"
20+
21+
+save_LIBS=$LIBS
22+
for ac_prog in flex lex
23+
do
24+
# Extract the first word of "$ac_prog", so it can be a program name with args.
25+
@@ -12692,6 +12693,8 @@ esac
26+
if test "$LEX" = :; then
27+
LEX=${am_missing_run}flex
28+
fi
29+
+LIBS=$save_LIBS
30+
+LEXLIB=
31+
32+
ALL_LINGUAS="bg ca da es fi fr hr id it ja pt ro ru rw sk sr sv tr uk vi zh_CN zh_TW"
33+
34+
--- a/binutils/configure.ac
35+
+++ b/binutils/configure.ac
36+
@@ -153,7 +153,10 @@ if test -z "$host" ; then
37+
fi
38+
39+
AC_PROG_YACC
40+
+save_LIBS=$LIBS
41+
AM_PROG_LEX
42+
+LIBS=$save_LIBS
43+
+LEXLIB=
44+
45+
ALL_LINGUAS="bg ca da es fi fr hr id it ja pt ro ru rw sk sr sv tr uk vi zh_CN zh_TW"
46+
ZW_GNU_GETTEXT_SISTER_DIR
47+
--- a/gas/configure
48+
+++ b/gas/configure
49+
@@ -13033,6 +13033,7 @@ fi
50+
done
51+
test -n "$YACC" || YACC="yacc"
52+
53+
+save_LIBS=$LIBS
54+
for ac_prog in flex lex
55+
do
56+
# Extract the first word of "$ac_prog", so it can be a program name with args.
57+
@@ -13196,6 +13197,8 @@ esac
58+
if test "$LEX" = :; then
59+
LEX=${am_missing_run}flex
60+
fi
61+
+LIBS=$save_LIBS
62+
+LEXLIB=
63+
64+
ALL_LINGUAS="es fi fr id ja ru rw sv tr uk zh_CN"
65+
66+
--- a/gas/configure.ac
67+
+++ b/gas/configure.ac
68+
@@ -935,7 +935,10 @@ AC_DEFINE_UNQUOTED(TARGET_VENDOR, "${tar
69+
AC_DEFINE_UNQUOTED(TARGET_OS, "${target_os}", [Target OS.])
70+
71+
AC_PROG_YACC
72+
+save_LIBS=$LIBS
73+
AM_PROG_LEX
74+
+LIBS=$save_LIBS
75+
+LEXLIB=
76+
77+
ALL_LINGUAS="es fi fr id ja ru rw sv tr uk zh_CN"
78+
ZW_GNU_GETTEXT_SISTER_DIR
79+
--- a/ld/configure
80+
+++ b/ld/configure
81+
@@ -18501,6 +18501,7 @@ fi
82+
done
83+
test -n "$YACC" || YACC="yacc"
84+
85+
+save_LIBS=$LIBS
86+
for ac_prog in flex lex
87+
do
88+
# Extract the first word of "$ac_prog", so it can be a program name with args.
89+
@@ -18664,6 +18665,8 @@ esac
90+
if test "$LEX" = :; then
91+
LEX=${am_missing_run}flex
92+
fi
93+
+LIBS=$save_LIBS
94+
+LEXLIB=
95+
96+
97+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
98+
--- a/ld/configure.ac
99+
+++ b/ld/configure.ac
100+
@@ -394,7 +394,10 @@ AM_PO_SUBDIRS
101+
AC_EXEEXT
102+
103+
AC_PROG_YACC
104+
+save_LIBS=$LIBS
105+
AM_PROG_LEX
106+
+LIBS=$save_LIBS
107+
+LEXLIB=
108+
109+
AM_MAINTAINER_MODE
110+
AM_CONDITIONAL(GENINSRC_NEVER, false)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
From caeb8d1403fa6ce3334ac8527bc89d3103b3c604 Mon Sep 17 00:00:00 2001
2+
From: Andrew Hsieh <andrewhsieh@google.com>
3+
Date: Wed, 18 Mar 2015 10:57:24 +0800
4+
Subject: [PATCH 5/8] Fix darwin build
5+
6+
1. In Drawin PTHREAD_ONCE_INIT is {0x30B1BCBA, {0}} and the GCC < 4.4
7+
doesn't support ended initializer list
8+
2. wcsncasecmp doesn't exist in MacSDK10.6.x
9+
10+
Change-Id: I69204a72f853f5263dffedc448379d75ed4eca2e
11+
---
12+
bfd/peXXigen.c | 22 ++++++++++++++++++++++
13+
gold/gold-threads.cc | 15 ++++++++++++---
14+
2 files changed, 34 insertions(+), 3 deletions(-)
15+
16+
--- a/bfd/peXXigen.c
17+
+++ b/bfd/peXXigen.c
18+
@@ -3681,6 +3681,28 @@ u16_mbtouc (wint_t * puc, const unsigned
19+
}
20+
#endif /* not Cygwin/Mingw */
21+
22+
+#if defined __APPLE__ && __DARWIN_C_LEVEL < 200809L
23+
+/* wcsncasecmp isn't always defined in Mac SDK */
24+
+static int
25+
+wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n)
26+
+{
27+
+ wchar_t c1, c2;
28+
+
29+
+ if (n == 0)
30+
+ return (0);
31+
+ for (; *s1; s1++, s2++)
32+
+ {
33+
+ c1 = towlower(*s1);
34+
+ c2 = towlower(*s2);
35+
+ if (c1 != c2)
36+
+ return ((int)c1 - c2);
37+
+ if (--n == 0)
38+
+ return (0);
39+
+ }
40+
+ return (-*s2);
41+
+}
42+
+#endif
43+
+
44+
/* Perform a comparison of two entries. */
45+
static signed int
46+
rsrc_cmp (bool is_name, rsrc_entry * a, rsrc_entry * b)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
From 880742786662b8adc996cc639d123d1884559344 Mon Sep 17 00:00:00 2001
2+
From: Sven Rebhan <odinshorse@googlemail.com>
3+
Date: Mon, 8 Aug 2022 20:46:29 +1200
4+
Subject: [PATCH 6/8] sysroot
5+
6+
Always try to prepend the sysroot prefix to absolute filenames first.
7+
8+
http://bugs.gentoo.org/275666
9+
http://sourceware.org/bugzilla/show_bug.cgi?id=10340
10+
11+
Signed-off-by: Sven Rebhan <odinshorse@googlemail.com>
12+
---
13+
ld/ldfile.c | 11 +++++++++--
14+
1 file changed, 9 insertions(+), 2 deletions(-)
15+
16+
--- a/ld/ldfile.c
17+
+++ b/ld/ldfile.c
18+
@@ -569,18 +569,25 @@ ldfile_open_file_search (const char *arc
19+
directory first. */
20+
if (!entry->flags.maybe_archive)
21+
{
22+
- if (entry->flags.sysrooted && IS_ABSOLUTE_PATH (entry->filename))
23+
+ /* For absolute pathnames, try to always open the file in the
24+
+ sysroot first. If this fails, try to open the file at the
25+
+ given location. */
26+
+ entry->flags.sysrooted = is_sysrooted_pathname (entry->filename);
27+
+ if (!entry->flags.sysrooted && IS_ABSOLUTE_PATH (entry->filename)
28+
+ && ld_sysroot)
29+
{
30+
char *name = concat (ld_sysroot, entry->filename,
31+
(const char *) NULL);
32+
if (ldfile_try_open_bfd (name, entry))
33+
{
34+
entry->filename = name;
35+
+ entry->flags.sysrooted = true;
36+
return true;
37+
}
38+
free (name);
39+
}
40+
- else if (ldfile_try_open_bfd (entry->filename, entry))
41+
+
42+
+ if (ldfile_try_open_bfd (entry->filename, entry))
43+
return true;
44+
45+
if (IS_ABSOLUTE_PATH (entry->filename))

0 commit comments

Comments
 (0)