aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
Diffstat (limited to 'binutils')
-rw-r--r--binutils/NEWS2
-rw-r--r--binutils/README-how-to-make-a-release65
-rw-r--r--binutils/objcopy.c72
-rw-r--r--binutils/objdump.c19
-rw-r--r--binutils/readelf.c63
-rw-r--r--binutils/testsuite/binutils-all/link-order.s2
-rw-r--r--binutils/testsuite/binutils-all/objcopy.exp2
-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/pr33230.obj.bz2bin0 -> 411 bytes
-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.exp227
-rw-r--r--binutils/testsuite/lib/binutils-common.exp29
14 files changed, 429 insertions, 103 deletions
diff --git a/binutils/NEWS b/binutils/NEWS
index 281de00..5038851 100644
--- a/binutils/NEWS
+++ b/binutils/NEWS
@@ -1,5 +1,7 @@
-*- text -*-
+* NaCl target support is removed.
+
Changes in 2.45:
* New versioned release of libsframe: libsframe.so.2. This release introduces
diff --git a/binutils/README-how-to-make-a-release b/binutils/README-how-to-make-a-release
index 6e19a8b..7ab4c69 100644
--- a/binutils/README-how-to-make-a-release
+++ b/binutils/README-how-to-make-a-release
@@ -136,17 +136,6 @@ Approx time to complete from here: 2 hours ...
./src-release.sh -x binutils
- FIXME: Not sure if the following steps are needed...
-
- Add a .dirstamp file to the gas/doc subdirectory:
-
- touch -d `date +%Y-%m-%d` binutils-2.45.90/gas/doc/.dirstamp
- tar rvf binutils-2.45.90.tar binutils-2.45.90/gas/doc/.dirstamp
- rm binutils-2.45.90.tar.xz
- xz -9 -k binutils-2.45.90.tar
-
- ...END OF FIXME
-
c. Build a test target using this tarball.
cp binutils-*.tar.xz /dev/shm
@@ -243,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.
+
==============================================================================
==============================================================================
@@ -264,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".
@@ -291,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
@@ -322,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.
@@ -341,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).
@@ -376,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 ..."
@@ -398,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.
@@ -431,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
@@ -468,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 .
@@ -481,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 8c90773..5774711 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -2529,7 +2529,6 @@ merge_gnu_build_notes (bfd * abfd,
/* Reconstruct the ELF notes. */
bfd_byte * new_contents;
- bfd_byte * old;
bfd_byte * new;
bfd_vma prev_start = 0;
bfd_vma prev_end = 0;
@@ -2537,12 +2536,8 @@ merge_gnu_build_notes (bfd * abfd,
/* Not sure how, but the notes might grow in size.
(eg see PR 1774507). Allow for this here. */
new = new_contents = xmalloc (size * 2);
- for (pnote = pnotes, old = contents;
- pnote < pnotes_end;
- pnote ++)
+ for (pnote = pnotes; pnote < pnotes_end; pnote ++)
{
- bfd_size_type note_size = 12 + pnote->padded_namesz + pnote->note.descsz;
-
if (! is_deleted_note (pnote))
{
/* Create the note, potentially using the
@@ -2585,8 +2580,6 @@ merge_gnu_build_notes (bfd * abfd,
prev_end = pnote->end;
}
}
-
- old += note_size;
}
#if DEBUG_MERGE
@@ -2668,7 +2661,8 @@ set_long_section_mode (bfd *output_bfd, bfd *input_bfd, enum long_section_name_h
Returns TRUE upon success, FALSE otherwise. */
static bool
-copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch)
+copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch,
+ bool target_defaulted)
{
bfd_vma start;
long symcount;
@@ -2819,7 +2813,7 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch)
imach = 0;
}
if (!bfd_set_arch_mach (obfd, iarch, imach)
- && (ibfd->target_defaulted
+ && (target_defaulted
|| bfd_get_arch (ibfd) != bfd_get_arch (obfd)))
{
if (bfd_get_arch (ibfd) == bfd_arch_unknown)
@@ -3622,7 +3616,8 @@ fail:
static bool
copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
bool force_output_target,
- const bfd_arch_info_type *input_arch)
+ const bfd_arch_info_type *input_arch,
+ bool target_defaulted)
{
struct name_list
{
@@ -3748,10 +3743,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. */
@@ -3776,7 +3774,8 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
#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. */
@@ -3876,6 +3875,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)
{
@@ -3887,9 +3888,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
@@ -3953,7 +3953,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;
@@ -3984,17 +3985,32 @@ 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 (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:
/* 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)
@@ -4025,7 +4041,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.
@@ -5043,9 +5059,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 cfccdd2..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
@@ -21727,8 +21730,13 @@ print_v850_note (Elf_Internal_Note * pnote)
{
unsigned int val;
+ printf (" %s: ", get_v850_elf_note_type (pnote->type));
+
if (pnote->descsz != 4)
- return false;
+ {
+ printf ("<corrupt descsz: %#lx>\n", pnote->descsz);
+ return false;
+ }
val = byte_get ((unsigned char *) pnote->descdata, pnote->descsz);
@@ -23297,10 +23305,15 @@ process_v850_notes (Filedata * filedata, uint64_t offset, uint64_t length)
" %#" PRIx64 " with length %#" PRIx64 ":\n"),
offset, length);
- while ((char *) external + sizeof (Elf_External_Note) < end)
+ while ((char *) external < end)
{
- Elf_External_Note * next;
+ char *next;
Elf_Internal_Note inote;
+ size_t data_remaining = end - (char *) external;
+
+ if (data_remaining < offsetof (Elf_External_Note, name))
+ break;
+ data_remaining -= offsetof (Elf_External_Note, name);
inote.type = BYTE_GET (external->type);
inote.namesz = BYTE_GET (external->namesz);
@@ -23308,47 +23321,25 @@ process_v850_notes (Filedata * filedata, uint64_t offset, uint64_t length)
inote.descsz = BYTE_GET (external->descsz);
inote.descdata = inote.namedata + align_power (inote.namesz, 2);
inote.descpos = offset + (inote.descdata - (char *) pnotes);
+ next = inote.descdata + align_power (inote.descsz, 2);
- if (inote.descdata < (char *) pnotes || inote.descdata >= end)
- {
- warn (_("Corrupt note: name size is too big: %lx\n"), inote.namesz);
- inote.descdata = inote.namedata;
- inote.namesz = 0;
- }
-
- next = (Elf_External_Note *) (inote.descdata + align_power (inote.descsz, 2));
-
- if ( ((char *) next > end)
- || ((char *) next < (char *) pnotes))
+ if ((size_t) (inote.descdata - inote.namedata) < inote.namesz
+ || (size_t) (inote.descdata - inote.namedata) > data_remaining
+ || (size_t) (next - inote.descdata) < inote.descsz
+ || ((size_t) (next - inote.descdata)
+ > data_remaining - (size_t) (inote.descdata - inote.namedata)))
{
- warn (_("corrupt descsz found in note at offset %#tx\n"),
+ warn (_("note with invalid namesz and/or descsz found at offset %#tx\n"),
(char *) external - (char *) pnotes);
- warn (_(" type: %#lx, namesize: %#lx, descsize: %#lx\n"),
- inote.type, inote.namesz, inote.descsz);
+ warn (_(" type: %#lx, namesize: %#lx, descsize: %#lx, alignment: %u\n"),
+ inote.type, inote.namesz, inote.descsz, 2);
break;
}
- external = next;
-
- /* Prevent out-of-bounds indexing. */
- if ( inote.namedata + inote.namesz > end
- || inote.namedata + inote.namesz < inote.namedata)
- {
- warn (_("corrupt namesz found in note at offset %#zx\n"),
- (char *) external - (char *) pnotes);
- warn (_(" type: %#lx, namesize: %#lx, descsize: %#lx\n"),
- inote.type, inote.namesz, inote.descsz);
- break;
- }
-
- printf (" %s: ", get_v850_elf_note_type (inote.type));
+ external = (Elf_External_Note *) next;
if (! print_v850_note (& inote))
- {
- res = false;
- printf ("<corrupt sizes: namesz: %#lx, descsz: %#lx>\n",
- inote.namesz, inote.descsz);
- }
+ res = false;
}
free (pnotes);
diff --git a/binutils/testsuite/binutils-all/link-order.s b/binutils/testsuite/binutils-all/link-order.s
index 5994cb8..918cd06 100644
--- a/binutils/testsuite/binutils-all/link-order.s
+++ b/binutils/testsuite/binutils-all/link-order.s
@@ -5,7 +5,7 @@
foo:
.prologue 2, 2
.vframe r2
- mov r2 = r12
+ mov r2 = r12;;
.body
.restore sp
mov r12 = r2
diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp
index 6aa6d2d..89370bc 100644
--- a/binutils/testsuite/binutils-all/objcopy.exp
+++ b/binutils/testsuite/binutils-all/objcopy.exp
@@ -1293,7 +1293,7 @@ proc objcopy_test_elf_common_symbols {} {
# ia64 specific tests
if { ([istarget "ia64-*-elf*"]
|| [istarget "ia64-*-linux*"]) } {
- objcopy_test "ia64 link order" link-order.s object "" ""
+ objcopy_test "ia64 link order" link-order.s object "-x" ""
}
# ELF specific tests
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/pr33230.obj.bz2 b/binutils/testsuite/binutils-all/x86-64/pr33230.obj.bz2
new file mode 100644
index 0000000..6309a2a
--- /dev/null
+++ b/binutils/testsuite/binutils-all/x86-64/pr33230.obj.bz2
Binary files differ
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..6d1b308 100644
--- a/binutils/testsuite/binutils-all/x86-64/x86-64.exp
+++ b/binutils/testsuite/binutils-all/x86-64/x86-64.exp
@@ -96,3 +96,230 @@ 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"
+
+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/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
index 2da7138..7297f6d 100644
--- a/binutils/testsuite/lib/binutils-common.exp
+++ b/binutils/testsuite/lib/binutils-common.exp
@@ -44,7 +44,6 @@ proc is_elf_format {} {
&& ![istarget kvx-*-*]
&& ![istarget *-*-*linux*]
&& ![istarget *-*-lynxos*]
- && ![istarget *-*-nacl*]
&& ![istarget *-*-netbsd*]
&& ![istarget *-*-nto*]
&& ![istarget *-*-openbsd*]
@@ -238,7 +237,6 @@ proc match_target { target } {
proc supports_gnu_osabi {} {
if { [istarget *-*-gnu*]
|| [istarget *-*-linux*]
- || [istarget *-*-nacl*]
|| ( [istarget *-*-*bsd*] && ![istarget arm*-*-netbsd*] )
|| [istarget *-*-lynxos]
|| ( [istarget *-*-nto*] && ![istarget arm*-*-*] )
@@ -1813,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"
+ }
+ }
+ }
+}