Merge branch 'CR_3508_update_toolchain_2' into 'jh7110-devel'

CR_3508: update gcc toolchain to gcc 12

See merge request sdk/buildroot!102
This commit is contained in:
andy.hu
2023-05-19 03:36:37 +00:00
54 changed files with 3153 additions and 49 deletions
+11
View File
@@ -27,4 +27,15 @@ ifeq ($(BR2_RISCV_ISA_RVC),y)
GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)c
endif
# Starting from gcc 12.x, csr and fence instructions have been
# separated from the base I instruction set, and special -march
# suffixes are needed to enable their support. In Buildroot, we assume
# all RISC-V cores that support Linux implement those instructions, so
# we unconditionally enable those extensions.
# For starfive JH7110, add _zicsr_zifencei_zba_zbb as default march
ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_12),y)
GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)_zicsr_zifencei
GCC_TARGET_ARCH := $(GCC_TARGET_ARCH)_zba_zbb
endif
endif
+1
View File
@@ -168,6 +168,7 @@ TARGET_HARDENED += -D_FORTIFY_SOURCE=2
endif
TARGET_CPPFLAGS += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
TARGET_CPPFLAGS += -mabi=lp64d -march=rv64imafdc_zicsr_zifencei_zba_zbb -mcpu=sifive-u74 -mtune=sifive-7-series -fomit-frame-pointer --param l1-cache-size=32 --param l2-cache-size=2048
TARGET_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) $(TARGET_HARDENED)
TARGET_CXXFLAGS = $(TARGET_CFLAGS)
TARGET_FCFLAGS = $(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)
+48
View File
@@ -0,0 +1,48 @@
From 33f3c1f804efc2e4f97849081589efb70cda31e5 Mon Sep 17 00:00:00 2001
From: Romain Naour <romain.naour@gmail.com>
Date: Fri, 25 Dec 2015 11:38:13 +0100
Subject: [PATCH] sh-conf
Likewise, binutils has no idea about any of these new targets either, so we
fix that up too.. now we're able to actually build a real toolchain for
sh2a_nofpu- and other more ineptly named toolchains (and yes, there are more
inept targets than that one, really. Go look, I promise).
[Romain: rebase on top of 2.32]
Signed-off-by: Romain Naour <romain.naour@gmail.com>
[Thomas: rebase on top of 2.29, in which sh64 support was removed.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
configure | 2 +-
configure.ac | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 3dd206525a7..6881ce632f5 100755
--- a/configure
+++ b/configure
@@ -3892,7 +3892,7 @@ case "${target}" in
nvptx*-*-*)
noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc"
;;
- sh-*-*)
+ sh*-*-*)
case "${target}" in
sh*-*-elf)
;;
diff --git a/configure.ac b/configure.ac
index 797a624621e..1f9256bbf18 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1175,7 +1175,7 @@ case "${target}" in
nvptx*-*-*)
noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc"
;;
- sh-*-*)
+ sh*-*-*)
case "${target}" in
sh*-*-elf)
;;
--
2.31.1
@@ -0,0 +1,306 @@
From 4d8705ddb55897e8a74b617ab95736d520d9e1ea Mon Sep 17 00:00:00 2001
From: Romain Naour <romain.naour@gmail.com>
Date: Fri, 25 Dec 2015 11:45:38 +0100
Subject: [PATCH] poison-system-directories
Patch adapted to binutils 2.23.2 and extended to use
BR_COMPILER_PARANOID_UNSAFE_PATH by Thomas Petazzoni.
[Romain: rebase on top of 2.33.1]
Signed-off-by: Romain Naour <romain.naour@gmail.com>
[Gustavo: adapt to binutils 2.25]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Upstream-Status: Inappropriate [distribution: codesourcery]
Patch originally created by Mark Hatle, forward-ported to
binutils 2.21 by Scott Garman.
purpose: warn for uses of system directories when cross linking
Code Merged from Sourcery G++ binutils 2.19 - 4.4-277
2008-07-02 Joseph Myers <joseph@codesourcery.com>
ld/
* ld.h (args_type): Add error_poison_system_directories.
* ld.texinfo (--error-poison-system-directories): Document.
* ldfile.c (ldfile_add_library_path): Check
command_line.error_poison_system_directories.
* ldmain.c (main): Initialize
command_line.error_poison_system_directories.
* lexsup.c (enum option_values): Add
OPTION_ERROR_POISON_SYSTEM_DIRECTORIES.
(ld_options): Add --error-poison-system-directories.
(parse_args): Handle new option.
2007-06-13 Joseph Myers <joseph@codesourcery.com>
ld/
* config.in: Regenerate.
* ld.h (args_type): Add poison_system_directories.
* ld.texinfo (--no-poison-system-directories): Document.
* ldfile.c (ldfile_add_library_path): Check
command_line.poison_system_directories.
* ldmain.c (main): Initialize
command_line.poison_system_directories.
* lexsup.c (enum option_values): Add
OPTION_NO_POISON_SYSTEM_DIRECTORIES.
(ld_options): Add --no-poison-system-directories.
(parse_args): Handle new option.
2007-04-20 Joseph Myers <joseph@codesourcery.com>
Merge from Sourcery G++ binutils 2.17:
2007-03-20 Joseph Myers <joseph@codesourcery.com>
Based on patch by Mark Hatle <mark.hatle@windriver.com>.
ld/
* configure.ac (--enable-poison-system-directories): New option.
* configure, config.in: Regenerate.
* ldfile.c (ldfile_add_library_path): If
ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of /lib,
/usr/lib, /usr/local/lib or /usr/X11R6/lib.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
---
ld/config.in | 3 +++
ld/configure | 14 ++++++++++++++
ld/configure.ac | 10 ++++++++++
ld/ld.h | 8 ++++++++
ld/ld.texi | 12 ++++++++++++
ld/ldfile.c | 17 +++++++++++++++++
ld/ldlex.h | 2 ++
ld/ldmain.c | 2 ++
ld/lexsup.c | 21 +++++++++++++++++++++
9 files changed, 89 insertions(+)
diff --git a/ld/config.in b/ld/config.in
index 26d55a00d47..ffad464783c 100644
--- a/ld/config.in
+++ b/ld/config.in
@@ -43,6 +43,9 @@
language is requested. */
#undef ENABLE_NLS
+/* Define to warn for use of native system library directories */
+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
+
/* Additional extension a shared object might have. */
#undef EXTRA_SHLIB_EXTENSION
diff --git a/ld/configure b/ld/configure
index c197aaef3cb..882263aa43f 100755
--- a/ld/configure
+++ b/ld/configure
@@ -829,6 +829,7 @@ with_lib_path
enable_targets
enable_64_bit_bfd
with_sysroot
+enable_poison_system_directories
enable_gold
enable_got
enable_compressed_debug_sections
@@ -1498,6 +1499,8 @@ Optional Features:
--enable-checking enable run-time checks
--enable-targets alternative target configurations
--enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)
+ --enable-poison-system-directories
+ warn for use of native system library directories
--enable-gold[=ARG] build gold [ARG={default,yes,no}]
--enable-got=<type> GOT handling scheme (target, single, negative,
multigot)
@@ -15236,7 +15239,18 @@ else
fi
+# Check whether --enable-poison-system-directories was given.
+if test "${enable_poison_system_directories+set}" = set; then :
+ enableval=$enable_poison_system_directories;
+else
+ enable_poison_system_directories=no
+fi
+
+if test "x${enable_poison_system_directories}" = "xyes"; then
+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
+
+fi
# Check whether --enable-got was given.
if test "${enable_got+set}" = set; then :
diff --git a/ld/configure.ac b/ld/configure.ac
index 8ea97c43cd4..0f246db67d8 100644
--- a/ld/configure.ac
+++ b/ld/configure.ac
@@ -106,6 +106,16 @@ AC_SUBST(use_sysroot)
AC_SUBST(TARGET_SYSTEM_ROOT)
AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
+AC_ARG_ENABLE([poison-system-directories],
+ AS_HELP_STRING([--enable-poison-system-directories],
+ [warn for use of native system library directories]),,
+ [enable_poison_system_directories=no])
+if test "x${enable_poison_system_directories}" = "xyes"; then
+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
+ [1],
+ [Define to warn for use of native system library directories])
+fi
+
dnl Use --enable-gold to decide if this linker should be the default.
dnl "install_as_default" is set to false if gold is the default linker.
dnl "installed_linker" is the installed BFD linker name.
diff --git a/ld/ld.h b/ld/ld.h
index 35fafebfaed..74e66405de6 100644
--- a/ld/ld.h
+++ b/ld/ld.h
@@ -162,6 +162,14 @@ typedef struct
in the linker script. */
bool force_group_allocation;
+ /* If TRUE (the default) warn for uses of system directories when
+ cross linking. */
+ bool poison_system_directories;
+
+ /* If TRUE (default FALSE) give an error for uses of system
+ directories when cross linking instead of a warning. */
+ bool error_poison_system_directories;
+
/* Big or little endian as set on command line. */
enum endian_enum endian;
diff --git a/ld/ld.texi b/ld/ld.texi
index dd8f571d4e4..3ab210b41b9 100644
--- a/ld/ld.texi
+++ b/ld/ld.texi
@@ -2863,6 +2863,18 @@ string identifying the original linked file does not change.
Passing @code{none} for @var{style} disables the setting from any
@code{--build-id} options earlier on the command line.
+
+@kindex --no-poison-system-directories
+@item --no-poison-system-directories
+Do not warn for @option{-L} options using system directories such as
+@file{/usr/lib} when cross linking. This option is intended for use
+in chroot environments when such directories contain the correct
+libraries for the target system rather than the host.
+
+@kindex --error-poison-system-directories
+@item --error-poison-system-directories
+Give an error instead of a warning for @option{-L} options using
+system directories when cross linking.
@end table
@c man end
diff --git a/ld/ldfile.c b/ld/ldfile.c
index 9d0af06f1f6..7cdd3b1c1b1 100644
--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -117,6 +117,23 @@ ldfile_add_library_path (const char *name, bool cmdline)
new_dirs->name = concat (ld_sysroot, name + strlen ("$SYSROOT"), (const char *) NULL);
else
new_dirs->name = xstrdup (name);
+
+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
+ if (command_line.poison_system_directories
+ && ((!strncmp (name, "/lib", 4))
+ || (!strncmp (name, "/usr/lib", 8))
+ || (!strncmp (name, "/usr/local/lib", 14))
+ || (!strncmp (name, "/usr/X11R6/lib", 14))))
+ {
+ if (command_line.error_poison_system_directories)
+ einfo (_("%X%P: error: library search path \"%s\" is unsafe for "
+ "cross-compilation\n"), name);
+ else
+ einfo (_("%P: warning: library search path \"%s\" is unsafe for "
+ "cross-compilation\n"), name);
+ }
+#endif
+
}
/* Try to open a BFD for a lang_input_statement. */
diff --git a/ld/ldlex.h b/ld/ldlex.h
index 9e8bf5fb835..2f0fadfe0a3 100644
--- a/ld/ldlex.h
+++ b/ld/ldlex.h
@@ -163,6 +163,8 @@ enum option_values
OPTION_CTF_VARIABLES,
OPTION_NO_CTF_VARIABLES,
OPTION_CTF_SHARE_TYPES,
+ OPTION_NO_POISON_SYSTEM_DIRECTORIES,
+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES,
};
/* The initial parser states. */
diff --git a/ld/ldmain.c b/ld/ldmain.c
index 42660eb9a3c..1aef9387f93 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -321,6 +321,8 @@ main (int argc, char **argv)
command_line.warn_mismatch = true;
command_line.warn_search_mismatch = true;
command_line.check_section_addresses = -1;
+ command_line.poison_system_directories = true;
+ command_line.error_poison_system_directories = false;
/* We initialize DEMANGLING based on the environment variable
COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 00274c500d0..4f23b3a2da2 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -595,6 +595,14 @@ static const struct ld_option ld_options[] =
" <method> is: share-unconflicted (default),\n"
" share-duplicated"),
TWO_DASHES },
+ { {"no-poison-system-directories", no_argument, NULL,
+ OPTION_NO_POISON_SYSTEM_DIRECTORIES},
+ '\0', NULL, N_("Do not warn for -L options using system directories"),
+ TWO_DASHES },
+ { {"error-poison-system-directories", no_argument, NULL,
+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES},
+ '\0', NULL, N_("Give an error for -L options using system directories"),
+ TWO_DASHES },
};
#define OPTION_COUNT ARRAY_SIZE (ld_options)
@@ -607,6 +615,7 @@ parse_args (unsigned argc, char **argv)
int ingroup = 0;
char *default_dirlist = NULL;
char *shortopts;
+ char *BR_paranoid_env;
struct option *longopts;
struct option *really_longopts;
int last_optind;
@@ -1643,6 +1652,14 @@ parse_args (unsigned argc, char **argv)
}
break;
+ case OPTION_NO_POISON_SYSTEM_DIRECTORIES:
+ command_line.poison_system_directories = false;
+ break;
+
+ case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES:
+ command_line.error_poison_system_directories = true;
+ break;
+
case OPTION_PUSH_STATE:
input_flags.pushed = xmemdup (&input_flags,
sizeof (input_flags),
@@ -1788,6 +1805,10 @@ parse_args (unsigned argc, char **argv)
command_line.soname = NULL;
}
+ BR_paranoid_env = getenv("BR_COMPILER_PARANOID_UNSAFE_PATH");
+ if (BR_paranoid_env && strlen(BR_paranoid_env) > 0)
+ command_line.error_poison_system_directories = true;
+
while (ingroup)
{
einfo (_("%P: missing --end-group; added as last command line option\n"));
--
2.31.1
@@ -0,0 +1,50 @@
From ef4ba1da823e8366ea4f126f50885a44ebf4dcf0 Mon Sep 17 00:00:00 2001
From: Giulio Benetti <giulio.benetti@benettiengineering.com>
Date: Wed, 9 Jun 2021 17:28:27 +0200
Subject: [PATCH] bfd/elf32-or1k: fix building with gcc version < 5
Gcc version >= 5 has standard C mode not set to -std=gnu11, so if we use
an old compiler(i.e. gcc 4.9) build fails on:
```
elf32-or1k.c:2251:3: error: 'for' loop initial declarations are only allowed in
C99 or C11 mode
for (size_t i = 0; i < insn_count; i++)
^
```
So let's declare `size_t i` at the top of the function instead of inside
for loop.
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
bfd/elf32-or1k.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
index 4ae7f324d33..32063ab0289 100644
--- a/bfd/elf32-or1k.c
+++ b/bfd/elf32-or1k.c
@@ -2244,9 +2244,10 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
{
unsigned nodelay = elf_elfheader (output_bfd)->e_flags & EF_OR1K_NODELAY;
unsigned output_insns[PLT_MAX_INSN_COUNT];
+ size_t i;
/* Copy instructions into the output buffer. */
- for (size_t i = 0; i < insn_count; i++)
+ for (i = 0; i < insn_count; i++)
output_insns[i] = insns[i];
/* Honor the no-delay-slot setting. */
@@ -2277,7 +2278,7 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
}
/* Write out the output buffer. */
- for (size_t i = 0; i < (insn_count+1); i++)
+ for (i = 0; i < (insn_count+1); i++)
bfd_put_32 (output_bfd, output_insns[i], contents + (i*4));
}
--
2.31.1
@@ -0,0 +1,75 @@
From 362a20108782b87cd780a989c0dbd014fc2def8b Mon Sep 17 00:00:00 2001
From: Stafford Horne <shorne@gmail.com>
Date: Sun, 2 Jan 2022 09:03:28 +0900
Subject: [PATCH] or1k: Avoid R_OR1K_GOT16 signed overflow by using special
howto
Previously when fixing PR 21464 we masked out upper bits of the
relocation value in order to avoid overflow complaints when acceptable.
It turns out this does not work when the relocation value ends up being
signed.
To fix this this patch introduces a special howto with
complain_on_overflow set to complain_overflow_dont. This is used in
place of the normal R_OR1K_GOT16 howto when we detect R_OR1K_GOT_AHI16
relocations.
bfd/ChangeLog:
PR 28735
* elf32-or1k.c (or1k_elf_got16_no_overflow_howto): Define.
(or1k_elf_relocate_section): Use new howto instead of trying to
mask out relocation bits.
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
bfd/elf32-or1k.c | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
index 4ae7f324d33..7fd88d72442 100644
--- a/bfd/elf32-or1k.c
+++ b/bfd/elf32-or1k.c
@@ -828,6 +828,23 @@ static reloc_howto_type or1k_elf_howto_table[] =
false), /* pcrel_offset */
};
+/* A copy of the R_OR1K_GOT16 used in the presense of R_OR1K_GOT_AHI16
+ relocations when we know we can ignore overflows. */
+static reloc_howto_type or1k_elf_got16_no_overflow_howto =
+ HOWTO (R_OR1K_GOT16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_OR1K_GOT16", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0xffff, /* dst_mask */
+ false); /* pcrel_offset */
+
/* Map BFD reloc types to Or1k ELF reloc types. */
struct or1k_reloc_map
@@ -1506,12 +1523,11 @@ or1k_elf_relocate_section (bfd *output_bfd,
if (r_type == R_OR1K_GOT_AHI16)
saw_gotha = true;
- /* If we have a R_OR1K_GOT16 followed by a R_OR1K_GOT_AHI16
+ /* If we have a R_OR1K_GOT16 following a R_OR1K_GOT_AHI16
relocation we assume the code is doing the right thing to avoid
- overflows. Here we mask the lower 16-bit of the relocation to
- avoid overflow validation failures. */
+ overflows. */
if (r_type == R_OR1K_GOT16 && saw_gotha)
- relocation &= 0xffff;
+ howto = &or1k_elf_got16_no_overflow_howto;
/* Addend should be zero. */
if (rel->r_addend != 0)
--
2.25.1
@@ -0,0 +1,55 @@
From ed9b2e40ebffec835d63473367da8dd8f80d7d5b Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Mon, 21 Feb 2022 10:58:57 +1030
Subject: [PATCH] binutils 2.38 vs. ppc32 linux kernel
Commit b25f942e18d6 made .machine more strict. Weaken it again.
* config/tc-ppc.c (ppc_machine): Treat an early .machine specially,
keeping sticky options to work around gcc bugs.
(cherry picked from commit cebc89b9328eab994f6b0314c263f94e7949a553)
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
gas/config/tc-ppc.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index 054f9c72161..89bc7d3f9b9 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -5965,7 +5965,30 @@ ppc_machine (int ignore ATTRIBUTE_UNUSED)
options do not count as a new machine, instead they add
to currently selected opcodes. */
ppc_cpu_t machine_sticky = 0;
- new_cpu = ppc_parse_cpu (ppc_cpu, &machine_sticky, cpu_string);
+ /* Unfortunately, some versions of gcc emit a .machine
+ directive very near the start of the compiler's assembly
+ output file. This is bad because it overrides user -Wa
+ cpu selection. Worse, there are versions of gcc that
+ emit the *wrong* cpu, not even respecting the -mcpu given
+ to gcc. See gcc pr101393. And to compound the problem,
+ as of 20220222 gcc doesn't pass the correct cpu option to
+ gas on the command line. See gcc pr59828. Hack around
+ this by keeping sticky options for an early .machine. */
+ asection *sec;
+ for (sec = stdoutput->sections; sec != NULL; sec = sec->next)
+ {
+ segment_info_type *info = seg_info (sec);
+ /* Are the frags for this section perturbed from their
+ initial state? Even .align will count here. */
+ if (info != NULL
+ && (info->frchainP->frch_root != info->frchainP->frch_last
+ || info->frchainP->frch_root->fr_type != rs_fill
+ || info->frchainP->frch_root->fr_fix != 0))
+ break;
+ }
+ new_cpu = ppc_parse_cpu (ppc_cpu,
+ sec == NULL ? &sticky : &machine_sticky,
+ cpu_string);
if (new_cpu != 0)
ppc_cpu = new_cpu;
else
--
2.30.2
+48
View File
@@ -0,0 +1,48 @@
From 33f3c1f804efc2e4f97849081589efb70cda31e5 Mon Sep 17 00:00:00 2001
From: Romain Naour <romain.naour@gmail.com>
Date: Fri, 25 Dec 2015 11:38:13 +0100
Subject: [PATCH] sh-conf
Likewise, binutils has no idea about any of these new targets either, so we
fix that up too.. now we're able to actually build a real toolchain for
sh2a_nofpu- and other more ineptly named toolchains (and yes, there are more
inept targets than that one, really. Go look, I promise).
[Romain: rebase on top of 2.32]
Signed-off-by: Romain Naour <romain.naour@gmail.com>
[Thomas: rebase on top of 2.29, in which sh64 support was removed.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
configure | 2 +-
configure.ac | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 3dd206525a7..6881ce632f5 100755
--- a/configure
+++ b/configure
@@ -3892,7 +3892,7 @@ case "${target}" in
nvptx*-*-*)
noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc"
;;
- sh-*-*)
+ sh*-*-*)
case "${target}" in
sh*-*-elf)
;;
diff --git a/configure.ac b/configure.ac
index 797a624621e..1f9256bbf18 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1175,7 +1175,7 @@ case "${target}" in
nvptx*-*-*)
noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc"
;;
- sh-*-*)
+ sh*-*-*)
case "${target}" in
sh*-*-elf)
;;
--
2.31.1
@@ -0,0 +1,298 @@
From 4d8705ddb55897e8a74b617ab95736d520d9e1ea Mon Sep 17 00:00:00 2001
From: Romain Naour <romain.naour@gmail.com>
Date: Fri, 25 Dec 2015 11:45:38 +0100
Subject: [PATCH] poison-system-directories
Patch adapted to binutils 2.23.2 and extended to use
BR_COMPILER_PARANOID_UNSAFE_PATH by Thomas Petazzoni.
[Waldemar: rebase on top of 2.39]
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
[Romain: rebase on top of 2.33.1]
Signed-off-by: Romain Naour <romain.naour@gmail.com>
[Gustavo: adapt to binutils 2.25]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Upstream-Status: Inappropriate [distribution: codesourcery]
Patch originally created by Mark Hatle, forward-ported to
binutils 2.21 by Scott Garman.
purpose: warn for uses of system directories when cross linking
Code Merged from Sourcery G++ binutils 2.19 - 4.4-277
2008-07-02 Joseph Myers <joseph@codesourcery.com>
ld/
* ld.h (args_type): Add error_poison_system_directories.
* ld.texinfo (--error-poison-system-directories): Document.
* ldfile.c (ldfile_add_library_path): Check
command_line.error_poison_system_directories.
* ldmain.c (main): Initialize
command_line.error_poison_system_directories.
* lexsup.c (enum option_values): Add
OPTION_ERROR_POISON_SYSTEM_DIRECTORIES.
(ld_options): Add --error-poison-system-directories.
(parse_args): Handle new option.
2007-06-13 Joseph Myers <joseph@codesourcery.com>
ld/
* config.in: Regenerate.
* ld.h (args_type): Add poison_system_directories.
* ld.texinfo (--no-poison-system-directories): Document.
* ldfile.c (ldfile_add_library_path): Check
command_line.poison_system_directories.
* ldmain.c (main): Initialize
command_line.poison_system_directories.
* lexsup.c (enum option_values): Add
OPTION_NO_POISON_SYSTEM_DIRECTORIES.
(ld_options): Add --no-poison-system-directories.
(parse_args): Handle new option.
2007-04-20 Joseph Myers <joseph@codesourcery.com>
Merge from Sourcery G++ binutils 2.17:
2007-03-20 Joseph Myers <joseph@codesourcery.com>
Based on patch by Mark Hatle <mark.hatle@windriver.com>.
ld/
* configure.ac (--enable-poison-system-directories): New option.
* configure, config.in: Regenerate.
* ldfile.c (ldfile_add_library_path): If
ENABLE_POISON_SYSTEM_DIRECTORIES defined, warn for use of /lib,
/usr/lib, /usr/local/lib or /usr/X11R6/lib.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
---
ld/config.in | 3 +++
ld/configure | 14 ++++++++++++++
ld/configure.ac | 10 ++++++++++
ld/ld.h | 8 ++++++++
ld/ld.texi | 12 ++++++++++++
ld/ldfile.c | 17 +++++++++++++++++
ld/ldlex.h | 2 ++
ld/ldmain.c | 2 ++
ld/lexsup.c | 21 +++++++++++++++++++++
9 files changed, 89 insertions(+)
diff -Nur binutils-2.39.orig/ld/config.in binutils-2.39/ld/config.in
--- binutils-2.39.orig/ld/config.in 2022-08-05 11:56:56.000000000 +0200
+++ binutils-2.39/ld/config.in 2022-08-11 13:00:55.310472243 +0200
@@ -55,6 +55,9 @@
language is requested. */
#undef ENABLE_NLS
+/* Define to warn for use of native system library directories */
+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
+
/* Additional extension a shared object might have. */
#undef EXTRA_SHLIB_EXTENSION
diff -Nur binutils-2.39.orig/ld/configure binutils-2.39/ld/configure
--- binutils-2.39.orig/ld/configure 2022-08-05 11:56:54.000000000 +0200
+++ binutils-2.39/ld/configure 2022-08-11 13:00:55.370470806 +0200
@@ -836,6 +836,7 @@
enable_targets
enable_64_bit_bfd
with_sysroot
+enable_poison_system_directories
enable_gold
enable_got
enable_compressed_debug_sections
@@ -1514,6 +1515,8 @@
--enable-checking enable run-time checks
--enable-targets alternative target configurations
--enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)
+ --enable-poison-system-directories
+ warn for use of native system library directories
--enable-gold[=ARG] build gold [ARG={default,yes,no}]
--enable-got=<type> GOT handling scheme (target, single, negative,
multigot)
@@ -15370,7 +15373,18 @@
fi
+# Check whether --enable-poison-system-directories was given.
+if test "${enable_poison_system_directories+set}" = set; then :
+ enableval=$enable_poison_system_directories;
+else
+ enable_poison_system_directories=no
+fi
+
+if test "x${enable_poison_system_directories}" = "xyes"; then
+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
+
+fi
# Check whether --enable-got was given.
if test "${enable_got+set}" = set; then :
diff -Nur binutils-2.39.orig/ld/configure.ac binutils-2.39/ld/configure.ac
--- binutils-2.39.orig/ld/configure.ac 2022-07-08 11:46:48.000000000 +0200
+++ binutils-2.39/ld/configure.ac 2022-08-11 13:00:55.370470806 +0200
@@ -102,6 +102,16 @@
AC_SUBST(TARGET_SYSTEM_ROOT)
AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
+AC_ARG_ENABLE([poison-system-directories],
+ AS_HELP_STRING([--enable-poison-system-directories],
+ [warn for use of native system library directories]),,
+ [enable_poison_system_directories=no])
+if test "x${enable_poison_system_directories}" = "xyes"; then
+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
+ [1],
+ [Define to warn for use of native system library directories])
+fi
+
dnl Use --enable-gold to decide if this linker should be the default.
dnl "install_as_default" is set to false if gold is the default linker.
dnl "installed_linker" is the installed BFD linker name.
diff -Nur binutils-2.39.orig/ld/ldfile.c binutils-2.39/ld/ldfile.c
--- binutils-2.39.orig/ld/ldfile.c 2022-07-08 11:46:48.000000000 +0200
+++ binutils-2.39/ld/ldfile.c 2022-08-11 13:00:55.394470231 +0200
@@ -117,6 +117,23 @@
new_dirs->name = concat (ld_sysroot, name + strlen ("$SYSROOT"), (const char *) NULL);
else
new_dirs->name = xstrdup (name);
+
+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
+ if (command_line.poison_system_directories
+ && ((!strncmp (name, "/lib", 4))
+ || (!strncmp (name, "/usr/lib", 8))
+ || (!strncmp (name, "/usr/local/lib", 14))
+ || (!strncmp (name, "/usr/X11R6/lib", 14))))
+ {
+ if (command_line.error_poison_system_directories)
+ einfo (_("%X%P: error: library search path \"%s\" is unsafe for "
+ "cross-compilation\n"), name);
+ else
+ einfo (_("%P: warning: library search path \"%s\" is unsafe for "
+ "cross-compilation\n"), name);
+ }
+#endif
+
}
/* Try to open a BFD for a lang_input_statement. */
diff -Nur binutils-2.39.orig/ld/ld.h binutils-2.39/ld/ld.h
--- binutils-2.39.orig/ld/ld.h 2022-07-08 11:46:48.000000000 +0200
+++ binutils-2.39/ld/ld.h 2022-08-11 13:00:55.382470519 +0200
@@ -162,6 +162,14 @@
in the linker script. */
bool force_group_allocation;
+ /* If TRUE (the default) warn for uses of system directories when
+ cross linking. */
+ bool poison_system_directories;
+
+ /* If TRUE (default FALSE) give an error for uses of system
+ directories when cross linking instead of a warning. */
+ bool error_poison_system_directories;
+
/* Big or little endian as set on command line. */
enum endian_enum endian;
diff -Nur binutils-2.39.orig/ld/ldlex.h binutils-2.39/ld/ldlex.h
--- binutils-2.39.orig/ld/ldlex.h 2022-07-08 11:46:48.000000000 +0200
+++ binutils-2.39/ld/ldlex.h 2022-08-11 13:03:35.462636396 +0200
@@ -164,6 +164,8 @@
OPTION_CTF_VARIABLES,
OPTION_NO_CTF_VARIABLES,
OPTION_CTF_SHARE_TYPES,
+ OPTION_NO_POISON_SYSTEM_DIRECTORIES,
+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES,
OPTION_WARN_EXECSTACK,
OPTION_NO_WARN_EXECSTACK,
OPTION_WARN_RWX_SEGMENTS,
diff -Nur binutils-2.39.orig/ld/ldmain.c binutils-2.39/ld/ldmain.c
--- binutils-2.39.orig/ld/ldmain.c 2022-07-08 11:46:48.000000000 +0200
+++ binutils-2.39/ld/ldmain.c 2022-08-11 13:00:55.402470040 +0200
@@ -321,6 +321,8 @@
command_line.warn_mismatch = true;
command_line.warn_search_mismatch = true;
command_line.check_section_addresses = -1;
+ command_line.poison_system_directories = true;
+ command_line.error_poison_system_directories = false;
/* We initialize DEMANGLING based on the environment variable
COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the
diff -Nur binutils-2.39.orig/ld/ld.texi binutils-2.39/ld/ld.texi
--- binutils-2.39.orig/ld/ld.texi 2022-07-08 11:46:48.000000000 +0200
+++ binutils-2.39/ld/ld.texi 2022-08-11 13:02:44.627853889 +0200
@@ -2936,6 +2936,18 @@
Passing @code{none} for @var{style} disables the setting from any
@code{--build-id} options earlier on the command line.
+@kindex --no-poison-system-directories
+@item --no-poison-system-directories
+Do not warn for @option{-L} options using system directories such as
+@file{/usr/lib} when cross linking. This option is intended for use
+in chroot environments when such directories contain the correct
+libraries for the target system rather than the host.
+
+@kindex --error-poison-system-directories
+@item --error-poison-system-directories
+Give an error instead of a warning for @option{-L} options using
+system directories when cross linking.
+
@kindex --package-metadata=@var{JSON}
@item --package-metadata=@var{JSON}
Request the creation of a @code{.note.package} ELF note section. The
diff -Nur binutils-2.39.orig/ld/lexsup.c binutils-2.39/ld/lexsup.c
--- binutils-2.39.orig/ld/lexsup.c 2022-07-08 11:46:48.000000000 +0200
+++ binutils-2.39/ld/lexsup.c 2022-08-11 13:00:55.434469274 +0200
@@ -608,6 +608,14 @@
" <method> is: share-unconflicted (default),\n"
" share-duplicated"),
TWO_DASHES },
+ { {"no-poison-system-directories", no_argument, NULL,
+ OPTION_NO_POISON_SYSTEM_DIRECTORIES},
+ '\0', NULL, N_("Do not warn for -L options using system directories"),
+ TWO_DASHES },
+ { {"error-poison-system-directories", no_argument, NULL,
+ OPTION_ERROR_POISON_SYSTEM_DIRECTORIES},
+ '\0', NULL, N_("Give an error for -L options using system directories"),
+ TWO_DASHES },
};
#define OPTION_COUNT ARRAY_SIZE (ld_options)
@@ -620,6 +628,7 @@
int ingroup = 0;
char *default_dirlist = NULL;
char *shortopts;
+ char *BR_paranoid_env;
struct option *longopts;
struct option *really_longopts;
int last_optind;
@@ -1679,6 +1688,14 @@
}
break;
+ case OPTION_NO_POISON_SYSTEM_DIRECTORIES:
+ command_line.poison_system_directories = false;
+ break;
+
+ case OPTION_ERROR_POISON_SYSTEM_DIRECTORIES:
+ command_line.error_poison_system_directories = true;
+ break;
+
case OPTION_PUSH_STATE:
input_flags.pushed = xmemdup (&input_flags,
sizeof (input_flags),
@@ -1824,6 +1841,10 @@
command_line.soname = NULL;
}
+ BR_paranoid_env = getenv("BR_COMPILER_PARANOID_UNSAFE_PATH");
+ if (BR_paranoid_env && strlen(BR_paranoid_env) > 0)
+ command_line.error_poison_system_directories = true;
+
while (ingroup)
{
einfo (_("%P: missing --end-group; added as last command line option\n"));
--
2.31.1
@@ -0,0 +1,50 @@
From ef4ba1da823e8366ea4f126f50885a44ebf4dcf0 Mon Sep 17 00:00:00 2001
From: Giulio Benetti <giulio.benetti@benettiengineering.com>
Date: Wed, 9 Jun 2021 17:28:27 +0200
Subject: [PATCH] bfd/elf32-or1k: fix building with gcc version < 5
Gcc version >= 5 has standard C mode not set to -std=gnu11, so if we use
an old compiler(i.e. gcc 4.9) build fails on:
```
elf32-or1k.c:2251:3: error: 'for' loop initial declarations are only allowed in
C99 or C11 mode
for (size_t i = 0; i < insn_count; i++)
^
```
So let's declare `size_t i` at the top of the function instead of inside
for loop.
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
bfd/elf32-or1k.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
index 4ae7f324d33..32063ab0289 100644
--- a/bfd/elf32-or1k.c
+++ b/bfd/elf32-or1k.c
@@ -2244,9 +2244,10 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
{
unsigned nodelay = elf_elfheader (output_bfd)->e_flags & EF_OR1K_NODELAY;
unsigned output_insns[PLT_MAX_INSN_COUNT];
+ size_t i;
/* Copy instructions into the output buffer. */
- for (size_t i = 0; i < insn_count; i++)
+ for (i = 0; i < insn_count; i++)
output_insns[i] = insns[i];
/* Honor the no-delay-slot setting. */
@@ -2277,7 +2278,7 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
}
/* Write out the output buffer. */
- for (size_t i = 0; i < (insn_count+1); i++)
+ for (i = 0; i < (insn_count+1); i++)
bfd_put_32 (output_bfd, output_insns[i], contents + (i*4));
}
--
2.31.1
+8
View File
@@ -36,6 +36,12 @@ config BR2_BINUTILS_VERSION_2_37_X
# https://github.com/uclinux-dev/elf2flt/issues/12
depends on !BR2_BINFMT_FLAT
config BR2_BINUTILS_VERSION_2_38_X
bool "binutils 2.38"
config BR2_BINUTILS_VERSION_2_39_X
bool "binutils 2.39"
config BR2_BINUTILS_VERSION_ARC
bool "binutils arc (2.34.50)"
depends on BR2_arc
@@ -49,6 +55,8 @@ config BR2_BINUTILS_VERSION
default "2.35.2" if BR2_BINUTILS_VERSION_2_35_X
default "2.36.1" if BR2_BINUTILS_VERSION_2_36_X
default "2.37" if BR2_BINUTILS_VERSION_2_37_X
default "2.38" if BR2_BINUTILS_VERSION_2_38_X
default "2.39" if BR2_BINUTILS_VERSION_2_39_X
config BR2_BINUTILS_ENABLE_LTO
bool
+2
View File
@@ -3,6 +3,8 @@ sha512 d326408f12a03d9a61a9de56584c2af12f81c2e50d2d7e835d51565df8314df01575724a
sha512 9974ede5978d32e0d68fef23da48fa00bd06b0bff7ec45b00ca075c126d6bbe0cf2defc03ecc3f17bc6cc85b64271a13009c4049d7ba17de26e84e3a6e2c0348 binutils-2.35.2.tar.xz
sha512 cc24590bcead10b90763386b6f96bb027d7594c659c2d95174a6352e8b98465a50ec3e4088d0da038428abe059bbc4ae5f37b269f31a40fc048072c8a234f4e9 binutils-2.36.1.tar.xz
sha512 5c11aeef6935860a6819ed3a3c93371f052e52b4bdc5033da36037c1544d013b7f12cb8d561ec954fe7469a68f1b66f1a3cd53d5a3af7293635a90d69edd15e7 binutils-2.37.tar.xz
sha512 8bf0b0d193c9c010e0518ee2b2e5a830898af206510992483b427477ed178396cd210235e85fd7bd99a96fc6d5eedbeccbd48317a10f752b7336ada8b2bb826d binutils-2.38.tar.xz
sha512 68e038f339a8c21faa19a57bbc447a51c817f47c2e06d740847c6e9cc3396c025d35d5369fa8c3f8b70414757c89f0e577939ddc0d70f283182504920f53b0a3 binutils-2.39.tar.xz
# Locally calculated (fetched from Github)
sha512 76a8227a19218435319c660e4983ea17985194b7f496f163e97543e7f6fd3e9249241fdc05a16ba512fba96a1d846c1f7b080983404d821d6215f10e7f11e238 binutils-gdb-arc-2020.09-release.tar.gz
+2 -2
View File
@@ -11,7 +11,7 @@ ifeq ($(BINUTILS_VERSION),)
ifeq ($(BR2_arc),y)
BINUTILS_VERSION = arc-2020.09-release
else
BINUTILS_VERSION = 2.36.1
BINUTILS_VERSION = 2.39
endif
endif # BINUTILS_VERSION
@@ -103,10 +103,10 @@ endef
# If we don't want full binutils on target
ifneq ($(BR2_PACKAGE_BINUTILS_TARGET),y)
# libiberty is static-only, so it is only installed to staging, above.
define BINUTILS_INSTALL_TARGET_CMDS
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/bfd DESTDIR=$(TARGET_DIR) install
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/opcodes DESTDIR=$(TARGET_DIR) install
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/libiberty DESTDIR=$(STAGING_DIR) install
endef
endif
@@ -0,0 +1,200 @@
From 7a20b4574f06472086c786bd1b078ee962cdb02c Mon Sep 17 00:00:00 2001
From: Stafford Horne <shorne@gmail.com>
Date: Tue, 6 Apr 2021 05:47:17 +0900
Subject: [PATCH] or1k: Add mcmodel option to handle large GOTs
When building libgeos we get an error with:
linux-uclibc/9.3.0/crtbeginS.o: in function `__do_global_dtors_aux':
crtstuff.c:(.text+0x118): relocation truncated to fit: R_OR1K_GOT16 against symbol `__cxa_finalize' defined in .text section in
/home/shorne/work/openrisc/3eb9f9d0f6d8274b2d19753c006bd83f7d536e3c/output/host/or1k-buildroot-linux-uclibc/sysroot/lib/libc.so.
This is caused by GOT code having a limit of 64k. In OpenRISC this
looks to be the only relocation code pattern to be limited to 64k.
This patch allows specifying a new option -mcmodel=large which can be
used to generate 2 more instructions to construct 32-bit addresses for
up to 4G GOTs.
gcc/ChangeLog:
PR target/99783
* config/or1k/or1k-opts.h: New file.
* config/or1k/or1k.c (or1k_legitimize_address_1, print_reloc):
Support generating gotha relocations if -mcmodel=large is
specified.
* config/or1k/or1k.h (TARGET_CMODEL_SMALL, TARGET_CMODEL_LARGE):
New macros.
* config/or1k/or1k.opt (mcmodel=): New option.
* doc/invoke.texi (OpenRISC Options): Document mcmodel.
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
gcc/config/or1k/or1k-opts.h | 30 ++++++++++++++++++++++++++++++
gcc/config/or1k/or1k.c | 11 +++++++++--
gcc/config/or1k/or1k.h | 7 +++++++
gcc/config/or1k/or1k.opt | 19 +++++++++++++++++++
gcc/doc/invoke.texi | 12 +++++++++++-
5 files changed, 76 insertions(+), 3 deletions(-)
create mode 100644 gcc/config/or1k/or1k-opts.h
diff --git a/gcc/config/or1k/or1k-opts.h b/gcc/config/or1k/or1k-opts.h
new file mode 100644
index 00000000000..f791b894fdd
--- /dev/null
+++ b/gcc/config/or1k/or1k-opts.h
@@ -0,0 +1,30 @@
+/* Definitions for option handling for OpenRISC.
+ Copyright (C) 2021 Free Software Foundation, Inc.
+ Contributed by Stafford Horne.
+
+ This file is part of GCC.
+
+ GCC is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ GCC 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 General Public
+ License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef GCC_OR1K_OPTS_H
+#define GCC_OR1K_OPTS_H
+
+/* The OpenRISC code generation models available. */
+enum or1k_cmodel_type {
+ CMODEL_SMALL,
+ CMODEL_LARGE
+};
+
+#endif /* GCC_OR1K_OPTS_H */
diff --git a/gcc/config/or1k/or1k.c b/gcc/config/or1k/or1k.c
index e772a7addea..27d3fa17995 100644
--- a/gcc/config/or1k/or1k.c
+++ b/gcc/config/or1k/or1k.c
@@ -750,7 +750,14 @@ or1k_legitimize_address_1 (rtx x, rtx scratch)
{
base = gen_sym_unspec (base, UNSPEC_GOT);
crtl->uses_pic_offset_table = 1;
- t2 = gen_rtx_LO_SUM (Pmode, pic_offset_table_rtx, base);
+ if (TARGET_CMODEL_LARGE)
+ {
+ emit_insn (gen_rtx_SET (t1, gen_rtx_HIGH (Pmode, base)));
+ emit_insn (gen_add3_insn (t1, t1, pic_offset_table_rtx));
+ t2 = gen_rtx_LO_SUM (Pmode, t1, base);
+ }
+ else
+ t2 = gen_rtx_LO_SUM (Pmode, pic_offset_table_rtx, base);
t2 = gen_const_mem (Pmode, t2);
emit_insn (gen_rtx_SET (t1, t2));
base = t1;
@@ -1089,7 +1096,7 @@ print_reloc (FILE *stream, rtx x, HOST_WIDE_INT add, reloc_kind kind)
no special markup. */
static const char * const relocs[RKIND_MAX][RTYPE_MAX] = {
{ "lo", "got", "gotofflo", "tpofflo", "gottpofflo", "tlsgdlo" },
- { "ha", NULL, "gotoffha", "tpoffha", "gottpoffha", "tlsgdhi" },
+ { "ha", "gotha", "gotoffha", "tpoffha", "gottpoffha", "tlsgdhi" },
};
reloc_type type = RTYPE_DIRECT;
diff --git a/gcc/config/or1k/or1k.h b/gcc/config/or1k/or1k.h
index fe01ab81ead..669907e7e74 100644
--- a/gcc/config/or1k/or1k.h
+++ b/gcc/config/or1k/or1k.h
@@ -21,6 +21,8 @@
#ifndef GCC_OR1K_H
#define GCC_OR1K_H
+#include "config/or1k/or1k-opts.h"
+
/* Names to predefine in the preprocessor for this target machine. */
#define TARGET_CPU_CPP_BUILTINS() \
do \
@@ -37,6 +39,11 @@
} \
while (0)
+#define TARGET_CMODEL_SMALL \
+ (or1k_code_model == CMODEL_SMALL)
+#define TARGET_CMODEL_LARGE \
+ (or1k_code_model == CMODEL_LARGE)
+
/* Storage layout. */
#define DEFAULT_SIGNED_CHAR 1
diff --git a/gcc/config/or1k/or1k.opt b/gcc/config/or1k/or1k.opt
index 6bd0f3eee6d..cc23e3b8856 100644
--- a/gcc/config/or1k/or1k.opt
+++ b/gcc/config/or1k/or1k.opt
@@ -21,6 +21,9 @@
; See the GCC internals manual (options.texi) for a description of
; this file's format.
+HeaderInclude
+config/or1k/or1k-opts.h
+
mhard-div
Target RejectNegative InverseMask(SOFT_DIV)
Enable generation of hardware divide (l.div, l.divu) instructions. This is the
@@ -63,6 +66,22 @@ When -mhard-float is selected, enables generation of unordered floating point
compare and set flag (lf.sfun*) instructions. By default functions from libgcc
are used to perform unordered floating point compare and set flag operations.
+mcmodel=
+Target RejectNegative Joined Enum(or1k_cmodel_type) Var(or1k_code_model) Init(CMODEL_SMALL)
+Specify the code model used for accessing memory addresses. Specifying large
+enables generating binaries with large global offset tables. By default the
+value is small.
+
+Enum
+Name(or1k_cmodel_type) Type(enum or1k_cmodel_type)
+Known code model types (for use with the -mcmodel= option):
+
+EnumValue
+Enum(or1k_cmodel_type) String(small) Value(CMODEL_SMALL)
+
+EnumValue
+Enum(or1k_cmodel_type) String(large) Value(CMODEL_LARGE)
+
mcmov
Target RejectNegative Mask(CMOV)
Enable generation of conditional move (l.cmov) instructions. By default the
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 35508efb4ef..a1b7608a3aa 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -1136,7 +1136,8 @@ Objective-C and Objective-C++ Dialects}.
@gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
-msoft-mul -msoft-div @gol
-msoft-float -mhard-float -mdouble-float -munordered-float @gol
--mcmov -mror -mrori -msext -msfimm -mshftimm}
+-mcmov -mror -mrori -msext -msfimm -mshftimm @gol
+-mcmodel=@var{code-model}}
@emph{PDP-11 Options}
@gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
@@ -26443,6 +26444,15 @@ Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
@code{l.slli}) instructions. By default extra instructions will be generated
to store the immediate to a register first.
+@item -mcmodel=small
+@opindex mcmodel=small
+Generate OpenRISC code for the small model: The GOT is limited to 64k. This is
+the default model.
+
+@item -mcmodel=large
+@opindex mcmodel=large
+Generate OpenRISC code for the large model: The GOT may grow up to 4G in size.
+
@end table
--
2.35.1
@@ -0,0 +1,60 @@
From c544a63928406b706b8493fd9b8ca2136b433cf0 Mon Sep 17 00:00:00 2001
From: Stafford Horne <shorne@gmail.com>
Date: Wed, 21 Apr 2021 05:33:15 +0900
Subject: [PATCH] or1k: Use cmodel=large when building crtstuff
When linking gcc runtime objects into large binaries the link may fail
with the below errors. This will happen even if we are building with
-mcmodel=large.
/home/shorne/work/openrisc/output/host/lib/gcc/or1k-buildroot-linux-uclibc/10.3.0/crtbeginS.o: in function `deregister_tm_clones':
crtstuff.c:(.text+0x3c): relocation truncated to fit: R_OR1K_GOT16 against undefined symbol `_ITM_deregisterTMCloneTable'
/home/shorne/work/openrisc/output/host/lib/gcc/or1k-buildroot-linux-uclibc/10.3.0/crtbeginS.o: in function `register_tm_clones':
crtstuff.c:(.text+0xc0): relocation truncated to fit: R_OR1K_GOT16 against undefined symbol `_ITM_registerTMCloneTable'
This patch builds the gcc crtstuff binaries always with the
-mcmodel=large option to ensure they can be linked into large binaries.
libgcc/ChangeLog:
PR target/99783
* config.host (or1k-*, tmake_file): Add or1k/t-crtstuff.
* config/or1k/t-crtstuff: New file.
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
libgcc/config.host | 4 ++--
libgcc/config/or1k/t-crtstuff | 2 ++
2 files changed, 4 insertions(+), 2 deletions(-)
create mode 100644 libgcc/config/or1k/t-crtstuff
diff --git a/libgcc/config.host b/libgcc/config.host
index f2dc7e266f4..6f193c32fbd 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -1132,12 +1132,12 @@ nios2-*-*)
extra_parts="$extra_parts crti.o crtn.o"
;;
or1k-*-linux*)
- tmake_file="$tmake_file or1k/t-or1k"
+ tmake_file="$tmake_file or1k/t-or1k or1k/t-crtstuff"
tmake_file="$tmake_file t-softfp-sfdf t-softfp"
md_unwind_header=or1k/linux-unwind.h
;;
or1k-*-*)
- tmake_file="$tmake_file or1k/t-or1k"
+ tmake_file="$tmake_file or1k/t-or1k or1k/t-crtstuff"
tmake_file="$tmake_file t-softfp-sfdf t-softfp"
;;
pdp11-*-*)
diff --git a/libgcc/config/or1k/t-crtstuff b/libgcc/config/or1k/t-crtstuff
new file mode 100644
index 00000000000..dcae7f3498e
--- /dev/null
+++ b/libgcc/config/or1k/t-crtstuff
@@ -0,0 +1,2 @@
+# Compile crtbeginS.o and crtendS.o with -mcmodel=large
+CRTSTUFF_T_CFLAGS_S += -mcmodel=large
--
2.35.1
@@ -0,0 +1,31 @@
From 8ef5787701f4d7cf46a27771d38ab54af2499e25 Mon Sep 17 00:00:00 2001
From: Bernd Kuhls <bernd.kuhls@t-online.de>
Date: Fri, 27 Mar 2020 21:23:53 +0100
Subject: [PATCH] gcc: define _REENTRANT for OpenRISC when -pthread is passed
The detection of pthread support fails on OpenRISC unless _REENTRANT
is defined. Added the CPP_SPEC definition to correct this.
Patch sent upstream: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94372
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
---
gcc/config/or1k/linux.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/gcc/config/or1k/linux.h b/gcc/config/or1k/linux.h
index 196f3f3c8f0..0cbdc934af1 100644
--- a/gcc/config/or1k/linux.h
+++ b/gcc/config/or1k/linux.h
@@ -32,6 +32,8 @@
#undef MUSL_DYNAMIC_LINKER
#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-or1k.so.1"
+#define CPP_SPEC "%{pthread:-D_REENTRANT}"
+
#undef LINK_SPEC
#define LINK_SPEC "%{h*} \
%{static:-Bstatic} \
--
2.35.1
@@ -0,0 +1,26 @@
From 3b9d7d397fa6dc290eb05bffca80968efb6ec2e5 Mon Sep 17 00:00:00 2001
From: Waldemar Brodkorb <wbx@openadk.org>
Date: Mon, 25 Jul 2022 00:29:55 +0200
Subject: [PATCH] disable split-stack for non-thread builds
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
[Romain: convert to git format]
Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
libgcc/config/t-stack | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libgcc/config/t-stack b/libgcc/config/t-stack
index cc0366b4cd8..f3f97e86d60 100644
--- a/libgcc/config/t-stack
+++ b/libgcc/config/t-stack
@@ -1,4 +1,6 @@
# Makefile fragment to provide generic support for -fsplit-stack.
# This should be used in config.host for any host which supports
# -fsplit-stack.
+ifeq ($(enable_threads),yes)
LIB2ADD_ST += $(srcdir)/generic-morestack.c $(srcdir)/generic-morestack-thread.c
+endif
--
2.34.3
@@ -0,0 +1,120 @@
From ca2c3a7d3db7a699c358d3408f820396dd536fc8 Mon Sep 17 00:00:00 2001
From: Segher Boessenkool <segher@kernel.crashing.org>
Date: Tue, 1 Mar 2022 17:04:29 +0000
Subject: [PATCH] rs6000: Improve .machine
This adds more correct .machine for most older CPUs. It should be
conservative in the sense that everything we handled before we handle at
least as well now. This does not yet revamp the server CPU handling, it
is too risky at this point in time.
Tested on powerpc64-linux {-m32,-m64}. Also manually tested with all
-mcpu=, and the output of that passed through the GNU assembler.
2022-03-04 Segher Boessenkool <segher@kernel.crashing.org>
* config/rs6000/rs6000.c (rs6000_machine_from_flags): Restructure a
bit. Handle most older CPUs.
(cherry picked from commit 77eccbf39ed55297802bb66dff5f62507a7239e3)
(cherry picked from commit fc7e603edc67c66a14f893f3b5a0a34e7d26f77c)
Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
gcc/config/rs6000/rs6000.c | 81 +++++++++++++++++++++++++-------------
1 file changed, 54 insertions(+), 27 deletions(-)
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 0421dc7adb3..0a55c979c36 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -5742,33 +5742,60 @@ const char *rs6000_machine;
const char *
rs6000_machine_from_flags (void)
{
- /* For some CPUs, the machine cannot be determined by ISA flags. We have to
- check them first. */
- switch (rs6000_cpu)
- {
- case PROCESSOR_PPC8540:
- case PROCESSOR_PPC8548:
- return "e500";
-
- case PROCESSOR_PPCE300C2:
- case PROCESSOR_PPCE300C3:
- return "e300";
-
- case PROCESSOR_PPCE500MC:
- return "e500mc";
-
- case PROCESSOR_PPCE500MC64:
- return "e500mc64";
-
- case PROCESSOR_PPCE5500:
- return "e5500";
-
- case PROCESSOR_PPCE6500:
- return "e6500";
-
- default:
- break;
- }
+ /* e300 and e500 */
+ if (rs6000_cpu == PROCESSOR_PPCE300C2 || rs6000_cpu == PROCESSOR_PPCE300C3)
+ return "e300";
+ if (rs6000_cpu == PROCESSOR_PPC8540 || rs6000_cpu == PROCESSOR_PPC8548)
+ return "e500";
+ if (rs6000_cpu == PROCESSOR_PPCE500MC)
+ return "e500mc";
+ if (rs6000_cpu == PROCESSOR_PPCE500MC64)
+ return "e500mc64";
+ if (rs6000_cpu == PROCESSOR_PPCE5500)
+ return "e5500";
+ if (rs6000_cpu == PROCESSOR_PPCE6500)
+ return "e6500";
+
+ /* 400 series */
+ if (rs6000_cpu == PROCESSOR_PPC403)
+ return "\"403\"";
+ if (rs6000_cpu == PROCESSOR_PPC405)
+ return "\"405\"";
+ if (rs6000_cpu == PROCESSOR_PPC440)
+ return "\"440\"";
+ if (rs6000_cpu == PROCESSOR_PPC476)
+ return "\"476\"";
+
+ /* A2 */
+ if (rs6000_cpu == PROCESSOR_PPCA2)
+ return "a2";
+
+ /* Cell BE */
+ if (rs6000_cpu == PROCESSOR_CELL)
+ return "cell";
+
+ /* Titan */
+ if (rs6000_cpu == PROCESSOR_TITAN)
+ return "titan";
+
+ /* 500 series and 800 series */
+ if (rs6000_cpu == PROCESSOR_MPCCORE)
+ return "\"821\"";
+
+ /* 600 series and 700 series, "classic" */
+ if (rs6000_cpu == PROCESSOR_PPC601 || rs6000_cpu == PROCESSOR_PPC603
+ || rs6000_cpu == PROCESSOR_PPC604 || rs6000_cpu == PROCESSOR_PPC604e
+ || rs6000_cpu == PROCESSOR_PPC750 || rs6000_cpu == PROCESSOR_POWERPC)
+ return "ppc";
+
+ /* Classic with AltiVec, "G4" */
+ if (rs6000_cpu == PROCESSOR_PPC7400 || rs6000_cpu == PROCESSOR_PPC7450)
+ return "\"7450\"";
+
+ /* The older 64-bit CPUs */
+ if (rs6000_cpu == PROCESSOR_PPC620 || rs6000_cpu == PROCESSOR_PPC630
+ || rs6000_cpu == PROCESSOR_RS64A || rs6000_cpu == PROCESSOR_POWERPC64)
+ return "ppc64";
HOST_WIDE_INT flags = rs6000_isa_flags;
--
2.34.3
@@ -0,0 +1,68 @@
From 6de33ed642f119f1e2543095dd56e4a94f97c27f Mon Sep 17 00:00:00 2001
From: Segher Boessenkool <segher@kernel.crashing.org>
Date: Fri, 11 Mar 2022 21:15:18 +0000
Subject: [PATCH] rs6000: Do not use rs6000_cpu for .machine ppc and ppc64
(PR104829)
Fixes: 77eccbf39ed5
rs6000.h has
#define PROCESSOR_POWERPC PROCESSOR_PPC604
#define PROCESSOR_POWERPC64 PROCESSOR_RS64A
which means that if you use things like -mcpu=powerpc -mvsx it will no
longer work after my latest .machine patch. This causes GCC build errors
in some cases, not a good idea (even if the errors are actually
pre-existing: using -mvsx with a machine that does not have VSX cannot
work properly).
2022-03-11 Segher Boessenkool <segher@kernel.crashing.org>
PR target/104829
* config/rs6000/rs6000.c (rs6000_machine_from_flags): Don't output
"ppc" and "ppc64" based on rs6000_cpu.
(cherry picked from commit 80fcc4b6afee72443bef551064826b3b4b6785e6)
(cherry picked from commit d87e0e297b1cba73a0c055d2a3e9267d288f435a)
Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
gcc/config/rs6000/rs6000.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 0a55c979c36..7e5cdd34840 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -5782,20 +5782,28 @@ rs6000_machine_from_flags (void)
if (rs6000_cpu == PROCESSOR_MPCCORE)
return "\"821\"";
+#if 0
+ /* This (and ppc64 below) are disabled here (for now at least) because
+ PROCESSOR_POWERPC, PROCESSOR_POWERPC64, and PROCESSOR_COMMON
+ are #define'd as some of these. Untangling that is a job for later. */
+
/* 600 series and 700 series, "classic" */
if (rs6000_cpu == PROCESSOR_PPC601 || rs6000_cpu == PROCESSOR_PPC603
|| rs6000_cpu == PROCESSOR_PPC604 || rs6000_cpu == PROCESSOR_PPC604e
- || rs6000_cpu == PROCESSOR_PPC750 || rs6000_cpu == PROCESSOR_POWERPC)
+ || rs6000_cpu == PROCESSOR_PPC750)
return "ppc";
+#endif
/* Classic with AltiVec, "G4" */
if (rs6000_cpu == PROCESSOR_PPC7400 || rs6000_cpu == PROCESSOR_PPC7450)
return "\"7450\"";
+#if 0
/* The older 64-bit CPUs */
if (rs6000_cpu == PROCESSOR_PPC620 || rs6000_cpu == PROCESSOR_PPC630
- || rs6000_cpu == PROCESSOR_RS64A || rs6000_cpu == PROCESSOR_POWERPC64)
+ || rs6000_cpu == PROCESSOR_RS64A)
return "ppc64";
+#endif
HOST_WIDE_INT flags = rs6000_isa_flags;
--
2.34.3
@@ -0,0 +1,124 @@
From de3f4ee9a5bd2adcb5ff2e1690db2567fda1473c Mon Sep 17 00:00:00 2001
From: Xi Ruoyao <xry111@mengyan1223.wang>
Date: Mon, 28 Jun 2021 13:54:58 +0800
Subject: [PATCH] fixinc: don't "fix" machine names in __has_include(...)
[PR91085]
fixincludes/
PR other/91085
* fixfixes.c (check_has_inc): New static function.
(machine_name_fix): Don't replace header names in
__has_include(...).
* inclhack.def (machine_name): Adjust test.
* tests/base/testing.h: Update.
Upstream: 6bf383c37e6131a8e247e8a0997d55d65c830b6d
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
fixincludes/fixfixes.c | 45 ++++++++++++++++++++++++++++++--
fixincludes/inclhack.def | 3 ++-
fixincludes/tests/base/testing.h | 2 +-
3 files changed, 46 insertions(+), 4 deletions(-)
diff --git a/fixincludes/fixfixes.c b/fixincludes/fixfixes.c
index 5b23a8b640d..404b420f302 100644
--- a/fixincludes/fixfixes.c
+++ b/fixincludes/fixfixes.c
@@ -477,6 +477,39 @@ FIX_PROC_HEAD( char_macro_def_fix )
fputs (text, stdout);
}
+/* Check if the pattern at pos is actually in a "__has_include(...)"
+ directive. Return the pointer to the ')' of this
+ "__has_include(...)" if it is, NULL otherwise. */
+static const char *
+check_has_inc (const char *begin, const char *pos, const char *end)
+{
+ static const char has_inc[] = "__has_include";
+ const size_t has_inc_len = sizeof (has_inc) - 1;
+ const char *p;
+
+ for (p = memmem (begin, pos - begin, has_inc, has_inc_len);
+ p != NULL;
+ p = memmem (p, pos - p, has_inc, has_inc_len))
+ {
+ p += has_inc_len;
+ while (p < end && ISSPACE (*p))
+ p++;
+
+ /* "__has_include" may appear as "defined(__has_include)",
+ search for the next appearance then. */
+ if (*p != '(')
+ continue;
+
+ /* To avoid too much complexity, just hope there is never a
+ ')' in a header name. */
+ p = memchr (p, ')', end - p);
+ if (p == NULL || p > pos)
+ return p;
+ }
+
+ return NULL;
+}
+
/* Fix for machine name #ifdefs that are not in the namespace reserved
by the C standard. They won't be defined if compiling with -ansi,
and the headers will break. We go to some trouble to only change
@@ -524,7 +557,7 @@ FIX_PROC_HEAD( machine_name_fix )
/* If the 'name_pat' matches in between base and limit, we have
a bogon. It is not worth the hassle of excluding comments
because comments on #if/#ifdef lines are rare, and strings on
- such lines are illegal.
+ such lines are only legal in a "__has_include" directive.
REG_NOTBOL means 'base' is not at the beginning of a line, which
shouldn't matter since the name_re has no ^ anchor, but let's
@@ -544,8 +577,16 @@ FIX_PROC_HEAD( machine_name_fix )
break;
p = base + match[0].rm_so;
- base += match[0].rm_eo;
+ /* Check if the match is in __has_include(...) (PR 91085). */
+ q = check_has_inc (base, p, limit);
+ if (q)
+ {
+ base = q + 1;
+ goto again;
+ }
+
+ base += match[0].rm_eo;
/* One more test: if on the same line we have the same string
with the appropriate underscores, then leave it alone.
We want exactly two leading and trailing underscores. */
diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 066bef99162..b7ad6982e96 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -3154,7 +3154,8 @@ fix = {
c_fix = machine_name;
test_text = "/* MACH_DIFF: */\n"
- "#if defined( i386 ) || defined( sparc ) || defined( vax )"
+ "#if defined( i386 ) || defined( sparc ) || defined( vax ) || "
+ "defined( linux ) || __has_include ( <linux.h> )"
"\n/* no uniform test, so be careful :-) */";
};
diff --git a/fixincludes/tests/base/testing.h b/fixincludes/tests/base/testing.h
index cf95321fb86..8b3accaf04e 100644
--- a/fixincludes/tests/base/testing.h
+++ b/fixincludes/tests/base/testing.h
@@ -64,7 +64,7 @@ BSD43__IOWR('T', 1) /* Some are multi-line */
#if defined( MACHINE_NAME_CHECK )
/* MACH_DIFF: */
-#if defined( i386 ) || defined( sparc ) || defined( vax )
+#if defined( i386 ) || defined( sparc ) || defined( vax ) || defined( linux ) || __has_include ( <linux.h> )
/* no uniform test, so be careful :-) */
#endif /* MACHINE_NAME_CHECK */
--
2.37.3
@@ -0,0 +1,26 @@
From 4f67134e0b1404fef4ea72342be8fab4c37ca8c8 Mon Sep 17 00:00:00 2001
From: Waldemar Brodkorb <wbx@openadk.org>
Date: Mon, 25 Jul 2022 00:29:55 +0200
Subject: [PATCH] disable split-stack for non-thread builds
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
[Romain: convert to git format]
Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
libgcc/config/t-stack | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libgcc/config/t-stack b/libgcc/config/t-stack
index cc0366b4cd8..f3f97e86d60 100644
--- a/libgcc/config/t-stack
+++ b/libgcc/config/t-stack
@@ -1,4 +1,6 @@
# Makefile fragment to provide generic support for -fsplit-stack.
# This should be used in config.host for any host which supports
# -fsplit-stack.
+ifeq ($(enable_threads),yes)
LIB2ADD_ST += $(srcdir)/generic-morestack.c $(srcdir)/generic-morestack-thread.c
+endif
--
2.34.3
+82
View File
@@ -0,0 +1,82 @@
From ee4af2ed0b7322884ec4ff537564683c3749b813 Mon Sep 17 00:00:00 2001
From: Jonathan Wakely <jwakely@redhat.com>
Date: Thu, 22 Dec 2022 09:56:47 +0000
Subject: [PATCH] libstdc++: Avoid recursion in __nothrow_wait_cv::wait
[PR105730]
The commit r12-5877-g9e18a25331fa25 removed the incorrect
noexcept-specifier from std::condition_variable::wait and gave the new
symbol version @@GLIBCXX_3.4.30. It also redefined the original symbol
std::condition_variable::wait(unique_lock<mutex>&)@GLIBCXX_3.4.11 as an
alias for a new symbol, __gnu_cxx::__nothrow_wait_cv::wait, which still
has the incorrect noexcept guarantee. That __nothrow_wait_cv::wait is
just a wrapper around the real condition_variable::wait which adds
noexcept and so terminates on a __forced_unwind exception.
This doesn't work on uclibc, possibly due to a dynamic linker bug. When
__nothrow_wait_cv::wait calls the condition_variable::wait function it
binds to the alias symbol, which means it just calls itself recursively
until the stack overflows.
This change avoids the possibility of a recursive call by changing the
__nothrow_wait_cv::wait function so that instead of calling
condition_variable::wait it re-implements it. This requires accessing
the private _M_cond member of condition_variable, so we need to use the
trick of instantiating a template with the member-pointer of the private
member.
libstdc++-v3/ChangeLog:
PR libstdc++/105730
* src/c++11/compatibility-condvar.cc (__nothrow_wait_cv::wait):
Access private data member of base class and call its wait
member.
Signed-off-by: Gleb Mazovetskiy <glex.spb@gmail.com>
---
.../src/c++11/compatibility-condvar.cc | 22 ++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/libstdc++-v3/src/c++11/compatibility-condvar.cc b/libstdc++-v3/src/c++11/compatibility-condvar.cc
index e3a8b8403ca..3cef3bc0714 100644
--- a/libstdc++-v3/src/c++11/compatibility-condvar.cc
+++ b/libstdc++-v3/src/c++11/compatibility-condvar.cc
@@ -67,6 +67,24 @@ _GLIBCXX_END_NAMESPACE_VERSION
&& defined(_GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT)
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
+namespace
+{
+ // Pointer-to-member for private std::condition_variable::_M_cond member.
+ std::__condvar std::condition_variable::* __base_member;
+
+ template<std::__condvar std::condition_variable::*X>
+ struct cracker
+ { static std::__condvar std::condition_variable::* value; };
+
+ // Initializer for this static member also initializes __base_member.
+ template<std::__condvar std::condition_variable::*X>
+ std::__condvar std::condition_variable::*
+ cracker<X>::value = __base_member = X;
+
+ // Explicit instantiation is allowed to access the private member.
+ template class cracker<&std::condition_variable::_M_cond>;
+}
+
struct __nothrow_wait_cv : std::condition_variable
{
void wait(std::unique_lock<std::mutex>&) noexcept;
@@ -76,7 +94,9 @@ __attribute__((used))
void
__nothrow_wait_cv::wait(std::unique_lock<std::mutex>& lock) noexcept
{
- this->condition_variable::wait(lock);
+ // In theory this could be simply this->std::condition_variable::wait(lock)
+ // but with uclibc that binds to the @GLIBCXX_3.4.11 symbol, see PR 105730.
+ (this->*__base_member).wait(*lock.mutex());
}
} // namespace __gnu_cxx
--
2.31.1
+28 -9
View File
@@ -2,9 +2,10 @@ comment "GCC Options"
choice
prompt "GCC compiler Version"
default BR2_GCC_VERSION_ARC if BR2_GCC_VERSION_4_8_ARC # legacy
default BR2_GCC_VERSION_ARC if BR2_arc
default BR2_GCC_VERSION_POWERPC_SPE if BR2_powerpc_SPE
default BR2_GCC_VERSION_10_X
default BR2_GCC_VERSION_11_X
help
Select the version of gcc you wish to use.
@@ -12,7 +13,7 @@ config BR2_GCC_VERSION_ARC
bool "gcc arc (10.x)"
# Only supported architecture
depends on BR2_arc
select BR2_TOOLCHAIN_GCC_AT_LEAST_9
select BR2_TOOLCHAIN_GCC_AT_LEAST_10
config BR2_GCC_VERSION_POWERPC_SPE
bool "gcc powerpc spe"
@@ -39,14 +40,13 @@ config BR2_GCC_VERSION_10_X
# powerpc spe support has been deprecated since gcc 8.x.
# https://gcc.gnu.org/ml/gcc/2018-04/msg00102.html
depends on !BR2_powerpc_SPE
# C-SKY sk610 needs abiv1, which is not supported in
# upstream gcc. C-SKY gcc upstream support not tested
# with upstream binutils and glibc.
depends on !BR2_csky
# ARC HS48 rel 31 only supported by gcc arc fork.
depends on !BR2_archs4x_rel31
select BR2_TOOLCHAIN_GCC_AT_LEAST_10
config BR2_GCC_VERSION_11_X
bool "gcc 11.x"
depends on !BR2_ARCH_NEEDS_GCC_AT_LEAST_12
# powerpc spe support has been deprecated since gcc 8.x.
# https://gcc.gnu.org/ml/gcc/2018-04/msg00102.html
depends on !BR2_powerpc_SPE
@@ -54,8 +54,23 @@ config BR2_GCC_VERSION_11_X
# that need to be reverted since gcc 8.4, 9.3 and 10.1.
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98784
depends on !BR2_sparc
# ARC HS48 rel 31 only supported by gcc arc fork.
depends on !BR2_archs4x_rel31
select BR2_TOOLCHAIN_GCC_AT_LEAST_11
config BR2_GCC_VERSION_12_X
bool "gcc 12.x"
# powerpc spe support has been deprecated since gcc 8.x.
# https://gcc.gnu.org/ml/gcc/2018-04/msg00102.html
depends on !BR2_powerpc_SPE
# uClibc-ng broken on sparc due to recent gcc changes
# that need to be reverted since gcc 8.4, 9.3 and 10.1.
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98784
depends on !BR2_sparc
# ARC HS48 rel 31 only supported by gcc arc fork.
depends on !BR2_archs4x_rel31
select BR2_TOOLCHAIN_GCC_AT_LEAST_12
endchoice
# libcilkrts was introduced in gcc 4.9 and removed in gcc 8.x
@@ -75,13 +90,17 @@ config BR2_GCC_SUPPORTS_DLANG
default y if BR2_riscv && !BR2_RISCV_64
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_9
depends on BR2_TOOLCHAIN_USES_GLIBC
# "The D front-end is now itself written in D, in order to build GDC, you
# will need a working GDC compiler (GCC version 9.1 or later)."
# https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=5fee5ec362f7a243f459e6378fd49dfc89dc9fb5
depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_12
config BR2_GCC_VERSION
string
default "8.4.0" if BR2_GCC_VERSION_POWERPC_SPE
default "9.4.0" if BR2_GCC_VERSION_9_X
default "10.3.0" if BR2_GCC_VERSION_10_X
default "11.2.0" if BR2_GCC_VERSION_11_X
default "10.4.0" if BR2_GCC_VERSION_10_X
default "11.3.0" if BR2_GCC_VERSION_11_X
default "12.2.0" if BR2_GCC_VERSION_12_X
default "arc-2020.09-release" if BR2_GCC_VERSION_ARC
config BR2_EXTRA_GCC_CONFIG_OPTIONS
+7 -7
View File
@@ -1,11 +1,11 @@
# From ftp://gcc.gnu.org/pub/gcc/releases/gcc-8.4.0/sha512.sum
# From https://gcc.gnu.org/pub/gcc/releases/gcc-8.4.0/sha512.sum
sha512 6de904f552a02de33b11ef52312bb664396efd7e1ce3bbe37bfad5ef617f133095b3767b4804bc7fe78df335cb53bc83f1ac055baed40979ce4c2c3e46b70280 gcc-8.4.0.tar.xz
# From ftp://gcc.gnu.org/pub/gcc/releases/gcc-9.4.0/sha512.sum
sha512 dfd3500bf21784b8351a522d53463cf362ede66b0bc302edf350bb44e94418497a8b4b797b6af8ca9b2eeb746b3b115d9c3698381b989546e9151b4496415624 gcc-9.4.0.tar.xz
# From ftp://gcc.gnu.org/pub/gcc/releases/gcc-10.3.0/sha512.sum
sha512 2b2dd7453d48a398c29eaebd1422b70341001b8c90a62aee51e83344e7fdd8a8e45f82a4a9165bd7edc76dada912c932f4b6632c5636760fec4c5d7e402b3f86 gcc-10.3.0.tar.xz
# From ftp://gcc.gnu.org/pub/gcc/releases/gcc-11.2.0/sha512.sum
sha512 d53a0a966230895c54f01aea38696f818817b505f1e2bfa65e508753fcd01b2aedb4a61434f41f3a2ddbbd9f41384b96153c684ded3f0fa97c82758d9de5c7cf gcc-11.2.0.tar.xz
# From https://gcc.gnu.org/pub/gcc/releases/gcc-10.4.0/sha512.sum
sha512 440c08ca746da450d9a1b35e8fd2305cb27e7e6987cd9d0f7d375f3b1fc9e4b0bd7acb3cd7bf795e72fcbead59cdef5b6c152862f5d35cd9fbfe6902101ce648 gcc-10.4.0.tar.xz
# From https://gcc.gnu.org/pub/gcc/releases/gcc-11.3.0/sha512.sum
sha512 f0be5ad705c73b84477128a69c047f57dd47002f375eb60e1e842e08cf2009a509e92152bca345823926d550b7395ae6d4de7db51d1ee371c2dc37313881fca7 gcc-11.3.0.tar.xz
# From https://gcc.gnu.org/pub/gcc/releases/gcc-12.2.0/sha512.sum
sha512 e9e857bd81bf7a370307d6848c81b2f5403db8c7b5207f54bce3f3faac3bde63445684092c2bc1a2427cddb6f7746496d9fbbef05fbbd77f2810b2998f1f9173 gcc-12.2.0.tar.xz
# Locally calculated (fetched from Github)
sha512 b0853e2b1c5998044392023fa653e399e74118c46e616504ac59e1a2cf27620f94434767ce06b6cf4ca3dfb57f81d6eda92752befaf095ea5e564a9181b4659c gcc-arc-2020.09-release.tar.gz
+2 -1
View File
@@ -104,6 +104,7 @@ endif
# Propagate options used for target software building to GCC target libs
HOST_GCC_COMMON_CONF_ENV += CFLAGS_FOR_TARGET="$(GCC_COMMON_TARGET_CFLAGS)"
HOST_GCC_COMMON_CONF_ENV += CXXFLAGS_FOR_TARGET="$(GCC_COMMON_TARGET_CXXFLAGS)"
HOST_GCC_COMMON_CONF_ENV += AR_FOR_TARGET=gcc-ar NM_FOR_TARGET=gcc-nm RANLIB_FOR_TARGET=gcc-ranlib
# libitm needs sparc V9+
ifeq ($(BR2_sparc_v8)$(BR2_sparc_leon3),y)
@@ -117,7 +118,7 @@ endif
# quadmath support requires wchar
ifeq ($(BR2_USE_WCHAR)$(BR2_TOOLCHAIN_HAS_LIBQUADMATH),yy)
HOST_GCC_COMMON_CONF_OPTS += --enable-libquadmath
HOST_GCC_COMMON_CONF_OPTS += --enable-libquadmath --enable-libquadmath-support
else
HOST_GCC_COMMON_CONF_OPTS += --disable-libquadmath --disable-libquadmath-support
endif
@@ -0,0 +1,55 @@
From bca7617f325787550e2133fe082dbe4da7716fc6 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 6 Aug 2016 17:32:50 -0700
Subject: [PATCH] ppc/ptrace: Define pt_regs uapi_pt_regs on !GLIBC systems
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
[Rebase on gdb 8.3]
Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
gdb/nat/ppc-linux.h | 6 ++++++
gdbserver/linux-ppc-low.cc | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/gdb/nat/ppc-linux.h b/gdb/nat/ppc-linux.h
index 1094f6b0be3..d8588a646c2 100644
--- a/gdb/nat/ppc-linux.h
+++ b/gdb/nat/ppc-linux.h
@@ -18,7 +18,13 @@
#ifndef NAT_PPC_LINUX_H
#define NAT_PPC_LINUX_H
+#if !defined(__GLIBC__)
+# define pt_regs uapi_pt_regs
+#endif
#include <asm/ptrace.h>
+#if !defined(__GLIBC__)
+# undef pt_regs
+#endif
#include <asm/cputable.h>
/* This sometimes isn't defined. */
diff --git a/gdbserver/linux-ppc-low.cc b/gdbserver/linux-ppc-low.cc
index 08824887003..69afbae5359 100644
--- a/gdbserver/linux-ppc-low.cc
+++ b/gdbserver/linux-ppc-low.cc
@@ -23,7 +23,13 @@
#include "elf/common.h"
#include <sys/uio.h>
#include <elf.h>
+#if !defined(__GLIBC__)
+# define pt_regs uapi_pt_regs
+#endif
#include <asm/ptrace.h>
+#if !defined(__GLIBC__)
+# undef pt_regs
+#endif
#include "arch/ppc-linux-common.h"
#include "arch/ppc-linux-tdesc.h"
--
2.37.1
@@ -0,0 +1,43 @@
From a3b84f1777bd75bdc5914f4ce5f52c55e723cd9a Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Sat, 3 Jun 2017 21:23:52 +0200
Subject: [PATCH] sh/ptrace: Define pt_{dsp,}regs uapi_pt_{dsp,}regs on !GLIBC
systems
Fixes a pt_{dsp,}regs redefinition when building with the musl C library
on SuperH.
Inspired by
http://git.yoctoproject.org/clean/cgit.cgi/poky/plain/meta/recipes-devtools/gdb/gdb/0004-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch,
adapted for SuperH.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
[Rebase on gdb 8.0]
Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
gdbserver/linux-sh-low.cc | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/gdbserver/linux-sh-low.cc b/gdbserver/linux-sh-low.cc
index 966bdeb8ba7..1e3ce53b4d5 100644
--- a/gdbserver/linux-sh-low.cc
+++ b/gdbserver/linux-sh-low.cc
@@ -76,7 +76,15 @@ extern const struct target_desc *tdesc_sh;
#include <sys/reg.h>
#endif
+#if !defined(__GLIBC__)
+# define pt_regs uapi_pt_regs
+# define pt_dspregs uapi_pt_dspregs
+#endif
#include <asm/ptrace.h>
+#if !defined(__GLIBC__)
+# undef pt_regs
+# undef pt_dspregs
+#endif
#define sh_num_regs 41
--
2.37.1
@@ -0,0 +1,40 @@
From 8c94bf2b40d51c500c364ac03a2da1e9f9a94287 Mon Sep 17 00:00:00 2001
From: Andre McCurdy <amccurdy@gmail.com>
Date: Sat, 30 Apr 2016 15:29:06 -0700
Subject: [PATCH] use <asm/sgidefs.h>
Build fix for MIPS with musl libc
The MIPS specific header <sgidefs.h> is provided by glibc and uclibc
but not by musl. Regardless of the libc, the kernel headers provide
<asm/sgidefs.h> which provides the same definitions, so use that
instead.
Upstream-Status: Pending
[Vincent:
Taken from: https://sourceware.org/bugzilla/show_bug.cgi?id=21070]
Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
---
gdb/mips-linux-nat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
index 20e12b6889e..1e66e98a013 100644
--- a/gdb/mips-linux-nat.c
+++ b/gdb/mips-linux-nat.c
@@ -31,7 +31,7 @@
#include "gdb_proc_service.h"
#include "gregset.h"
-#include <sgidefs.h>
+#include <asm/sgidefs.h>
#include "nat/gdb_ptrace.h"
#include <asm/ptrace.h>
#include "inf-ptrace.h"
--
2.37.1
@@ -0,0 +1,63 @@
From 48af20f76b468c5d274d286677a2887136c4c7c4 Mon Sep 17 00:00:00 2001
From: Romain Naour <romain.naour@gmail.com>
Date: Fri, 22 Jun 2018 22:40:26 +0200
Subject: [PATCH] gdbserver: fix build for m68k
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
As for strace [1], when <sys/reg.h> is included after <linux/ptrace.h>,
the build fails on m68k with the following diagnostics:
In file included from ./../nat/linux-ptrace.h:28:0,
from linux-low.h:27,
from linux-m68k-low.c:20:
[...]/usr/include/sys/reg.h:26:3: error: expected identifier before numeric constant
PT_D1 = 0,
^
[...]usr/include/sys/reg.h:26:3: error: expected « } » before numeric constant
[...]usr/include/sys/reg.h:26:3: error: expected unqualified-id before numeric constant
In file included from linux-m68k-low.c:27:0:
[...]usr/include/sys/reg.h:99:1: error: expected declaration before « } » token
};
^
Fix this by moving <sys/reg.h> on top of "linux-low.h".
[1] https://github.com/strace/strace/commit/6ebf6c4f9e5ebca123a5b5f24afe67cf0473cf92
Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
gdbserver/linux-m68k-low.cc | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/gdbserver/linux-m68k-low.cc b/gdbserver/linux-m68k-low.cc
index 7a433ffab5e..bb3fbd69bd7 100644
--- a/gdbserver/linux-m68k-low.cc
+++ b/gdbserver/linux-m68k-low.cc
@@ -17,6 +17,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "server.h"
+
+#ifdef HAVE_SYS_REG_H
+#include <sys/reg.h>
+#endif
+
#include "linux-low.h"
/* Linux target op definitions for the m68k architecture. */
@@ -80,10 +85,6 @@ m68k_target::low_decr_pc_after_break ()
void init_registers_m68k (void);
extern const struct target_desc *tdesc_m68k;
-#ifdef HAVE_SYS_REG_H
-#include <sys/reg.h>
-#endif
-
#define m68k_num_regs 29
#define m68k_num_gregs 18
--
2.37.1
@@ -0,0 +1,53 @@
From cbcb73a86dea0c0b9917b49b37095463155c5377 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Date: Sun, 24 Jun 2018 23:33:55 +0200
Subject: [PATCH] nat/fork-inferior: include linux-ptrace.h
To decide whether fork() or vfork() should be used, fork-inferior.c
uses the following test:
#if !(defined(__UCLIBC__) && defined(HAS_NOMMU))
However, HAS_NOMMU is never defined, because it gets defined in
linux-ptrace.h, which is not included by fork-inferior.c. Due to this,
gdbserver fails to build on noMMU architectures. This commit fixes
that by simply including linux-ptrace.h.
This bug was introduced by commit
2090129c36c7e582943b7d300968d19b46160d84 ("Share fork_inferior et al
with gdbserver"). Indeed, the same fork()/vfork() selection was done,
but in another file where linux-ptrace.h was included.
Fixes the following build issue:
../nat/fork-inferior.c: In function 'pid_t fork_inferior(const char*, const string&, char**, void (*)(), void (*)(int), void (*)(), const char*, void (*)(const char*, char* const*, char* const*))':
../nat/fork-inferior.c:376:11: error: 'fork' was not declared in this scope
pid = fork ();
^~~~
../nat/fork-inferior.c:376:11: note: suggested alternative: 'vfork'
pid = fork ();
^~~~
vfork
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
[Romain: rebase on gdb 8.3]
Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
gdb/nat/fork-inferior.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/gdb/nat/fork-inferior.c b/gdb/nat/fork-inferior.c
index 4df9a98047e..9bf0f6059f5 100644
--- a/gdb/nat/fork-inferior.c
+++ b/gdb/nat/fork-inferior.c
@@ -27,6 +27,7 @@
#include "gdbsupport/pathstuff.h"
#include "gdbsupport/signals-state-save-restore.h"
#include "gdbsupport/gdb_tilde_expand.h"
+#include "linux-ptrace.h"
#include <vector>
extern char **environ;
--
2.37.1
@@ -0,0 +1,39 @@
From 03efe04b5748703234516836cb0186d25b052556 Mon Sep 17 00:00:00 2001
From: Peter Seiderer <ps.report@gmx.net>
Date: Sat, 6 Nov 2021 10:06:25 +0100
Subject: [PATCH] Fix getrandom compile for uclibc < v1.0.35
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- fix getrandom compile for uclibc < v1.0.35, add missing stddef.h
include (fixed in uclibc since v1.0.35, see [1])
Fixes:
.../host/x86_64-buildroot-linux-uclibc/sysroot/usr/include/sys/random.h:27:35: error: unknown type name size_t
27 | extern int getrandom(void *__buf, size_t count, unsigned int flags)
| ^~~~~~
[1] https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/commit/?id=00972c02c2b6e0a95d5def4a71bdfb188e091782t
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
gnulib/import/getrandom.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/gnulib/import/getrandom.c b/gnulib/import/getrandom.c
index 41212fb329d..0ad3f9648d2 100644
--- a/gnulib/import/getrandom.c
+++ b/gnulib/import/getrandom.c
@@ -19,6 +19,7 @@
#include <config.h>
+#include <stddef.h>
#include <sys/random.h>
#include <errno.h>
--
2.37.1
@@ -0,0 +1,60 @@
From f2dd94dce490d8e8301fba9e4684cfb8d7bc7756 Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Wed, 10 Nov 2021 23:14:54 +0100
Subject: [PATCH] fix musl build on riscv
Fix the following build failure raised with musl:
../../gdbserver/linux-riscv-low.cc: In function 'void riscv_fill_fpregset(regcache*, void*)':
../../gdbserver/linux-riscv-low.cc:140:19: error: 'ELF_NFPREG' was not declared in this scope; did you mean 'ELF_NGREG'?
140 | for (i = 0; i < ELF_NFPREG - 1; i++, regbuf += flen)
| ^~~~~~~~~~
| ELF_NGREG
musl fixed the issue with
https://git.musl-libc.org/cgit/musl/commit/?id=e5d2823631bbfebacf48e1a34ed28f28d7cb2570
Fixes:
- http://autobuild.buildroot.org/results/16b19198980ce9c81a618b3f6e8dc9fe28247a28
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
gdb/nat/riscv-linux-tdesc.c | 5 +++++
gdbserver/linux-riscv-low.cc | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/gdb/nat/riscv-linux-tdesc.c b/gdb/nat/riscv-linux-tdesc.c
index 07b49c0f16e..1ff58cce16f 100644
--- a/gdb/nat/riscv-linux-tdesc.c
+++ b/gdb/nat/riscv-linux-tdesc.c
@@ -31,6 +31,11 @@
# define NFPREG 33
#endif
+/* Work around musl breakage since version 1.1.24. */
+#ifndef ELF_NFPREG
+# define ELF_NFPREG 33
+#endif
+
/* See nat/riscv-linux-tdesc.h. */
struct riscv_gdbarch_features
diff --git a/gdbserver/linux-riscv-low.cc b/gdbserver/linux-riscv-low.cc
index 6b2902e422d..ead54db09a8 100644
--- a/gdbserver/linux-riscv-low.cc
+++ b/gdbserver/linux-riscv-low.cc
@@ -30,6 +30,11 @@
# define NFPREG 33
#endif
+/* Work around musl breakage since version 1.1.24. */
+#ifndef ELF_NFPREG
+# define ELF_NFPREG 33
+#endif
+
/* Linux target op definitions for the RISC-V architecture. */
class riscv_target : public linux_process_target
--
2.37.1
@@ -0,0 +1,38 @@
From 73487022cb629415c3b0c2d9e125035b6e5c2d32 Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Thu, 18 Nov 2021 22:52:08 +0100
Subject: [PATCH] gdbserver/Makefile.in: fix NLS build
Fix the following build failure raised since gdb version 10.1 and
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=9a665d62266e75f0519f3a663784c458885b5c63:
CXXLD libinproctrace.so
/home/buildroot/autobuild/instance-2/output-1/host/opt/ext-toolchain/bin/../lib/gcc/i586-buildroot-linux-musl/9.3.0/../../../../i586-buildroot-linux-musl/bin/ld: gdbsupport/tdesc-ipa.o: in function `print_xml_feature::visit(tdesc_type_builtin const*)':
/home/buildroot/autobuild/instance-2/output-1/build/gdb-10.2/build/gdbserver/../../gdbserver/../gdbsupport/tdesc.cc:310: undefined reference to `libintl_gettext'
Fixes:
- http://autobuild.buildroot.org/results/faacc874fe9d32b74cb3d3dea988ef661cb0e3d0
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
[Upstream status:
https://sourceware.org/pipermail/gdb-patches/2021-November/183580.html]
---
gdbserver/Makefile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in
index 47648b8d962..9d862bcb9c9 100644
--- a/gdbserver/Makefile.in
+++ b/gdbserver/Makefile.in
@@ -383,7 +383,7 @@ $(IPA_LIB): $(sort $(IPA_OBJS)) ${CDEPS}
$(ECHO_CXXLD) $(CC_LD) -shared -fPIC -Wl,--soname=$(IPA_LIB) \
-Wl,--no-undefined $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) \
$(CXXFLAGS) \
- -o $(IPA_LIB) ${IPA_OBJS} $(LIBIBERTY_FOR_SHLIB) -ldl -pthread
+ -o $(IPA_LIB) ${IPA_OBJS} $(LIBIBERTY_FOR_SHLIB) -ldl -pthread $(INTL)
# Put the proper machine-specific files first, so M-. on a machine
# specific routine gets the one for the correct machine.
--
2.37.1
@@ -0,0 +1,57 @@
From 222cb32acf044fe90e8534b064f9168ad0d8c705 Mon Sep 17 00:00:00 2001
From: Romain Naour <romain.naour@gmail.com>
Date: Sun, 28 Aug 2022 23:21:37 +0200
Subject: [PATCH] gdb: Fix native build on xtensa
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Apply a similar fix than for Alpha architecture on gdb 9:
https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=7a27b85f6d9b5eea9bd1493f903158fbea4b2231
Fixes:
../../gdb/xtensa-linux-nat.c: In function void fill_gregset(const regcache*, elf_greg_t (*)[128], int):
../../gdb/xtensa-linux-nat.c:66:17: error: gdbarch_pc_regnum was not declared in this scope
66 | if (regnum == gdbarch_pc_regnum (gdbarch) || regnum == -1)
| ^~~~~~~~~~~~~~~~~
CXX complaints.o
../../gdb/xtensa-linux-nat.c:68:17: error: gdbarch_ps_regnum was not declared in this scope
68 | if (regnum == gdbarch_ps_regnum (gdbarch) || regnum == -1)
| ^~~~~~~~~~~~~~~~~
../../gdb/xtensa-linux-nat.c:71:38: error: no matching function for call to gdbarch_tdep::gdbarch_tdep(gdbarch*&)
71 | if (regnum == gdbarch_tdep (gdbarch)->wb_regnum || regnum == -1)
| ^
In file included from ../../gdb/xtensa-linux-nat.c:38:
../../gdb/xtensa-tdep.h:160:8: note: candidate: gdbarch_tdep::gdbarch_tdep()
160 | struct gdbarch_tdep
| ^~~~~~~~~~~~
../../gdb/xtensa-tdep.h:160:8: note: candidate expects 0 arguments, 1 provided
../../gdb/xtensa-tdep.h:160:8: note: candidate: constexpr gdbarch_tdep::gdbarch_tdep(const gdbarch_tdep&)
../../gdb/xtensa-tdep.h:160:8: note: no known conversion for argument 1 from gdbarch* to const gdbarch_tdep&
../../gdb/xtensa-tdep.h:160:8: note: candidate: constexpr gdbarch_tdep::gdbarch_tdep(gdbarch_tdep&&)
../../gdb/xtensa-tdep.h:160:8: note: no known conversion for argument 1 from gdbarch* to gdbarch_tdep&&
../../gdb/xtensa-linux-nat.c:72:49: error: no matching function for call to gdbarch_tdep::gdbarch_tdep(gdbarch*&)
72 | regcache->raw_collect (gdbarch_tdep (gdbarch)->wb_regnum,
| ^
Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
gdb/xtensa-linux-nat.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/gdb/xtensa-linux-nat.c b/gdb/xtensa-linux-nat.c
index 097d7bd6f96..4e4290fe038 100644
--- a/gdb/xtensa-linux-nat.c
+++ b/gdb/xtensa-linux-nat.c
@@ -36,6 +36,7 @@
#include "gregset.h"
#include "xtensa-tdep.h"
+#include "gdbarch.h"
/* Defines ps_err_e, struct ps_prochandle. */
#include "gdb_proc_service.h"
--
2.37.2
+11 -2
View File
@@ -61,7 +61,7 @@ config BR2_PACKAGE_HOST_GDB_SIM
choice
prompt "GDB debugger Version"
default BR2_GDB_VERSION_10
default BR2_GDB_VERSION_12
depends on !BR2_arc
depends on !BR2_csky
help
@@ -74,9 +74,16 @@ config BR2_GDB_VERSION_9_2
config BR2_GDB_VERSION_10
bool "gdb 10.x"
# gdbserver support missing
depends on !BR2_or1k
config BR2_GDB_VERSION_11
bool "gdb 11.x"
# gdbserver support missing
depends on !BR2_or1k
config BR2_GDB_VERSION_12
bool "gdb 12.x"
endchoice
@@ -88,8 +95,9 @@ config BR2_GDB_VERSION
default "arc-2020.09-release-gdb" if BR2_arc
default "4ecb98fbc2f94dbe01b69384afbc515107de73df" if BR2_csky
default "9.2" if BR2_GDB_VERSION_9_2
default "10.2" if BR2_GDB_VERSION_10 || !BR2_PACKAGE_HOST_GDB
default "10.2" if BR2_GDB_VERSION_10
default "11.1" if BR2_GDB_VERSION_11
default "12.1" if BR2_GDB_VERSION_12 || !BR2_PACKAGE_HOST_GDB
depends on BR2_PACKAGE_GDB || BR2_PACKAGE_HOST_GDB
# recent gdb versions (>= 10) have gdbserver moved at the top-level,
@@ -99,5 +107,6 @@ config BR2_PACKAGE_GDB_TOPLEVEL
default y if BR2_arc
default y if BR2_GDB_VERSION_10
default y if BR2_GDB_VERSION_11
default y if BR2_GDB_VERSION_12
default y if !BR2_PACKAGE_HOST_GDB
depends on BR2_PACKAGE_GDB || BR2_PACKAGE_HOST_GDB
+1
View File
@@ -2,6 +2,7 @@
sha512 73635f00f343117aa5e2436f1e1597099e2bfb31ef7bb162b273fa1ea282c3fa9b0f52762e70bfc7ad0334addb8d159e9ac7cbe5998ca4f755ea8cf90714d274 gdb-9.2.tar.xz
sha512 3653762ac008e065c37cd641653184c9ff7ce51ee2222ade1122bec9d6cc64dffd4fb74888ef11ac1942064a08910e96b7865112ad37f4602eb0a16bed074caa gdb-10.2.tar.xz
sha512 c40bf970e2f7c2107b29c5aa6a7150daa709d75ddadb73ac20742419d4637d158e3063a4c6ff6e47fae8ca8e1d36253973f85ea15445d004be6d5d7a2dd9bd46 gdb-11.1.tar.xz
sha512 425568d2e84672177d0fb87b1ad7daafdde097648d605e30cf0656970f66adc6a82ca2d83375ea4be583e9683a340e5bfdf5819668ddf66728200141ae50ff2d gdb-12.1.tar.xz
# Locally calculated (fetched from Github)
sha512 5a2acf2fd33ab2ff589e1037ca40abda54328997dcff26b2b49b874bd3be980be5a63342962254f3c3bda98e32ce7a33af704d37353352833dee193135600458 gdb-arc-2020.09-release-gdb.tar.gz
+9
View File
@@ -169,6 +169,15 @@ GDB_CONF_OPTS += \
--without-curses
endif
# Starting from GDB 11.x, gmp is needed as a dependency to build full
# gdb. So we avoid the dependency only for GDB 10.x and the special
# version used on ARC.
ifeq ($(BR2_GDB_VERSION_10)$(BR2_arc):$(BR2_PACKAGE_GDB_DEBUGGER),:y)
GDB_CONF_OPTS += \
--with-libgmp-prefix=$(STAGING_DIR)/usr
GDB_DEPENDENCIES += gmp
endif
ifeq ($(BR2_PACKAGE_GDB_SERVER),y)
GDB_CONF_OPTS += --enable-gdbserver
GDB_DEPENDENCIES += $(TARGET_NLS_DEPENDENCIES)
@@ -0,0 +1,132 @@
From dfda505870f94a7ac8063eb47f622ddc65665ff1 Mon Sep 17 00:00:00 2001
From: James Hilliard <james.hilliard1@gmail.com>
Date: Tue, 14 Jun 2022 19:42:43 -0600
Subject: [PATCH] Revert "Linux: Implement a useful version of _startup_fatal"
Fixes:
csu/libc-tls.c:202: undefined reference to `_startup_fatal_not_constant'
This reverts commit 2d05ba7f8ef979947e910a37ae8115a816eb4d08.
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
sysdeps/unix/sysv/linux/i386/startup.h | 23 ++++++++++++---
sysdeps/unix/sysv/linux/ia64/startup.h | 22 ---------------
sysdeps/unix/sysv/linux/startup.h | 39 --------------------------
3 files changed, 19 insertions(+), 65 deletions(-)
delete mode 100644 sysdeps/unix/sysv/linux/ia64/startup.h
delete mode 100644 sysdeps/unix/sysv/linux/startup.h
diff --git a/sysdeps/unix/sysv/linux/i386/startup.h b/sysdeps/unix/sysv/linux/i386/startup.h
index 213805d7d2..67c9310f3a 100644
--- a/sysdeps/unix/sysv/linux/i386/startup.h
+++ b/sysdeps/unix/sysv/linux/i386/startup.h
@@ -1,5 +1,5 @@
/* Linux/i386 definitions of functions used by static libc main startup.
- Copyright (C) 2022 Free Software Foundation, Inc.
+ Copyright (C) 2017-2022 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -16,7 +16,22 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-/* Can't use "call *%gs:SYSINFO_OFFSET" during startup. */
-#define I386_USE_SYSENTER 0
+#if BUILD_PIE_DEFAULT
+/* Can't use "call *%gs:SYSINFO_OFFSET" during statup in static PIE. */
+# define I386_USE_SYSENTER 0
-#include_next <startup.h>
+# include <sysdep.h>
+# include <abort-instr.h>
+
+__attribute__ ((__noreturn__))
+static inline void
+_startup_fatal (const char *message __attribute__ ((unused)))
+{
+ /* This is only called very early during startup in static PIE.
+ FIXME: How can it be improved? */
+ ABORT_INSTRUCTION;
+ __builtin_unreachable ();
+}
+#else
+# include_next <startup.h>
+#endif
diff --git a/sysdeps/unix/sysv/linux/ia64/startup.h b/sysdeps/unix/sysv/linux/ia64/startup.h
deleted file mode 100644
index 77f29f15a2..0000000000
--- a/sysdeps/unix/sysv/linux/ia64/startup.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Linux/ia64 definitions of functions used by static libc main startup.
- Copyright (C) 2022 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- 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
- <https://www.gnu.org/licenses/>. */
-
-/* This code is used before the TCB is set up. */
-#define IA64_USE_NEW_STUB 0
-
-#include_next <startup.h>
diff --git a/sysdeps/unix/sysv/linux/startup.h b/sysdeps/unix/sysv/linux/startup.h
deleted file mode 100644
index 39859b404a..0000000000
--- a/sysdeps/unix/sysv/linux/startup.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Linux definitions of functions used by static libc main startup.
- Copyright (C) 2017-2022 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- 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
- <https://www.gnu.org/licenses/>. */
-
-#ifdef SHARED
-# include_next <startup.h>
-#else
-# include <sysdep.h>
-
-/* Avoid a run-time invocation of strlen. */
-#define _startup_fatal(message) \
- do \
- { \
- size_t __message_length = __builtin_strlen (message); \
- if (! __builtin_constant_p (__message_length)) \
- { \
- extern void _startup_fatal_not_constant (void); \
- _startup_fatal_not_constant (); \
- } \
- INTERNAL_SYSCALL_CALL (write, STDERR_FILENO, (message), \
- __message_length); \
- INTERNAL_SYSCALL_CALL (exit_group, 127); \
- } \
- while (0)
-#endif /* !SHARED */
--
2.25.1
@@ -0,0 +1,117 @@
From 2d7ed98add14f75041499ac189696c9bd3d757fe Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <slyich@gmail.com>
Date: Tue, 13 Sep 2022 13:39:13 -0400
Subject: [PATCH] Makerules: fix MAKEFLAGS assignment for upcoming make-4.4
[BZ# 29564]
make-4.4 will add long flags to MAKEFLAGS variable:
* WARNING: Backward-incompatibility!
Previously only simple (one-letter) options were added to the MAKEFLAGS
variable that was visible while parsing makefiles. Now, all options
are available in MAKEFLAGS.
This causes locale builds to fail when long options are used:
$ make --shuffle
...
make -C localedata install-locales
make: invalid shuffle mode: '1662724426r'
The change fixes it by passing eash option via whitespace and dashes.
That way option is appended to both single-word form and whitespace
separated form.
While at it fixed --silent mode detection in $(MAKEFLAGS) by filtering
out --long-options. Otherwise options like --shuffle flag enable silent
mode unintentionally. $(silent-make) variable consolidates the checks.
Resolves: BZ# 29564
CC: Paul Smith <psmith@gnu.org>
CC: Siddhesh Poyarekar <siddhesh@gotplt.org>
Signed-off-by: Sergei Trofimovich <slyich@gmail.com>
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
[james.hilliard1@gmail.com: backport from upstream commit
2d7ed98add14f75041499ac189696c9bd3d757fe]
---
Makeconfig | 18 +++++++++++++++++-
Makerules | 4 ++--
elf/rtld-Rules | 2 +-
3 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/Makeconfig b/Makeconfig
index f8164a0025..842f49eb58 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -43,6 +43,22 @@ else
$(error objdir must be defined by the build-directory Makefile)
endif
+# Did we request 'make -s' run? "yes" or "no".
+# Starting from make-4.4 MAKEFLAGS now contains long
+# options like '--shuffle'. To detect presence of 's'
+# we pick first word with short options. Long options
+# are guaranteed to come after whitespace. We use '-'
+# prefix to always have a word before long options
+# even if no short options were passed.
+# Typical MAKEFLAGS values to watch for:
+# "rs --shuffle=42" (silent)
+# " --shuffle" (not silent)
+ifeq ($(findstring s, $(firstword -$(MAKEFLAGS))),)
+silent-make := no
+else
+silent-make := yes
+endif
+
# Root of the sysdeps tree.
sysdep_dir := $(..)sysdeps
export sysdep_dir := $(sysdep_dir)
@@ -917,7 +933,7 @@ endif
# umpteen zillion filenames along with it (we use `...' instead)
# but we don't want this echoing done when the user has said
# he doesn't want to see commands echoed by using -s.
-ifneq "$(findstring s,$(MAKEFLAGS))" "" # if -s
+ifeq ($(silent-make),yes) # if -s
+cmdecho := echo >/dev/null
else # not -s
+cmdecho := echo
diff --git a/Makerules b/Makerules
index d1e139d03c..09c0cf8357 100644
--- a/Makerules
+++ b/Makerules
@@ -794,7 +794,7 @@ endif
# Maximize efficiency by minimizing the number of rules.
.SUFFIXES: # Clear the suffix list. We don't use suffix rules.
# Don't define any builtin rules.
-MAKEFLAGS := $(MAKEFLAGS)r
+MAKEFLAGS := $(MAKEFLAGS) -r
# Generic rule for making directories.
%/:
@@ -811,7 +811,7 @@ MAKEFLAGS := $(MAKEFLAGS)r
.PRECIOUS: $(foreach l,$(libtypes),$(patsubst %,$(common-objpfx)$l,c))
# Use the verbose option of ar and tar when not running silently.
-ifeq "$(findstring s,$(MAKEFLAGS))" "" # if not -s
+ifeq ($(silent-make),no) # if not -s
verbose := v
else # -s
verbose :=
diff --git a/elf/rtld-Rules b/elf/rtld-Rules
index ca00dd1fe2..3c5e273f2b 100644
--- a/elf/rtld-Rules
+++ b/elf/rtld-Rules
@@ -52,7 +52,7 @@ $(objpfx)rtld-libc.a: $(foreach dir,$(rtld-subdirs),\
mv -f $@T $@
# Use the verbose option of ar and tar when not running silently.
-ifeq "$(findstring s,$(MAKEFLAGS))" "" # if not -s
+ifeq ($(silent-make),no) # if not -s
verbose := v
else # -s
verbose :=
--
2.34.1
@@ -0,0 +1,48 @@
From 3935b543adcb9a46ab79f8931bc489068b049378 Mon Sep 17 00:00:00 2001
From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Date: Wed, 21 Sep 2022 10:51:08 -0300
Subject: [PATCH] x86: Fix -Os build (BZ #29576)
The compiler might transform __stpcpy calls (which are routed to
__builtin_stpcpy as an optimization) to strcpy and x86_64 strcpy
multiarch implementation does not build any working symbol due
ISA_SHOULD_BUILD not being evaluated for IS_IN(rtld).
Checked on x86_64-linux-gnu.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
(cherry picked from commit 9dc4e29f630c6ef8299120b275e503321dc0c8c7)
Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
sysdeps/x86_64/multiarch/rtld-strcpy.S | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
create mode 100644 sysdeps/x86_64/multiarch/rtld-strcpy.S
diff --git a/sysdeps/x86_64/multiarch/rtld-strcpy.S b/sysdeps/x86_64/multiarch/rtld-strcpy.S
new file mode 100644
index 0000000000..19439c553d
--- /dev/null
+++ b/sysdeps/x86_64/multiarch/rtld-strcpy.S
@@ -0,0 +1,18 @@
+/* Copyright (C) 2022 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ 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
+ <https://www.gnu.org/licenses/>. */
+
+#include "../strcpy.S"
--
2.34.3
@@ -0,0 +1,397 @@
From 666e593642136fad34be8eef1fcf1e872830013c Mon Sep 17 00:00:00 2001
From: Mason Huo <mason.huo@starfivetech.com>
Date: Mon, 17 Apr 2023 13:41:06 +0800
Subject: [PATCH] Optimize memory operations for RISCV
Port the linux kernel memcpy function for optimizing
the 128 byte align case, this will improve the
performance of large block memcpy.
Here we combine the memcpy of glibc and kernel.
Signed-off-by: Mason Huo <mason.huo@starfivetech.com>
---
sysdeps/riscv/Makefile | 4 +
sysdeps/riscv/memcpy.c | 265 +++++++++++++++++++++++++++++++++
sysdeps/riscv/memcpy_aligned.S | 82 ++++++++++
3 files changed, 351 insertions(+)
create mode 100644 sysdeps/riscv/memcpy.c
create mode 100644 sysdeps/riscv/memcpy_aligned.S
diff --git a/sysdeps/riscv/Makefile b/sysdeps/riscv/Makefile
index 20a99681..5c3c3244 100644
--- a/sysdeps/riscv/Makefile
+++ b/sysdeps/riscv/Makefile
@@ -2,6 +2,10 @@ ifeq ($(subdir),misc)
sysdep_headers += sys/asm.h
endif
+ifeq ($(subdir),string)
+sysdep_routines += memcpy_aligned
+endif
+
# RISC-V's assembler also needs to know about PIC as it changes the definition
# of some assembler macros.
ASFLAGS-.os += $(pic-ccflag)
diff --git a/sysdeps/riscv/memcpy.c b/sysdeps/riscv/memcpy.c
new file mode 100644
index 00000000..1de6141e
--- /dev/null
+++ b/sysdeps/riscv/memcpy.c
@@ -0,0 +1,265 @@
+/* Copy memory to memory until the specified number of bytes
+ has been copied. Overlap is NOT handled correctly.
+ Copyright (C) 1991-2020 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Torbjorn Granlund (tege@sics.se).
+
+ 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
+ <https://www.gnu.org/licenses/>. */
+
+#include <stddef.h>
+#include <string.h>
+
+#define MERGE(w0, sh_1, w1, sh_2) (((w0) >> (sh_1)) | ((w1) << (sh_2)))
+#define OP_T_THRES 16
+#define op_t unsigned long
+#define OPSIZ (sizeof(op_t))
+#define OPSIZ_MASK (sizeof(op_t) - 1)
+#define FAST_COPY_THRES (128)
+#define byte unsigned char
+
+static void _wordcopy_fwd_aligned(long dstp, long srcp, size_t len)
+{
+ op_t a0, a1;
+
+ switch (len % 8) {
+ case 2:
+ a0 = ((op_t *) srcp)[0];
+ srcp -= 6 * OPSIZ;
+ dstp -= 7 * OPSIZ;
+ len += 6;
+ goto do1;
+ case 3:
+ a1 = ((op_t *) srcp)[0];
+ srcp -= 5 * OPSIZ;
+ dstp -= 6 * OPSIZ;
+ len += 5;
+ goto do2;
+ case 4:
+ a0 = ((op_t *) srcp)[0];
+ srcp -= 4 * OPSIZ;
+ dstp -= 5 * OPSIZ;
+ len += 4;
+ goto do3;
+ case 5:
+ a1 = ((op_t *) srcp)[0];
+ srcp -= 3 * OPSIZ;
+ dstp -= 4 * OPSIZ;
+ len += 3;
+ goto do4;
+ case 6:
+ a0 = ((op_t *) srcp)[0];
+ srcp -= 2 * OPSIZ;
+ dstp -= 3 * OPSIZ;
+ len += 2;
+ goto do5;
+ case 7:
+ a1 = ((op_t *) srcp)[0];
+ srcp -= 1 * OPSIZ;
+ dstp -= 2 * OPSIZ;
+ len += 1;
+ goto do6;
+
+ case 0:
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ return;
+ a0 = ((op_t *) srcp)[0];
+ srcp -= 0 * OPSIZ;
+ dstp -= 1 * OPSIZ;
+ goto do7;
+ case 1:
+ a1 = ((op_t *) srcp)[0];
+ srcp -= -1 * OPSIZ;
+ dstp -= 0 * OPSIZ;
+ len -= 1;
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ goto do0;
+ goto do8; /* No-op. */
+ }
+
+ do {
+do8:
+ a0 = ((op_t *) srcp)[0];
+ ((op_t *) dstp)[0] = a1;
+do7:
+ a1 = ((op_t *) srcp)[1];
+ ((op_t *) dstp)[1] = a0;
+do6:
+ a0 = ((op_t *) srcp)[2];
+ ((op_t *) dstp)[2] = a1;
+do5:
+ a1 = ((op_t *) srcp)[3];
+ ((op_t *) dstp)[3] = a0;
+do4:
+ a0 = ((op_t *) srcp)[4];
+ ((op_t *) dstp)[4] = a1;
+do3:
+ a1 = ((op_t *) srcp)[5];
+ ((op_t *) dstp)[5] = a0;
+do2:
+ a0 = ((op_t *) srcp)[6];
+ ((op_t *) dstp)[6] = a1;
+do1:
+ a1 = ((op_t *) srcp)[7];
+ ((op_t *) dstp)[7] = a0;
+
+ srcp += 8 * OPSIZ;
+ dstp += 8 * OPSIZ;
+ len -= 8;
+ } while (len != 0);
+
+ /* This is the right position for do0. Please don't move
+ * it into the loop.
+ */
+do0:
+ ((op_t *) dstp)[0] = a1;
+}
+
+static void _wordcopy_fwd_dest_aligned(long dstp, long srcp, size_t len)
+{
+ op_t a0, a1, a2, a3;
+ int sh_1, sh_2;
+
+ /* Calculate how to shift a word read at the memory operation
+ * aligned srcp to make it aligned for copy.
+ */
+
+ sh_1 = 8 * (srcp % OPSIZ);
+ sh_2 = 8 * OPSIZ - sh_1;
+
+ /* Make SRCP aligned by rounding it down to the beginning of the `op_t'
+ * it points in the middle of.
+ */
+ srcp &= -OPSIZ;
+
+ switch (len % 4) {
+ case 2:
+ a1 = ((op_t *) srcp)[0];
+ a2 = ((op_t *) srcp)[1];
+ srcp -= 1 * OPSIZ;
+ dstp -= 3 * OPSIZ;
+ len += 2;
+ goto do1;
+ case 3:
+ a0 = ((op_t *) srcp)[0];
+ a1 = ((op_t *) srcp)[1];
+ srcp -= 0 * OPSIZ;
+ dstp -= 2 * OPSIZ;
+ len += 1;
+ goto do2;
+ case 0:
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ return;
+ a3 = ((op_t *) srcp)[0];
+ a0 = ((op_t *) srcp)[1];
+ srcp -= -1 * OPSIZ;
+ dstp -= 1 * OPSIZ;
+ len += 0;
+ goto do3;
+ case 1:
+ a2 = ((op_t *) srcp)[0];
+ a3 = ((op_t *) srcp)[1];
+ srcp -= -2 * OPSIZ;
+ dstp -= 0 * OPSIZ;
+ len -= 1;
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ goto do0;
+ goto do4; /* No-op. */
+ }
+
+ do {
+do4:
+ a0 = ((op_t *) srcp)[0];
+ ((op_t *) dstp)[0] = MERGE(a2, sh_1, a3, sh_2);
+do3:
+ a1 = ((op_t *) srcp)[1];
+ ((op_t *) dstp)[1] = MERGE(a3, sh_1, a0, sh_2);
+do2:
+ a2 = ((op_t *) srcp)[2];
+ ((op_t *) dstp)[2] = MERGE(a0, sh_1, a1, sh_2);
+do1:
+ a3 = ((op_t *) srcp)[3];
+ ((op_t *) dstp)[3] = MERGE(a1, sh_1, a2, sh_2);
+
+ srcp += 4 * OPSIZ;
+ dstp += 4 * OPSIZ;
+ len -= 4;
+ } while (len != 0);
+
+ /* This is the right position for do0. Please don't move
+ * it into the loop.
+ */
+do0:
+ ((op_t *) dstp)[0] = MERGE(a2, sh_1, a3, sh_2);
+}
+
+#define BYTE_COPY_FWD(dst_bp, src_bp, nbytes) \
+do { \
+ size_t __nbytes = (nbytes); \
+ while (__nbytes > 0) { \
+ byte __x = ((byte *) src_bp)[0]; \
+ src_bp += 1; \
+ __nbytes -= 1; \
+ ((byte *) dst_bp)[0] = __x; \
+ dst_bp += 1; \
+ } \
+} while (0)
+
+#define WORD_COPY_FWD(dst_bp, src_bp, nbytes_left, nbytes) \
+do { \
+ if (src_bp % OPSIZ == 0) \
+ _wordcopy_fwd_aligned(dst_bp, src_bp, (nbytes) / OPSIZ); \
+ else \
+ _wordcopy_fwd_dest_aligned(dst_bp, src_bp, (nbytes) / OPSIZ); \
+ src_bp += (nbytes) & -OPSIZ; \
+ dst_bp += (nbytes) & -OPSIZ; \
+ (nbytes_left) = (nbytes) % OPSIZ; \
+} while (0)
+
+extern void *__memcpy_aligned(void *dest, const void *src, size_t len);
+void *__memcpy(void *dest, const void *src, size_t len)
+{
+ unsigned long dstp = (long) dest;
+ unsigned long srcp = (long) src;
+
+ /* If there not too few bytes to copy, use word copy. */
+ if (len >= OP_T_THRES) {
+ if ((len >= FAST_COPY_THRES) && ((dstp & OPSIZ_MASK) == 0) &&
+ ((srcp & OPSIZ_MASK) == 0)) {
+ __memcpy_aligned(dest, src, len);
+ return dest;
+ }
+ /* Copy just a few bytes to make DSTP aligned. */
+ len -= (-dstp) % OPSIZ;
+ BYTE_COPY_FWD(dstp, srcp, (-dstp) % OPSIZ);
+
+ /* Copy from SRCP to DSTP taking advantage of the known alignment of
+ * DSTP. Number of bytes remaining is put in the third argument,
+ * i.e. in LEN. This number may vary from machine to machine.
+ */
+ WORD_COPY_FWD(dstp, srcp, len, len);
+ /* Fall out and copy the tail. */
+ }
+
+ /* There are just a few bytes to copy. Use byte memory operations. */
+ BYTE_COPY_FWD(dstp, srcp, len);
+
+ return dest;
+}
+
+#ifdef weak_alias
+weak_alias (__memcpy, memcpy)
+#endif
+
+libc_hidden_builtin_def (memcpy)
diff --git a/sysdeps/riscv/memcpy_aligned.S b/sysdeps/riscv/memcpy_aligned.S
new file mode 100644
index 00000000..b9b01e35
--- /dev/null
+++ b/sysdeps/riscv/memcpy_aligned.S
@@ -0,0 +1,82 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2013 Regents of the University of California
+ */
+
+#include <sysdep.h>
+#include <sys/asm.h>
+
+/* void *__memcpy_aligned(void *, const void *, size_t) */
+ENTRY(__memcpy_aligned)
+ move t6, a0 /* Preserve return value */
+
+2:
+ andi a4, a2, ~((16*SZREG)-1)
+ beqz a4, 4f
+ add a3, a1, a4
+3:
+ REG_L a4, 0(a1)
+ REG_L a5, SZREG(a1)
+ REG_L a6, 2*SZREG(a1)
+ REG_L a7, 3*SZREG(a1)
+ REG_L t0, 4*SZREG(a1)
+ REG_L t1, 5*SZREG(a1)
+ REG_L t2, 6*SZREG(a1)
+ REG_L t3, 7*SZREG(a1)
+ REG_L t4, 8*SZREG(a1)
+ REG_L t5, 9*SZREG(a1)
+ REG_S a4, 0(t6)
+ REG_S a5, SZREG(t6)
+ REG_S a6, 2*SZREG(t6)
+ REG_S a7, 3*SZREG(t6)
+ REG_S t0, 4*SZREG(t6)
+ REG_S t1, 5*SZREG(t6)
+ REG_S t2, 6*SZREG(t6)
+ REG_S t3, 7*SZREG(t6)
+ REG_S t4, 8*SZREG(t6)
+ REG_S t5, 9*SZREG(t6)
+ REG_L a4, 10*SZREG(a1)
+ REG_L a5, 11*SZREG(a1)
+ REG_L a6, 12*SZREG(a1)
+ REG_L a7, 13*SZREG(a1)
+ REG_L t0, 14*SZREG(a1)
+ REG_L t1, 15*SZREG(a1)
+ addi a1, a1, 16*SZREG
+ REG_S a4, 10*SZREG(t6)
+ REG_S a5, 11*SZREG(t6)
+ REG_S a6, 12*SZREG(t6)
+ REG_S a7, 13*SZREG(t6)
+ REG_S t0, 14*SZREG(t6)
+ REG_S t1, 15*SZREG(t6)
+ addi t6, t6, 16*SZREG
+ bltu a1, a3, 3b
+ andi a2, a2, (16*SZREG)-1 /* Update count */
+
+4:
+ /* Handle trailing misalignment */
+ beqz a2, 6f
+ add a3, a1, a2
+
+ /* Use word-oriented copy if co-aligned to word boundary */
+ or a5, a1, t6
+ or a5, a5, a3
+ andi a5, a5, 3
+ bnez a5, 5f
+7:
+ lw a4, 0(a1)
+ addi a1, a1, 4
+ sw a4, 0(t6)
+ addi t6, t6, 4
+ bltu a1, a3, 7b
+
+ ret
+
+5:
+ lb a4, 0(a1)
+ addi a1, a1, 1
+ sb a4, 0(t6)
+ addi t6, t6, 1
+ bltu a1, a3, 5b
+6:
+ ret
+END(__memcpy_aligned)
--
2.39.2
+53
View File
@@ -1,3 +1,44 @@
config BR2_PACKAGE_GLIBC_ARCH_SUPPORTS
bool
default y if BR2_arm
default y if BR2_armeb
default y if BR2_aarch64
default y if BR2_aarch64_be
default y if BR2_i386
default y if BR2_mips
default y if BR2_mipsel
default y if BR2_mips64
default y if BR2_mips64el
default y if BR2_or1k
default y if BR2_powerpc
default y if BR2_powerpc64
default y if BR2_powerpc64le
default y if BR2_riscv
default y if BR2_s390x
default y if BR2_sh
default y if BR2_sparc64
default y if BR2_x86_64
default y if BR2_microblaze
default y if BR2_nios2
default y if BR2_arc && BR2_ARC_ATOMIC_EXT
depends on !BR2_powerpc_SPE
depends on BR2_RISCV_ISA_RVA || !BR2_riscv
depends on BR2_USE_MMU
config BR2_PACKAGE_GLIBC_SUPPORTS
bool
default y if BR2_PACKAGE_GLIBC_ARCH_SUPPORTS
# Make sure to keep these dependencies in sync with the
# Config.in comments in
# toolchain/toolchain-buildroot/Config.in
depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_2
depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_10 || !BR2_powerpc64le
depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_5 || !BR2_MIPS_NAN_2008
depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_4 || !BR2_RISCV_32
depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_0 || !BR2_RISCV_64
depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_1 || !BR2_arc
depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_4 || !BR2_or1k
if BR2_TOOLCHAIN_BUILDROOT_GLIBC
comment "Glibc Options"
@@ -10,6 +51,18 @@ config BR2_PACKAGE_GLIBC
help
https://www.gnu.org/software/libc/
config BR2_PACKAGE_GLIBC_KERNEL_COMPAT
bool "Enable compatibility shims to run on older kernels"
help
Say 'y' here if you plan on running your system on a kernel
older than the version used for the toolchain headers.
Enabling those compatibility shims may generate a slightly
bigger and slightly slower glibc library.
The oldest supported kernel version depends on the
architecture.
config BR2_PACKAGE_GLIBC_UTILS
bool "Install glibc utilities"
help
+7 -2
View File
@@ -1,2 +1,7 @@
# This hash file is not used; instead, update the
# hash files in the per-version sub-directories.
# Locally calculated (fetched from Github)
sha256 51b946f6c8dddd2b0c9902f7792ecf594497da6b0cc8fb9246fa30f108cbb422 glibc-2.36-66-ga1dc0be03c9dd850b864bd7a9c03cf8e396eb7ca.tar.gz
# Hashes for license files
sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643 COPYING
sha256 dc626520dcd53a22f727af3ee42c770e56c97a64fe3adb063799d8ab032fe551 COPYING.LIB
sha256 b33d0bd9f685b46853548814893a6135e74430d12f6d94ab3eba42fc591f83bc LICENSES
+6 -1
View File
@@ -7,7 +7,7 @@
# Generate version string using:
# git describe --match 'glibc-*' --abbrev=40 origin/release/MAJOR.MINOR/master | cut -d '-' -f 2-
# When updating the version, please also update localedef
GLIBC_VERSION = 2.32-50-g737efa27fca5c97f566a2005687fda7d6659cd2e
GLIBC_VERSION = 2.36-66-ga1dc0be03c9dd850b864bd7a9c03cf8e396eb7ca
# Upstream doesn't officially provide an https download link.
# There is one (https://sourceware.org/git/glibc.git) but it's not reliable,
# sometimes the connection times out. So use an unofficial github mirror.
@@ -53,6 +53,11 @@ ifeq ($(BR2_ENABLE_DEBUG),y)
GLIBC_EXTRA_CFLAGS += -g
endif
# glibc explicitly requires compile barriers between files
ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_7),y)
GLIBC_EXTRA_CFLAGS += -fno-lto
endif
# The stubs.h header is not installed by install-headers, but is
# needed for the gcc build. An empty stubs.h will work, as explained
# in http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html. The same trick
@@ -0,0 +1,30 @@
From d1ca3f53c96dc8a4048b17dc16147a8fac782d4a Mon Sep 17 00:00:00 2001
From: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Date: Mon, 14 Feb 2022 13:54:09 +0200
Subject: [PATCH] libmatrix: Add missing <utility> include
Fixes compilation with GCC 12.
Fixes #169
[Paul: backport upstream d1ca3f53c96dc8a4048b17dc16147a8fac782d4a]
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
src/libmatrix/program.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/libmatrix/program.h b/src/libmatrix/program.h
index f95b470..1c9de08 100644
--- a/src/libmatrix/program.h
+++ b/src/libmatrix/program.h
@@ -15,6 +15,7 @@
#include <string>
#include <vector>
#include <map>
+#include <utility>
#include "mat.h"
// Simple shader container. Abstracts all of the OpenGL bits, but leaves
--
2.35.1
+31 -1
View File
@@ -65,6 +65,14 @@ config BR2_KERNEL_HEADERS_5_14
config BR2_KERNEL_HEADERS_5_15
bool "Linux 5.15.x kernel headers"
select BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_15
config BR2_KERNEL_HEADERS_5_19
bool "Linux 5.19.x kernel headers"
select BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_19
config BR2_KERNEL_HEADERS_6_0
bool "Linux 6.0.x kernel headers"
select BR2_TOOLCHAIN_HEADERS_AT_LEAST_6_0
select BR2_KERNEL_HEADERS_LATEST
config BR2_KERNEL_HEADERS_VERSION
@@ -139,8 +147,28 @@ choice
If your kernel headers are more recent than the latest version
in the choice, then select the latest version.
config BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_0
bool "6.0.x or later"
select BR2_TOOLCHAIN_HEADERS_AT_LEAST_6_0
config BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_19
bool "5.19.x"
select BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_19
config BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_18
bool "5.18.x"
select BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_18
config BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_17
bool "5.17.x"
select BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_17
config BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_16
bool "5.16.x"
select BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_16
config BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_15
bool "5.15.x or later"
bool "5.15.x"
select BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_15
config BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_14
@@ -382,6 +410,8 @@ config BR2_DEFAULT_KERNEL_HEADERS
default "5.10.83" if BR2_KERNEL_HEADERS_5_10
default "5.14.21" if BR2_KERNEL_HEADERS_5_14
default "5.15.6" if BR2_KERNEL_HEADERS_5_15
default "5.19.17" if BR2_KERNEL_HEADERS_5_19
default "6.0.19" if BR2_KERNEL_HEADERS_6_0
default BR2_DEFAULT_KERNEL_VERSION if BR2_KERNEL_HEADERS_VERSION
default "custom" if BR2_KERNEL_HEADERS_CUSTOM_TARBALL
default BR2_KERNEL_HEADERS_CUSTOM_REPO_VERSION \
@@ -1,2 +1,2 @@
# Locally calculated
sha256 237c44e22453e4be6648a854c4333493d00fe5a2e5bd8775644005758198807c img-gpu-powervr-bin-1.17.6210866.tar.gz
sha256 bb94718c965a1c6d6ee68529e4b85989b08f347ccc8b64d12d8872dd668070d1 img-gpu-powervr-bin-1.17.6210866.tar.gz
+61 -12
View File
@@ -115,15 +115,13 @@ config BR2_TOOLCHAIN_SUPPORTS_VARIADIC_MI_THUNK
depends on !BR2_or1k
depends on !BR2_xtensa
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43744. This bug no
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43744. This bug
# reappeared on gcc 9.x and is still not fixed on gcc 11.x
config BR2_TOOLCHAIN_HAS_GCC_BUG_43744
bool
default y if BR2_sh4
depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_8 || \
BR2_TOOLCHAIN_GCC_AT_LEAST_9 || \
BR2_TOOLCHAIN_GCC_AT_LEAST_10 || \
BR2_TOOLCHAIN_GCC_AT_LEAST_11
default y if !BR2_TOOLCHAIN_GCC_AT_LEAST_8
default y if BR2_TOOLCHAIN_GCC_AT_LEAST_9
depends on BR2_sh
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63261. This bug no
# longer exists in gcc 8.x.
@@ -144,7 +142,7 @@ config BR2_TOOLCHAIN_HAS_GCC_BUG_64735
!BR2_TOOLCHAIN_GCC_AT_LEAST_7
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68485. This bug still
# exists in gcc 9.x
# exists in gcc 12.x
config BR2_TOOLCHAIN_HAS_GCC_BUG_68485
bool
default y if BR2_microblaze
@@ -155,8 +153,9 @@ config BR2_TOOLCHAIN_HAS_GCC_BUG_68485
# it still not been fixed yet.
config BR2_TOOLCHAIN_HAS_GCC_BUG_83143
bool
default y if BR2_sh
depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_10 || BR2_TOOLCHAIN_GCC_AT_LEAST_11
default y if !BR2_TOOLCHAIN_GCC_AT_LEAST_10
default y if BR2_TOOLCHAIN_GCC_AT_LEAST_11
depends on BR2_sh
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85180. This bug no
# longer exists in gcc 8.x.
@@ -175,11 +174,12 @@ config BR2_TOOLCHAIN_HAS_GCC_BUG_85862
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90620
# ICE: in do_output_reload, at reload1.c:7978 on microblaze.
# This bug no longer exists in gcc 10.x
# This bug no longer exists in gcc 10.x but reappeared in gcc 11.x
config BR2_TOOLCHAIN_HAS_GCC_BUG_90620
bool
default y if BR2_microblaze
depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_10
depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_10 \
|| BR2_TOOLCHAIN_GCC_AT_LEAST_11
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93847
# ICE: compiler error: Segmentation fault on Nios II. This bug
@@ -207,7 +207,7 @@ config BR2_TOOLCHAIN_HAS_GCC_BUG_101737
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101915
# ICE: in extract_insn, at recog.c:2294 on microblaze.
# This bug still exists in gcc = 11.1.0
# This bug still exists in gcc = 12.1.0
config BR2_TOOLCHAIN_HAS_GCC_BUG_101915
bool
default y if BR2_microblaze
@@ -226,6 +226,25 @@ config BR2_TOOLCHAIN_HAS_GCC_BUG_101952
bool
default y if BR2_sh4
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104028
# ICE: on M68K: Error: value -16034 out of range
# This bug still exists in gcc = 11.1.0
config BR2_TOOLCHAIN_HAS_GCC_BUG_104028
bool
default y if BR2_m68k
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107728
# https://sourceware.org/bugzilla/show_bug.cgi?id=29621
config BR2_TOOLCHAIN_HAS_GCC_BUG_107728
bool
default y if BR2_microblazebe || BR2_microblazeel \
|| BR2_mips || BR2_mipsel \
|| BR2_nios2 \
|| BR2_or1k \
|| BR2_sh
depends on BR2_TOOLCHAIN_USES_GLIBC
depends on BR2_OPTIMIZE_0
config BR2_TOOLCHAIN_HAS_NATIVE_RPC
bool
@@ -572,6 +591,26 @@ config BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_14
config BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_15
bool
select BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_14
config BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_16
bool
select BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_15
config BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_17
bool
select BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_16
config BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_18
bool
select BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_17
config BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_19
bool
select BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_18
config BR2_TOOLCHAIN_HEADERS_AT_LEAST_6_0
bool
select BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_19
select BR2_TOOLCHAIN_HEADERS_LATEST
# This should be selected by the latest version, above, to indicate that
@@ -585,6 +624,11 @@ config BR2_TOOLCHAIN_HEADERS_LATEST
# stops affecting a value on the first matching default.
config BR2_TOOLCHAIN_HEADERS_AT_LEAST
string
default "6.0" if BR2_TOOLCHAIN_HEADERS_AT_LEAST_6_0
default "5.19" if BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_19
default "5.18" if BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_18
default "5.17" if BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_17
default "5.16" if BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_16
default "5.15" if BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_15
default "5.14" if BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_14
default "5.13" if BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_13
@@ -699,10 +743,15 @@ config BR2_TOOLCHAIN_GCC_AT_LEAST_11
bool
select BR2_TOOLCHAIN_GCC_AT_LEAST_10
config BR2_TOOLCHAIN_GCC_AT_LEAST_12
bool
select BR2_TOOLCHAIN_GCC_AT_LEAST_11
# This order guarantees that the highest version is set, as kconfig
# stops affecting a value on the first matching default.
config BR2_TOOLCHAIN_GCC_AT_LEAST
string
default "12" if BR2_TOOLCHAIN_GCC_AT_LEAST_12
default "11" if BR2_TOOLCHAIN_GCC_AT_LEAST_11
default "10" if BR2_TOOLCHAIN_GCC_AT_LEAST_10
default "9" if BR2_TOOLCHAIN_GCC_AT_LEAST_9
+1 -1
View File
@@ -150,7 +150,7 @@ copy_toolchain_sysroot = \
if test -n "$${SUPPORT_LIB_DIR}" ; then \
cp -a $${SUPPORT_LIB_DIR}/* $(STAGING_DIR)/lib/ ; \
fi ; \
find $(STAGING_DIR) -type d | xargs chmod 755
find $(STAGING_DIR) -type d -print0 | xargs -0 chmod 755
#
# Check the specified kernel headers version actually matches the
+32 -5
View File
@@ -22,8 +22,7 @@ config BR2_TOOLCHAIN_BUILDROOT_VENDOR
choice
prompt "C library"
default BR2_TOOLCHAIN_BUILDROOT_UCLIBC
default BR2_TOOLCHAIN_BUILDROOT_GLIBC if BR2_powerpc64
default BR2_TOOLCHAIN_BUILDROOT_GLIBC
config BR2_TOOLCHAIN_BUILDROOT_UCLIBC
bool "uClibc-ng"
@@ -66,9 +65,9 @@ config BR2_TOOLCHAIN_BUILDROOT_GLIBC
http://www.gnu.org/software/libc/
comment "glibc needs a toolchain w/ dynamic library, kernel headers >= 3.2"
depends on BR2_USE_MMU
depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_2
comment "glibc needs a toolchain w/ kernel headers >= 3.2"
depends on BR2_PACKAGE_GLIBC_ARCH_SUPPORTS
depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_2
# glibc >= 2.26 require kernel headers >= 3.10 on powerpc64le.
comment "glibc on powerpc64le needs a toolchain w/ headers >= 3.10"
@@ -80,6 +79,22 @@ comment "glibc on MIPS w/ NAN2008 needs a toolchain w/ headers >= 4.5"
depends on BR2_MIPS_NAN_2008
depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_5
comment "glibc on RISC-V 64-bit needs a toolchain w/ headers >= 5.0"
depends on BR2_RISCV_64
depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_0
comment "glibc on RISC-V 32-bit needs a toolchain w/ headers >= 5.4"
depends on BR2_RISCV_32
depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_4
comment "glibc on ARC needs a toolchain w/ headers >= 5.1"
depends on BR2_arc
depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_1
comment "glibc on or1k needs a toolchain w/ headers >= 5.4"
depends on BR2_or1k
depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_4
config BR2_TOOLCHAIN_BUILDROOT_MUSL
bool "musl"
depends on BR2_aarch64 || BR2_arm || BR2_armeb || BR2_i386 || \
@@ -98,6 +113,18 @@ config BR2_TOOLCHAIN_BUILDROOT_MUSL
https://www.musl-libc.org/
config BR2_TOOLCHAIN_BUILDROOT_NONE
bool "none"
depends on !BR2_PACKAGE_UCLIBC_SUPPORTS && \
!BR2_PACKAGE_GLIBC_SUPPORTS && \
!BR2_PACKAGE_MUSL_SUPPORTS
help
This option is visible if no C library is available for the
currently selected configuration. If you select this option,
the build will refuse to start as Buildroot needs a C
library to build a toolchain. Change your configuration
settings to make sure one of the C libraries is selected.
endchoice
config BR2_TOOLCHAIN_BUILDROOT_LIBC
@@ -31,6 +31,10 @@ choice
Set to the gcc version that is used by your external
toolchain.
config BR2_TOOLCHAIN_EXTERNAL_GCC_12
bool "12.x"
select BR2_TOOLCHAIN_GCC_AT_LEAST_12
config BR2_TOOLCHAIN_EXTERNAL_GCC_11
bool "11.x"
select BR2_TOOLCHAIN_GCC_AT_LEAST_11
@@ -123,8 +127,28 @@ choice
If your toolchain uses headers newer than the latest version
in the choice, then select the latest version.
config BR2_TOOLCHAIN_EXTERNAL_HEADERS_6_0
bool "6.0.x or later"
select BR2_TOOLCHAIN_HEADERS_AT_LEAST_6_0
config BR2_TOOLCHAIN_EXTERNAL_HEADERS_5_19
bool "5.19.x"
select BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_19
config BR2_TOOLCHAIN_EXTERNAL_HEADERS_5_18
bool "5.18.x"
select BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_18
config BR2_TOOLCHAIN_EXTERNAL_HEADERS_5_17
bool "5.17.x"
select BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_17
config BR2_TOOLCHAIN_EXTERNAL_HEADERS_5_16
bool "5.16.x"
select BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_16
config BR2_TOOLCHAIN_EXTERNAL_HEADERS_5_15
bool "5.15.x or later"
bool "5.15.x"
select BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_15
config BR2_TOOLCHAIN_EXTERNAL_HEADERS_5_14
+4 -2
View File
@@ -507,8 +507,10 @@ int main(int argc, char **argv)
exec_args = args;
#ifdef BR_CCACHE
if (getenv("BR_NO_CCACHE"))
/* Skip the ccache call */
/* If BR2_USE_CCACHE is not defined, or its value is not 1,
* skip the ccache call */
char *br_use_ccache = getenv("BR2_USE_CCACHE");
if (!br_use_ccache || strncmp(br_use_ccache, "1", strlen("1")))
exec_args++;
#endif
+4
View File
@@ -26,11 +26,15 @@ TOOLCHAIN_WRAPPER_OPTS += -Wl,--build-id=none
ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_8),y)
TOOLCHAIN_WRAPPER_OPTS += -ffile-prefix-map=$(BASE_DIR)=buildroot
else
TOOLCHAIN_WRAPPER_OPTS += -fdebug-prefix-map=$(BASE_DIR)=buildroot
TOOLCHAIN_WRAPPER_OPTS += -D__FILE__=\"\" -D__BASE_FILE__=\"\" -Wno-builtin-macro-redefined
endif
ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_7),)
TOOLCHAIN_WRAPPER_OPTS += -DBR_NEED_SOURCE_DATE_EPOCH
endif
ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_6),)
TOOLCHAIN_WRAPPER_OPTS += -gno-record-gcc-switches
endif
endif
# Disable -ftree-loop-distribute-patterns on microblaze to
+7 -2
View File
@@ -27,6 +27,10 @@ define TOOLCHAIN_GLIBC_COPY_GCONV_LIBS
$(INSTALL) -m 0644 $(STAGING_DIR)/usr/lib/$${d}/gconv/*.so \
$(TARGET_DIR)/usr/lib/gconv \
|| exit 1; \
if [ -d $(STAGING_DIR)/usr/lib/$${d}/gconv/gconv-modules.d ]; then \
cp -a $(STAGING_DIR)/usr/lib/$${d}/gconv/gconv-modules.d \
$(TARGET_DIR)/usr/lib/gconv/ || exit 1; \
fi; \
else \
for l in $(TOOLCHAIN_GLIBC_GCONV_LIBS); do \
$(INSTALL) -m 0644 -D $(STAGING_DIR)/usr/lib/$${d}/gconv/$${l}.so \
@@ -41,8 +45,9 @@ define TOOLCHAIN_GLIBC_COPY_GCONV_LIBS
|| exit 1; \
done; \
done; \
./support/scripts/expunge-gconv-modules "$(TOOLCHAIN_GLIBC_GCONV_LIBS)" \
<$(STAGING_DIR)/usr/lib/$${d}/gconv/gconv-modules \
./support/scripts/expunge-gconv-modules \
$(STAGING_DIR)/usr/lib/$${d}/gconv \
"$(TOOLCHAIN_GLIBC_GCONV_LIBS)" \
>$(TARGET_DIR)/usr/lib/gconv/gconv-modules; \
fi
endef