aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/bfd-in2.h7
-rw-r--r--bfd/coffcode.h4
-rw-r--r--bfd/format.c84
-rw-r--r--bfd/version.h2
-rw-r--r--binutils/README-how-to-make-a-release54
-rw-r--r--binutils/objcopy.c40
-rw-r--r--binutils/objdump.c19
-rw-r--r--binutils/readelf.c3
-rw-r--r--binutils/testsuite/binutils-all/x86-64/objdump-sframe-01.d18
-rw-r--r--binutils/testsuite/binutils-all/x86-64/pr33198.c4
-rw-r--r--binutils/testsuite/binutils-all/x86-64/readelf-sframe-01.d18
-rw-r--r--binutils/testsuite/binutils-all/x86-64/sframe-func.s11
-rw-r--r--binutils/testsuite/binutils-all/x86-64/x86-64.exp158
-rw-r--r--binutils/testsuite/lib/binutils-common.exp27
-rw-r--r--gas/NEWS8
-rw-r--r--gas/as.c6
-rw-r--r--gas/as.h26
-rw-r--r--gas/config/tc-aarch64.c4
-rw-r--r--gas/config/tc-arc.h2
-rw-r--r--gas/config/tc-arm.h3
-rw-r--r--gas/config/tc-csky.h2
-rw-r--r--gas/config/tc-msp430.h3
-rw-r--r--gas/config/tc-ppc.h3
-rw-r--r--gas/config/tc-s390.h3
-rw-r--r--gas/config/tc-sparc.h2
-rw-r--r--gas/config/tc-tic6x.h4
-rw-r--r--gas/doc/c-aarch64.texi20
-rw-r--r--gas/dw2gencfi.c11
-rw-r--r--gas/gen-sframe.c15
-rw-r--r--gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.d2
-rw-r--r--gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1c.d5
-rw-r--r--gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1c.s3
-rw-r--r--gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-pr33170.d19
-rw-r--r--gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-pr33170.s40
-rw-r--r--gas/testsuite/gas/cfi-sframe/cfi-sframe.exp2
-rw-r--r--gdb/cli/cli-cmds.c5
-rw-r--r--gdb/corelow.c5
-rw-r--r--gdb/dictionary.c26
-rw-r--r--gdb/dwarf2/read.c63
-rw-r--r--gdb/inflow.c23
-rw-r--r--gdb/mingw-hdep.c5
-rw-r--r--gdb/solib-frv.h2
-rw-r--r--gdb/solib-svr4.c15
-rw-r--r--gdb/solib.c5
-rw-r--r--gdb/svr4-tls-tdep.c2
-rw-r--r--gdb/symtab.c5
-rw-r--r--gdb/terminal.h15
-rw-r--r--gdb/testsuite/gdb.ada/operator_call.exp6
-rw-r--r--gdb/testsuite/gdb.tui/main-2.exp2
-rw-r--r--gdb/testsuite/gdb.tui/tuiterm.exp46
-rw-r--r--gdb/testsuite/lib/tuiterm.exp91
-rw-r--r--gdbserver/server.cc21
-rw-r--r--gold/aclocal.m429
-rwxr-xr-xgold/configure1
-rw-r--r--gold/configure.ac5
-rw-r--r--ld/ChangeLog6
-rwxr-xr-xld/configure17
-rw-r--r--ld/configure.ac13
-rw-r--r--ld/scripttempl/avr.sc22
-rw-r--r--ld/testsuite/ld-elf/indirect.exp15
-rwxr-xr-xlibctf/configure10
-rw-r--r--libctf/configure.ac10
-rw-r--r--libctf/ctf-link.c88
-rw-r--r--libctf/ctf-serialize.c6
-rw-r--r--libctf/testsuite/config/default.exp8
-rw-r--r--libctf/testsuite/lib/ctf-lib.exp45
-rw-r--r--libctf/testsuite/libctf-lookup/lookup.exp5
-rw-r--r--libctf/testsuite/libctf-regression/libctf-repeat-cu.exp5
-rw-r--r--libctf/testsuite/libctf-regression/regression.exp5
-rw-r--r--libsframe/doc/sframe-spec.texi20
-rw-r--r--opcodes/sparc-dis.c40
71 files changed, 989 insertions, 330 deletions
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index b013ef9..2ff3e93 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -2903,8 +2903,15 @@ bool generic_core_file_matches_executable_p
(bfd *core_bfd, bfd *exec_bfd);
/* Extracted from format.c. */
+bool bfd_check_format_lto (bfd *abfd, bfd_format format,
+ bool lto_sections_removed);
+
bool bfd_check_format (bfd *abfd, bfd_format format);
+bool bfd_check_format_matches_lto
+ (bfd *abfd, bfd_format format, char ***matching,
+ bool lto_sections_removed);
+
bool bfd_check_format_matches
(bfd *abfd, bfd_format format, char ***matching);
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index b81195d..a2ee036 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -909,7 +909,9 @@ fill_comdat_hash (bfd *abfd)
if (! _bfd_coff_get_external_symbols (abfd))
return true;
- esymstart = esym = (bfd_byte *) obj_coff_external_syms (abfd);
+ esymstart = esym = obj_coff_external_syms (abfd);
+ if (esym == NULL)
+ return true;
esymend = esym + obj_raw_syment_count (abfd) * bfd_coff_symesz (abfd);
for (struct internal_syment isym;
diff --git a/bfd/format.c b/bfd/format.c
index a909b70..f3a0774 100644
--- a/bfd/format.c
+++ b/bfd/format.c
@@ -56,16 +56,19 @@ extern const size_t _bfd_target_vector_entries;
/*
FUNCTION
- bfd_check_format
+ bfd_check_format_lto
SYNOPSIS
- bool bfd_check_format (bfd *abfd, bfd_format format);
+ bool bfd_check_format_lto (bfd *abfd, bfd_format format,
+ bool lto_sections_removed);
DESCRIPTION
Verify if the file attached to the BFD @var{abfd} is compatible
with the format @var{format} (i.e., one of <<bfd_object>>,
<<bfd_archive>> or <<bfd_core>>).
+ If LTO_SECTION_REMOVED is true, ignore plugin target.
+
If the BFD has been set to a specific target before the
call, only the named target and format combination is
checked. If the target has not been set, or has been set to
@@ -100,9 +103,30 @@ DESCRIPTION
*/
bool
+bfd_check_format_lto (bfd *abfd, bfd_format format,
+ bool lto_sections_removed)
+{
+ return bfd_check_format_matches_lto (abfd, format, NULL,
+ lto_sections_removed);
+}
+
+
+/*
+FUNCTION
+ bfd_check_format
+
+SYNOPSIS
+ bool bfd_check_format (bfd *abfd, bfd_format format);
+
+DESCRIPTION
+ Similar to bfd_check_format_plugin, except plugin target isn't
+ ignored.
+*/
+
+bool
bfd_check_format (bfd *abfd, bfd_format format)
{
- return bfd_check_format_matches (abfd, format, NULL);
+ return bfd_check_format_matches_lto (abfd, format, NULL, false);
}
struct bfd_preserve
@@ -407,11 +431,12 @@ bfd_set_lto_type (bfd *abfd ATTRIBUTE_UNUSED)
/*
FUNCTION
- bfd_check_format_matches
+ bfd_check_format_matches_lto
SYNOPSIS
- bool bfd_check_format_matches
- (bfd *abfd, bfd_format format, char ***matching);
+ bool bfd_check_format_matches_lto
+ (bfd *abfd, bfd_format format, char ***matching,
+ bool lto_sections_removed);
DESCRIPTION
Like <<bfd_check_format>>, except when it returns FALSE with
@@ -423,10 +448,14 @@ DESCRIPTION
When done with the list that @var{matching} points to, the caller
should free it.
+
+ If LTO_SECTION_REMOVED is true, ignore plugin target.
*/
bool
-bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
+bfd_check_format_matches_lto (bfd *abfd, bfd_format format,
+ char ***matching,
+ bool lto_sections_removed ATTRIBUTE_UNUSED)
{
extern const bfd_target binary_vec;
const bfd_target * const *target;
@@ -495,8 +524,13 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
if (!bfd_preserve_save (abfd, &preserve, NULL))
goto err_ret;
- /* If the target type was explicitly specified, just check that target. */
- if (!abfd->target_defaulted)
+ /* If the target type was explicitly specified, just check that target.
+ If LTO_SECTION_REMOVED is true, don't match the plugin target. */
+ if (!abfd->target_defaulted
+#if BFD_SUPPORTS_PLUGINS
+ && (!lto_sections_removed || !bfd_plugin_target_p (abfd->xvec))
+#endif
+ )
{
if (bfd_seek (abfd, 0, SEEK_SET) != 0) /* rewind! */
goto err_ret;
@@ -540,10 +574,12 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
searching. Don't match the plugin target if we have another
alternative since we want to properly set the input format
before allowing a plugin to claim the file. Also, don't
- check the default target twice. */
+ check the default target twice. If LTO_SECTION_REMOVED is
+ true, don't match the plugin target. */
if (*target == &binary_vec
#if BFD_SUPPORTS_PLUGINS
- || (match_count != 0 && bfd_plugin_target_p (*target))
+ || ((lto_sections_removed || match_count != 0)
+ && bfd_plugin_target_p (*target))
#endif
|| (!abfd->target_defaulted && *target == save_targ))
continue;
@@ -797,6 +833,32 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
/*
FUNCTION
+ bfd_check_format_matches
+
+SYNOPSIS
+ bool bfd_check_format_matches
+ (bfd *abfd, bfd_format format, char ***matching);
+
+DESCRIPTION
+ Like <<bfd_check_format>>, except when it returns FALSE with
+ <<bfd_errno>> set to <<bfd_error_file_ambiguously_recognized>>. In that
+ case, if @var{matching} is not NULL, it will be filled in with
+ a NULL-terminated list of the names of the formats that matched,
+ allocated with <<malloc>>.
+ Then the user may choose a format and try again.
+
+ When done with the list that @var{matching} points to, the caller
+ should free it.
+*/
+
+bool
+bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
+{
+ return bfd_check_format_matches_lto (abfd, format, matching, false);
+}
+
+/*
+FUNCTION
bfd_set_format
SYNOPSIS
diff --git a/bfd/version.h b/bfd/version.h
index 41a4b75..864ebe4 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 20250722
+#define BFD_VERSION_DATE 20250728
#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/binutils/README-how-to-make-a-release b/binutils/README-how-to-make-a-release
index 0604a56..7ab4c69 100644
--- a/binutils/README-how-to-make-a-release
+++ b/binutils/README-how-to-make-a-release
@@ -232,6 +232,10 @@ If this is an ODD numbered release:
For the next few weeks, monitor the mailing list for new translations
and respond to any requests to have patches applied to the branch.
+Also - expect to receive lots of new/updated translations from the
+Translation Project. These all need to be checked in to both the
+mainline and the branch.
+
==============================================================================
==============================================================================
@@ -253,7 +257,7 @@ How to create the release.
21. a. Update the release number in bfd/version.m4 on the release
branch to a whole new minor version number, without a point
- value. Eg "2.44.90" becomes "2.45". NB/ Not: "2.45.00"
+ value. Eg "2.45.90" becomes "2.46". NB/ Not: "2.46.00"
b. Change bfd/development.sh to set all values to "false".
@@ -280,11 +284,10 @@ How to create the release.
to exist in the master repository, and that the GDB project would
need to agree to have it there.
- e. Add ChangeLog entries for all of the updates and add a
- "this-is-the-2.43-release" comment and commit.
+ e. Commit.
git add .
- git commit -m "This is the 2.45 release"
+ git commit -m "This is the 2.46 release"
git push
22. Check that your file creation mask will create the
@@ -311,17 +314,15 @@ How to create the release.
If this is an EVEN numbered release:
- ./src-release.sh -b -g -l -x -z binutils_with_gold
+ ./src-release.sh -b -g -l -x -z \
+ -r `git log -1 --format=%cd --date=format:%F bfd/version.m4` \
+ binutils_with_gold
If this is an ODD numbered release:
- ./src-release.sh -b -g -l -x -z binutils
-
- OR ... for a more reproducible tarball:
-
./src-release.sh -b -g -l -x -z \
-r `git log -1 --format=%cd --date=format:%F bfd/version.m4` \
- [binutils | binutils_with_gold]
+ binutils
24. Check that the files in the tarballs have the correct
permissions.
@@ -330,7 +331,7 @@ How to create the release.
Also check that the man files are not empty. (cf PR 28144).
- tar tvf binutils-*.tar | grep -e "\.1"
+ tar tvf binutils-*.tar | grep -e "\.1" (look for zero sized files)
25. Sanity check the release on x86_64-pc-linux-gnu by building and
running the testsuites (gas, gold, binutils and ld).
@@ -365,21 +366,23 @@ How to create the release.
popd
26. Tag the branch with the new release number:
- [optional: add "-u XXXXX" to sign with a gpg key]
- enter a tag message such as: "Official GNU Binutils 2.4x release"
+ [Optional: add "-u XXXXX" to sign with a gpg key.
+ Note: This may require changing the setting of [gpg] in your .gitconfig file]
+
+ Enter a tag message such as: "Official GNU Binutils 2.4x release"
git tag -a <TAG> -u <Your Key>
eg:
- git tag -a binutils-2_44 -u DD9E3C4F <=== Be careful to get the tag right
+ git tag -a binutils-2_46 -u DD9E3C4F <=== Be careful to get the tag right
or:
- git tag -a binutils-2_44 -u DD9E3C4F -m "Official GNU Binutils 2.44 release"
+ git tag -a binutils-2_46 -u DD9E3C4F -m "Official GNU Binutils 2.46 release"
NB/ If you do sign the binaries make sure to use a key
that has been published with the FSF.
Then push the release:
- git push origin binutils-2_44
+ git push origin binutils-2_46
If you get an error message along the lines of:
"Invalid revision range ..."
@@ -387,11 +390,11 @@ How to create the release.
27. Upload the tarballs to ftp.gnu.org.
- gnupload --to ftp.gnu.org:binutils binutils-2.44.tar.*
+ gnupload --to ftp.gnu.org:binutils binutils-2.46.tar.*
Be prepared to provide the password for the key, if you
signed the binaries.
-
+
The gnupload script is in the build-aux/ directory of the gnulib
project's srouces. It uses the ncftp package for transmitting
the files.
@@ -420,8 +423,8 @@ How to create the release.
Create a new docs sub-directory and move into it:
cd binutils-htdocs
- mkdir docs-2.45
- cd docs-2.45
+ mkdir docs-2.46
+ cd docs-2.46
Copy the index.html from the previous release
@@ -457,8 +460,8 @@ How to create the release.
cp <build-dir>/ld/ld.pdf . [NB/ Path not like others]
[NB/ The gprofng documentation does not have a node-per-page selection]
- cp <build-dir>/gprofng/doc/gprof.html .
- cp <build-dir>/gprofng/doc/gprof.pdf .
+ cp <build-dir>/gprofng/gprof.html .
+ cp <build-dir>/gprofng/gprof.pdf .
cp <build-dir>/libctf/doc/ctf-spec.html .
cp <build-dir>/libctf/doc/ctf-spec.pdf .
@@ -470,19 +473,20 @@ How to create the release.
cd .. [Should now be in be in binutils-htdocs/ ]
rm docs
- ln -s docs-2.45 docs
+ ln -s docs-2.46 docs
Edit index.html file to change the links to point to the new
release, mention any new features, update dates and so on.
- Check that the new web page is correct:
+ Check that the new web page is correct by opening it in a browser:
file:///<path-to-binutils-htdocs>/index.html
Add the new directories and files, commit and push the changes:
+ get add docs-2.46
git add .
- git commit -m"Update documenation for the 2.45 release"
+ git commit -m"Update documenation for the 2.46 release"
git push
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 2ca04e8..905ce91 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -3741,10 +3741,13 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
l->obfd = NULL;
list = l;
+#if BFD_SUPPORTS_PLUGINS
+ /* Ignore plugin target if all LTO sections should be removed. */
+ ok_object = bfd_check_format_lto (this_element, bfd_object,
+ lto_sections_removed);
+#else
ok_object = bfd_check_format (this_element, bfd_object);
- if (!ok_object)
- bfd_nonfatal_message (NULL, this_element, NULL,
- _("Unable to recognise the format of file"));
+#endif
/* PR binutils/3110: Cope with archives
containing multiple target types. */
@@ -3880,9 +3883,8 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
}
#if BFD_SUPPORTS_PLUGINS
- /* Enable LTO plugin in strip unless all LTO sections should be
- removed. */
- if (is_strip && !target && !lto_sections_removed)
+ /* Enable LTO plugin in strip. */
+ if (is_strip && !target)
target = "plugin";
#endif
@@ -3980,7 +3982,21 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
input_arch))
status = 1;
}
- else if (bfd_check_format_matches (ibfd, bfd_object, &obj_matching))
+ else if (
+#if BFD_SUPPORTS_PLUGINS
+ /* Ignore plugin target first if all LTO sections should be
+ removed. Try with plugin target next if ignoring plugin
+ target fails to match the format. */
+ bfd_check_format_matches_lto (ibfd, bfd_object, &obj_matching,
+ lto_sections_removed)
+ || (lto_sections_removed
+ && bfd_check_format_matches_lto (ibfd, bfd_object,
+ &obj_matching, false))
+#else
+ bfd_check_format_matches_lto (ibfd, bfd_object, &obj_matching,
+ false)
+#endif
+ )
{
bfd *obfd;
do_copy:
@@ -5036,9 +5052,13 @@ strip_main (int argc, char *argv[])
#if BFD_SUPPORTS_PLUGINS
/* Check if all GCC LTO sections should be removed, assuming all LTO
sections will be removed with -R .gnu.lto_.*. * Remove .gnu.lto_.*
- sections will also remove .gnu.debuglto_. sections. */
- lto_sections_removed = !!find_section_list (".gnu.lto_.*", false,
- SECTION_CONTEXT_REMOVE);
+ sections will also remove .gnu.debuglto_. sections. LLVM IR
+ bitcode is stored in .llvm.lto section which will be removed with
+ -R .llvm.lto. */
+ lto_sections_removed = (!!find_section_list (".gnu.lto_.*", false,
+ SECTION_CONTEXT_REMOVE)
+ || !!find_section_list (".llvm.lto", false,
+ SECTION_CONTEXT_REMOVE));
#endif
i = optind;
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 98d3049..0bea4d0 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -4498,6 +4498,9 @@ dump_dwarf_section (bfd *abfd, asection *section,
else
match = name;
+ if (elf_section_type (section) == SHT_GNU_SFRAME)
+ match = ".sframe";
+
for (i = 0; i < max; i++)
if ((strcmp (debug_displays [i].section.uncompressed_name, match) == 0
|| strcmp (debug_displays [i].section.compressed_name, match) == 0
@@ -4999,6 +5002,18 @@ dump_sframe_section (bfd *abfd, const char *sect_name, bool is_mainfile)
printf (_("No %s section present\n\n"), sanitize_string (sect_name));
return;
}
+ /* Starting with Binutils 2.45, SFrame sections have section type
+ SHT_GNU_SFRAME. For SFrame sections from Binutils 2.44 or earlier,
+ check explcitly for SFrame sections of type SHT_PROGBITS and name
+ ".sframe" to allow them. */
+ else if (elf_section_type (sec) != SHT_GNU_SFRAME
+ && !(elf_section_type (sec) == SHT_PROGBITS
+ && strcmp (sect_name, ".sframe") == 0))
+ {
+ printf (_("Section %s does not contain SFrame data\n\n"),
+ sanitize_string (sect_name));
+ return;
+ }
}
dump_dwarf (abfd, is_mainfile);
}
@@ -6332,8 +6347,10 @@ main (int argc, char **argv)
if (optarg)
dump_sframe_section_name = xstrdup (optarg);
+ else
+ dump_sframe_section_name = ".sframe";
- /* Error checking for user-provided section name is done in
+ /* Error checking for dump_sframe_section_name is done in
dump_sframe_section (). Initialize for now with the default
internal name: "sframe-internal-only". */
dwarf_select_sections_by_names ("sframe-internal-only");
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 686a16c..bb81c82 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -17493,6 +17493,7 @@ display_debug_section (int shndx, Elf_Internal_Shdr * section, Filedata * fileda
if (streq (sec->uncompressed_name, name)
|| (id == line && startswith (name, ".debug_line."))
+ || (id == sframe && section->sh_type == SHT_GNU_SFRAME)
|| streq (sec->compressed_name, name))
{
bool secondary = (section != find_section (filedata, name));
@@ -17502,6 +17503,8 @@ display_debug_section (int shndx, Elf_Internal_Shdr * section, Filedata * fileda
if (i == line && startswith (name, ".debug_line."))
sec->name = name;
+ else if (id == sframe && section->sh_type == SHT_GNU_SFRAME)
+ sec->name = name;
else if (streq (sec->uncompressed_name, name))
sec->name = sec->uncompressed_name;
else
diff --git a/binutils/testsuite/binutils-all/x86-64/objdump-sframe-01.d b/binutils/testsuite/binutils-all/x86-64/objdump-sframe-01.d
new file mode 100644
index 0000000..cca83cb
--- /dev/null
+++ b/binutils/testsuite/binutils-all/x86-64/objdump-sframe-01.d
@@ -0,0 +1,18 @@
+#PROG:objcopy
+#name: objdump dump SFrame section .sframe2
+#source: sframe-func.s
+#as: --gsframe
+#objcopy: --rename-section .sframe=.sframe2
+#objdump: --sframe=.sframe2
+#target: x86_64-*-*
+#xfail: ![gas_sframe_check]
+
+#...
+ Header :
+
+ Version: SFRAME_VERSION_2
+ Flags: SFRAME_F_FDE_FUNC_START_PCREL
+ CFA fixed RA offset: -8
+ Num FDEs: 1
+ Num FREs: 4
+#pass
diff --git a/binutils/testsuite/binutils-all/x86-64/pr33198.c b/binutils/testsuite/binutils-all/x86-64/pr33198.c
new file mode 100644
index 0000000..cd0130c
--- /dev/null
+++ b/binutils/testsuite/binutils-all/x86-64/pr33198.c
@@ -0,0 +1,4 @@
+void
+foo (void)
+{
+}
diff --git a/binutils/testsuite/binutils-all/x86-64/readelf-sframe-01.d b/binutils/testsuite/binutils-all/x86-64/readelf-sframe-01.d
new file mode 100644
index 0000000..a6973d8
--- /dev/null
+++ b/binutils/testsuite/binutils-all/x86-64/readelf-sframe-01.d
@@ -0,0 +1,18 @@
+#PROG:objcopy
+#name: readelf dump SFrame section .sframe2
+#source: sframe-func.s
+#as: --gsframe
+#objcopy: --rename-section .sframe=.sframe2
+#readelf: --sframe=.sframe2
+#target: x86_64-*-*
+#xfail: ![gas_sframe_check]
+
+#...
+ Header :
+
+ Version: SFRAME_VERSION_2
+ Flags: SFRAME_F_FDE_FUNC_START_PCREL
+ CFA fixed RA offset: -8
+ Num FDEs: 1
+ Num FREs: 4
+#pass
diff --git a/binutils/testsuite/binutils-all/x86-64/sframe-func.s b/binutils/testsuite/binutils-all/x86-64/sframe-func.s
new file mode 100644
index 0000000..cbd83c3
--- /dev/null
+++ b/binutils/testsuite/binutils-all/x86-64/sframe-func.s
@@ -0,0 +1,11 @@
+ .cfi_sections .sframe
+ .cfi_startproc
+ .long 8
+ .cfi_def_cfa_offset 16
+ .cfi_offset 6, -16
+ .long 8
+ .cfi_def_cfa_register 6
+ .long 8
+ .cfi_def_cfa 7, 8
+ .long 8
+ .cfi_endproc
diff --git a/binutils/testsuite/binutils-all/x86-64/x86-64.exp b/binutils/testsuite/binutils-all/x86-64/x86-64.exp
index 05c7304..ab1aa50 100644
--- a/binutils/testsuite/binutils-all/x86-64/x86-64.exp
+++ b/binutils/testsuite/binutils-all/x86-64/x86-64.exp
@@ -96,3 +96,161 @@ if {[catch "system \"bzip2 -dc $t > $tempfile\""] != 0} {
}
}
}
+
+proc run_pr33198_test { fat strip_flags } {
+ global srcdir
+ global subdir
+ global llvm_plug_opt
+ global AR
+ global CLANG_FOR_TARGET
+ global NM
+ global READELF
+ global STRIP
+
+ set test pr33198
+ set testname "${test}${fat} with $strip_flags"
+
+ if { [istarget "x86_64-*-linux*-gnux32"] \
+ || ![info exists CLANG_FOR_TARGET]
+ || [string match "" $llvm_plug_opt] } then {
+ untested $testname
+ return
+ }
+
+ set src $srcdir/$subdir/${test}.c
+ set obj tmpdir/${test}${fat}.o
+ set archive tmpdir/${test}${fat}.a
+ set CLANG_CFLAGS "-c -O2 -flto"
+ if { "$fat" == "-fat" } {
+ append CLANG_CFLAGS " -ffat-lto-objects"
+ }
+
+ append strip_flags " --strip-unneeded $llvm_plug_opt"
+
+ set cmd "$CLANG_FOR_TARGET $CLANG_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 "$NM $llvm_plug_opt $obj\n"
+ 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 ($obj)"
+ return
+ }
+
+ pass "$testname ($obj)"
+
+ 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 $llvm_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 "\.llvm\.lto *LLVM_LTO *" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (strip $obj)"
+ return
+ }
+ }
+
+ pass "$testname (strip $obj)"
+
+ set cmd "$AR $llvm_plug_opt -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 "$NM $llvm_plug_opt $archive\n"
+ 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 ($archive)"
+ return
+ }
+
+ pass "$testname ($archive)"
+
+ 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 $llvm_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 "\.llvm\.lto *LLVM_LTO *" $got] then {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (strip $archive)"
+ return
+ }
+ }
+
+ pass "$testname (strip $archive)"
+}
+
+run_pr33198_test "" "-R .gnu.lto_* -R .gnu.debuglto_* -R .llvm.lto -N __gnu_lto_v1"
+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"
diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
index b73b555..7297f6d 100644
--- a/binutils/testsuite/lib/binutils-common.exp
+++ b/binutils/testsuite/lib/binutils-common.exp
@@ -1811,3 +1811,30 @@ proc get_standard_section_names {} {
}
return
}
+
+set llvm_plug_opt ""
+if { [isnative] } then {
+ if ![info exists CLANG_FOR_TARGET] then {
+ catch "exec clang -v" got
+ if [regexp "clang version" $got] then {
+ set CLANG_FOR_TARGET clang
+ }
+ }
+ if [info exists CLANG_FOR_TARGET] then {
+ set llvm_plug_so [string trim [exec $CLANG_FOR_TARGET -print-file-name=LLVMgold.so]]
+ if { $llvm_plug_so ne "LLVMgold.so" } then {
+ set llvm_plug_opt "--plugin $llvm_plug_so"
+ }
+
+ if { $llvm_plug_opt eq "" } then {
+ # If it is still blank, try llvm-config --libdir. Clang
+ # searches CLANG_INSTALL_LIBDIR_BASENAME which corresponds
+ # to this.
+ catch "exec llvm-config --libdir" got
+ if {[file isdirectory $got] \
+ && [file isfile $got/LLVMgold.so]} then {
+ set llvm_plug_opt "--plugin $got/LLVMgold.so"
+ }
+ }
+ }
+}
diff --git a/gas/NEWS b/gas/NEWS
index 0caaa2d..a985893 100644
--- a/gas/NEWS
+++ b/gas/NEWS
@@ -56,6 +56,14 @@ Changes in 2.45:
* For LoongArch, warn about negative right-shift amounts and
division/modulus-by-zero when evaluating expressions.
+* Add support for most Armv9.6 extensions, enabled by the option
+ `-march=armv9.6-a' and extensions '+cmpbr', '+f8f16mm', '+f8f32mm',
+ '+fprcvt', '+lsfe', '+lsui', '+occmo', '+pops', '+sme2p2', '+ssve-aes',
+ '+sve-aes', '+sve-aes2', '+sve-bfscale', '+sve-f16f32mm' and '+sve2p2'.
+
+* AArch64 system registers can now be assembled without restriction. The
+ previous behavior can be enabled with '-menable-sysreg-checking'.
+
Changes in 2.44:
* Add support for the x86 Intel Diamond Rapids AMX instructions, including
diff --git a/gas/as.c b/gas/as.c
index bc38cdf..58ed0a5 100644
--- a/gas/as.c
+++ b/gas/as.c
@@ -1042,14 +1042,14 @@ This program has absolutely no warranty.\n"));
if (optarg)
{
if (strcasecmp (optarg, "no") == 0)
- flag_gen_sframe = 0;
+ flag_gen_sframe = GEN_SFRAME_DISABLED;
else if (strcasecmp (optarg, "yes") == 0)
- flag_gen_sframe = 1;
+ flag_gen_sframe = GEN_SFRAME_ENABLED;
else
as_fatal (_("Invalid --gsframe option: `%s'"), optarg);
}
else
- flag_gen_sframe = 1;
+ flag_gen_sframe = GEN_SFRAME_ENABLED;
break;
#endif /* OBJ_ELF */
diff --git a/gas/as.h b/gas/as.h
index 872c6dd..8f2facb 100644
--- a/gas/as.h
+++ b/gas/as.h
@@ -355,8 +355,30 @@ COMMON int flag_execstack;
/* TRUE if .note.GNU-stack section with SEC_CODE should be created */
COMMON int flag_noexecstack;
-/* TRUE if .sframe section should be created. */
-COMMON int flag_gen_sframe;
+/* PR gas/33175.
+ Add enumerators to disambiguate between configure-time
+ enablement (or not) vs user-specficied enablement/disablement (the latter
+ via command line). The expected usage of these states is:
+ - user-specified command line takes precedence over configure-time
+ setting and .cfi_sections directive usage.
+ - .cfi_sections usage takes precedence over configure-time setting. */
+enum gen_sframe_option
+{
+ /* Default. SFrame generation not enabled at configure time. GNU as will
+ not generate SFrame sections by default, unless enabled by user via
+ command line. */
+ GEN_SFRAME_DEFAULT_NONE,
+ /* SFrame generation enabled at configure time. GNU as will generate SFrame
+ sections for all objects, unless disabled by user via command line. */
+ GEN_SFRAME_CONFIG_ENABLED,
+ /* User specified disablement via --gsframe=no. */
+ GEN_SFRAME_DISABLED,
+ /* User specified enablement via --gsframe or --gsframe=yes. */
+ GEN_SFRAME_ENABLED,
+};
+
+/* State of the setting for SFrame section creation. */
+COMMON enum gen_sframe_option flag_gen_sframe;
/* name of emitted object file */
COMMON const char *out_file_name;
diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index cd9ae58..96bfe74 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -10869,8 +10869,8 @@ static const struct aarch64_option_cpu_value_table aarch64_features[] = {
{"sme-b16b16", AARCH64_FEATURE (SME_B16B16),
AARCH64_FEATURES (2, SVE_B16B16, SME2)},
{"pops", AARCH64_FEATURE (PoPS), AARCH64_NO_FEATURES},
- {"sve2p2", AARCH64_FEATURE (SVE2p2), AARCH64_FEATURE (SVE2)},
- {"sme2p2", AARCH64_FEATURE (SME2p2), AARCH64_FEATURE (SME2)},
+ {"sve2p2", AARCH64_FEATURE (SVE2p2), AARCH64_FEATURE (SVE2p1)},
+ {"sme2p2", AARCH64_FEATURE (SME2p2), AARCH64_FEATURE (SME2p1)},
{NULL, AARCH64_NO_FEATURES, AARCH64_NO_FEATURES},
};
diff --git a/gas/config/tc-arc.h b/gas/config/tc-arc.h
index 145d955..65470f0 100644
--- a/gas/config/tc-arc.h
+++ b/gas/config/tc-arc.h
@@ -271,4 +271,4 @@ struct arc_relax_type
extern void arc_md_end (void);
#define md_end arc_md_end
-#endif
+#endif /* TC_ARC */
diff --git a/gas/config/tc-arm.h b/gas/config/tc-arm.h
index aa5f117..4148a6f 100644
--- a/gas/config/tc-arm.h
+++ b/gas/config/tc-arm.h
@@ -20,6 +20,7 @@
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
+#ifndef TC_ARM
#define TC_ARM 1
#ifndef TARGET_BYTES_BIG_ENDIAN
@@ -377,3 +378,5 @@ extern bool arm_tc_equal_in_insn (int, char *);
#define TC_LARGEST_EXPONENT_IS_NORMAL(PRECISION) \
arm_is_largest_exponent_ok ((PRECISION))
int arm_is_largest_exponent_ok (int precision);
+
+#endif /* TC_ARM */
diff --git a/gas/config/tc-csky.h b/gas/config/tc-csky.h
index 7e32347..d391084 100644
--- a/gas/config/tc-csky.h
+++ b/gas/config/tc-csky.h
@@ -106,4 +106,4 @@ extern long csky_relax_frag (segT, fragS *, long);
const char * elf32_csky_target_format (void);
#endif
-#endif
+#endif /* TC_CSKY */
diff --git a/gas/config/tc-msp430.h b/gas/config/tc-msp430.h
index 47da4aa..fc39a59 100644
--- a/gas/config/tc-msp430.h
+++ b/gas/config/tc-msp430.h
@@ -20,6 +20,7 @@
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
+#ifndef TC_MSP430
#define TC_MSP430
/* By convention, you should define this macro in the `.h' file. For
example, `tc-m68k.h' defines `TC_M68K'. You might have to use this
@@ -172,3 +173,5 @@ extern bool msp430_allow_local_subtract (expressionS *, expressionS *, segT);
#define TC_LINKRELAX_FIXUP(seg) ((seg->flags & SEC_CODE) || (seg->flags & SEC_DEBUGGING))
#define DWARF2_ADDR_SIZE(bfd) 4
+
+#endif /* TC_MSP430 */
diff --git a/gas/config/tc-ppc.h b/gas/config/tc-ppc.h
index 97e2f4e..e568c42 100644
--- a/gas/config/tc-ppc.h
+++ b/gas/config/tc-ppc.h
@@ -19,6 +19,7 @@
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
+#ifndef TC_PPC
#define TC_PPC
#include "opcode/ppc.h"
@@ -367,3 +368,5 @@ extern int ppc_dwarf2_line_min_insn_length;
#define DWARF2_DEFAULT_RETURN_COLUMN 0x41
#define DWARF2_CIE_DATA_ALIGNMENT ppc_cie_data_alignment
#define EH_FRAME_ALIGNMENT 2
+
+#endif /* TC_PPC */
diff --git a/gas/config/tc-s390.h b/gas/config/tc-s390.h
index c92769e..0c62125 100644
--- a/gas/config/tc-s390.h
+++ b/gas/config/tc-s390.h
@@ -19,6 +19,7 @@
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
+#ifndef TC_S390
#define TC_S390
struct fix;
@@ -129,3 +130,5 @@ extern offsetT s390_sframe_cfa_ra_offset (void);
/* The abi/arch identifier for SFrame. */
unsigned char s390_sframe_get_abi_arch (void);
#define sframe_get_abi_arch s390_sframe_get_abi_arch
+
+#endif /* TC_S390 */
diff --git a/gas/config/tc-sparc.h b/gas/config/tc-sparc.h
index d569fe7..cfb89e0 100644
--- a/gas/config/tc-sparc.h
+++ b/gas/config/tc-sparc.h
@@ -178,4 +178,4 @@ extern int sparc_cie_data_alignment;
this, BFD_RELOC_32_PCREL will be emitted directly instead. */
#define CFI_DIFF_EXPR_OK 0
-#endif
+#endif /* TC_SPARC */
diff --git a/gas/config/tc-tic6x.h b/gas/config/tc-tic6x.h
index 55f2b2c..5859333 100644
--- a/gas/config/tc-tic6x.h
+++ b/gas/config/tc-tic6x.h
@@ -18,7 +18,9 @@
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
+#ifndef TC_TIC6X
#define TC_TIC6X 1
+
#define TARGET_BYTES_BIG_ENDIAN 0
#define WORKING_DOT_WORD
#define DOUBLEBAR_PARALLEL
@@ -225,3 +227,5 @@ struct fde_entry;
void tic6x_cfi_endproc (struct fde_entry *fde);
#define tc_cfi_section_name ".c6xabi.exidx"
+
+#endif /* TC_TIC6X */
diff --git a/gas/doc/c-aarch64.texi b/gas/doc/c-aarch64.texi
index dc64e09..8f5702f 100644
--- a/gas/doc/c-aarch64.texi
+++ b/gas/doc/c-aarch64.texi
@@ -197,6 +197,8 @@ automatically cause those extensions to be disabled.
@tab Enable 8-bit floating-point matrix multiply-accumulate to half-precision instructions.
@item @code{f8f32mm} @tab @code{simd} @code{fp}
@tab Enable 8-bit floating-point matrix multiply-accumulate to single-precision instructions.
+@item @code{faminmax} @tab @code{simd}
+ @tab Enable the famin and famax instructions.
@item @code{fcma} @tab @code{fp16}, @code{simd}
@tab Enable the complex number SIMD extensions.
@item @code{flagm} @tab
@@ -243,7 +245,7 @@ automatically cause those extensions to be disabled.
@tab Enable Large System Float Extension.
@item @code{lsui} @tab
@tab Enable Unprivileged Load/Store instructions.
-@item @code{lut} @tab
+@item @code{lut} @tab @code{simd}
@tab Enable the Lookup Table (LUT) extension.
@item @code{memtag} @tab
@tab Enable Armv8.5-A Memory Tagging Extensions.
@@ -258,9 +260,9 @@ automatically cause those extensions to be disabled.
@item @code{pops} @tab
@tab Enable Point of Physical Storage.
@item @code{predres} @tab
- @tab Enable the Execution and Data and Prediction instructions.
+ @tab Enable execution and data prediction restriction instructions.
@item @code{predres2} @tab @code{predres}
- @tab Enable Prediction instructions.
+ @tab Enable additional prediction restriction instructions.
@item @code{profile} @tab
@tab Enable statistical profiling extensions.
@item @code{ras} @tab
@@ -297,6 +299,8 @@ automatically cause those extensions to be disabled.
@tab Enable the SME F8F16 Extension.
@item @code{sme-f8f32} @tab @code{sme2}, @code{fp8}
@tab Enable the SME F8F32 Extension.
+@item @code{sme-f16f16} @tab @code{sme2}
+ @tab Enable the SME2 F16F16 Extension.
@item @code{sme-f64f64} @tab @code{sme}
@tab Enable SME F64F64 Extension.
@item @code{sme-i16i64} @tab @code{sme}
@@ -311,10 +315,10 @@ automatically cause those extensions to be disabled.
@tab Enable SME2.2.
@item @code{ssbs} @tab
@tab Enable Speculative Store Bypassing Safe state read and write.
-@item @code{ssve-fp8dot2} @tab @code{sme2}, @code{fp8}
- @tab Enable the Streaming SVE FP8 2-way dot product instructions.
@item @code{ssve-aes} @tab @code{sme2}, @code{sve-aes}
@tab Enable SVE AES instructions in streaming mode.
+@item @code{ssve-fp8dot2} @tab @code{sme2}, @code{fp8}
+ @tab Enable the Streaming SVE FP8 2-way dot product instructions.
@item @code{ssve-fp8dot4} @tab @code{sme2}, @code{fp8}
@tab Enable the Streaming SVE FP8 4-way dot product instructions.
@item @code{ssve-fp8fma} @tab @code{sme2}, @code{fp8}
@@ -322,7 +326,7 @@ automatically cause those extensions to be disabled.
@item @code{sve} @tab @code{fcma}
@tab Enable the Scalable Vector Extension.
@item @code{sve-aes} @tab @code{aes}
- @tab Enable the SVE PMULL128 instructions.
+ @tab Enable the SVE2 AES and PMULL Extensions.
@item @code{sve-aes2} @tab
@tab Enable the SVE-AES2 extension.
@item @code{sve-b16b16} @tab
@@ -333,7 +337,7 @@ automatically cause those extensions to be disabled.
@tab Enable the SVE_F16F32MM extension.
@item @code{sve2} @tab @code{sve}
@tab Enable SVE2.
-@item @code{sve2-aes} @tab @code{sve2}, @code{aes}
+@item @code{sve2-aes} @tab @code{sve2}, @code{sve-aes}
@tab Enable the SVE2 AES and PMULL Extensions.
@item @code{sve2-bitperm} @tab @code{sve2}
@tab Enable the SVE2 BITPERM Extension.
@@ -353,8 +357,6 @@ automatically cause those extensions to be disabled.
@tab Enable @code{wfet} and @code{wfit} instructions.
@item @code{xs} @tab
@tab Enable the XS memory attribute extension.
-@item @code{sme-f16f16} @tab
- @tab Enable the SME2 F16F16 Extension.
@end multitable
@multitable @columnfractions .20 .80
diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c
index 57fffab..c28856c 100644
--- a/gas/dw2gencfi.c
+++ b/gas/dw2gencfi.c
@@ -2596,10 +2596,13 @@ cfi_finish (void)
flag_traditional_format = save_flag_traditional_format;
}
- /* Generate SFrame section if the user specifies:
- - the command line option to gas, or
- - .sframe in the .cfi_sections directive. */
- if (flag_gen_sframe || (all_cfi_sections & CFI_EMIT_sframe) != 0)
+ /* Generate SFrame section if the user:
+ - enables via the command line option, or
+ - specifies .sframe in the .cfi_sections directive and does not disable
+ via the command line. */
+ if (flag_gen_sframe == GEN_SFRAME_ENABLED
+ || ((all_cfi_sections & CFI_EMIT_sframe) != 0
+ && flag_gen_sframe != GEN_SFRAME_DISABLED))
{
#ifdef support_sframe_p
if (support_sframe_p () && !SUPPORT_FRAME_LINKONCE)
diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c
index 806ef5f..d082b97 100644
--- a/gas/gen-sframe.c
+++ b/gas/gen-sframe.c
@@ -1286,11 +1286,18 @@ sframe_xlate_do_restore (struct sframe_xlate_ctx *xlate_ctx,
list of FREs for the specific function. */
struct sframe_row_entry *cur_fre = xlate_ctx->cur_fre;
+ /* PR gas/33170. It is valid to have a:
+ .cfi_restore N
+ even at the entry of a function; in which case cie_fre is not yet setup.
+ Point cie_fre to cur_fre, and let the machinery proceed to update
+ merge_candidate as usual. */
+ if (cie_fre == NULL)
+ cie_fre = cur_fre;
+
/* Change the rule for the indicated register to the rule assigned to
- it by the initial_instructions in the CIE. */
- gas_assert (cie_fre);
- /* SFrame FREs track only CFA and FP / RA for backtracing purposes;
- skip the other .cfi_restore directives. */
+ it by the initial_instructions in the CIE. SFrame FREs track only CFA
+ and FP / RA for backtracing purposes; skip the other .cfi_restore
+ directives. */
if (cfi_insn->u.r == SFRAME_CFA_FP_REG)
{
gas_assert (cur_fre);
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.d
index 8c74680..9c341b4 100644
--- a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.d
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.d
@@ -1,4 +1,4 @@
-#as: --gsframe
+#as:
#objdump: --sframe=.sframe
#name: SFrame generation using CFI directive .cfi_sections
#...
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1c.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1c.d
new file mode 100644
index 0000000..3493d58
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1c.d
@@ -0,0 +1,5 @@
+#as: --gsframe=no
+#readelf: -S
+#name: No SFrame section with explicit --gsframe=no
+#failif
+[ ]*\[.*\][ ]+\.sframe[ ]+GNU_SFRAME.*
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1c.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1c.s
new file mode 100644
index 0000000..ac9c6ca
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1c.s
@@ -0,0 +1,3 @@
+ .cfi_sections .sframe
+ .cfi_startproc
+ .cfi_endproc
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-pr33170.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-pr33170.d
new file mode 100644
index 0000000..85c358f
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-pr33170.d
@@ -0,0 +1,19 @@
+#as: --gsframe
+#objdump: --sframe=.sframe
+#name: SFrame generation on x86_64 pr31170
+#...
+Contents of the SFrame section .sframe:
+ Header :
+
+ Version: SFRAME_VERSION_2
+ Flags: SFRAME_F_FDE_FUNC_START_PCREL
+ CFA fixed RA offset: \-8
+ Num FDEs: 1
+ Num FREs: 2
+
+ Function Index :
+
+ func idx \[0\]: pc = 0x0, size = 50 bytes
+ STARTPC +CFA +FP +RA +
+ 0+0000 +fp\+16 +c\-16 +f +
+ 0+002d +fp\+16 +c\-16 +f +
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-pr33170.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-pr33170.s
new file mode 100644
index 0000000..fa71984
--- /dev/null
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-pr33170.s
@@ -0,0 +1,40 @@
+# PR gas/33170
+# Ennsure graceful handling.
+ .section .text.unlikely
+ .cfi_startproc
+ .type XZ.cold, @function
+XZ.cold:
+.L1:
+ .cfi_def_cfa 6, 16
+ .cfi_offset 3, -56
+ .cfi_offset 6, -16
+ .cfi_offset 12, -48
+ .cfi_offset 13, -40
+ .cfi_offset 14, -32
+ .cfi_offset 15, -24
+.L2:
+ .cfi_restore 12
+ .cfi_restore 13
+ movl $56, %esi
+ movq %r14, %rdi
+ call _Z@PLT
+ movq %r12, -32(%rbp)
+ movq %r13, -24(%rbp)
+ movq %r14, -16(%rbp)
+ movq %r15, -8(%rbp)
+ .cfi_offset 12, -48
+ .cfi_offset 13, -40
+ .cfi_offset 14, -32
+ .cfi_offset 15, -24
+ jne .L3
+ movq %rbx, %rdi
+ call bar@PLT
+.L3:
+ movq -32(%rbp), %r12
+ .cfi_remember_state
+ .cfi_restore 12
+ jmp .L4
+.L4:
+ .cfi_restore_state
+ call _ZF@PLT
+ .cfi_endproc
diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp b/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp
index 00a3ecc..9380c98 100644
--- a/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp
+++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp
@@ -36,6 +36,7 @@ if { ([istarget "x86_64-*-*"] || [istarget "aarch64*-*-*"]
run_dump_test "cfi-sframe-common-1"
run_dump_test "cfi-sframe-common-1b"
+ run_dump_test "cfi-sframe-common-1c"
run_dump_test "cfi-sframe-common-2"
run_dump_test "cfi-sframe-common-3"
run_dump_test "cfi-sframe-common-4"
@@ -58,6 +59,7 @@ if { [istarget "x86_64-*-*"] && [gas_sframe_check] } then {
set ASFLAGS "$ASFLAGS --64"
run_dump_test "cfi-sframe-x86_64-1"
run_dump_test "cfi-sframe-x86_64-2"
+ run_dump_test "cfi-sframe-x86_64-pr33170"
run_dump_test "cfi-sframe-x86_64-empty-1"
run_dump_test "cfi-sframe-x86_64-empty-2"
run_dump_test "cfi-sframe-x86_64-empty-3"
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 5e887f5..a15a04a 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -51,6 +51,7 @@
#include "cli/cli-cmds.h"
#include "cli/cli-style.h"
#include "cli/cli-utils.h"
+#include "terminal.h"
#include "extension.h"
#include "gdbsupport/pathstuff.h"
@@ -949,6 +950,9 @@ shell_escape (const char *arg, int from_tty)
static void
shell_command (const char *arg, int from_tty)
{
+ scoped_gdb_ttystate save_restore_gdb_ttystate;
+ restore_initial_gdb_ttystate ();
+
shell_escape (arg, from_tty);
}
@@ -2898,6 +2902,7 @@ This can be changed using \"set listsize\", and the current value\n\
can be shown using \"show listsize\"."));
add_com_alias ("l", list_cmd, class_files, 1);
+ set_cmd_completer(list_cmd, location_completer);
c = add_com ("disassemble", class_vars, disassemble_command, _("\
Disassemble a specified section of memory.\n\
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 24b949b..a74cb05 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -451,11 +451,8 @@ core_target::build_file_mappings ()
const bfd_build_id *core_build_id
= build_id_bfd_get (current_program_space->core_bfd ());
- for (const auto &iter : mapped_files)
+ for (const auto &[filename, file_data] : mapped_files)
{
- const std::string &filename = iter.first;
- const mapped_file &file_data = iter.second;
-
/* If this mapped file has the same build-id as was discovered for
the core-file itself, then we assume this is the main
executable. Record the filename as we can use this later. */
diff --git a/gdb/dictionary.c b/gdb/dictionary.c
index 91dafd1..28e900d 100644
--- a/gdb/dictionary.c
+++ b/gdb/dictionary.c
@@ -952,14 +952,9 @@ mdict_create_hashed (struct obstack *obstack,
retval->n_allocated_dictionaries = nsyms.size ();
int idx = 0;
- for (const auto &pair : nsyms)
- {
- enum language language = pair.first;
- std::vector<symbol *> symlist = pair.second;
-
- retval->dictionaries[idx++]
- = dict_create_hashed (obstack, language, symlist);
- }
+ for (const auto &[language, symlist] : nsyms)
+ retval->dictionaries[idx++] = dict_create_hashed (obstack, language,
+ symlist);
return retval;
}
@@ -997,14 +992,9 @@ mdict_create_linear (struct obstack *obstack,
retval->n_allocated_dictionaries = nsyms.size ();
int idx = 0;
- for (const auto &pair : nsyms)
- {
- enum language language = pair.first;
- std::vector<symbol *> symlist = pair.second;
-
- retval->dictionaries[idx++]
- = dict_create_linear (obstack, language, symlist);
- }
+ for (const auto &[language, symlist] : nsyms)
+ retval->dictionaries[idx++] = dict_create_linear (obstack, language,
+ symlist);
return retval;
}
@@ -1135,10 +1125,8 @@ mdict_add_pending (struct multidictionary *mdict,
gdb::unordered_map<enum language, std::vector<symbol *>> nsyms
= collate_pending_symbols_by_language (symbol_list);
- for (const auto &pair : nsyms)
+ for (const auto &[language, symlist] : nsyms)
{
- enum language language = pair.first;
- std::vector<symbol *> symlist = pair.second;
struct dictionary *dict = find_language_dictionary (mdict, language);
if (dict == nullptr)
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 5e18e45..634d67a 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -9918,33 +9918,37 @@ static void
handle_member_location (struct die_info *die, struct dwarf2_cu *cu,
struct field *field)
{
- struct attribute *attr;
+ const auto data_member_location_attr
+ = dwarf2_attr (die, DW_AT_data_member_location, cu);
- attr = dwarf2_attr (die, DW_AT_data_member_location, cu);
- if (attr != NULL)
+ if (data_member_location_attr != nullptr)
{
bool has_bit_offset = false;
LONGEST bit_offset = 0;
LONGEST anonymous_size = 0;
+ const auto bit_offset_attr = dwarf2_attr (die, DW_AT_bit_offset, cu);
- attribute *attr2 = dwarf2_attr (die, DW_AT_bit_offset, cu);
- if (attr2 != nullptr && attr2->form_is_constant ())
+ if (bit_offset_attr != nullptr && bit_offset_attr->form_is_constant ())
{
has_bit_offset = true;
- bit_offset = attr2->confused_constant ().value_or (0);
- attr2 = dwarf2_attr (die, DW_AT_byte_size, cu);
- if (attr2 != nullptr && attr2->form_is_constant ())
+ bit_offset = bit_offset_attr->confused_constant ().value_or (0);
+
+ const auto byte_size_attr = dwarf2_attr (die, DW_AT_byte_size, cu);
+
+ if (byte_size_attr != nullptr && byte_size_attr->form_is_constant ())
{
/* The size of the anonymous object containing
the bit field is explicit, so use the
indicated size (in bytes). */
- anonymous_size = attr2->unsigned_constant ().value_or (0);
+ anonymous_size
+ = byte_size_attr->unsigned_constant ().value_or (0);
}
}
- if (attr->form_is_constant ())
+ if (data_member_location_attr->form_is_constant ())
{
- LONGEST offset = attr->confused_constant ().value_or (0);
+ LONGEST offset
+ = data_member_location_attr->confused_constant ().value_or (0);
/* Work around this GCC 11 bug, where it would erroneously use -1
data member locations, instead of 0:
@@ -9962,11 +9966,17 @@ handle_member_location (struct die_info *die, struct dwarf2_cu *cu,
if (has_bit_offset)
apply_bit_offset_to_field (*field, bit_offset, anonymous_size);
}
- else if (attr->form_is_block ())
+ else if (data_member_location_attr->form_is_block ())
{
CORE_ADDR offset;
- if (decode_locdesc (attr->as_block (), cu, &offset))
- field->set_loc_bitpos (offset * bits_per_byte);
+ if (decode_locdesc (data_member_location_attr->as_block (), cu,
+ &offset))
+ {
+ field->set_loc_bitpos (offset * bits_per_byte);
+
+ if (has_bit_offset)
+ apply_bit_offset_to_field (*field, bit_offset, anonymous_size);
+ }
else
{
dwarf2_per_objfile *per_objfile = cu->per_objfile;
@@ -9985,8 +9995,8 @@ handle_member_location (struct die_info *die, struct dwarf2_cu *cu,
else
dlbaton = OBSTACK_ZALLOC (&objfile->objfile_obstack,
struct dwarf2_locexpr_baton);
- dlbaton->data = attr->as_block ()->data;
- dlbaton->size = attr->as_block ()->size;
+ dlbaton->data = data_member_location_attr->as_block ()->data;
+ dlbaton->size = data_member_location_attr->as_block ()->size;
/* When using this baton, we want to compute the address
of the field, not the value. This is why
is_reference is set to false here. */
@@ -9999,16 +10009,19 @@ handle_member_location (struct die_info *die, struct dwarf2_cu *cu,
}
else
complaint (_("Unsupported form %s for DW_AT_data_member_location"),
- dwarf_form_name (attr->form));
+ dwarf_form_name (data_member_location_attr->form));
}
else
{
- attr = dwarf2_attr (die, DW_AT_data_bit_offset, cu);
- if (attr != nullptr)
+ const auto data_bit_offset_attr
+ = dwarf2_attr (die, DW_AT_data_bit_offset, cu);
+
+ if (data_bit_offset_attr != nullptr)
{
- if (attr->form_is_constant ())
- field->set_loc_bitpos (attr->unsigned_constant ().value_or (0));
- else if (attr->form_is_block ())
+ if (data_bit_offset_attr->form_is_constant ())
+ field->set_loc_bitpos (data_bit_offset_attr->unsigned_constant ()
+ .value_or (0));
+ else if (data_bit_offset_attr->form_is_block ())
{
/* This is a DWARF extension. See
https://dwarfstd.org/issues/250501.1.html. */
@@ -10016,8 +10029,8 @@ handle_member_location (struct die_info *die, struct dwarf2_cu *cu,
dwarf2_locexpr_baton *dlbaton
= OBSTACK_ZALLOC (&per_objfile->objfile->objfile_obstack,
dwarf2_locexpr_baton);
- dlbaton->data = attr->as_block ()->data;
- dlbaton->size = attr->as_block ()->size;
+ dlbaton->data = data_bit_offset_attr->as_block ()->data;
+ dlbaton->size = data_bit_offset_attr->as_block ()->size;
dlbaton->per_objfile = per_objfile;
dlbaton->per_cu = cu->per_cu;
@@ -10025,7 +10038,7 @@ handle_member_location (struct die_info *die, struct dwarf2_cu *cu,
}
else
complaint (_("Unsupported form %s for DW_AT_data_bit_offset"),
- dwarf_form_name (attr->form));
+ dwarf_form_name (data_bit_offset_attr->form));
}
}
}
diff --git a/gdb/inflow.c b/gdb/inflow.c
index 31e1565..4f1c8ef 100644
--- a/gdb/inflow.c
+++ b/gdb/inflow.c
@@ -55,6 +55,20 @@ static void child_terminal_ours_1 (target_terminal_state);
static struct serial *stdin_serial;
+/* See terminal.h. */
+
+scoped_gdb_ttystate::scoped_gdb_ttystate ()
+{
+ m_ttystate = serial_get_tty_state (stdin_serial);
+}
+
+/* See terminal.h. */
+
+scoped_gdb_ttystate::~scoped_gdb_ttystate ()
+{
+ serial_set_tty_state (stdin_serial, m_ttystate);
+}
+
/* Terminal related info we need to keep track of. Each inferior
holds an instance of this structure --- we save it whenever the
corresponding inferior stops, and restore it to the terminal when
@@ -163,6 +177,15 @@ set_initial_gdb_ttystate (void)
}
}
+/* See terminal.h. */
+
+void
+restore_initial_gdb_ttystate ()
+{
+ if (initial_gdb_ttystate != nullptr)
+ serial_set_tty_state (stdin_serial, initial_gdb_ttystate);
+}
+
/* Does GDB have a terminal (on stdin)? */
static int
diff --git a/gdb/mingw-hdep.c b/gdb/mingw-hdep.c
index 481bd41..a4e9cf5 100644
--- a/gdb/mingw-hdep.c
+++ b/gdb/mingw-hdep.c
@@ -493,10 +493,7 @@ show_maint_console_translation_mode (struct ui_file *file, int from_tty,
console_translation_mode.c_str ());
}
-extern void _initialize_mingw_hdep ();
-
-void
-_initialize_mingw_hdep ()
+INIT_GDB_FILE (mingw_hdep)
{
add_setshow_string_cmd ("console-translation-mode",
class_maintenance,
diff --git a/gdb/solib-frv.h b/gdb/solib-frv.h
index 710a424..a2f3558 100644
--- a/gdb/solib-frv.h
+++ b/gdb/solib-frv.h
@@ -1,5 +1,5 @@
/* Handle FR-V (FDPIC) shared libraries for GDB, the GNU Debugger.
- Copyright (C) 2024 Free Software Foundation, Inc.
+ Copyright (C) 2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index c72d9ad..af08b75 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -3591,16 +3591,11 @@ find_debug_base_for_solib (const solib *solib)
auto *lm_info
= gdb::checked_static_cast<const lm_info_svr4 *> (solib->lm_info.get ());
- for (const auto &tuple : info->solib_lists)
- {
- CORE_ADDR debug_base = tuple.first;
- const std::vector<svr4_so> &sos = tuple.second;
-
- for (const svr4_so &so : sos)
- if (svr4_same (solib->original_name.c_str (), so.name.c_str (),
- *lm_info, *so.lm_info))
- return debug_base;
- }
+ for (const auto &[debug_base, sos] : info->solib_lists)
+ for (const svr4_so &so : sos)
+ if (svr4_same (solib->original_name.c_str (), so.name.c_str (), *lm_info,
+ *so.lm_info))
+ return debug_base;
return 0;
}
diff --git a/gdb/solib.c b/gdb/solib.c
index bd9f3cb..3ec2032 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -1210,14 +1210,13 @@ info_linker_namespace_command (const char *pattern, int from_tty)
bool ns_separator = false;
- for (auto &solibs_pair : all_solibs_to_print)
+ for (const auto &[ns, solibs_to_print] : all_solibs_to_print)
{
if (ns_separator)
uiout->message ("\n\n");
else
ns_separator = true;
- int ns = solibs_pair.first;
- std::vector<const solib *> solibs_to_print = solibs_pair.second;
+
if (solibs_to_print.size () == 0)
{
uiout->message (_("Linker namespace [[%d]] is not active.\n"), ns);
diff --git a/gdb/svr4-tls-tdep.c b/gdb/svr4-tls-tdep.c
index 75d06a4..1f36d57 100644
--- a/gdb/svr4-tls-tdep.c
+++ b/gdb/svr4-tls-tdep.c
@@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux, architecture independent.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2025 Free Software Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 160a465..302f4eb 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -6986,11 +6986,8 @@ info_module_subcommand (bool quiet, const char *module_regexp,
const char *last_filename = "";
const symbol *last_module_symbol = nullptr;
- for (const module_symbol_search &ms : module_symbols)
+ for (const auto &[p, q] : module_symbols)
{
- const symbol_search &p = ms.first;
- const symbol_search &q = ms.second;
-
gdb_assert (q.symbol != nullptr);
if (last_module_symbol != p.symbol)
diff --git a/gdb/terminal.h b/gdb/terminal.h
index 54e5e98..720fd4a 100644
--- a/gdb/terminal.h
+++ b/gdb/terminal.h
@@ -19,6 +19,8 @@
#ifndef GDB_TERMINAL_H
#define GDB_TERMINAL_H
+#include "serial.h"
+
struct inferior;
extern void new_tty_prefork (std::string ttyname);
@@ -43,4 +45,17 @@ extern void gdb_save_tty_state (void);
have had a chance to alter it. */
extern void set_initial_gdb_ttystate (void);
+/* Restore initial tty state. */
+extern void restore_initial_gdb_ttystate (void);
+
+/* An RAII-based object that saves the tty state, and then restores it again
+ when this object is destroyed. */
+class scoped_gdb_ttystate
+{
+public:
+ scoped_gdb_ttystate ();
+ ~scoped_gdb_ttystate ();
+private:
+ serial_ttystate m_ttystate;
+};
#endif /* GDB_TERMINAL_H */
diff --git a/gdb/testsuite/gdb.ada/operator_call.exp b/gdb/testsuite/gdb.ada/operator_call.exp
index e96107b..dc7f679 100644
--- a/gdb/testsuite/gdb.ada/operator_call.exp
+++ b/gdb/testsuite/gdb.ada/operator_call.exp
@@ -71,6 +71,12 @@ proc test_with_menu {command result} {
fail $command
}
}
+ "Argument to arithmetic operation not a number or boolean." {
+ fail $command
+ }
+ -re "No definition of \".*\" in current context." {
+ fail $command
+ }
timeout {
fail "$command (timeout)"
}
diff --git a/gdb/testsuite/gdb.tui/main-2.exp b/gdb/testsuite/gdb.tui/main-2.exp
index 2b0fb6b..71ad03b 100644
--- a/gdb/testsuite/gdb.tui/main-2.exp
+++ b/gdb/testsuite/gdb.tui/main-2.exp
@@ -41,7 +41,7 @@ if {![Term::enter_tui]} {
set line " return 0;"
set nr [gdb_get_line_number $line]
-set screen_line [Term::get_line_with_attrs 6]
+set screen_line [Term::get_string_with_attrs 6 1 79]
verbose -log "screen line 6: '$screen_line'"
gdb_assert { [regexp "$nr <reverse:1>$line<reverse:0>" $screen_line] } \
"highlighted line in middle of source window"
diff --git a/gdb/testsuite/gdb.tui/tuiterm.exp b/gdb/testsuite/gdb.tui/tuiterm.exp
index 9dc2402..6cd65f3 100644
--- a/gdb/testsuite/gdb.tui/tuiterm.exp
+++ b/gdb/testsuite/gdb.tui/tuiterm.exp
@@ -102,7 +102,7 @@ proc test_backspace {} {
Term::_move_cursor 1 2
- Term::_ctl_0x08
+ Term::_ctl_0x08 0
check "backspace one" {
"abcdefgh"
"ijklmnop"
@@ -111,13 +111,22 @@ proc test_backspace {} {
} 0 2
# Cursor should not move if it is already at column 0.
- Term::_ctl_0x08
+ Term::_ctl_0x08 0
check "backspace 2" {
"abcdefgh"
"ijklmnop"
"qrstuvwx"
"yz01234 "
} 0 2
+
+ # Cursor should wrap to previous line.
+ Term::_ctl_0x08 1
+ check "backspace 3" {
+ "abcdefgh"
+ "ijklmnop"
+ "qrstuvwx"
+ "yz01234 "
+ } 7 1
}
proc test_linefeed { } {
@@ -435,6 +444,30 @@ proc test_horizontal_absolute { } {
"qrstuvwx"
"yz01234 "
} 3 2
+
+ Term::_csi_G 8
+ check "cursor horizontal absolute 3" {
+ "abcdefgh"
+ "ijklmnop"
+ "qrstuvwx"
+ "yz01234 "
+ } 7 2
+
+ Term::_csi_G 9
+ check "cursor horizontal absolute 4" {
+ "abcdefgh"
+ "ijklmnop"
+ "qrstuvwx"
+ "yz01234 "
+ } 7 2
+
+ Term::_csi_`
+ check "horizontal position absolute 1" {
+ "abcdefgh"
+ "ijklmnop"
+ "qrstuvwx"
+ "yz01234 "
+ } 0 2
}
proc test_cursor_position { } {
@@ -750,6 +783,15 @@ proc test_attrs {} {
set line [Term::get_line_with_attrs 0]
gdb_assert { [regexp $re $line] } "attribute: $attr"
}
+
+ # Regression test: Check that _csi_m works without arguments.
+ setup_terminal 4 1
+ Term::_csi_m 7
+ Term::_insert "a"
+ Term::_csi_m
+ Term::_insert "a"
+ set line [Term::get_line_with_attrs 0]
+ gdb_assert { [string equal $line "<reverse:1>a<reverse:0>a "] }
}
# Run proc TEST_PROC_NAME with a "small" terminal.
diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp
index a0cd199..cc8e852 100644
--- a/gdb/testsuite/lib/tuiterm.exp
+++ b/gdb/testsuite/lib/tuiterm.exp
@@ -45,9 +45,16 @@ namespace eval Term {
set orig_cur_row $_cur_row
set orig_cur_col $_cur_col
- uplevel $body
+ set code [catch {uplevel $body} result]
_log "$what, cursor: ($orig_cur_row, $orig_cur_col) -> ($_cur_row, $_cur_col)"
+
+ if { $code == 1 } {
+ global errorInfo errorCode
+ return -code $code -errorinfo $errorInfo -errorcode $errorCode $result
+ } else {
+ return -code $code $result
+ }
}
# If ARG is empty, return DEF: otherwise ARG. This is useful for
@@ -83,14 +90,40 @@ namespace eval Term {
proc _ctl_0x07 {} {
}
+ # Return 1 if tuiterm has the bw/auto_left_margin enabled.
+ proc _have_bw {} {
+ return [string equal $Term::_TERM "ansiw"]
+ }
+
# Backspace.
- proc _ctl_0x08 {} {
- _log_cur "Backspace" {
+ proc _ctl_0x08 { {bw -1} } {
+ if { $bw == -1 } {
+ set bw [_have_bw]
+ }
+ _log_cur "Backspace, bw == $bw" {
variable _cur_col
+ variable _cur_row
+ variable _cols
- if {$_cur_col > 0} {
+ if { $_cur_col > 0 } {
+ # No wrapping needed.
incr _cur_col -1
+ return
+ }
+
+ if { ! $bw } {
+ # Wrapping not enabled.
+ return
}
+
+ if { $_cur_row == 0 } {
+ # Can't wrap.
+ return
+ }
+
+ # Wrap to previous line.
+ set _cur_col [expr $_cols - 1]
+ incr _cur_row -1
}
}
@@ -155,6 +188,14 @@ namespace eval Term {
}
}
+ # Horizontal Position Absolute.
+ #
+ # https://vt100.net/docs/vt510-rm/HPA.html
+ proc _csi_` {args} {
+ # Same as Cursor Horizontal Absolute.
+ return [Term::_csi_G {*}$args]
+ }
+
# Cursor Up.
#
# https://vt100.net/docs/vt510-rm/CUU.html
@@ -251,7 +292,7 @@ namespace eval Term {
variable _cur_col
variable _cols
- set _cur_col [expr {min ($arg - 1, $_cols)}]
+ set _cur_col [expr {min ($arg, $_cols)} - 1]
}
}
@@ -597,6 +638,11 @@ namespace eval Term {
#
# https://vt100.net/docs/vt510-rm/SGR.html
proc _csi_m {args} {
+ if { [llength $args] == 0 } {
+ # Apply default.
+ set args [list 0]
+ }
+
_log_cur "Select Graphic Rendition ([join $args {, }])" {
variable _attrs
@@ -740,7 +786,7 @@ namespace eval Term {
_log "wait_for: unsupported escape"
error "unsupported escape"
}
- -re "^\x1b\\\[(\[0-9;\]*)(\[a-zA-Z@\])" {
+ -re "^\x1b\\\[(\[0-9;\]*)(\[a-zA-Z@`\])" {
set cmd $expect_out(2,string)
set params [split $expect_out(1,string) ";"]
_log "wait_for: _csi_$cmd <<<$expect_out(1,string)>>>"
@@ -844,8 +890,16 @@ namespace eval Term {
# BODY.
proc with_tuiterm {rows cols body} {
global env stty_init
+ variable _TERM
save_vars {env(TERM) env(NO_COLOR) stty_init} {
- setenv TERM ansi
+ if { [ishost *-*-*bsd*] } {
+ setenv TERM ansiw
+ } else {
+ setenv TERM ansi
+ }
+ # Save active TERM variable.
+ set Term::_TERM $env(TERM)
+
setenv NO_COLOR ""
_setup $rows $cols
@@ -955,10 +1009,10 @@ namespace eval Term {
return $res
}
- # Return the text of screen line N. Lines are 0-based. If C is given,
- # stop before column C. Columns are also zero-based. If ATTRS, annotate
- # with attributes.
- proc get_line_1 {n c attrs} {
+ # Return the text of screen line N. Lines are 0-based. Start at column
+ # X. If C is non-empty, stop before column C. Columns are also
+ # zero-based. If ATTRS, annotate with attributes.
+ proc get_string {n x c {attrs 0}} {
variable _rows
# This can happen during resizing, if the cursor seems to
# temporarily be off-screen.
@@ -970,7 +1024,6 @@ namespace eval Term {
variable _cols
variable _chars
set c [_default $c $_cols]
- set x 0
if { $attrs } {
_reset_attrs line_attrs
}
@@ -990,6 +1043,20 @@ namespace eval Term {
return $result
}
+ # Return the text of screen line N. Lines are 0-based. Start at column
+ # X. If C is non-empty, stop before column C. Columns are also
+ # zero-based. Annotate with attributes.
+ proc get_string_with_attrs { n x c } {
+ return [get_string $n $x $c 1]
+ }
+
+ # Return the text of screen line N. Lines are 0-based. If C is
+ # non-empty, stop before column C. Columns are also zero-based. If
+ # ATTRS, annotate with attributes.
+ proc get_line_1 {n c attrs} {
+ return [get_string $n 0 $c $attrs]
+ }
+
# Return the text of screen line N, without attributes. Lines are
# 0-based. If C is given, stop before column C. Columns are also
# zero-based.
diff --git a/gdbserver/server.cc b/gdbserver/server.cc
index ab69400..ce84c7f 100644
--- a/gdbserver/server.cc
+++ b/gdbserver/server.cc
@@ -1018,20 +1018,15 @@ handle_general_set (char *own_buf)
});
}
- for (const auto &iter : set_options)
- {
- thread_info *thread = iter.first;
- gdb_thread_options options = iter.second;
-
- if (thread->thread_options != options)
- {
- threads_debug_printf ("[options for %s are now %s]\n",
- target_pid_to_str (thread->id).c_str (),
- to_string (options).c_str ());
+ for (const auto &[thread, options] : set_options)
+ if (thread->thread_options != options)
+ {
+ threads_debug_printf ("[options for %s are now %s]\n",
+ target_pid_to_str (thread->id).c_str (),
+ to_string (options).c_str ());
- thread->thread_options = options;
- }
- }
+ thread->thread_options = options;
+ }
write_ok (own_buf);
return;
diff --git a/gold/aclocal.m4 b/gold/aclocal.m4
index d0455aa..a8512a2 100644
--- a/gold/aclocal.m4
+++ b/gold/aclocal.m4
@@ -751,35 +751,6 @@ else
fi
])
-# -*- Autoconf -*-
-# Obsolete and "removed" macros, that must however still report explicit
-# error messages when used, to smooth transition.
-#
-# Copyright (C) 1996-2017 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([AM_CONFIG_HEADER],
-[AC_DIAGNOSE([obsolete],
-['$0': this macro is obsolete.
-You should use the 'AC][_CONFIG_HEADERS' macro instead.])dnl
-AC_CONFIG_HEADERS($@)])
-
-AC_DEFUN([AM_PROG_CC_STDC],
-[AC_PROG_CC
-am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc
-AC_DIAGNOSE([obsolete],
-['$0': this macro is obsolete.
-You should simply use the 'AC][_PROG_CC' macro instead.
-Also, your code should no longer depend upon 'am_cv_prog_cc_stdc',
-but upon 'ac_cv_prog_cc_stdc'.])])
-
-AC_DEFUN([AM_C_PROTOTYPES],
- [AC_FATAL([automatic de-ANSI-fication support has been removed])])
-AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES])
-
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
diff --git a/gold/configure b/gold/configure
index f4cb3f8..a81a04f 100755
--- a/gold/configure
+++ b/gold/configure
@@ -13590,6 +13590,7 @@ DEFS=-DHAVE_CONFIG_H
ac_libobjs=
ac_ltlibobjs=
+U=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed.
ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
diff --git a/gold/configure.ac b/gold/configure.ac
index 90e51de..597788d 100644
--- a/gold/configure.ac
+++ b/gold/configure.ac
@@ -25,7 +25,7 @@ AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([no-dist parallel-tests])
AM_SILENT_RULES([yes])
-AM_CONFIG_HEADER(config.h:config.in)
+AC_CONFIG_HEADERS([config.h:config.in])
AC_USE_SYSTEM_EXTENSIONS
@@ -737,4 +737,5 @@ AM_LC_MESSAGES
AM_MAINTAINER_MODE
-AC_OUTPUT(Makefile testsuite/Makefile po/Makefile.in:po/Make-in)
+AC_CONFIG_FILES([Makefile testsuite/Makefile po/Makefile.in:po/Make-in])
+AC_OUTPUT
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 52bbeda..96960ab 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2025-07-25 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ PR ld/32580
+ * configure.ac <*-*-solaris2*>: Enforce SHELL=/bin/bash.
+ * configure: Regenerate.
+
2025-07-13 Nick Clifton <nickc@redhat.com>
* 2.45 Branch point.
diff --git a/ld/configure b/ld/configure
index 015666d..124b441 100755
--- a/ld/configure
+++ b/ld/configure
@@ -3362,6 +3362,19 @@ fi
+case $target in
+ *-*-solaris2*)
+ case "$SHELL" in
+ *bash*)
+ ;;
+ *)
+ # PR 32580: Force use of bash to avoid corrupt linker scripts.
+ SHELL=/bin/bash
+ ;;
+ esac
+ ;;
+esac
+
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -11501,7 +11514,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11504 "configure"
+#line 11517 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11607,7 +11620,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11610 "configure"
+#line 11623 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/ld/configure.ac b/ld/configure.ac
index af065fe..e306c1d 100644
--- a/ld/configure.ac
+++ b/ld/configure.ac
@@ -28,6 +28,19 @@ AM_INIT_AUTOMAKE
AM_SILENT_RULES([yes])
AM_MAINTAINER_MODE
+case $target in
+ *-*-solaris2*)
+ case "$SHELL" in
+ *bash*)
+ ;;
+ *)
+ # PR 32580: Force use of bash to avoid corrupt linker scripts.
+ SHELL=/bin/bash
+ ;;
+ esac
+ ;;
+esac
+
AC_PROG_CC
AC_PROG_CXX
AC_PROG_GREP
diff --git a/ld/scripttempl/avr.sc b/ld/scripttempl/avr.sc
index 4d9af7f..a902385 100644
--- a/ld/scripttempl/avr.sc
+++ b/ld/scripttempl/avr.sc
@@ -186,7 +186,9 @@ SECTIONS
/* Internal text space or external memory. */
.text ${RELOCATING-0} :
{
- ${RELOCATING+*(.vectors)
+EOF
+test -z "${RELOCATING}" || cat <<EOF
+ *(.vectors)
KEEP(*(.vectors))
/* For data that needs to reside in the lower 64k of progmem.
@@ -197,7 +199,7 @@ SECTIONS
*(.progmem.*)
__progmem_end = . ;
ASSERT (__progmem_start == __progmem_end || __progmem_end <= 0x10000,
- \".progmem section exceeds 0x10000\");
+ ".progmem section exceeds 0x10000");
. = ALIGN(2);
__trampolines_start = . ;
@@ -210,8 +212,9 @@ SECTIONS
/* For code that needs to reside in the lower 128k progmem. */
*(.lowtext)
- *(.lowtext*)}
-
+ *(.lowtext*)
+EOF
+cat <<EOF
${CONSTRUCTING+ __ctors_start = . ; }
${CONSTRUCTING+ *(.ctors) }
${CONSTRUCTING+ __ctors_end = . ; }
@@ -365,21 +368,20 @@ EOF
fi
if test -n "${HAVE_FLMAP}"; then
- cat <<EOF
-
-${RELOCATING+
+test -z "${RELOCATING}" || cat <<EOF
__flmap_init_label = DEFINED(__flmap_init_start) ? __flmap_init_start : 0 ;
/* User can specify position of .rodata in flash (LMA) by supplying
__RODATA_FLASH_START__ or __flmap, where the former takes precedence. */
__RODATA_FLASH_START__ = DEFINED(__RODATA_FLASH_START__)
? __RODATA_FLASH_START__
: DEFINED(__flmap) ? __flmap * 32K : ${RODATA_FLASH_START};
-ASSERT (__RODATA_FLASH_START__ % 32K == 0, \"__RODATA_FLASH_START__ must be a multiple of 32 KiB\")
+ASSERT (__RODATA_FLASH_START__ % 32K == 0, "__RODATA_FLASH_START__ must be a multiple of 32 KiB")
__flmap = ${FLMAP_MASK} & (__RODATA_FLASH_START__ >> 15);
__RODATA_FLASH_START__ = __flmap << 15;
__rodata_load_start = MAX (__data_load_end, __RODATA_FLASH_START__);
-__rodata_start = __RODATA_ORIGIN__ + __rodata_load_start - __RODATA_FLASH_START__;}
-
+__rodata_start = __RODATA_ORIGIN__ + __rodata_load_start - __RODATA_FLASH_START__;
+EOF
+cat << EOF
.rodata ${RELOCATING+ __rodata_start} ${RELOCATING-0} : ${RELOCATING+ AT (__rodata_load_start)}
{
*(.rodata)
diff --git a/ld/testsuite/ld-elf/indirect.exp b/ld/testsuite/ld-elf/indirect.exp
index 9a0bcb2..3d9cc2a 100644
--- a/ld/testsuite/ld-elf/indirect.exp
+++ b/ld/testsuite/ld-elf/indirect.exp
@@ -189,14 +189,21 @@ set run_tests [list \
{check-ptr-eq.c} "pr18720d" "pr18720.out"] \
[list "Run with libpr19553b.so" \
"-Wl,--no-as-needed tmpdir/libpr19553b.so tmpdir/libpr19553d.so -Wl,-rpath-link,." "" \
- {pr19553a.c} "pr19553b" "pr19553b.out"] \
+ {pr19553a.c} "pr19553b" "pr19553b.out"]
+]
+
+# This test relies on versioned symbols, which Solaris ld.so.1 doesn't support.
+if { ![istarget *-*-solaris2*] } {
+ lappend run_tests \
[list "Run with libpr19553c.so" \
"-Wl,--no-as-needed tmpdir/libpr19553c.so tmpdir/libpr19553b.so tmpdir/libpr19553d.so" "" \
- {pr19553a.c} "pr19553c" "pr19553c.out"] \
+ {pr19553a.c} "pr19553c" "pr19553c.out"]
+}
+
+lappend run_tests \
[list "Run with libpr19553d.so" \
"-Wl,--no-as-needed tmpdir/libpr19553d.so tmpdir/libpr19553b.so -Wl,-rpath-link,." "" \
- {pr19553a.c} "pr19553d" "pr19553d.out"] \
-]
+ {pr19553a.c} "pr19553d" "pr19553d.out"]
run_ld_link_exec_tests $run_tests
diff --git a/libctf/configure b/libctf/configure
index 7466d56..89c99c2 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 fbd8ec1..40d00e8 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 2d4401d..524ed7e 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 8c35a2b..f04c278 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 f244826..d5e51f4 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 64d2a40..4df6619 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 a8b09c2..d15c315 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 e29cf63..7c19fe8 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 e4b6347..0270cca 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/libsframe/doc/sframe-spec.texi b/libsframe/doc/sframe-spec.texi
index 7307789..f25791e 100644
--- a/libsframe/doc/sframe-spec.texi
+++ b/libsframe/doc/sframe-spec.texi
@@ -20,7 +20,7 @@ License''.
@titlepage
@title The SFrame Format
-@subtitle Version 2
+@subtitle Version 2 (Errata 1)
@sp 15
@center @today{}
@author Indu Bhagat
@@ -35,9 +35,9 @@ License''.
@node Top
@top The SFrame format
-This manual describes version 2 of the SFrame file format. SFrame stands for
-Simple Frame. The SFrame format keeps track of the minimal necessary
-information needed for generating stack traces:
+This manual describes version 2 (errata 1) of the SFrame file format. SFrame
+stands for Simple Frame. The SFrame format keeps track of the minimal
+necessary information needed for generating stack traces:
@itemize @minus
@item
@@ -130,9 +130,9 @@ the data structure.
The above two imply that each SFrame function descriptor entry has a fixed size
of 20 bytes instead of its size of 17 bytes in SFrame format version 1.
@item
-Add a new flag SFRAME_F_FDE_FUNC_START_PCREL, as an erratum to SFrame
-Version 2, to indicate the encoding of the SFrame FDE function start address
-field:
+[Errata 1] Add a new flag SFRAME_F_FDE_FUNC_START_PCREL, as an erratum to
+SFrame Version 2, to indicate the encoding of the SFrame FDE function start
+address field:
@itemize @minus
@item if set, @code{sfde_func_start_address} field contains the offset in
bytes to the start PC of the associated function from the field itself.
@@ -141,8 +141,8 @@ bytes to the start PC of the associated function from the start of the SFrame
section.
@end itemize
@item
-Add a new ABI/arch identifier SFRAME_ABI_S390X_ENDIAN_BIG for the s390
-architecture (64-bit) s390x ABI. Other s390x-specific backward compatible
+[Errata 1] Add a new ABI/arch identifier SFRAME_ABI_S390X_ENDIAN_BIG for the
+s390 architecture (64-bit) s390x ABI. Other s390x-specific backward compatible
changes including the following helper definitions have been incrementally
added to SFrame version 2 only:
@itemize @minus
@@ -165,6 +165,8 @@ CFA offset adjustment and then scale down by CFA offset alignment factor).
@item SFRAME_V2_S390X_CFA_OFFSET_DECODE: Decode CFA offset (i.e., scale up
by CFA offset alignment factor and then revert CFA offset adjustment).
@end itemize
+@item
+[Errata 1] An ELF SFrame section has the type SHT_GNU_SFRAME.
@end itemize
SFrame version 1 is now obsolete and should not be used.
diff --git a/opcodes/sparc-dis.c b/opcodes/sparc-dis.c
index 1138136..f935783 100644
--- a/opcodes/sparc-dis.c
+++ b/opcodes/sparc-dis.c
@@ -387,40 +387,12 @@ compare_opcodes (const void * a, const void * b)
return length_diff;
}
- /* Put 1+i before i+1. */
- {
- char *p0 = (char *) strchr (op0->args, '+');
- char *p1 = (char *) strchr (op1->args, '+');
-
- if (p0 && p1)
- {
- /* There is a plus in both operands. Note that a plus
- sign cannot be the first character in args,
- so the following [-1]'s are valid. */
- if (p0[-1] == 'i' && p1[1] == 'i')
- /* op0 is i+1 and op1 is 1+i, so op1 goes first. */
- return 1;
- if (p0[1] == 'i' && p1[-1] == 'i')
- /* op0 is 1+i and op1 is i+1, so op0 goes first. */
- return -1;
- }
- }
-
- /* Put 1,i before i,1. */
- {
- int i0 = strncmp (op0->args, "i,1", 3) == 0;
- int i1 = strncmp (op1->args, "i,1", 3) == 0;
-
- if (i0 ^ i1)
- return i0 - i1;
- }
-
- /* They are, as far as we can tell, identical.
- Since qsort may have rearranged the table partially, there is
- no way to tell which one was first in the opcode table as
- written, so just say there are equal. */
- /* ??? This is no longer true now that we sort a vector of pointers,
- not the table itself. */
+ /* They are, as far as we can tell, identical. Keep the order in
+ the sparc_opcodes table. */
+ if (op0 < op1)
+ return -1;
+ if (op0 > op1)
+ return 1;
return 0;
}