1
0

Compare commits

...

6 Commits

Author SHA1 Message Date
540304835a release 2.45-6~bpo13+1 2025-09-07 17:47:34 +03:00
341af4b343 sync with Debian
version: 2.45-6 (released to unstable)
commit: 76549fcba94044939c778ba49cec10dbf11e5d89
2025-09-07 17:44:02 +03:00
7f95dcfc94 release 2.45-5~bpo13+1 2025-08-29 17:05:17 +03:00
5585c1f074 sync with Debian
version: 2.45-5 (released to unstable)
commit: f6740cbcc3c6e89bcc6b9350570bf8f36332138e
2025-08-29 17:04:21 +03:00
445bd868b4 release 2.45-3~bpo13+2 2025-08-16 22:56:01 +03:00
eb9b0e389d sync with Debian
version: 2.45-4 (released to unstable)
commit: 6f0b22a3261e3f255a7ff03d9fc510f37bf721fb
2025-08-16 22:54:21 +03:00
6 changed files with 945 additions and 13 deletions

18
debian/changelog vendored
View File

@@ -1,3 +1,21 @@
binutils (2.45-6~bpo13+1) trixie-backports; urgency=medium
* Sync with Debian binutils=2.45-6.
-- Konstantin Demin <rockdrilla@gmail.com> Sun, 07 Sep 2025 17:43:55 +0300
binutils (2.45-5~bpo13+1) trixie-backports; urgency=medium
* Sync with Debian binutils=2.45-5.
-- Konstantin Demin <rockdrilla@gmail.com> Fri, 29 Aug 2025 17:04:33 +0300
binutils (2.45-3~bpo13+2) trixie-backports; urgency=medium
* Sync with Debian binutils=2.45-4.
-- Konstantin Demin <rockdrilla@gmail.com> Sat, 16 Aug 2025 22:55:29 +0300
binutils (2.45-3~bpo13+1) trixie-backports; urgency=medium
* Backport to Debian 13 "Trixie".

5
debian/control vendored
View File

@@ -144,8 +144,8 @@ Multi-Arch: same
Priority: optional
Section: libdevel
Depends: libsframe2 (= ${binary:Version}), ${shlibs:Depends}
Conflicts: binutils (<< 2.45-1~)
Replaces: binutils (<< 2.45-1~)
Conflicts: binutils (<< 2.45-3~)
Replaces: binutils (<< 2.45-3~)
Description: Library to handle the SFrame format (development files)
SFrame stands for Simple Frame format. SFrame format keeps track
of the minimal necessary information needed for generating stack traces.
@@ -193,7 +193,6 @@ Architecture: any
Priority: optional
Depends: binutils (= ${binary:Version}), libbinutils (= ${binary:Version}),
libctf0 (= ${binary:Version}), libctf-nobfd0 (= ${binary:Version}),
libsframe-dev (= ${binary:Version}),
libgprofng0 (= ${binary:Version}) [amd64 arm64 i386 riscv64 x32],
Conflicts: libbfd-dev
Provides: libbfd-dev

5
debian/control.in vendored
View File

@@ -144,8 +144,8 @@ Multi-Arch: same
Priority: optional
Section: libdevel
Depends: libsframe2 (= ${binary:Version}), ${shlibs:Depends}
Conflicts: binutils (<< 2.45-1~)
Replaces: binutils (<< 2.45-1~)
Conflicts: binutils (<< 2.45-3~)
Replaces: binutils (<< 2.45-3~)
Description: Library to handle the SFrame format (development files)
SFrame stands for Simple Frame format. SFrame format keeps track
of the minimal necessary information needed for generating stack traces.
@@ -193,7 +193,6 @@ Architecture: any
Priority: optional
Depends: binutils (= ${binary:Version}), libbinutils (= ${binary:Version}),
libctf0 (= ${binary:Version}), libctf-nobfd0 (= ${binary:Version}),
libsframe-dev (= ${binary:Version}),
libgprofng0 (= ${binary:Version}) [amd64 arm64 i386 riscv64 x32],
Conflicts: libbfd-dev
Provides: libbfd-dev

View File

@@ -1,12 +1,23 @@
# DP: updates from the binutils-2.45 branch
# git diff 2bc7af1ff7732451b6a7b09462a815c3284f9613 f57c0f19710c6fb2052d3709da7081327918ddf9
# git diff 2bc7af1ff7732451b6a7b09462a815c3284f9613 3af34f64c67e19658f7f5cde7d1734868f029096
diff --git a/bfd/archive.c b/bfd/archive.c
index 8e20554d781..c61d4b12658 100644
index 8e20554d781..697b2ed23f2 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -2299,7 +2299,6 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
@@ -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;
@@ -14,7 +25,7 @@ index 8e20554d781..c61d4b12658 100644
struct orl *map = NULL;
unsigned int orl_max = 1024; /* Fine initial default. */
unsigned int orl_count = 0;
@@ -2334,7 +2333,7 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
@@ -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;
@@ -23,6 +34,54 @@ index 8e20554d781..c61d4b12658 100644
{
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
@@ -433,8 +492,72 @@ index 46fafb332de..505f1196987 100644
}
}
}
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..c7bbd1445ca 100644
index beed058a6be..d94c933b73b 100644
--- a/bfd/version.h
+++ b/bfd/version.h
@@ -16,7 +16,7 @@
@@ -442,7 +565,7 @@ index beed058a6be..c7bbd1445ca 100644
In releases, the date is not included in either version strings or
sonames. */
-#define BFD_VERSION_DATE 20250727
+#define BFD_VERSION_DATE 20250810
+#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@
@@ -539,8 +662,35 @@ index 94be22505d4..0ff4539f458 100755
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..905ce917708 100644
index 038f6555c0b..a5690257059 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -2529,7 +2529,6 @@ merge_gnu_build_notes (bfd * abfd,
@@ -574,6 +724,131 @@ index 038f6555c0b..905ce917708 100644
}
#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
@@ -614,6 +889,87 @@ index 889126e9e32..fa77cd43d23 100644
&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
@@ -1228,6 +1584,540 @@ index 00000000000..e02e16b7d26
+.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 <ctf-impl.h>
#include <string.h>
-#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

25
debian/patches/gas-sframe-warn.diff vendored Normal file
View File

@@ -0,0 +1,25 @@
--- a/gas/gen-sframe.c
+++ b/gas/gen-sframe.c
@@ -1022,9 +1022,11 @@ sframe_xlate_do_def_cfa (struct sframe_x
if (cfi_insn->u.ri.reg != SFRAME_CFA_SP_REG
&& cfi_insn->u.ri.reg != SFRAME_CFA_FP_REG)
{
+ /* Disabled for Debian/Ubuntu, shows up in autopkg tests:
as_warn (_("no SFrame FDE emitted; "
"non-SP/FP register %u in .cfi_def_cfa"),
cfi_insn->u.ri.reg);
+ */
return SFRAME_XLATE_ERR_NOTREPRESENTED; /* Not represented. */
}
sframe_fre_set_cfa_base_reg (cur_fre, cfi_insn->u.ri.reg);
@@ -1586,8 +1588,10 @@ sframe_xlate_do_cfi_escape (const struct
OS-specific CFI opcodes), skip inspecting the DWARF expression.
This may impact the asynchronicity due to loss of coverage.
Continue to warn the user and bail out. */
+ /* Disabled for Debian/Ubuntu, shows up in autopkg tests:
as_warn (_("no SFrame FDE emitted; .cfi_escape with op (%#lx)"),
(unsigned long)firstop);
+ */
err = SFRAME_XLATE_ERR_NOTREPRESENTED;
}

View File

@@ -35,3 +35,4 @@ armhf-64k-alignment.diff
gprofng-examples-tgz-deterministic.diff
gprofng-cross-build.diff
gas-sframe-warn.diff