# DP: updates from the binutils-2.45 branch
# git diff 2bc7af1ff7732451b6a7b09462a815c3284f9613 3af34f64c67e19658f7f5cde7d1734868f029096
diff --git a/bfd/archive.c b/bfd/archive.c
index 8e20554d781..697b2ed23f2 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -141,6 +141,10 @@ SUBSECTION
#include "hashtab.h"
#include "filenames.h"
#include "bfdlink.h"
+#if BFD_SUPPORTS_PLUGINS
+#include "plugin-api.h"
+#include "plugin.h"
+#endif
#ifndef errno
extern int errno;
@@ -2299,7 +2303,6 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
{
char *first_name = NULL;
bfd *current;
- file_ptr elt_no = 0;
struct orl *map = NULL;
unsigned int orl_max = 1024; /* Fine initial default. */
unsigned int orl_count = 0;
@@ -2334,7 +2337,7 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
/* Map over each element. */
for (current = arch->archive_head;
current != NULL;
- current = current->archive_next, elt_no++)
+ current = current->archive_next)
{
if (bfd_check_format (current, bfd_object)
&& (bfd_get_file_flags (current) & HAS_SYMS) != 0)
@@ -2344,6 +2347,9 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
long src_count;
if (bfd_get_lto_type (current) == lto_slim_ir_object
+#if BFD_SUPPORTS_PLUGINS
+ && !bfd_plugin_target_p (current->xvec)
+#endif
&& report_plugin_err)
{
report_plugin_err = false;
@@ -2401,6 +2407,9 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
if (bfd_lto_slim_symbol_p (current,
syms[src_count]->name)
+#if BFD_SUPPORTS_PLUGINS
+ && !bfd_plugin_target_p (current->xvec)
+#endif
&& report_plugin_err)
{
report_plugin_err = false;
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 2ff3e930bfa..bcff44a0f44 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -2131,6 +2131,9 @@ struct bfd
/* Set if this is the linker input BFD. */
unsigned int is_linker_input : 1;
+ /* Set if this is the strip input BFD. */
+ unsigned int is_strip_input : 1;
+
/* If this is an input for a compiler plug-in library. */
ENUM_BITFIELD (bfd_plugin_format) plugin_format : 2;
diff --git a/bfd/bfd.c b/bfd/bfd.c
index 858ab5ce017..4aded6809bb 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -296,6 +296,9 @@ CODE_FRAGMENT
. {* Set if this is the linker input BFD. *}
. unsigned int is_linker_input : 1;
.
+. {* Set if this is the strip input BFD. *}
+. unsigned int is_strip_input : 1;
+.
. {* If this is an input for a compiler plug-in library. *}
. ENUM_BITFIELD (bfd_plugin_format) plugin_format : 2;
.
diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c
index 8c4d4f7bf73..1213a159358 100644
--- a/bfd/coff-mips.c
+++ b/bfd/coff-mips.c
@@ -801,7 +801,6 @@ mips_relocate_section (bfd *output_bfd,
bool gp_undefined;
struct external_reloc *ext_rel;
struct external_reloc *ext_rel_end;
- unsigned int i;
bool got_lo;
struct internal_reloc lo_int_rel;
bfd_size_type amt;
@@ -861,7 +860,7 @@ mips_relocate_section (bfd *output_bfd,
ext_rel = (struct external_reloc *) external_relocs;
ext_rel_end = ext_rel + input_section->reloc_count;
- for (i = 0; ext_rel < ext_rel_end; ext_rel++, i++)
+ for (; ext_rel < ext_rel_end; ext_rel++)
{
struct internal_reloc int_rel;
bool use_lo = false;
diff --git a/bfd/configure b/bfd/configure
index ec09f5bc834..86561b30ac4 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for bfd 2.45.
+# Generated by GNU Autoconf 2.69 for bfd 2.45.0.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='bfd'
PACKAGE_TARNAME='bfd'
-PACKAGE_VERSION='2.45'
-PACKAGE_STRING='bfd 2.45'
+PACKAGE_VERSION='2.45.0'
+PACKAGE_STRING='bfd 2.45.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1409,7 +1409,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures bfd 2.45 to adapt to many kinds of systems.
+\`configure' configures bfd 2.45.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1480,7 +1480,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of bfd 2.45:";;
+ short | recursive ) echo "Configuration of bfd 2.45.0:";;
esac
cat <<\_ACEOF
@@ -1625,7 +1625,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-bfd configure 2.45
+bfd configure 2.45.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2219,7 +2219,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by bfd $as_me 2.45, which was
+It was created by bfd $as_me 2.45.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3202,7 +3202,7 @@ fi
# Define the identity of the package.
PACKAGE='bfd'
- VERSION='2.45'
+ VERSION='2.45.0'
cat >>confdefs.h <<_ACEOF
@@ -17754,7 +17754,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by bfd $as_me 2.45, which was
+This file was extended by bfd $as_me 2.45.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -17820,7 +17820,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-bfd config.status 2.45
+bfd config.status 2.45.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/bfd/development.sh b/bfd/development.sh
index 8b004da7d52..b8014261bfb 100644
--- a/bfd/development.sh
+++ b/bfd/development.sh
@@ -16,7 +16,7 @@
# along with this program. If not, see .
# Controls whether to enable development-mode features by default.
-development=false
+development=true
# Indicate whether this is a release branch.
experimental=false
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index c913f2b4c7d..a8fca76eb09 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -6527,16 +6527,15 @@ elf32_arm_size_stubs (bfd *output_bfd,
while (1)
{
bfd *input_bfd;
- unsigned int bfd_indx;
asection *stub_sec;
enum elf32_arm_stub_type stub_type;
bool stub_changed = false;
unsigned prev_num_a8_fixes = num_a8_fixes;
num_a8_fixes = 0;
- for (input_bfd = info->input_bfds, bfd_indx = 0;
+ for (input_bfd = info->input_bfds;
input_bfd != NULL;
- input_bfd = input_bfd->link.next, bfd_indx++)
+ input_bfd = input_bfd->link.next)
{
Elf_Internal_Shdr *symtab_hdr;
asection *section;
diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c
index 7ac95a0634e..3cb554a717d 100644
--- a/bfd/elf32-bfin.c
+++ b/bfd/elf32-bfin.c
@@ -1376,7 +1376,6 @@ bfin_relocate_section (bfd * output_bfd,
asection *sgot;
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
- int i = 0;
dynobj = elf_hash_table (info)->dynobj;
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
@@ -1387,7 +1386,7 @@ bfin_relocate_section (bfd * output_bfd,
rel = relocs;
relend = relocs + input_section->reloc_count;
- for (; rel < relend; rel++, i++)
+ for (; rel < relend; rel++)
{
int r_type;
reloc_howto_type *howto;
diff --git a/bfd/elf32-csky.c b/bfd/elf32-csky.c
index 47a63895b55..3f55e7cbbac 100644
--- a/bfd/elf32-csky.c
+++ b/bfd/elf32-csky.c
@@ -3446,13 +3446,12 @@ elf32_csky_size_stubs (bfd *output_bfd,
while (1)
{
bfd *input_bfd;
- unsigned int bfd_indx;
asection *stub_sec;
bool stub_changed = false;
- for (input_bfd = info->input_bfds, bfd_indx = 0;
+ for (input_bfd = info->input_bfds;
input_bfd != NULL;
- input_bfd = input_bfd->link.next, bfd_indx++)
+ input_bfd = input_bfd->link.next)
{
Elf_Internal_Shdr *symtab_hdr;
asection *section;
diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
index 57c37c53074..db7ed465779 100644
--- a/bfd/elf32-microblaze.c
+++ b/bfd/elf32-microblaze.c
@@ -1765,7 +1765,6 @@ microblaze_elf_relax_section (bfd *abfd,
Elf_Internal_Rela *irel, *irelend;
bfd_byte *contents = NULL;
bfd_byte *free_contents = NULL;
- int rel_count;
unsigned int shndx;
size_t i, sym_index;
asection *o;
@@ -1818,8 +1817,7 @@ microblaze_elf_relax_section (bfd *abfd,
goto error_return;
irelend = internal_relocs + sec->reloc_count;
- rel_count = 0;
- for (irel = internal_relocs; irel < irelend; irel++, rel_count++)
+ for (irel = internal_relocs; irel < irelend; irel++)
{
bfd_vma symval;
if ((ELF32_R_TYPE (irel->r_info) != (int) R_MICROBLAZE_64_PCREL)
@@ -1935,10 +1933,9 @@ microblaze_elf_relax_section (bfd *abfd,
if (sdata->relax_count > 0)
{
shndx = _bfd_elf_section_from_bfd_section (abfd, sec);
- rel_count = 0;
sdata->relax[sdata->relax_count].addr = sec->size;
- for (irel = internal_relocs; irel < irelend; irel++, rel_count++)
+ for (irel = internal_relocs; irel < irelend; irel++)
{
bfd_vma nraddr;
diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c
index 3627b30af9c..bcd7c42e300 100644
--- a/bfd/elf32-nds32.c
+++ b/bfd/elf32-nds32.c
@@ -4344,7 +4344,6 @@ nds32_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
Elf_Internal_Shdr *symtab_hdr;
asection *sgot;
char *local_tls_type;
- unsigned long symndx;
bfd_vma *local_tlsdesc_gotent;
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
@@ -4386,8 +4385,8 @@ nds32_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
sgot = elf_hash_table (info)->sgot;
local_tls_type = elf32_nds32_local_got_tls_type (ibfd);
local_tlsdesc_gotent = elf32_nds32_local_tlsdesc_gotent (ibfd);
- for (symndx = 0; local_got < end_local_got;
- ++local_got, ++local_tls_type, ++local_tlsdesc_gotent, ++symndx)
+ for (; local_got < end_local_got;
+ ++local_got, ++local_tls_type, ++local_tlsdesc_gotent)
{
if (*local_got > 0)
{
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 3e768dca8d6..00c1c32ffd2 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -13819,15 +13819,14 @@ ppc64_elf_size_stubs (struct bfd_link_info *info)
while (1)
{
bfd *input_bfd;
- unsigned int bfd_indx;
struct map_stub *group;
htab->stub_iteration += 1;
htab->relr_count = 0;
- for (input_bfd = info->input_bfds, bfd_indx = 0;
+ for (input_bfd = info->input_bfds;
input_bfd != NULL;
- input_bfd = input_bfd->link.next, bfd_indx++)
+ input_bfd = input_bfd->link.next)
{
Elf_Internal_Shdr *symtab_hdr;
asection *section;
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 9e98215d638..e86f0280c2a 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -8464,10 +8464,9 @@ elfNN_aarch64_modify_headers (bfd *abfd,
struct bfd_link_info *info)
{
struct elf_segment_map *m;
- unsigned int segment_count = 0;
Elf_Internal_Phdr *p;
- for (m = elf_seg_map (abfd); m != NULL; m = m->next, segment_count++)
+ for (m = elf_seg_map (abfd); m != NULL; m = m->next)
{
/* We are only interested in the memory tag segment that will be dumped
to a core file. If we have no memory tags or this isn't a core file we
diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
index 46fafb332de..505f1196987 100644
--- a/bfd/elfnn-loongarch.c
+++ b/bfd/elfnn-loongarch.c
@@ -4902,6 +4902,60 @@ loongarch_relax_delete_or_nop (bfd *abfd,
bfd_put (32, abfd, LARCH_NOP, contents + addr);
}
+/* If some bytes in a symbol is deleted, we need to adjust its size. */
+static void
+loongarch_relax_resize_symbol (bfd_size_type *size, bfd_vma orig_value,
+ splay_tree pdops)
+{
+ splay_tree_key key = (splay_tree_key)orig_value;
+ bfd_vma orig_end = orig_value + *size;
+ splay_tree_node node = splay_tree_predecessor (pdops, key);
+
+ if (node)
+ {
+ bfd_vma addr = (bfd_vma)node->key;
+ struct pending_delete_op *op = (struct pending_delete_op *)node->value;
+
+ /* This shouldn't happen unless people write something really insane like
+ .reloc ., R_LARCH_ALIGN, 60
+ .rept 15
+ 1: nop
+ .endr
+ .set x, 1b
+ .size x, . - 1b
+ But let's just try to make it "work" anyway. */
+ if (orig_value < addr + op->size)
+ {
+ bfd_size_type n_deleted = op->size - (orig_value - addr);
+ if (n_deleted >= *size)
+ {
+ *size = 0;
+ return;
+ }
+
+ *size -= n_deleted;
+ }
+ }
+
+ node = splay_tree_lookup (pdops, key);
+ if (!node)
+ node = splay_tree_successor (pdops, key);
+
+ for (; node; node = splay_tree_successor (pdops, node->key))
+ {
+ bfd_vma addr = (bfd_vma)node->key;
+ struct pending_delete_op *op = (struct pending_delete_op *)node->value;
+
+ if (addr >= orig_end)
+ return;
+
+ if (orig_end < addr + op->size)
+ *size -= orig_end - addr;
+ else
+ *size -= op->size;
+ }
+}
+
static void
loongarch_relax_perform_deletes (bfd *abfd, asection *sec,
struct bfd_link_info *link_info)
@@ -5000,30 +5054,8 @@ loongarch_relax_perform_deletes (bfd *abfd, asection *sec,
sym->st_value
= loongarch_calc_relaxed_addr (link_info, orig_value);
- /* If the symbol *spans* some deleted bytes, that is its *end* is in
- the moved bytes but its *start* isn't, then we must adjust its
- size.
-
- This test needs to use the original value of st_value, otherwise
- we might accidentally decrease size when deleting bytes right
- before the symbol. */
- bfd_vma sym_end = orig_value + sym->st_size;
- if (sym_end <= toaddr)
- {
- splay_tree_node node = splay_tree_predecessor (
- pdops, (splay_tree_key)orig_value);
- for (; node; node = splay_tree_successor (pdops, node->key))
- {
- bfd_vma addr = (bfd_vma)node->key;
- struct pending_delete_op *op
- = (struct pending_delete_op *)node->value;
-
- if (addr >= sym_end)
- break;
- if (orig_value <= addr && sym_end > addr)
- sym->st_size -= op->size;
- }
- }
+ if (orig_value + sym->st_size <= toaddr)
+ loongarch_relax_resize_symbol (&sym->st_size, orig_value, pdops);
}
}
@@ -5070,29 +5102,13 @@ loongarch_relax_perform_deletes (bfd *abfd, asection *sec,
{
bfd_vma orig_value = sym_hash->root.u.def.value;
- /* As above, adjust the value. */
+ /* As above, adjust the value and size. */
if (orig_value <= toaddr)
sym_hash->root.u.def.value
= loongarch_calc_relaxed_addr (link_info, orig_value);
- /* As above, adjust the size if needed. */
- bfd_vma sym_end = orig_value + sym_hash->size;
- if (sym_end <= toaddr)
- {
- splay_tree_node node = splay_tree_predecessor (
- pdops, (splay_tree_key)orig_value);
- for (; node; node = splay_tree_successor (pdops, node->key))
- {
- bfd_vma addr = (bfd_vma)node->key;
- struct pending_delete_op *op
- = (struct pending_delete_op *)node->value;
-
- if (addr >= sym_end)
- break;
- if (orig_value <= addr && sym_end > addr)
- sym_hash->size -= op->size;
- }
- }
+ if (orig_value + sym_hash->size <= toaddr)
+ loongarch_relax_resize_symbol (&sym_hash->size, orig_value, pdops);
}
}
}
diff --git a/bfd/format.c b/bfd/format.c
index f3a0774af08..246838c7ab5 100644
--- a/bfd/format.c
+++ b/bfd/format.c
@@ -413,6 +413,11 @@ bfd_set_lto_type (bfd *abfd ATTRIBUTE_UNUSED)
abfd->object_only_section = sec;
break;
}
+ else if (strcmp (sec->name, ".llvm.lto") == 0)
+ {
+ type = lto_fat_ir_object;
+ break;
+ }
else if (lsection.major_version == 0
&& startswith (sec->name, ".gnu.lto_.lto.")
&& bfd_get_section_contents (abfd, sec, &lsection, 0,
@@ -481,10 +486,7 @@ bfd_check_format_matches_lto (bfd *abfd, bfd_format format,
}
if (abfd->format != bfd_unknown)
- {
- bfd_set_lto_type (abfd);
- return abfd->format == format;
- }
+ return abfd->format == format;
if (matching != NULL || *bfd_associated_vector != NULL)
{
@@ -537,7 +539,20 @@ bfd_check_format_matches_lto (bfd *abfd, bfd_format format,
cleanup = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
- if (cleanup)
+ /* When called from strip, don't treat archive member nor
+ standalone fat IR object as an IR object. For archive
+ member, it will be copied as an unknown object if the
+ plugin target is in use or it is a slim IR object. For
+ standalone fat IR object, it will be copied as non-IR
+ object. */
+ if (cleanup
+#if BFD_SUPPORTS_PLUGINS
+ && (!abfd->is_strip_input
+ || !bfd_plugin_target_p (abfd->xvec)
+ || (abfd->lto_type != lto_fat_ir_object
+ && abfd->my_archive == NULL))
+#endif
+ )
goto ok_ret;
/* For a long time the code has dropped through to check all
diff --git a/bfd/plugin.c b/bfd/plugin.c
index 1c72b748a8f..6dd22d75137 100644
--- a/bfd/plugin.c
+++ b/bfd/plugin.c
@@ -203,6 +203,9 @@ bfd_plugin_get_symbols_in_object_only (bfd *abfd)
bfd_close (nbfd);
return;
}
+
+ /* Copy LTO type derived from input sections. */
+ abfd->lto_type = nbfd->lto_type;
}
else
{
diff --git a/bfd/version.h b/bfd/version.h
index beed058a6be..d94c933b73b 100644
--- a/bfd/version.h
+++ b/bfd/version.h
@@ -16,7 +16,7 @@
In releases, the date is not included in either version strings or
sonames. */
-#define BFD_VERSION_DATE 20250727
+#define BFD_VERSION_DATE 20250902
#define BFD_VERSION @bfd_version@
#define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@
#define REPORT_BUGS_TO @report_bugs_to@
diff --git a/bfd/version.m4 b/bfd/version.m4
index 00d03934d68..848470098f5 100644
--- a/bfd/version.m4
+++ b/bfd/version.m4
@@ -1 +1 @@
-m4_define([BFD_VERSION], [2.45])
+m4_define([BFD_VERSION], [2.45.0])
diff --git a/binutils/configure b/binutils/configure
index 94be22505d4..0ff4539f458 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for binutils 2.45.
+# Generated by GNU Autoconf 2.69 for binutils 2.45.0.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='binutils'
PACKAGE_TARNAME='binutils'
-PACKAGE_VERSION='2.45'
-PACKAGE_STRING='binutils 2.45'
+PACKAGE_VERSION='2.45.0'
+PACKAGE_STRING='binutils 2.45.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1407,7 +1407,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures binutils 2.45 to adapt to many kinds of systems.
+\`configure' configures binutils 2.45.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1478,7 +1478,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of binutils 2.45:";;
+ short | recursive ) echo "Configuration of binutils 2.45.0:";;
esac
cat <<\_ACEOF
@@ -1640,7 +1640,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-binutils configure 2.45
+binutils configure 2.45.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2108,7 +2108,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by binutils $as_me 2.45, which was
+It was created by binutils $as_me 2.45.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3091,7 +3091,7 @@ fi
# Define the identity of the package.
PACKAGE='binutils'
- VERSION='2.45'
+ VERSION='2.45.0'
cat >>confdefs.h <<_ACEOF
@@ -16879,7 +16879,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by binutils $as_me 2.45, which was
+This file was extended by binutils $as_me 2.45.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -16945,7 +16945,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-binutils config.status 2.45
+binutils config.status 2.45.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/binutils/nm.c b/binutils/nm.c
index a5d56311dde..d44083dcc94 100644
--- a/binutils/nm.c
+++ b/binutils/nm.c
@@ -802,6 +802,9 @@ filter_symbols (bfd *abfd, bool is_dynamic, void *minisyms,
continue;
if (bfd_lto_slim_symbol_p (abfd, sym->name)
+#if BFD_SUPPORTS_PLUGINS
+ && !bfd_plugin_target_p (abfd->xvec)
+#endif
&& report_plugin_err)
{
report_plugin_err = false;
@@ -1484,7 +1487,11 @@ display_rel_file (bfd *abfd, bfd *archive_bfd)
/* lto_type is set to lto_non_ir_object when a bfd is loaded with a
compiler LTO plugin. */
- if (bfd_get_lto_type (abfd) == lto_slim_ir_object)
+ if (bfd_get_lto_type (abfd) == lto_slim_ir_object
+#if BFD_SUPPORTS_PLUGINS
+ && !bfd_plugin_target_p (abfd->xvec)
+#endif
+ )
{
report_plugin_err = false;
non_fatal (_("%s: plugin needed to handle lto object"),
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 038f6555c0b..a5690257059 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -2529,7 +2529,6 @@ merge_gnu_build_notes (bfd * abfd,
/* Reconstruct the ELF notes. */
bfd_byte * new_contents;
- bfd_byte * old;
bfd_byte * new;
bfd_vma prev_start = 0;
bfd_vma prev_end = 0;
@@ -2537,12 +2536,8 @@ merge_gnu_build_notes (bfd * abfd,
/* Not sure how, but the notes might grow in size.
(eg see PR 1774507). Allow for this here. */
new = new_contents = xmalloc (size * 2);
- for (pnote = pnotes, old = contents;
- pnote < pnotes_end;
- pnote ++)
+ for (pnote = pnotes; pnote < pnotes_end; pnote ++)
{
- bfd_size_type note_size = 12 + pnote->padded_namesz + pnote->note.descsz;
-
if (! is_deleted_note (pnote))
{
/* Create the note, potentially using the
@@ -2585,8 +2580,6 @@ merge_gnu_build_notes (bfd * abfd,
prev_end = pnote->end;
}
}
-
- old += note_size;
}
#if DEBUG_MERGE
@@ -2668,7 +2661,8 @@ set_long_section_mode (bfd *output_bfd, bfd *input_bfd, enum long_section_name_h
Returns TRUE upon success, FALSE otherwise. */
static bool
-copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch)
+copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch,
+ bool target_defaulted)
{
bfd_vma start;
long symcount;
@@ -2819,7 +2813,7 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch)
imach = 0;
}
if (!bfd_set_arch_mach (obfd, iarch, imach)
- && (ibfd->target_defaulted
+ && (target_defaulted
|| bfd_get_arch (ibfd) != bfd_get_arch (obfd)))
{
if (bfd_get_arch (ibfd) == bfd_arch_unknown)
@@ -3622,7 +3616,8 @@ fail:
static bool
copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
bool force_output_target,
- const bfd_arch_info_type *input_arch)
+ const bfd_arch_info_type *input_arch,
+ bool target_defaulted)
{
struct name_list
{
@@ -3692,6 +3687,8 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
bool ok_object;
const char *element_name;
+ this_element->is_strip_input = 1;
+
element_name = bfd_get_filename (this_element);
/* PR binutils/17533: Do not allow directory traversal
outside of the current directory tree by archive members. */
@@ -3773,13 +3770,16 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
#if BFD_SUPPORTS_PLUGINS
/* Copy LTO IR file as unknown object. */
- if (bfd_plugin_target_p (this_element->xvec))
+ if ((!lto_sections_removed
+ && this_element->lto_type == lto_slim_ir_object)
+ || bfd_plugin_target_p (this_element->xvec))
ok_object = false;
else
#endif
if (ok_object)
{
- ok = copy_object (this_element, output_element, input_arch);
+ ok = copy_object (this_element, output_element, input_arch,
+ target_defaulted);
if (!ok && bfd_get_arch (this_element) == bfd_arch_unknown)
/* Try again as an unknown object file. */
@@ -3879,6 +3879,8 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
char **core_matching;
off_t size = get_file_size (input_filename);
const char *target = input_target;
+ bool target_defaulted = (!input_target
+ || strcmp (input_target, "default") == 0);
if (size < 1)
{
@@ -3948,6 +3950,8 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
break;
}
+ ibfd->is_strip_input = 1;
+
if (bfd_check_format (ibfd, bfd_archive))
{
bool force_output_target;
@@ -3955,7 +3959,8 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
/* bfd_get_target does not return the correct value until
bfd_check_format succeeds. */
- if (output_target == NULL)
+ if (output_target == NULL
+ || strcmp (output_target, "default") == 0)
{
output_target = bfd_get_target (ibfd);
force_output_target = false;
@@ -3986,7 +3991,7 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
}
if (!copy_archive (ibfd, obfd, output_target, force_output_target,
- input_arch))
+ input_arch, target_defaulted))
status = 1;
}
else if (
@@ -4010,7 +4015,8 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
/* bfd_get_target does not return the correct value until
bfd_check_format succeeds. */
- if (output_target == NULL)
+ if (output_target == NULL
+ || strcmp (output_target, "default") == 0)
output_target = bfd_get_target (ibfd);
if (ofd >= 0)
@@ -4041,7 +4047,7 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
else
#endif
{
- if (! copy_object (ibfd, obfd, input_arch))
+ if (! copy_object (ibfd, obfd, input_arch, target_defaulted))
status = 1;
/* PR 17512: file: 0f15796a.
@@ -5066,6 +5072,11 @@ strip_main (int argc, char *argv[])
SECTION_CONTEXT_REMOVE)
|| !!find_section_list (".llvm.lto", false,
SECTION_CONTEXT_REMOVE));
+ /* NB: Must keep .gnu.debuglto_* sections unless all GCC LTO sections
+ will be removed to avoid undefined references to symbols in GCC LTO
+ debug sections. */
+ if (!lto_sections_removed)
+ find_section_list (".gnu.debuglto_*", true, SECTION_CONTEXT_KEEP);
#endif
i = optind;
diff --git a/binutils/resbin.c b/binutils/resbin.c
index 889126e9e32..fa77cd43d23 100644
--- a/binutils/resbin.c
+++ b/binutils/resbin.c
@@ -1052,7 +1052,7 @@ get_version_header (windres_bfd *wrbfd, const bfd_byte *data,
{
if (length < 8)
{
- toosmall (key);
+ toosmall (key ? key : _("version header"));
return false;
}
@@ -1250,7 +1250,7 @@ bin_to_res_version (windres_bfd *wrbfd, const bfd_byte *data,
vst = res_alloc (sizeof (rc_ver_stringtable));
- if (!get_version_header (wrbfd, data, length, "version stringtable",
+ if (!get_version_header (wrbfd, data, length, NULL,
&vst->language, &stverlen, &vallen,
&type, &off))
return NULL;
@@ -1284,7 +1284,7 @@ bin_to_res_version (windres_bfd *wrbfd, const bfd_byte *data,
vs = res_alloc (sizeof (rc_ver_stringinfo));
- if (!get_version_header (wrbfd, data, length, "version string",
+ if (!get_version_header (wrbfd, data, length, NULL,
&vs->key, &sverlen, &vallen,
&type, &off))
return NULL;
@@ -1348,7 +1348,7 @@ bin_to_res_version (windres_bfd *wrbfd, const bfd_byte *data,
data += off;
length -= off;
- if (!get_version_header (wrbfd, data, length, "version varfileinfo",
+ if (!get_version_header (wrbfd, data, length, NULL,
&vi->u.var.key, &verlen, &vallen,
&type, &off))
return NULL;
diff --git a/binutils/testsuite/binutils-all/x86-64/pr33230.obj.bz2 b/binutils/testsuite/binutils-all/x86-64/pr33230.obj.bz2
new file mode 100644
index 00000000000..6309a2ad810
Binary files /dev/null and b/binutils/testsuite/binutils-all/x86-64/pr33230.obj.bz2 differ
diff --git a/binutils/testsuite/binutils-all/x86-64/x86-64.exp b/binutils/testsuite/binutils-all/x86-64/x86-64.exp
index ab1aa50a9a1..6d1b308eca6 100644
--- a/binutils/testsuite/binutils-all/x86-64/x86-64.exp
+++ b/binutils/testsuite/binutils-all/x86-64/x86-64.exp
@@ -254,3 +254,72 @@ run_pr33198_test "" "-R .gnu.lto_* -R .gnu.debuglto_* -R .llvm.lto -N __gnu_lto_
run_pr33198_test "-fat" "-R .gnu.lto_* -R .gnu.debuglto_* -R .llvm.lto -N __gnu_lto_v1"
run_pr33198_test "" "-R .llvm.lto"
run_pr33198_test "-fat" "-R .llvm.lto"
+
+proc run_pr33230_test { testname obj strip_flags run_readelf } {
+ global srcdir
+ global subdir
+ global READELF
+ global STRIP
+
+ append strip_flags " --strip-debug"
+ append testname " ($strip_flags)"
+
+ set cmd "$STRIP $strip_flags $obj -o ${obj}.strip"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if { $run_readelf == "yes" } {
+ if ![string match "" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (${obj})"
+ return
+ }
+ set cmd "$READELF -h $obj"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if { ![regexp "Machine: +AArch64" $got] } then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (${obj})"
+ return
+ }
+ set cmd "$READELF -h ${obj}.strip"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if { ![regexp "Machine: +AArch64" $got] } then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (${obj}.strip)"
+ return
+ }
+ } elseif { ![regexp "Unable to recognise the format" $got] } then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname"
+ return
+ }
+
+ pass "$testname"
+}
+
+set t $srcdir/$subdir/pr33230.obj.bz2
+# We need to strip the ".bz2", but can leave the dirname.
+set test $subdir/[file tail $t]
+set testname [file rootname $test]
+verbose $testname
+set obj tmpdir/pr33230.o
+if {[catch "system \"bzip2 -dc $t > $obj\""] != 0} {
+ untested "bzip2 -dc ($testname)"
+} else {
+ catch "exec $STRIP --help" got
+ if { [regexp "elf64-littleaarch64" $got] } {
+ set run_readelf "yes"
+ } else {
+ set run_readelf "no"
+ }
+ run_pr33230_test "$testname" $obj "" $run_readelf
+ run_pr33230_test "$testname" $obj "--input-target=default" $run_readelf
+}
diff --git a/gas/config/tc-cr16.c b/gas/config/tc-cr16.c
index 99bc1bdd506..f2d110868f8 100644
--- a/gas/config/tc-cr16.c
+++ b/gas/config/tc-cr16.c
@@ -119,7 +119,6 @@ const size_t md_longopts_size = sizeof (md_longopts);
static void
l_cons (int nbytes)
{
- int c;
expressionS exp;
#ifdef md_flush_pending_output
@@ -141,7 +140,6 @@ l_cons (int nbytes)
md_cons_align (nbytes);
#endif
- c = 0;
do
{
unsigned int bits_available = BITS_PER_CHAR * nbytes;
@@ -236,7 +234,6 @@ l_cons (int nbytes)
if ((*(input_line_pointer) == '@') && (*(input_line_pointer +1) == 'c'))
code_label = 1;
emit_expr (&exp, nbytes);
- ++c;
if ((*(input_line_pointer) == '@') && (*(input_line_pointer +1) == 'c'))
{
input_line_pointer +=3;
diff --git a/gas/config/tc-mn10200.c b/gas/config/tc-mn10200.c
index 1eb470295a4..fe54d2161eb 100644
--- a/gas/config/tc-mn10200.c
+++ b/gas/config/tc-mn10200.c
@@ -896,7 +896,6 @@ md_assemble (char *str)
for (;;)
{
const char *errmsg = NULL;
- int op_idx;
char *hold;
int extra_shift = 0;
@@ -906,9 +905,9 @@ md_assemble (char *str)
next_opindex = 0;
insn = opcode->opcode;
extension = 0;
- for (op_idx = 1, opindex_ptr = opcode->operands;
+ for (opindex_ptr = opcode->operands;
*opindex_ptr != 0;
- opindex_ptr++, op_idx++)
+ opindex_ptr++)
{
const struct mn10200_operand *operand;
expressionS ex;
diff --git a/gas/config/tc-nds32.c b/gas/config/tc-nds32.c
index 647744fd6d1..d107555e373 100644
--- a/gas/config/tc-nds32.c
+++ b/gas/config/tc-nds32.c
@@ -3452,8 +3452,9 @@ nds32_lookup_pseudo_opcode (const char *str)
for (i = 0; i < maxlen; i++)
{
- if (is_whitespace (op[i] = str[i]))
+ if (is_end_of_stmt (str[i]) || is_whitespace (str[i]))
break;
+ op[i] = str[i];
}
op[i] = '\0';
@@ -4093,7 +4094,8 @@ nds32_relax_relocs (int relax)
{"", "",};
name = input_line_pointer;
- while (*input_line_pointer && !is_whitespace (*input_line_pointer))
+ while (!is_end_of_stmt (*input_line_pointer)
+ && !is_whitespace (*input_line_pointer))
input_line_pointer++;
saved_char = *input_line_pointer;
*input_line_pointer = 0;
@@ -4228,7 +4230,8 @@ nds32_relax_hint (int mode ATTRIBUTE_UNUSED)
struct relax_hint_id *record_id;
name = input_line_pointer;
- while (*input_line_pointer && !is_whitespace (*input_line_pointer))
+ while (!is_end_of_stmt (*input_line_pointer)
+ && !is_whitespace (*input_line_pointer))
input_line_pointer++;
saved_char = *input_line_pointer;
*input_line_pointer = 0;
@@ -4361,7 +4364,8 @@ nds32_flag (int ignore ATTRIBUTE_UNUSED)
/* Skip whitespaces. */
name = input_line_pointer;
- while (*input_line_pointer && !is_whitespace (*input_line_pointer))
+ while (!is_end_of_stmt (*input_line_pointer)
+ && !is_whitespace (*input_line_pointer))
input_line_pointer++;
saved_char = *input_line_pointer;
*input_line_pointer = 0;
@@ -4398,7 +4402,8 @@ ict_model (int ignore ATTRIBUTE_UNUSED)
/* Skip whitespaces. */
name = input_line_pointer;
- while (*input_line_pointer && !is_whitespace (*input_line_pointer))
+ while (!is_end_of_stmt (*input_line_pointer)
+ && !is_whitespace (*input_line_pointer))
input_line_pointer++;
saved_char = *input_line_pointer;
*input_line_pointer = 0;
@@ -5944,7 +5949,7 @@ nds32_elf_append_relax_relocs (const char *key, const void *value)
char *where;
int pcrel;
- if (!relocs_pattern)
+ if (!relocs_pattern || !relocs_pattern->opcode)
return;
if (!nds32_find_reloc_table (relocs_pattern, &hint_info))
diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c
index f73c3bfbab3..176910dfaff 100644
--- a/gas/config/tc-v850.c
+++ b/gas/config/tc-v850.c
@@ -344,15 +344,10 @@ v850_comm (int area)
int old_subsec;
char *pfrag;
int align;
- flagword applicable;
old_sec = now_seg;
old_subsec = now_subseg;
- applicable = bfd_applicable_section_flags (stdoutput);
-
- applicable &= SEC_ALLOC;
-
switch (area)
{
case SCOMMON_SECTION:
diff --git a/gas/config/tc-xgate.c b/gas/config/tc-xgate.c
index 0823ecd93a4..4a7829f4e60 100644
--- a/gas/config/tc-xgate.c
+++ b/gas/config/tc-xgate.c
@@ -1123,7 +1123,6 @@ xgate_scan_operands (struct xgate_opcode *opcode, s_operand oprs[])
unsigned short oper_mask = 0;
int operand_bit_length = 0;
unsigned int operand = 0;
- char n_operand_bits = 0;
char first_operand_equals_second = 0;
int i = 0;
char c = 0;
@@ -1139,7 +1138,6 @@ xgate_scan_operands (struct xgate_opcode *opcode, s_operand oprs[])
{
oper_mask <<= 1;
oper_mask += 1;
- n_operand_bits++;
}
}
diff --git a/gas/config/tc-z8k.c b/gas/config/tc-z8k.c
index 2980cffd59a..83a732f1335 100644
--- a/gas/config/tc-z8k.c
+++ b/gas/config/tc-z8k.c
@@ -1032,7 +1032,6 @@ build_bytes (opcode_entry_type *this_try, struct z8k_op *operand ATTRIBUTE_UNUSE
{
unsigned char *output_ptr = buffer;
int c;
- int nibble;
unsigned int *class_ptr;
frag_wane (frag_now);
@@ -1044,7 +1043,7 @@ build_bytes (opcode_entry_type *this_try, struct z8k_op *operand ATTRIBUTE_UNUSE
memset (buffer, 0, sizeof (buffer));
class_ptr = this_try->byte_info;
- for (nibble = 0; (c = *class_ptr++); nibble++)
+ while ((c = *class_ptr++) != 0)
{
switch (c & CLASS_MASK)
diff --git a/gas/configure b/gas/configure
index 9c640c870cd..ca149e79195 100755
--- a/gas/configure
+++ b/gas/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for gas 2.45.
+# Generated by GNU Autoconf 2.69 for gas 2.45.0.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='gas'
PACKAGE_TARNAME='gas'
-PACKAGE_VERSION='2.45'
-PACKAGE_STRING='gas 2.45'
+PACKAGE_VERSION='2.45.0'
+PACKAGE_STRING='gas 2.45.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1393,7 +1393,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures gas 2.45 to adapt to many kinds of systems.
+\`configure' configures gas 2.45.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1464,7 +1464,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of gas 2.45:";;
+ short | recursive ) echo "Configuration of gas 2.45.0:";;
esac
cat <<\_ACEOF
@@ -1621,7 +1621,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-gas configure 2.45
+gas configure 2.45.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2032,7 +2032,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by gas $as_me 2.45, which was
+It was created by gas $as_me 2.45.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3012,7 +3012,7 @@ fi
# Define the identity of the package.
PACKAGE='gas'
- VERSION='2.45'
+ VERSION='2.45.0'
cat >>confdefs.h <<_ACEOF
@@ -16548,7 +16548,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by gas $as_me 2.45, which was
+This file was extended by gas $as_me 2.45.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -16614,7 +16614,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-gas config.status 2.45
+gas config.status 2.45.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/gas/ecoff.c b/gas/ecoff.c
index 74115959f94..97b909364a9 100644
--- a/gas/ecoff.c
+++ b/gas/ecoff.c
@@ -3606,7 +3606,6 @@ ecoff_build_lineno (const struct ecoff_debug_swap *backend,
efdr_t *file;
proc_t *proc;
unsigned long c;
- long iline;
long totcount;
lineno_list_t first;
lineno_list_t *local_first_lineno = first_lineno;
@@ -3620,7 +3619,6 @@ ecoff_build_lineno (const struct ecoff_debug_swap *backend,
proc = NULL;
last = NULL;
c = offset;
- iline = 0;
totcount = 0;
/* FIXME? Now that MIPS embedded-PIC is gone, it may be safe to
@@ -3800,7 +3798,6 @@ ecoff_build_lineno (const struct ecoff_debug_swap *backend,
++c;
}
- ++iline;
last = l;
}
diff --git a/gas/testsuite/gas/nds32/nds32.exp b/gas/testsuite/gas/nds32/nds32.exp
index 82934cee605..216fcf185bf 100644
--- a/gas/testsuite/gas/nds32/nds32.exp
+++ b/gas/testsuite/gas/nds32/nds32.exp
@@ -16,17 +16,13 @@
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# MA 02110-1301, USA.
-if { [istarget nds32*] } {
- run_dump_test "alu-1"
- run_dump_test "alu-2"
- run_dump_test "lsi"
- run_dump_test "ls"
- run_dump_test "br-1"
- run_dump_test "br-2"
- run_dump_test "ji-jr"
- run_dump_test "to-16bit-v1"
- run_dump_test "to-16bit-v2"
- run_dump_test "to-16bit-v3"
- run_dump_test "usr-spe-reg"
- run_dump_test "sys-reg"
+if { ![istarget nds32*] } {
+ return
+}
+
+set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
+foreach t $test_list {
+ # We need to strip the ".d", but can leave the dirname.
+ verbose [file rootname $t]
+ run_dump_test [file rootname $t]
}
diff --git a/gas/testsuite/gas/nds32/pr33229.d b/gas/testsuite/gas/nds32/pr33229.d
new file mode 100644
index 00000000000..e65ca413d55
--- /dev/null
+++ b/gas/testsuite/gas/nds32/pr33229.d
@@ -0,0 +1,2 @@
+#as: --fatal-warnings
+#error: .*relax hint.*
diff --git a/gas/testsuite/gas/nds32/pr33229.s b/gas/testsuite/gas/nds32/pr33229.s
new file mode 100644
index 00000000000..3127d6da65b
--- /dev/null
+++ b/gas/testsuite/gas/nds32/pr33229.s
@@ -0,0 +1,3 @@
+ .relax_hint 0
+ ret5
+ .relax_hint 1
diff --git a/gas/write.c b/gas/write.c
index 455dc446a01..c56ad28ea51 100644
--- a/gas/write.c
+++ b/gas/write.c
@@ -2242,7 +2242,7 @@ write_object_file (void)
char *table_ptr;
addressT table_addr;
addressT from_addr, to_addr;
- int n, m;
+ int n;
subseg_change (lie->seg, lie->subseg);
fragP = lie->dispfrag;
@@ -2267,9 +2267,9 @@ write_object_file (void)
table_ptr += md_short_jump_size;
table_addr += md_short_jump_size;
- for (m = 0;
+ for (;
lie && lie->dispfrag == fragP;
- m++, lie = lie->next_broken_word)
+ lie = lie->next_broken_word)
{
if (lie->added == 2)
continue;
diff --git a/gprof/configure b/gprof/configure
index 36ac75e49b3..e40de173a1e 100755
--- a/gprof/configure
+++ b/gprof/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for gprof 2.45.
+# Generated by GNU Autoconf 2.69 for gprof 2.45.0.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='gprof'
PACKAGE_TARNAME='gprof'
-PACKAGE_VERSION='2.45'
-PACKAGE_STRING='gprof 2.45'
+PACKAGE_VERSION='2.45.0'
+PACKAGE_STRING='gprof 2.45.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1351,7 +1351,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures gprof 2.45 to adapt to many kinds of systems.
+\`configure' configures gprof 2.45.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1422,7 +1422,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of gprof 2.45:";;
+ short | recursive ) echo "Configuration of gprof 2.45.0:";;
esac
cat <<\_ACEOF
@@ -1541,7 +1541,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-gprof configure 2.45
+gprof configure 2.45.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1906,7 +1906,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by gprof $as_me 2.45, which was
+It was created by gprof $as_me 2.45.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2886,7 +2886,7 @@ fi
# Define the identity of the package.
PACKAGE='gprof'
- VERSION='2.45'
+ VERSION='2.45.0'
cat >>confdefs.h <<_ACEOF
@@ -14255,7 +14255,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by gprof $as_me 2.45, which was
+This file was extended by gprof $as_me 2.45.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -14321,7 +14321,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-gprof config.status 2.45
+gprof config.status 2.45.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/ld/configure b/ld/configure
index 78b54b39eb2..4afc58566fc 100755
--- a/ld/configure
+++ b/ld/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for ld 2.45.
+# Generated by GNU Autoconf 2.69 for ld 2.45.0.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='ld'
PACKAGE_TARNAME='ld'
-PACKAGE_VERSION='2.45'
-PACKAGE_STRING='ld 2.45'
+PACKAGE_VERSION='2.45.0'
+PACKAGE_STRING='ld 2.45.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1436,7 +1436,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures ld 2.45 to adapt to many kinds of systems.
+\`configure' configures ld 2.45.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1507,7 +1507,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of ld 2.45:";;
+ short | recursive ) echo "Configuration of ld 2.45.0:";;
esac
cat <<\_ACEOF
@@ -1690,7 +1690,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-ld configure 2.45
+ld configure 2.45.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2222,7 +2222,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by ld $as_me 2.45, which was
+It was created by ld $as_me 2.45.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3206,7 +3206,7 @@ fi
# Define the identity of the package.
PACKAGE='ld'
- VERSION='2.45'
+ VERSION='2.45.0'
cat >>confdefs.h <<_ACEOF
@@ -19661,7 +19661,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by ld $as_me 2.45, which was
+This file was extended by ld $as_me 2.45.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -19727,7 +19727,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-ld config.status 2.45
+ld config.status 2.45.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
index e23cdc87161..a33727f2efd 100644
--- a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
+++ b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
@@ -48,6 +48,8 @@ if [istarget "loongarch64-*-*"] {
run_dump_test "relax-after-alignment"
run_dump_test "relax-medium-call"
run_dump_test "relax-medium-call-1"
+ run_dump_test "relax-sym-size-1"
+ run_dump_test "relax-sym-size-2"
run_dump_test "check_got_relax"
}
diff --git a/ld/testsuite/ld-loongarch-elf/relax-sym-size-1.d b/ld/testsuite/ld-loongarch-elf/relax-sym-size-1.d
new file mode 100644
index 00000000000..eec989f68be
--- /dev/null
+++ b/ld/testsuite/ld-loongarch-elf/relax-sym-size-1.d
@@ -0,0 +1,7 @@
+#source: relax-sym-size-1.s
+#ld:
+#readelf: -s
+
+#...
+ *[0-9]+: [0-9a-z]+ +8 .* _start
+#...
diff --git a/ld/testsuite/ld-loongarch-elf/relax-sym-size-1.s b/ld/testsuite/ld-loongarch-elf/relax-sym-size-1.s
new file mode 100644
index 00000000000..c70ac7176bd
--- /dev/null
+++ b/ld/testsuite/ld-loongarch-elf/relax-sym-size-1.s
@@ -0,0 +1,8 @@
+.p2align 2
+bar:
+ nop
+.globl _start
+_start:
+ la.pcrel $a0, bar
+ ret
+.size _start, . - _start
diff --git a/ld/testsuite/ld-loongarch-elf/relax-sym-size-2.d b/ld/testsuite/ld-loongarch-elf/relax-sym-size-2.d
new file mode 100644
index 00000000000..1388099d37f
--- /dev/null
+++ b/ld/testsuite/ld-loongarch-elf/relax-sym-size-2.d
@@ -0,0 +1,7 @@
+#source: relax-sym-size-2.s
+#ld:
+#readelf: -s
+
+#...
+ *[0-9]+: [0-9a-z]+ +64 .* _start
+#...
diff --git a/ld/testsuite/ld-loongarch-elf/relax-sym-size-2.s b/ld/testsuite/ld-loongarch-elf/relax-sym-size-2.s
new file mode 100644
index 00000000000..e02e16b7d26
--- /dev/null
+++ b/ld/testsuite/ld-loongarch-elf/relax-sym-size-2.s
@@ -0,0 +1,19 @@
+bar:
+ nop
+.p2align 6
+
+.reloc ., R_LARCH_ALIGN, 60
+.rept 15
+ 1: nop
+.endr
+ la.pcrel $a0, bar
+ ret
+
+.reloc ., R_LARCH_ALIGN, 60
+.rept 15
+ 2: nop
+.endr
+
+.globl _start
+.set _start, 1b
+.size _start, 2b - 1b
diff --git a/ld/testsuite/ld-plugin/lto-binutils.exp b/ld/testsuite/ld-plugin/lto-binutils.exp
index 5b4e0a10991..51332696d5b 100644
--- a/ld/testsuite/ld-plugin/lto-binutils.exp
+++ b/ld/testsuite/ld-plugin/lto-binutils.exp
@@ -356,3 +356,178 @@ run_cc_link_tests [list \
"tmpdir/libstrip-1b-fat-s.a" \
] \
]
+
+proc run_pr33246_test { llvm fat } {
+ global srcdir
+ global subdir
+ global plug_opt
+ global llvm_plug_opt
+ global ar
+ global CLANG_FOR_TARGET
+ global CC_FOR_TARGET
+ global NM
+ global READELF
+ global strip
+
+ set strip_flags "--strip-debug --enable-deterministic-archives"
+
+ set test pr33246
+ set testname "${test}${llvm}${fat} with $strip_flags"
+
+ if { "$llvm" == "-llvm" } {
+ # Skip native x32 and i?86 targets since system LLVMgold.so may
+ # not be compatible with native x32 and i?86 targets binutils.
+ if { [istarget "x86_64-*-linux*-gnux32"]
+ || [istarget "i?86-*-*"]
+ || ![info exists CLANG_FOR_TARGET]
+ || [string match "" $llvm_plug_opt] } then {
+ untested $testname
+ return
+ }
+ set CC $CLANG_FOR_TARGET
+ set binutils_plug_opt "$llvm_plug_opt"
+ } else {
+ if { ![info exists CC_FOR_TARGET]
+ || [string match "" $plug_opt] } then {
+ untested $testname
+ return
+ }
+ set CC $CC_FOR_TARGET
+ set binutils_plug_opt "$plug_opt"
+ }
+
+ append strip_flags " $binutils_plug_opt"
+
+ set src $srcdir/$subdir/${test}.c
+ set obj tmpdir/${test}${llvm}${fat}.o
+ set archive tmpdir/${test}${llvm}${fat}.a
+ set CFLAGS "-c -g -O2 -flto"
+ if { "$fat" == "-fat" } {
+ append CFLAGS " -ffat-lto-objects"
+ } else {
+ append CFLAGS " -fno-fat-lto-objects"
+ }
+
+ set cmd "$CC $CFLAGS -o $obj $src"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if ![string match "" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname ($obj)"
+ return
+ }
+
+ set cmd "$strip $strip_flags $obj -o ${obj}.strip"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if ![string match "" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (strip $obj)"
+ return
+ }
+
+ set cmd "$NM $binutils_plug_opt ${obj}.strip"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if ![regexp "0+ T foo" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (strip $obj)"
+ return
+ }
+
+ if { "$fat" == "-fat" } {
+ set cmd "$READELF -SW ${obj}.strip"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if [regexp " \.debug_" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (strip $obj)"
+ return
+ }
+ } else {
+ set cmd "cmp $obj ${obj}.strip"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if ![string match "" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (strip $obj)"
+ return
+ }
+ }
+
+ pass "$testname (strip $obj)"
+
+ set cmd "$ar $binutils_plug_opt -D -s -r -c $archive $obj"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if ![string match "" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname ($archive)"
+ return
+ }
+
+ set cmd "$strip $strip_flags $archive -o ${archive}.strip"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if ![string match "" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (strip $archive)"
+ return
+ }
+
+ set cmd "$NM $binutils_plug_opt ${archive}.strip"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if ![regexp "0+ T foo" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (strip $archive)"
+ return
+ }
+
+ if { "$fat" == "-fat" } {
+ set cmd "$READELF -SW ${archive}.strip"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if [regexp " \.debug_" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (strip $archive)"
+ return
+ }
+ } else {
+ set cmd "cmp $archive ${archive}.strip"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if ![string match "" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (strip $archive)"
+ return
+ }
+ }
+
+ pass "$testname (strip $archive)"
+}
+
+run_pr33246_test "" ""
+run_pr33246_test "" "-fat"
+run_pr33246_test "-llvm" ""
+run_pr33246_test "-llvm" "-fat"
diff --git a/ld/testsuite/ld-plugin/pr33246.c b/ld/testsuite/ld-plugin/pr33246.c
new file mode 100644
index 00000000000..cd0130cacdf
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr33246.c
@@ -0,0 +1,4 @@
+void
+foo (void)
+{
+}
diff --git a/libctf/configure b/libctf/configure
index 7466d56a18b..89c99c2ddbf 100755
--- a/libctf/configure
+++ b/libctf/configure
@@ -15966,6 +15966,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+case "${host}" in
+ # PR libctf/29292
+ # libctf's use of mmap doesn't work on Solaris 11.4, so disable it.
+ *-*-solaris2.11*)
+ ac_cv_func_mmap_fixed_mapped=no
+ ;;
+esac
+
@@ -17015,7 +17023,7 @@ if test -n "$decommented_version_script"; then
# used by GNU ld. Use cpp to strip the comments out. (cpp exists under this
# name on all platforms that support ld -z gnu-version-script.)
/lib/cpp < $srcdir/libctf.ver > libctf-decommented.ver
- /lib/cpp < $srcdir/libctf-nobfd.ver > libctf-nobfd-decommented.ver
+ /lib/cpp < libctf-nobfd.ver > libctf-nobfd-decommented.ver
VERSION_FLAGS="$ac_cv_libctf_version_script='libctf-decommented.ver'"
VERSION_FLAGS_NOBFD="$ac_cv_libctf_version_script='libctf-nobfd-decommented.ver'"
elif test -z "$no_version_script"; then
diff --git a/libctf/configure.ac b/libctf/configure.ac
index fbd8ec12a14..40d00e8eb18 100644
--- a/libctf/configure.ac
+++ b/libctf/configure.ac
@@ -65,6 +65,14 @@ AM_MAINTAINER_MODE
AM_INSTALL_LIBBFD
ACX_PROG_CC_WARNING_OPTS([-Wall], [ac_libctf_warn_cflags])
+case "${host}" in
+ # PR libctf/29292
+ # libctf's use of mmap doesn't work on Solaris 11.4, so disable it.
+ *-*-solaris2.11*)
+ ac_cv_func_mmap_fixed_mapped=no
+ ;;
+esac
+
GCC_AC_FUNC_MMAP
# Needed for BFD capability checks.
AC_SEARCH_LIBS(dlsym, dl)
@@ -293,7 +301,7 @@ if test -n "$decommented_version_script"; then
# used by GNU ld. Use cpp to strip the comments out. (cpp exists under this
# name on all platforms that support ld -z gnu-version-script.)
/lib/cpp < $srcdir/libctf.ver > libctf-decommented.ver
- /lib/cpp < $srcdir/libctf-nobfd.ver > libctf-nobfd-decommented.ver
+ /lib/cpp < libctf-nobfd.ver > libctf-nobfd-decommented.ver
VERSION_FLAGS="$ac_cv_libctf_version_script='libctf-decommented.ver'"
VERSION_FLAGS_NOBFD="$ac_cv_libctf_version_script='libctf-nobfd-decommented.ver'"
elif test -z "$no_version_script"; then
diff --git a/libctf/ctf-link.c b/libctf/ctf-link.c
index 2d4401d2210..524ed7e2466 100644
--- a/libctf/ctf-link.c
+++ b/libctf/ctf-link.c
@@ -20,10 +20,6 @@
#include
#include
-#if defined (PIC)
-#pragma weak ctf_open
-#endif
-
/* CTF linking consists of adding CTF archives full of content to be merged into
this one to the current file (which must be writable) by calling
ctf_link_add_ctf. Once this is done, a call to ctf_link will merge the type
@@ -145,56 +141,33 @@ ctf_link_add_ctf_internal (ctf_dict_t *fp, ctf_archive_t *ctf,
return ctf_set_errno (fp, ENOMEM);
}
-/* Add a file, memory buffer, or unopened file (by name) to a link.
-
- You can call this with:
-
- CTF and NAME: link the passed ctf_archive_t, with the given NAME.
- NAME alone: open NAME as a CTF file when needed.
- BUF and NAME: open the BUF (of length N) as CTF, with the given NAME. (Not
- yet implemented.)
+/* Add an opened CTF archive or unopened file (by name) to a link.
+ If CTF is NULL and NAME is non-null, an unopened file is meant:
+ otherwise, the specified archive is assumed to have the given NAME.
- Passed in CTF args are owned by the dictionary and will be freed by it.
- The BUF arg is *not* owned by the dictionary, and the user should not free
- its referent until the link is done.
+ If CTF is NULL, the NAME is only opened when needed, and is closed when no
+ longer needed, so that large cu-mapped links will only use memory for their
+ cu-mapped inputs briefly (compensating for the memory usage of the
+ smushed-together cu-mapped verion).
- The order of calls to this function influences the order of types in the
- final link output, but otherwise is not important.
+ Passed in CTF args are owned by the dictionary and will be freed by it.
- Repeated additions of the same NAME have no effect; repeated additions of
- different dicts with the same NAME add all the dicts with unique NAMEs
- derived from NAME.
+ The order of calls to this function influences the order of types in the
+ final link output, but otherwise is not important.
- Private for now, but may in time become public once support for BUF is
- implemented. */
+ Repeated additions of the same NAME have no effect; repeated additions of
+ different dicts with the same NAME add all the dicts with unique NAMEs
+ derived from NAME. */
-static int
-ctf_link_add (ctf_dict_t *fp, ctf_archive_t *ctf, const char *name,
- void *buf _libctf_unused_, size_t n _libctf_unused_)
+int
+ctf_link_add_ctf (ctf_dict_t *fp, ctf_archive_t *ctf, const char *name)
{
- if (buf)
- return (ctf_set_errno (fp, ECTF_NOTYET));
-
- if (!((ctf && name && !buf)
- || (name && !buf && !ctf)
- || (buf && name && !ctf)))
+ if (!name)
return (ctf_set_errno (fp, EINVAL));
- /* We can only lazily open files if libctf.so is in use rather than
- libctf-nobfd.so. This is a little tricky: in shared libraries, we can use
- a weak symbol so that -lctf -lctf-nobfd works, but in static libraries we
- must distinguish between the two libraries explicitly. */
-
-#if defined (PIC)
- if (!buf && !ctf && name && !ctf_open)
- return (ctf_set_errno (fp, ECTF_NEEDSBFD));
-#elif NOBFD
- if (!buf && !ctf && name)
- return (ctf_set_errno (fp, ECTF_NEEDSBFD));
-#endif
-
if (fp->ctf_link_outputs)
return (ctf_set_errno (fp, ECTF_LINKADDEDLATE));
+
if (fp->ctf_link_inputs == NULL)
fp->ctf_link_inputs = ctf_dynhash_create (ctf_hash_string,
ctf_hash_eq_string, free,
@@ -203,22 +176,15 @@ ctf_link_add (ctf_dict_t *fp, ctf_archive_t *ctf, const char *name,
if (fp->ctf_link_inputs == NULL)
return (ctf_set_errno (fp, ENOMEM));
- return ctf_link_add_ctf_internal (fp, ctf, NULL, name);
-}
-
-/* Add an opened CTF archive or unopened file (by name) to a link.
- If CTF is NULL and NAME is non-null, an unopened file is meant:
- otherwise, the specified archive is assumed to have the given NAME.
-
- Passed in CTF args are owned by the dictionary and will be freed by it.
+ /* We can only lazily open files if libctf.so is in use rather than
+ libctf-nobfd.so. */
- The order of calls to this function influences the order of types in the
- final link output, but otherwise is not important. */
+#if NOBFD
+ if (!ctf)
+ return (ctf_set_errno (fp, ECTF_NEEDSBFD));
+#endif
-int
-ctf_link_add_ctf (ctf_dict_t *fp, ctf_archive_t *ctf, const char *name)
-{
- return ctf_link_add (fp, ctf, name, NULL, 0);
+ return ctf_link_add_ctf_internal (fp, ctf, NULL, name);
}
/* Lazily open a CTF archive for linking, if not already open.
@@ -238,12 +204,12 @@ ctf_link_lazy_open (ctf_dict_t *fp, ctf_link_input_t *input)
return 1;
/* See ctf_link_add_ctf. */
-#if defined (PIC) || !NOBFD
- input->clin_arc = ctf_open (input->clin_filename, NULL, &err);
-#else
+#if NOBFD
ctf_err_warn (fp, 0, ECTF_NEEDSBFD, _("cannot open %s lazily"),
input->clin_filename);
return ctf_set_errno (fp, ECTF_NEEDSBFD);
+#else
+ input->clin_arc = ctf_open (input->clin_filename, NULL, &err);
#endif
/* Having no CTF sections is not an error. We just don't need to do
diff --git a/libctf/ctf-serialize.c b/libctf/ctf-serialize.c
index 8c35a2b2489..f04c278344c 100644
--- a/libctf/ctf-serialize.c
+++ b/libctf/ctf-serialize.c
@@ -74,6 +74,12 @@ ctf_symtab_skippable (ctf_link_sym_t *sym)
|| sym->st_shndx == SHN_UNDEF
|| strcmp (sym->st_name, "_START_") == 0
|| strcmp (sym->st_name, "_END_") == 0
+ || strcmp (sym->st_name, "_DYNAMIC") == 0
+ || strcmp (sym->st_name, "_GLOBAL_OFFSET_TABLE_") == 0
+ || strcmp (sym->st_name, "_PROCEDURE_LINKAGE_TABLE_") == 0
+ || strcmp (sym->st_name, "_edata") == 0
+ || strcmp (sym->st_name, "_end") == 0
+ || strcmp (sym->st_name, "_etext") == 0
|| (sym->st_type == STT_OBJECT && sym->st_shndx == SHN_EXTABS
&& sym->st_value == 0));
}
diff --git a/libctf/testsuite/config/default.exp b/libctf/testsuite/config/default.exp
index f24482620b6..d5e51f418ca 100644
--- a/libctf/testsuite/config/default.exp
+++ b/libctf/testsuite/config/default.exp
@@ -34,6 +34,10 @@ if ![info exists as] then {
set as [findfile $base_dir/../gas/as-new $base_dir/../gas/as-new [transform as]]
}
+if ![info exists objdump] then {
+ set objdump [findfile $base_dir/../binutils/objdump]
+}
+
remote_exec host "mkdir -p tmpdir"
# Make symlinks from tmpdir/libctf to the linker and assembler in the
@@ -63,10 +67,12 @@ if {![info exists CFLAGS_FOR_TARGET]} {
if ![info exists AR] then {
set AR [findfile $base_dir/../binutils/ar]
}
-
if {![info exists OBJDUMP]} {
set OBJDUMP [findfile $base_dir/../binutils/objdump]
}
+if ![info exists OBJDUMPFLAGS] then {
+ set OBJDUMPFLAGS {}
+}
# load the utility procedures
load_lib ctf-lib.exp
diff --git a/libctf/testsuite/lib/ctf-lib.exp b/libctf/testsuite/lib/ctf-lib.exp
index 64d2a40ad9f..4df6619606b 100644
--- a/libctf/testsuite/lib/ctf-lib.exp
+++ b/libctf/testsuite/lib/ctf-lib.exp
@@ -20,6 +20,51 @@
load_file $srcdir/../../ld/testsuite/lib/ld-lib.exp
+# Returns true if the target linker deduplicates CTF.
+proc check_ctf_linker_dedup { } {
+ global ctf_linker_dedup_saved
+
+ if {![info exists ctf_linker_dedup_saved]} {
+ set ctf_linker_dedup_saved 0
+
+ if ([check_ctf_available]) {
+ global objdump srcdir
+
+ set basename "tmpdir/ctf_linker_dedups[pid]"
+ compile_one_cc $srcdir/libctf-lookup/ambiguous-struct-A.c ${basename}-A.o "-gctf -fPIC -c"
+ compile_one_cc $srcdir/libctf-lookup/ambiguous-struct-B.c ${basename}-B.o "-gctf -fPIC -c"
+ compile_one_cc "${basename}-A.o ${basename}-B.o" $basename.so "-gctf -fPIC -shared"
+ if {! [remote_file host exists $basename.so] } {
+ return 0
+ }
+
+ # Don't use run_host_cmd: it dumps the entire output into the log,
+ # even on success.
+ set cmdret [remote_exec host [concat sh -c [list "$objdump --ctf $basename.so >dump.out 2>dump.err"]] "" "/dev/null"]
+ set cmdret [lindex $cmdret 0]
+ remote_upload host "dump.out"
+ remote_upload host "dump.err"
+ set dump_out [prune_warnings [file_contents "dump.out"]]
+ set dump_err [prune_warnings [file_contents "dump.err"]]
+ remote_file host delete "dump.out" "dump.err"
+ remote_file build delete "dump.out" "dump.err"
+
+ if {$cmdret != 0} {
+ verbose -log "failed with $cmdret: stderr: $dump_err"
+ verbose -log "output: $dump_out"
+ return 0;
+ }
+
+ remote_file host delete $basename.so ${basename}-A.o ${basename}-B.o
+ if [regexp {CTF archive member: } $dump_out] {
+ set ctf_linker_dedup_saved 1
+ }
+ }
+ }
+ return $ctf_linker_dedup_saved
+}
+
+
proc run_native_host_cmd { command } {
global link_output
global ld
diff --git a/libctf/testsuite/libctf-lookup/lookup.exp b/libctf/testsuite/libctf-lookup/lookup.exp
index a8b09c2df78..d15c315729d 100644
--- a/libctf/testsuite/libctf-lookup/lookup.exp
+++ b/libctf/testsuite/libctf-lookup/lookup.exp
@@ -28,6 +28,11 @@ if {![check_ctf_available]} {
return 0
}
+if {![check_ctf_linker_dedup]} {
+ unsupported "no CTF deduplication support in the linker"
+ return 0
+}
+
if {[info exists env(LC_ALL)]} {
set old_lc_all $env(LC_ALL)
}
diff --git a/libctf/testsuite/libctf-regression/libctf-repeat-cu.exp b/libctf/testsuite/libctf-regression/libctf-repeat-cu.exp
index e29cf63fce9..7c19fe8f6a7 100644
--- a/libctf/testsuite/libctf-regression/libctf-repeat-cu.exp
+++ b/libctf/testsuite/libctf-regression/libctf-repeat-cu.exp
@@ -37,6 +37,11 @@ if {![check_ctf_available]} {
return 0
}
+if {![check_ctf_linker_dedup]} {
+ unsupported "no CTF deduplication support in the linker"
+ return 0
+}
+
if {[info exists env(LC_ALL)]} {
set old_lc_all $env(LC_ALL)
}
diff --git a/libctf/testsuite/libctf-regression/regression.exp b/libctf/testsuite/libctf-regression/regression.exp
index e4b63473691..0270cca0cba 100644
--- a/libctf/testsuite/libctf-regression/regression.exp
+++ b/libctf/testsuite/libctf-regression/regression.exp
@@ -23,6 +23,11 @@ if {![check_ctf_available]} {
return 0
}
+if {![check_ctf_linker_dedup]} {
+ unsupported "no CTF deduplication support in the linker"
+ return 0
+}
+
if ![is_elf_format] {
unsupported "CTF needs bfd changes to be emitted on non-ELF"
return 0
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 2ae5626ed2e..b072d0bed52 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,14 @@
+2025-08-06 Matthieu Longo
+
+ * testsuite/test-doubly-linked-list.c: disable debug logging on
+ stdout.
+
+2025-07-09 Matthieu Longo
+
+ * Makefile.in: Add new header.
+ * testsuite/Makefile.in: Add new test.
+ * testsuite/test-doubly-linked-list.c: New test.
+
2025-05-13 Andreas Schwab
* regex.c (regex_compile): Don't write beyond array bounds when
diff --git a/libiberty/testsuite/test-doubly-linked-list.c b/libiberty/testsuite/test-doubly-linked-list.c
index 1e1fc637653..93fe19a27ae 100644
--- a/libiberty/testsuite/test-doubly-linked-list.c
+++ b/libiberty/testsuite/test-doubly-linked-list.c
@@ -155,19 +155,26 @@ bool check(const char *op,
bool success = true;
bool res;
- l_print (wrapper->first);
+#define DUMP_LIST 0
+
+ if (DUMP_LIST)
+ l_print (wrapper->first);
+
res = run_test (expect, wrapper, false);
printf ("%s: test-linked-list::%s: check forward conformity\n",
res ? "PASS": "FAIL", op);
success &= res;
- l_reverse_print (wrapper->last);
+ if (DUMP_LIST)
+ l_reverse_print (wrapper->last);
+
res = run_test (expect, wrapper, true);
printf ("%s: test-linked-list::%s: check backward conformity\n",
res ? "PASS": "FAIL", op);
success &= res;
- printf("\n");
+ if (DUMP_LIST)
+ printf("\n");
return success;
}
diff --git a/opcodes/configure b/opcodes/configure
index d878234c88f..3dd6b692f89 100755
--- a/opcodes/configure
+++ b/opcodes/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for opcodes 2.45.
+# Generated by GNU Autoconf 2.69 for opcodes 2.45.0.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='opcodes'
PACKAGE_TARNAME='opcodes'
-PACKAGE_VERSION='2.45'
-PACKAGE_STRING='opcodes 2.45'
+PACKAGE_VERSION='2.45.0'
+PACKAGE_STRING='opcodes 2.45.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1368,7 +1368,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures opcodes 2.45 to adapt to many kinds of systems.
+\`configure' configures opcodes 2.45.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1439,7 +1439,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of opcodes 2.45:";;
+ short | recursive ) echo "Configuration of opcodes 2.45.0:";;
esac
cat <<\_ACEOF
@@ -1560,7 +1560,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-opcodes configure 2.45
+opcodes configure 2.45.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1971,7 +1971,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by opcodes $as_me 2.45, which was
+It was created by opcodes $as_me 2.45.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2951,7 +2951,7 @@ fi
# Define the identity of the package.
PACKAGE='opcodes'
- VERSION='2.45'
+ VERSION='2.45.0'
cat >>confdefs.h <<_ACEOF
@@ -14623,7 +14623,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by opcodes $as_me 2.45, which was
+This file was extended by opcodes $as_me 2.45.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -14689,7 +14689,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-opcodes config.status 2.45
+opcodes config.status 2.45.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"