diff --git a/add-elfcompress_zstd.patch b/add-elfcompress_zstd.patch new file mode 100644 index 0000000..36e762b --- /dev/null +++ b/add-elfcompress_zstd.patch @@ -0,0 +1,29 @@ +From f41928feb3e44fb27776afa062a1cd06263b7d1d Mon Sep 17 00:00:00 2001 +From: Cary Coutant +Date: Tue, 2 Aug 2022 16:19:43 -0700 +Subject: [PATCH 1/2] Add ELFCOMPRESS_ZSTD. + +include/elf/ + * common.h: Add ELFCOMPRESS_ZSTD. +--- + include/elf/common.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/include/elf/common.h b/include/elf/common.h +index 70d63e3299c..c409da2bd16 100644 +--- a/include/elf/common.h ++++ b/include/elf/common.h +@@ -588,6 +588,8 @@ + + /* Compression types. */ + #define ELFCOMPRESS_ZLIB 1 /* Compressed with zlib. */ ++#define ELFCOMPRESS_ZSTD 2 /* Compressed with zstd */ ++ /* (see http://www.zstandard.org). */ + #define ELFCOMPRESS_LOOS 0x60000000 /* OS-specific semantics, lo */ + #define ELFCOMPRESS_HIOS 0x6FFFFFFF /* OS-specific semantics, hi */ + #define ELFCOMPRESS_LOPROC 0x70000000 /* Processor-specific semantics, lo */ + +base-commit: 835a10f8541c7c4150098c82e097c4f606475cfa +-- +2.35.3 + diff --git a/binutils-gdb-support-zstd-compressed-debug-section.patch b/binutils-gdb-support-zstd-compressed-debug-section.patch new file mode 100644 index 0000000..2520bec --- /dev/null +++ b/binutils-gdb-support-zstd-compressed-debug-section.patch @@ -0,0 +1,1288 @@ +From 5a700ee4aabd1a2ed3530cab0b172c65b574ca41 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Thu, 23 Feb 2023 15:14:12 +0100 +Subject: [PATCH 2/2] binutils, gdb: support zstd compressed debug section + +--- + bfd/Makefile.am | 4 +- + bfd/Makefile.in | 13 ++- + bfd/aclocal.m4 | 2 + + bfd/bfd-in.h | 3 +- + bfd/bfd-in2.h | 12 +- + bfd/bfd.c | 26 +++-- + bfd/compress.c | 72 +++++++++--- + bfd/config.in | 3 + + bfd/configure | 268 ++++++++++++++++++++++++++++++++++++++++++++- + bfd/configure.ac | 3 +- + bfd/elf.c | 12 ++ + bfd/elfxx-target.h | 6 +- + bfd/section.c | 3 +- + config/zstd.m4 | 23 ++++ + configure | 10 ++ + configure.ac | 3 + + gdb/Makefile.in | 8 +- + gdb/NEWS | 2 + + gdb/acinclude.m4 | 3 +- + gdb/config.in | 3 + + gdb/configure | 137 ++++++++++++++++++++++- + gdb/configure.ac | 4 +- + 22 files changed, 570 insertions(+), 50 deletions(-) + create mode 100644 config/zstd.m4 + +diff --git a/bfd/Makefile.am b/bfd/Makefile.am +index b9a3f8207ac..e3fe1d34f6c 100644 +--- a/bfd/Makefile.am ++++ b/bfd/Makefile.am +@@ -57,7 +57,7 @@ ZLIBINC = @zlibinc@ + + WARN_CFLAGS = @WARN_CFLAGS@ + NO_WERROR = @NO_WERROR@ +-AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC) ++AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC) $(ZSTD_CFLAGS) + AM_CPPFLAGS = -DBINDIR='"$(bindir)"' -DLIBDIR='"$(libdir)"' @LARGEFILE_CPPFLAGS@ + if PLUGINS + bfdinclude_HEADERS += $(INCDIR)/plugin-api.h +@@ -779,7 +779,7 @@ ofiles: stamp-ofiles ; @true + libbfd_la_SOURCES = $(BFD32_LIBS_CFILES) + EXTRA_libbfd_la_SOURCES = $(CFILES) + libbfd_la_DEPENDENCIES = $(OFILES) ofiles +-libbfd_la_LIBADD = `cat ofiles` @SHARED_LIBADD@ $(LIBDL) $(ZLIB) ++libbfd_la_LIBADD = `cat ofiles` @SHARED_LIBADD@ $(LIBDL) $(ZLIB) $(ZSTD_LIBS) + libbfd_la_LDFLAGS += -release `cat libtool-soversion` @SHARED_LDFLAGS@ + + # libtool will build .libs/libbfd.a. We create libbfd.a in the build +diff --git a/bfd/Makefile.in b/bfd/Makefile.in +index 934dd4bc066..23b3e171c85 100644 +--- a/bfd/Makefile.in ++++ b/bfd/Makefile.in +@@ -122,10 +122,12 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \ + $(top_srcdir)/../config/lead-dot.m4 \ + $(top_srcdir)/../config/nls.m4 \ + $(top_srcdir)/../config/override.m4 \ ++ $(top_srcdir)/../config/pkg.m4 \ + $(top_srcdir)/../config/plugins.m4 \ + $(top_srcdir)/../config/po.m4 \ + $(top_srcdir)/../config/progtest.m4 \ +- $(top_srcdir)/../config/zlib.m4 $(top_srcdir)/../libtool.m4 \ ++ $(top_srcdir)/../config/zlib.m4 \ ++ $(top_srcdir)/../config/zstd.m4 $(top_srcdir)/../libtool.m4 \ + $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \ + $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \ + $(top_srcdir)/bfd.m4 $(top_srcdir)/warning.m4 \ +@@ -405,6 +407,9 @@ PACKAGE_URL = @PACKAGE_URL@ + PACKAGE_VERSION = @PACKAGE_VERSION@ + PATH_SEPARATOR = @PATH_SEPARATOR@ + PKGVERSION = @PKGVERSION@ ++PKG_CONFIG = @PKG_CONFIG@ ++PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ ++PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ + POSUB = @POSUB@ + RANLIB = @RANLIB@ + REPORT_BUGS_TEXI = @REPORT_BUGS_TEXI@ +@@ -422,6 +427,8 @@ WARN_CFLAGS = @WARN_CFLAGS@ + WARN_CFLAGS_FOR_BUILD = @WARN_CFLAGS_FOR_BUILD@ + WARN_WRITE_STRINGS = @WARN_WRITE_STRINGS@ + XGETTEXT = @XGETTEXT@ ++ZSTD_CFLAGS = @ZSTD_CFLAGS@ ++ZSTD_LIBS = @ZSTD_LIBS@ + abs_builddir = @abs_builddir@ + abs_srcdir = @abs_srcdir@ + abs_top_builddir = @abs_top_builddir@ +@@ -526,7 +533,7 @@ libbfd_la_LDFLAGS = $(am__append_1) -release `cat libtool-soversion` \ + # case both are empty. + ZLIB = @zlibdir@ -lz + ZLIBINC = @zlibinc@ +-AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC) ++AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC) $(ZSTD_CFLAGS) + AM_CPPFLAGS = -DBINDIR='"$(bindir)"' -DLIBDIR='"$(libdir)"' \ + @LARGEFILE_CPPFLAGS@ @HDEFINES@ @COREFLAG@ @TDEFINES@ \ + $(CSEARCH) $(CSWITCHES) $(HAVEVECS) @INCINTL@ +@@ -1208,7 +1215,7 @@ OFILES = $(BFD_BACKENDS) $(BFD_MACHINES) @COREFILE@ @bfd64_libs@ + libbfd_la_SOURCES = $(BFD32_LIBS_CFILES) + EXTRA_libbfd_la_SOURCES = $(CFILES) + libbfd_la_DEPENDENCIES = $(OFILES) ofiles +-libbfd_la_LIBADD = `cat ofiles` @SHARED_LIBADD@ $(LIBDL) $(ZLIB) ++libbfd_la_LIBADD = `cat ofiles` @SHARED_LIBADD@ $(LIBDL) $(ZLIB) $(ZSTD_LIBS) + + # libtool will build .libs/libbfd.a. We create libbfd.a in the build + # directory so that we don't have to convert all the programs that use +diff --git a/bfd/aclocal.m4 b/bfd/aclocal.m4 +index 0f8aa1d4518..09b849dfc87 100644 +--- a/bfd/aclocal.m4 ++++ b/bfd/aclocal.m4 +@@ -1176,10 +1176,12 @@ m4_include([../config/largefile.m4]) + m4_include([../config/lead-dot.m4]) + m4_include([../config/nls.m4]) + m4_include([../config/override.m4]) ++m4_include([../config/pkg.m4]) + m4_include([../config/plugins.m4]) + m4_include([../config/po.m4]) + m4_include([../config/progtest.m4]) + m4_include([../config/zlib.m4]) ++m4_include([../config/zstd.m4]) + m4_include([../libtool.m4]) + m4_include([../ltoptions.m4]) + m4_include([../ltsugar.m4]) +diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h +index a1c4bf139fc..76f841fe457 100644 +--- a/bfd/bfd-in.h ++++ b/bfd/bfd-in.h +@@ -387,7 +387,8 @@ enum compressed_debug_section_type + COMPRESS_DEBUG_NONE = 0, + COMPRESS_DEBUG = 1 << 0, + COMPRESS_DEBUG_GNU_ZLIB = COMPRESS_DEBUG | 1 << 1, +- COMPRESS_DEBUG_GABI_ZLIB = COMPRESS_DEBUG | 1 << 2 ++ COMPRESS_DEBUG_GABI_ZLIB = COMPRESS_DEBUG | 1 << 2, ++ COMPRESS_DEBUG_ZSTD = COMPRESS_DEBUG | 1 << 3 + }; + + /* This structure is used to keep track of stabs in sections +diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h +index c0b563aec02..85ab198d179 100644 +--- a/bfd/bfd-in2.h ++++ b/bfd/bfd-in2.h +@@ -394,7 +394,8 @@ enum compressed_debug_section_type + COMPRESS_DEBUG_NONE = 0, + COMPRESS_DEBUG = 1 << 0, + COMPRESS_DEBUG_GNU_ZLIB = COMPRESS_DEBUG | 1 << 1, +- COMPRESS_DEBUG_GABI_ZLIB = COMPRESS_DEBUG | 1 << 2 ++ COMPRESS_DEBUG_GABI_ZLIB = COMPRESS_DEBUG | 1 << 2, ++ COMPRESS_DEBUG_ZSTD = COMPRESS_DEBUG | 1 << 3 + }; + + /* This structure is used to keep track of stabs in sections +@@ -1007,7 +1008,8 @@ typedef struct bfd_section + unsigned int compress_status : 2; + #define COMPRESS_SECTION_NONE 0 + #define COMPRESS_SECTION_DONE 1 +-#define DECOMPRESS_SECTION_SIZED 2 ++#define DECOMPRESS_SECTION_ZLIB 2 ++#define DECOMPRESS_SECTION_ZSTD 3 + + /* The following flags are used by the ELF linker. */ + +@@ -6672,11 +6674,14 @@ struct bfd + /* Put pathnames into archives (non-POSIX). */ + #define BFD_ARCHIVE_FULL_PATH 0x100000 + ++ /* Compress sections in this BFD with SHF_COMPRESSED zstd. */ ++#define BFD_COMPRESS_ZSTD 0x400000 ++ + /* Flags bits to be saved in bfd_preserve_save. */ + #define BFD_FLAGS_SAVED \ + (BFD_IN_MEMORY | BFD_COMPRESS | BFD_DECOMPRESS | BFD_LINKER_CREATED \ + | BFD_PLUGIN | BFD_COMPRESS_GABI | BFD_CONVERT_ELF_COMMON \ +- | BFD_USE_ELF_STT_COMMON) ++ | BFD_USE_ELF_STT_COMMON | BFD_COMPRESS_ZSTD) + + /* Flags bits which are for BFD use only. */ + #define BFD_FLAGS_FOR_BFD_USE_MASK \ +@@ -7300,6 +7305,7 @@ void bfd_update_compression_header + + bool bfd_check_compression_header + (bfd *abfd, bfd_byte *contents, asection *sec, ++ unsigned int *ch_type, + bfd_size_type *uncompressed_size, + unsigned int *uncompressed_alignment_power); + +diff --git a/bfd/bfd.c b/bfd/bfd.c +index 913ce2d6abe..c5fca601ce8 100644 +--- a/bfd/bfd.c ++++ b/bfd/bfd.c +@@ -176,11 +176,14 @@ CODE_FRAGMENT + . {* Put pathnames into archives (non-POSIX). *} + .#define BFD_ARCHIVE_FULL_PATH 0x100000 + . ++. {* Compress sections in this BFD with SHF_COMPRESSED zstd. *} ++.#define BFD_COMPRESS_ZSTD 0x400000 ++. + . {* Flags bits to be saved in bfd_preserve_save. *} + .#define BFD_FLAGS_SAVED \ + . (BFD_IN_MEMORY | BFD_COMPRESS | BFD_DECOMPRESS | BFD_LINKER_CREATED \ + . | BFD_PLUGIN | BFD_COMPRESS_GABI | BFD_CONVERT_ELF_COMMON \ +-. | BFD_USE_ELF_STT_COMMON) ++. | BFD_USE_ELF_STT_COMMON | BFD_COMPRESS_ZSTD) + . + . {* Flags bits which are for BFD use only. *} + .#define BFD_FLAGS_FOR_BFD_USE_MASK \ +@@ -2492,6 +2495,9 @@ bfd_update_compression_header (bfd *abfd, bfd_byte *contents, + { + const struct elf_backend_data *bed = get_elf_backend_data (abfd); + struct bfd_elf_section_data * esd = elf_section_data (sec); ++ const unsigned int ch_type = abfd->flags & BFD_COMPRESS_ZSTD ++ ? ELFCOMPRESS_ZSTD ++ : ELFCOMPRESS_ZLIB; + + /* Set the SHF_COMPRESSED bit. */ + elf_section_flags (sec) |= SHF_COMPRESSED; +@@ -2499,7 +2505,7 @@ bfd_update_compression_header (bfd *abfd, bfd_byte *contents, + if (bed->s->elfclass == ELFCLASS32) + { + Elf32_External_Chdr *echdr = (Elf32_External_Chdr *) contents; +- bfd_put_32 (abfd, ELFCOMPRESS_ZLIB, &echdr->ch_type); ++ bfd_put_32 (abfd, ch_type, &echdr->ch_type); + bfd_put_32 (abfd, sec->size, &echdr->ch_size); + bfd_put_32 (abfd, 1u << sec->alignment_power, + &echdr->ch_addralign); +@@ -2510,7 +2516,7 @@ bfd_update_compression_header (bfd *abfd, bfd_byte *contents, + else + { + Elf64_External_Chdr *echdr = (Elf64_External_Chdr *) contents; +- bfd_put_32 (abfd, ELFCOMPRESS_ZLIB, &echdr->ch_type); ++ bfd_put_32 (abfd, ch_type, &echdr->ch_type); + bfd_put_32 (abfd, 0, &echdr->ch_reserved); + bfd_put_64 (abfd, sec->size, &echdr->ch_size); + bfd_put_64 (abfd, UINT64_C (1) << sec->alignment_power, +@@ -2545,14 +2551,15 @@ bfd_update_compression_header (bfd *abfd, bfd_byte *contents, + SYNOPSIS + bool bfd_check_compression_header + (bfd *abfd, bfd_byte *contents, asection *sec, ++ unsigned int *ch_type, + bfd_size_type *uncompressed_size, + unsigned int *uncompressed_alignment_power); + + DESCRIPTION +- Check the compression header at CONTENTS of SEC in ABFD and +- store the uncompressed size in UNCOMPRESSED_SIZE and the +- uncompressed data alignment in UNCOMPRESSED_ALIGNMENT_POWER +- if the compression header is valid. ++ Check the compression header at CONTENTS of SEC in ABFD and store the ++ ch_type in CH_TYPE, uncompressed size in UNCOMPRESSED_SIZE, and the ++ uncompressed data alignment in UNCOMPRESSED_ALIGNMENT_POWER if the ++ compression header is valid. + + RETURNS + Return TRUE if the compression header is valid. +@@ -2561,6 +2568,7 @@ RETURNS + bool + bfd_check_compression_header (bfd *abfd, bfd_byte *contents, + asection *sec, ++ unsigned int *ch_type, + bfd_size_type *uncompressed_size, + unsigned int *uncompressed_alignment_power) + { +@@ -2583,7 +2591,9 @@ bfd_check_compression_header (bfd *abfd, bfd_byte *contents, + chdr.ch_size = bfd_get_64 (abfd, &echdr->ch_size); + chdr.ch_addralign = bfd_get_64 (abfd, &echdr->ch_addralign); + } +- if (chdr.ch_type == ELFCOMPRESS_ZLIB ++ *ch_type = chdr.ch_type; ++ if ((chdr.ch_type == ELFCOMPRESS_ZLIB ++ || chdr.ch_type == ELFCOMPRESS_ZSTD) + && chdr.ch_addralign == (chdr.ch_addralign & -chdr.ch_addralign)) + { + *uncompressed_size = chdr.ch_size; +diff --git a/bfd/compress.c b/bfd/compress.c +index b2e39826e38..0e75b687013 100644 +--- a/bfd/compress.c ++++ b/bfd/compress.c +@@ -20,18 +20,31 @@ + + #include "sysdep.h" + #include ++#ifdef HAVE_ZSTD ++#include ++#endif + #include "bfd.h" ++#include "elf-bfd.h" + #include "libbfd.h" + #include "safe-ctype.h" + + #define MAX_COMPRESSION_HEADER_SIZE 24 + + static bool +-decompress_contents (bfd_byte *compressed_buffer, ++decompress_contents (bool is_zstd, bfd_byte *compressed_buffer, + bfd_size_type compressed_size, + bfd_byte *uncompressed_buffer, + bfd_size_type uncompressed_size) + { ++ if (is_zstd) ++ { ++#ifdef HAVE_ZSTD ++ size_t ret = ZSTD_decompress (uncompressed_buffer, uncompressed_size, ++ compressed_buffer, compressed_size); ++ return !ZSTD_isError (ret); ++#endif ++ } ++ + z_stream strm; + int rc; + +@@ -69,7 +82,7 @@ decompress_contents (bfd_byte *compressed_buffer, + } + + /* Compress data of the size specified in @var{uncompressed_size} +- and pointed to by @var{uncompressed_buffer} using zlib and store ++ and pointed to by @var{uncompressed_buffer} using zlib/zstd and store + as the contents field. This function assumes the contents + field was allocated using bfd_malloc() or equivalent. + +@@ -150,9 +163,10 @@ bfd_compress_section_contents (bfd *abfd, sec_ptr sec, + sec->size = orig_uncompressed_size; + if (decompress) + { +- if (!decompress_contents (uncompressed_buffer +- + orig_compression_header_size, +- zlib_size, buffer, buffer_size)) ++ if (!decompress_contents ( ++ sec->compress_status == DECOMPRESS_SECTION_ZSTD, ++ uncompressed_buffer + orig_compression_header_size, ++ zlib_size, buffer, buffer_size)) + { + bfd_set_error (bfd_error_bad_value); + bfd_release (abfd, buffer); +@@ -175,10 +189,23 @@ bfd_compress_section_contents (bfd *abfd, sec_ptr sec, + } + else + { +- if (compress ((Bytef*) buffer + header_size, +- &compressed_size, +- (const Bytef*) uncompressed_buffer, +- uncompressed_size) != Z_OK) ++ if (abfd->flags & BFD_COMPRESS_ZSTD) ++ { ++#if HAVE_ZSTD ++ compressed_size = ZSTD_compress ( ++ buffer + header_size, compressed_size, uncompressed_buffer, ++ uncompressed_size, ZSTD_CLEVEL_DEFAULT); ++ if (ZSTD_isError (compressed_size)) ++ { ++ bfd_release (abfd, buffer); ++ bfd_set_error (bfd_error_bad_value); ++ return 0; ++ } ++#endif ++ } ++ else if (compress ((Bytef *)buffer + header_size, &compressed_size, ++ (const Bytef *)uncompressed_buffer, uncompressed_size) ++ != Z_OK) + { + bfd_release (abfd, buffer); + bfd_set_error (bfd_error_bad_value); +@@ -237,6 +264,7 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr) + bfd_size_type save_rawsize; + bfd_byte *compressed_buffer; + unsigned int compression_header_size; ++ const unsigned int compress_status = sec->compress_status; + + if (abfd->direction != write_direction && sec->rawsize != 0) + sz = sec->rawsize; +@@ -248,7 +276,7 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr) + return true; + } + +- switch (sec->compress_status) ++ switch (compress_status) + { + case COMPRESS_SECTION_NONE: + if (p == NULL) +@@ -298,7 +326,8 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr) + *ptr = p; + return true; + +- case DECOMPRESS_SECTION_SIZED: ++ case DECOMPRESS_SECTION_ZLIB: ++ case DECOMPRESS_SECTION_ZSTD: + /* Read in the full compressed section contents. */ + compressed_buffer = (bfd_byte *) bfd_malloc (sec->compressed_size); + if (compressed_buffer == NULL) +@@ -316,7 +345,7 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr) + /* Restore rawsize and size. */ + sec->rawsize = save_rawsize; + sec->size = save_size; +- sec->compress_status = DECOMPRESS_SECTION_SIZED; ++ sec->compress_status = compress_status; + if (!ret) + goto fail_compressed; + +@@ -330,8 +359,10 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr) + /* Set header size to the zlib header size if it is a + SHF_COMPRESSED section. */ + compression_header_size = 12; +- if (!decompress_contents (compressed_buffer + compression_header_size, +- sec->compressed_size - compression_header_size, p, sz)) ++ bool is_zstd = compress_status == DECOMPRESS_SECTION_ZSTD; ++ if (!decompress_contents ( ++ is_zstd, compressed_buffer + compression_header_size, ++ sec->compressed_size - compression_header_size, p, sz)) + { + bfd_set_error (bfd_error_bad_value); + if (p != *ptr) +@@ -381,7 +412,8 @@ DESCRIPTION + void + bfd_cache_section_contents (asection *sec, void *contents) + { +- if (sec->compress_status == DECOMPRESS_SECTION_SIZED) ++ if (sec->compress_status == DECOMPRESS_SECTION_ZLIB ++ || sec->compress_status == DECOMPRESS_SECTION_ZSTD) + sec->compress_status = COMPRESS_SECTION_DONE; + sec->contents = contents; + sec->flags |= SEC_IN_MEMORY; +@@ -418,6 +450,7 @@ bfd_is_section_compressed_with_header (bfd *abfd, sec_ptr sec, + int compression_header_size; + int header_size; + unsigned int saved = sec->compress_status; ++ unsigned int ch_type; + bool compressed; + + *uncompressed_align_pow_p = 0; +@@ -448,7 +481,7 @@ bfd_is_section_compressed_with_header (bfd *abfd, sec_ptr sec, + { + if (compression_header_size != 0) + { +- if (!bfd_check_compression_header (abfd, header, sec, ++ if (!bfd_check_compression_header (abfd, header, sec, &ch_type, + uncompressed_size_p, + uncompressed_align_pow_p)) + compression_header_size = -1; +@@ -507,7 +540,7 @@ SYNOPSIS + DESCRIPTION + Record compressed section size, update section size with + decompressed size and set compress_status to +- DECOMPRESS_SECTION_SIZED. ++ DECOMPRESS_SECTION_{ZLIB,ZSTD}. + + Return @code{FALSE} if the section is not a valid compressed + section. Otherwise, return @code{TRUE}. +@@ -521,6 +554,7 @@ bfd_init_section_decompress_status (bfd *abfd, sec_ptr sec) + int header_size; + bfd_size_type uncompressed_size; + unsigned int uncompressed_alignment_power = 0; ++ unsigned int ch_type; + z_stream strm; + + compression_header_size = bfd_get_compression_header_size (abfd, sec); +@@ -550,6 +584,7 @@ bfd_init_section_decompress_status (bfd *abfd, sec_ptr sec) + uncompressed_size = bfd_getb64 (header + 4); + } + else if (!bfd_check_compression_header (abfd, header, sec, ++ &ch_type, + &uncompressed_size, + &uncompressed_alignment_power)) + { +@@ -569,7 +604,8 @@ bfd_init_section_decompress_status (bfd *abfd, sec_ptr sec) + sec->compressed_size = sec->size; + sec->size = uncompressed_size; + bfd_set_section_alignment (sec, uncompressed_alignment_power); +- sec->compress_status = DECOMPRESS_SECTION_SIZED; ++ sec->compress_status = (ch_type == ELFCOMPRESS_ZSTD ++ ? DECOMPRESS_SECTION_ZSTD : DECOMPRESS_SECTION_ZLIB); + + return true; + } +diff --git a/bfd/config.in b/bfd/config.in +index f54a3cacbea..a59304e0a66 100644 +--- a/bfd/config.in ++++ b/bfd/config.in +@@ -232,6 +232,9 @@ + /* Define to 1 if you have the header file. */ + #undef HAVE_WINDOWS_H + ++/* Define to 1 if zstd is enabled. */ ++#undef HAVE_ZSTD ++ + /* Define to the sub-directory in which libtool stores uninstalled libraries. + */ + #undef LT_OBJDIR +diff --git a/bfd/configure b/bfd/configure +index 0ef4c206fb0..04004f9d3eb 100755 +--- a/bfd/configure ++++ b/bfd/configure +@@ -652,6 +652,11 @@ TDEFINES + SHARED_LIBADD + SHARED_LDFLAGS + LIBM ++ZSTD_LIBS ++ZSTD_CFLAGS ++PKG_CONFIG_LIBDIR ++PKG_CONFIG_PATH ++PKG_CONFIG + zlibinc + zlibdir + EXEEXT_FOR_BUILD +@@ -845,6 +850,7 @@ enable_maintainer_mode + enable_install_libbfd + enable_nls + with_system_zlib ++with_zstd + ' + ac_precious_vars='build_alias + host_alias +@@ -854,7 +860,12 @@ CFLAGS + LDFLAGS + LIBS + CPPFLAGS +-CPP' ++CPP ++PKG_CONFIG ++PKG_CONFIG_PATH ++PKG_CONFIG_LIBDIR ++ZSTD_CFLAGS ++ZSTD_LIBS' + + + # Initialize some variables set by options. +@@ -1517,6 +1528,8 @@ Optional Packages: + Binutils" + --with-bugurl=URL Direct users to URL to report a bug + --with-system-zlib use installed libz ++ --with-zstd support zstd compressed debug sections ++ (default=auto) + + Some influential environment variables: + CC C compiler command +@@ -1527,6 +1540,13 @@ Some influential environment variables: + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor ++ PKG_CONFIG path to pkg-config utility ++ PKG_CONFIG_PATH ++ directories to add to pkg-config's search path ++ PKG_CONFIG_LIBDIR ++ path overriding pkg-config's built-in search path ++ ZSTD_CFLAGS C compiler flags for ZSTD, overriding pkg-config ++ ZSTD_LIBS linker flags for ZSTD, overriding pkg-config + + Use these variables to override the choices made by `configure' or to help + it to find libraries and programs with nonstandard names/locations. +@@ -11086,7 +11106,7 @@ else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +-#line 11089 "configure" ++#line 11109 "configure" + #include "confdefs.h" + + #if HAVE_DLFCN_H +@@ -11192,7 +11212,7 @@ else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +-#line 11195 "configure" ++#line 11215 "configure" + #include "confdefs.h" + + #if HAVE_DLFCN_H +@@ -13010,7 +13030,7 @@ $as_echo "#define USE_BINARY_FOPEN 1" >>confdefs.h + ;; + esac + +-# Link in zlib if we can. This allows us to read compressed debug sections. ++# Link in zlib/zstd if we can. This allows us to read compressed debug sections. + # This is used only by compress.c. + + # Use the system's zlib library. +@@ -13030,6 +13050,246 @@ fi + + + ++ ++ ++ ++ ++ ++ ++if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then ++ if test -n "$ac_tool_prefix"; then ++ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. ++set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 ++$as_echo_n "checking for $ac_word... " >&6; } ++if ${ac_cv_path_PKG_CONFIG+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ case $PKG_CONFIG in ++ [\\/]* | ?:[\\/]*) ++ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ++ ;; ++ *) ++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" ++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++ done ++IFS=$as_save_IFS ++ ++ ;; ++esac ++fi ++PKG_CONFIG=$ac_cv_path_PKG_CONFIG ++if test -n "$PKG_CONFIG"; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 ++$as_echo "$PKG_CONFIG" >&6; } ++else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++fi ++ ++ ++fi ++if test -z "$ac_cv_path_PKG_CONFIG"; then ++ ac_pt_PKG_CONFIG=$PKG_CONFIG ++ # Extract the first word of "pkg-config", so it can be a program name with args. ++set dummy pkg-config; ac_word=$2 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 ++$as_echo_n "checking for $ac_word... " >&6; } ++if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ case $ac_pt_PKG_CONFIG in ++ [\\/]* | ?:[\\/]*) ++ ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ++ ;; ++ *) ++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" ++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++ done ++IFS=$as_save_IFS ++ ++ ;; ++esac ++fi ++ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG ++if test -n "$ac_pt_PKG_CONFIG"; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 ++$as_echo "$ac_pt_PKG_CONFIG" >&6; } ++else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++fi ++ ++ if test "x$ac_pt_PKG_CONFIG" = x; then ++ PKG_CONFIG="" ++ else ++ case $cross_compiling:$ac_tool_warned in ++yes:) ++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 ++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ++ac_tool_warned=yes ;; ++esac ++ PKG_CONFIG=$ac_pt_PKG_CONFIG ++ fi ++else ++ PKG_CONFIG="$ac_cv_path_PKG_CONFIG" ++fi ++ ++fi ++if test -n "$PKG_CONFIG"; then ++ _pkg_min_version=0.9.0 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 ++$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } ++ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++ else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ PKG_CONFIG="" ++ fi ++fi ++ ++ ++# Check whether --with-zstd was given. ++if test "${with_zstd+set}" = set; then : ++ withval=$with_zstd; ++else ++ with_zstd=auto ++fi ++ ++ ++if test "$with_zstd" != no; then ++ ++pkg_failed=no ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libzstd" >&5 ++$as_echo_n "checking for libzstd... " >&6; } ++ ++if test -n "$ZSTD_CFLAGS"; then ++ pkg_cv_ZSTD_CFLAGS="$ZSTD_CFLAGS" ++ elif test -n "$PKG_CONFIG"; then ++ if test -n "$PKG_CONFIG" && \ ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libzstd\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "libzstd") 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; then ++ pkg_cv_ZSTD_CFLAGS=`$PKG_CONFIG --cflags "libzstd" 2>/dev/null` ++ test "x$?" != "x0" && pkg_failed=yes ++else ++ pkg_failed=yes ++fi ++ else ++ pkg_failed=untried ++fi ++if test -n "$ZSTD_LIBS"; then ++ pkg_cv_ZSTD_LIBS="$ZSTD_LIBS" ++ elif test -n "$PKG_CONFIG"; then ++ if test -n "$PKG_CONFIG" && \ ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libzstd\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "libzstd") 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; then ++ pkg_cv_ZSTD_LIBS=`$PKG_CONFIG --libs "libzstd" 2>/dev/null` ++ test "x$?" != "x0" && pkg_failed=yes ++else ++ pkg_failed=yes ++fi ++ else ++ pkg_failed=untried ++fi ++ ++if test $pkg_failed = no; then ++ pkg_save_LDFLAGS="$LDFLAGS" ++ LDFLAGS="$LDFLAGS $pkg_cv_ZSTD_LIBS" ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++int ++main () ++{ ++ ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_link "$LINENO"; then : ++ ++else ++ pkg_failed=yes ++fi ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext ++ LDFLAGS=$pkg_save_LDFLAGS ++fi ++ ++ ++ ++if test $pkg_failed = yes; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ ++if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then ++ _pkg_short_errors_supported=yes ++else ++ _pkg_short_errors_supported=no ++fi ++ if test $_pkg_short_errors_supported = yes; then ++ ZSTD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libzstd" 2>&1` ++ else ++ ZSTD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libzstd" 2>&1` ++ fi ++ # Put the nasty error message in config.log where it belongs ++ echo "$ZSTD_PKG_ERRORS" >&5 ++ ++ ++ if test "$with_zstd" = yes; then ++ as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5 ++ fi ++ ++elif test $pkg_failed = untried; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ ++ if test "$with_zstd" = yes; then ++ as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5 ++ fi ++ ++else ++ ZSTD_CFLAGS=$pkg_cv_ZSTD_CFLAGS ++ ZSTD_LIBS=$pkg_cv_ZSTD_LIBS ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++ ++ ++$as_echo "#define HAVE_ZSTD 1" >>confdefs.h ++ ++ ++fi ++fi ++ ++ + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking compiler support for hidden visibility" >&5 +diff --git a/bfd/configure.ac b/bfd/configure.ac +index 9e873736792..62145b81063 100644 +--- a/bfd/configure.ac ++++ b/bfd/configure.ac +@@ -263,9 +263,10 @@ AC_CHECK_DECLS([basename, ffs, stpcpy, asprintf, vasprintf, strnlen]) + + BFD_BINARY_FOPEN + +-# Link in zlib if we can. This allows us to read compressed debug sections. ++# Link in zlib/zstd if we can. This allows us to read compressed debug sections. + # This is used only by compress.c. + AM_ZLIB ++AC_ZSTD + + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror" +diff --git a/bfd/elf.c b/bfd/elf.c +index 82b53be99f9..ffdd2f507e5 100644 +--- a/bfd/elf.c ++++ b/bfd/elf.c +@@ -1252,6 +1252,18 @@ _bfd_elf_make_section_from_shdr (bfd *abfd, + abfd, name); + return false; + } ++#ifndef HAVE_ZSTD ++ if (newsect->compress_status == DECOMPRESS_SECTION_ZSTD) ++ { ++ _bfd_error_handler ++ /* xgettext:c-format */ ++ (_ ("%pB: section %s is compressed with zstd, but BFD " ++ "is not built with zstd support"), ++ abfd, name); ++ newsect->compress_status = COMPRESS_SECTION_NONE; ++ return false; ++ } ++#endif + } + + if (abfd->is_linker_input) +diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h +index 0579f64d1a0..4c03660f782 100644 +--- a/bfd/elfxx-target.h ++++ b/bfd/elfxx-target.h +@@ -985,7 +985,8 @@ const bfd_target TARGET_BIG_SYM = + /* object_flags: mask of all file flags */ + (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS + | DYNAMIC | WP_TEXT | D_PAGED | BFD_COMPRESS | BFD_DECOMPRESS +- | BFD_COMPRESS_GABI | BFD_CONVERT_ELF_COMMON | BFD_USE_ELF_STT_COMMON), ++ | BFD_COMPRESS_GABI | BFD_COMPRESS_ZSTD | BFD_CONVERT_ELF_COMMON ++ | BFD_USE_ELF_STT_COMMON), + + /* section_flags: mask of all section flags */ + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY +@@ -1089,7 +1090,8 @@ const bfd_target TARGET_LITTLE_SYM = + /* object_flags: mask of all file flags */ + (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS + | DYNAMIC | WP_TEXT | D_PAGED | BFD_COMPRESS | BFD_DECOMPRESS +- | BFD_COMPRESS_GABI | BFD_CONVERT_ELF_COMMON | BFD_USE_ELF_STT_COMMON), ++ | BFD_COMPRESS_GABI | BFD_COMPRESS_ZSTD | BFD_CONVERT_ELF_COMMON ++ | BFD_USE_ELF_STT_COMMON), + + /* section_flags: mask of all section flags */ + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY +diff --git a/bfd/section.c b/bfd/section.c +index 9a1071454f5..bca3c1340c2 100644 +--- a/bfd/section.c ++++ b/bfd/section.c +@@ -392,7 +392,8 @@ CODE_FRAGMENT + . unsigned int compress_status : 2; + .#define COMPRESS_SECTION_NONE 0 + .#define COMPRESS_SECTION_DONE 1 +-.#define DECOMPRESS_SECTION_SIZED 2 ++.#define DECOMPRESS_SECTION_ZLIB 2 ++.#define DECOMPRESS_SECTION_ZSTD 3 + . + . {* The following flags are used by the ELF linker. *} + . +diff --git a/config/zstd.m4 b/config/zstd.m4 +new file mode 100644 +index 00000000000..6da4db68c58 +--- /dev/null ++++ b/config/zstd.m4 +@@ -0,0 +1,23 @@ ++dnl Copyright (C) 2022 Free Software Foundation, Inc. ++dnl This file is free software, distributed under the terms of the GNU ++dnl General Public License. As a special exception to the GNU General ++dnl Public License, this file may be distributed as part of a program ++dnl that contains a configuration script generated by Autoconf, under ++dnl the same distribution terms as the rest of that program. ++ ++dnl Enable features using the zstd library. ++AC_DEFUN([AC_ZSTD], [ ++AC_ARG_WITH(zstd, ++ [AS_HELP_STRING([--with-zstd], [support zstd compressed debug sections (default=auto)])], ++ [], [with_zstd=auto]) ++ ++AS_IF([test "$with_zstd" != no], ++ [PKG_CHECK_MODULES(ZSTD, [libzstd], [ ++ AC_DEFINE(HAVE_ZSTD, 1, [Define to 1 if zstd is enabled.]) ++ ], [ ++ if test "$with_zstd" = yes; then ++ AC_MSG_ERROR([--with-zstd was given, but pkgconfig/libzstd.pc is not found]) ++ fi ++ ]) ++ ]) ++]) +diff --git a/configure b/configure +index 26935ebda24..9149d7be19a 100755 +--- a/configure ++++ b/configure +@@ -783,6 +783,7 @@ ac_user_opts=' + enable_option_checking + with_build_libsubdir + with_system_zlib ++with_zstd + enable_as_accelerator_for + enable_offload_targets + enable_gold +@@ -1563,6 +1564,8 @@ Optional Packages: + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-build-libsubdir=DIR Directory where to find libraries for build system + --with-system-zlib use installed libz ++ --with-zstd Support zstd compressed debug sections ++ (default=auto) + --with-mpc=PATH specify prefix directory for installed MPC package. + Equivalent to --with-mpc-include=PATH/include plus + --with-mpc-lib=PATH/lib +@@ -2921,6 +2924,13 @@ if test x$with_system_zlib = xyes ; then + noconfigdirs="$noconfigdirs zlib" + fi + ++ ++# Check whether --with-zstd was given. ++if test "${with_zstd+set}" = set; then : ++ withval=$with_zstd; ++fi ++ ++ + # Don't compile the bundled readline/libreadline.a if --with-system-readline + # is provided. + if test x$with_system_readline = xyes ; then +diff --git a/configure.ac b/configure.ac +index bb8bdfb6ec0..388247fd87a 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -246,6 +246,9 @@ if test x$with_system_zlib = xyes ; then + noconfigdirs="$noconfigdirs zlib" + fi + ++AC_ARG_WITH(zstd, ++[AS_HELP_STRING([--with-zstd], [Support zstd compressed debug sections (default=auto)])]) ++ + # Don't compile the bundled readline/libreadline.a if --with-system-readline + # is provided. + if test x$with_system_readline = xyes ; then +diff --git a/gdb/Makefile.in b/gdb/Makefile.in +index b66ed380a79..39a3aa16936 100644 +--- a/gdb/Makefile.in ++++ b/gdb/Makefile.in +@@ -173,6 +173,9 @@ BFD_CFLAGS = -I$(BFD_DIR) -I$(BFD_SRC) + ZLIB = @zlibdir@ -lz + ZLIBINC = @zlibinc@ + ++ZSTD_CFLAGS = @ZSTD_CFLAGS@ ++ZSTD_LIBS = @ZSTD_LIBS@ ++ + # Where is the decnumber library? Typically in ../libdecnumber. + LIBDECNUMBER_DIR = ../libdecnumber + LIBDECNUMBER = $(LIBDECNUMBER_DIR)/libdecnumber.a +@@ -622,7 +625,7 @@ INTERNAL_CPPFLAGS = $(CPPFLAGS) @GUILE_CPPFLAGS@ @PYTHON_CPPFLAGS@ \ + INTERNAL_CFLAGS_BASE = \ + $(GLOBAL_CFLAGS) $(PROFILE_CFLAGS) \ + $(GDB_CFLAGS) $(OPCODES_CFLAGS) $(READLINE_CFLAGS) $(ZLIBINC) \ +- $(BFD_CFLAGS) $(INCLUDE_CFLAGS) $(LIBDECNUMBER_CFLAGS) \ ++ $(ZSTD_CFLAGS) $(BFD_CFLAGS) $(INCLUDE_CFLAGS) $(LIBDECNUMBER_CFLAGS) \ + $(INTL_CFLAGS) $(INCGNU) $(INCSUPPORT) $(LIBBACKTRACE_INC) \ + $(ENABLE_CFLAGS) $(INTERNAL_CPPFLAGS) $(SRCHIGH_CFLAGS) \ + $(TOP_CFLAGS) $(PTHREAD_CFLAGS) $(DEBUGINFOD_CFLAGS) +@@ -644,7 +647,7 @@ INTERNAL_LDFLAGS = \ + # Libraries and corresponding dependencies for compiling gdb. + # XM_CLIBS, defined in *config files, have host-dependent libs. + # LIBIBERTY appears twice on purpose. +-CLIBS = $(SIM) $(READLINE) $(OPCODES) $(LIBCTF) $(BFD) $(ZLIB) \ ++CLIBS = $(SIM) $(READLINE) $(OPCODES) $(LIBCTF) $(BFD) $(ZLIB) $(ZSTD_LIBS) \ + $(LIBSUPPORT) $(INTL) $(LIBIBERTY) $(LIBDECNUMBER) \ + $(XM_CLIBS) $(GDBTKLIBS) $(LIBBACKTRACE_LIB) \ + @LIBS@ @GUILE_LIBS@ @PYTHON_LIBS@ \ +@@ -2090,6 +2093,7 @@ aclocal_m4_deps = \ + ../config/lcmessage.m4 \ + ../config/codeset.m4 \ + ../config/zlib.m4 \ ++ ../config/zstd.m4 \ + ../config/ax_pthread.m4 + + $(srcdir)/aclocal.m4: @MAINTAINER_MODE_TRUE@ $(aclocal_m4_deps) +diff --git a/gdb/NEWS b/gdb/NEWS +index 501ace1872e..51baf910761 100644 +--- a/gdb/NEWS ++++ b/gdb/NEWS +@@ -36,6 +36,8 @@ + Disabling this can cause a performance penalty when there are a lot of + symbols to load, but is useful for debugging purposes. + ++* gdb now supports zstd compressed debug sections (ELFCOMPRESS_ZSTD) for ELF. ++ + * New commands + + maint set backtrace-on-fatal-signal on|off +diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4 +index 95ff2b6f35e..28846119dcb 100644 +--- a/gdb/acinclude.m4 ++++ b/gdb/acinclude.m4 +@@ -43,6 +43,7 @@ m4_include([../config/lib-link.m4]) + m4_include([../config/iconv.m4]) + + m4_include([../config/zlib.m4]) ++m4_include([../config/zstd.m4]) + + m4_include([../gdbsupport/common.m4]) + +@@ -233,7 +234,7 @@ AC_DEFUN([GDB_AC_CHECK_BFD], [ + # always want our bfd. + CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS" + ZLIBDIR=`echo $zlibdir | sed 's,\$(top_builddir)/,,g'` +- LDFLAGS="-L../bfd -L../libiberty $ZLIBDIR $LDFLAGS" ++ LDFLAGS="-L../bfd -L../libiberty $ZLIBDIR $ZSTD_LIBS $LDFLAGS" + intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'` + LIBS="-lbfd -liberty -lz $intl $LIBS" + AC_CACHE_CHECK( +diff --git a/gdb/config.in b/gdb/config.in +index 422ccdde171..3ba0a5b5ceb 100644 +--- a/gdb/config.in ++++ b/gdb/config.in +@@ -598,6 +598,9 @@ + /* Define to 1 if you have the `XML_StopParser' function. */ + #undef HAVE_XML_STOPPARSER + ++/* Define to 1 if zstd is enabled. */ ++#undef HAVE_ZSTD ++ + /* Define to 1 if your system has the _etext variable. */ + #undef HAVE__ETEXT + +diff --git a/gdb/configure b/gdb/configure +index ac372e3b65c..2fcba76b5e8 100755 +--- a/gdb/configure ++++ b/gdb/configure +@@ -747,6 +747,8 @@ READLINE_DEPS + READLINE + LTLIBICONV + LIBICONV ++ZSTD_LIBS ++ZSTD_CFLAGS + zlibinc + zlibdir + MIG +@@ -899,6 +901,7 @@ enable_codesign + with_pkgversion + with_bugurl + with_system_zlib ++with_zstd + with_gnu_ld + enable_rpath + with_libiconv_prefix +@@ -969,6 +972,8 @@ RPM_CFLAGS + RPM_LIBS + YACC + YFLAGS ++ZSTD_CFLAGS ++ZSTD_LIBS + XMKMF' + ac_subdirs_all='testsuite + gdbtk' +@@ -1651,6 +1656,8 @@ Optional Packages: + --with-pkgversion=PKG Use PKG in the version string in place of "GDB" + --with-bugurl=URL Direct users to URL to report a bug + --with-system-zlib use installed libz ++ --with-zstd support zstd compressed debug sections ++ (default=auto) + --with-gnu-ld assume the C compiler uses GNU ld default=no + --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib + --without-libiconv-prefix don't search for libiconv in includedir and libdir +@@ -1733,6 +1740,8 @@ Some influential environment variables: + YFLAGS The list of arguments that will be passed by default to $YACC. + This script will default YFLAGS to the empty string to avoid a + default value of `-d' given by some make applications. ++ ZSTD_CFLAGS C compiler flags for ZSTD, overriding pkg-config ++ ZSTD_LIBS linker flags for ZSTD, overriding pkg-config + XMKMF Path to xmkmf, Makefile generator for X Window System + + Use these variables to override the choices made by `configure' or to help +@@ -8730,7 +8739,8 @@ if test "$ac_res" != no; then : + fi + + +-# Link in zlib if we can. This allows us to read compressed debug sections. ++# Link in zlib/zstd if we can. This allows us to read compressed debug ++# sections. + + # Use the system's zlib library. + zlibdir="-L\$(top_builddir)/../zlib" +@@ -8750,6 +8760,127 @@ fi + + + ++# Check whether --with-zstd was given. ++if test "${with_zstd+set}" = set; then : ++ withval=$with_zstd; ++else ++ with_zstd=auto ++fi ++ ++ ++if test "$with_zstd" != no; then : ++ ++pkg_failed=no ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libzstd" >&5 ++$as_echo_n "checking for libzstd... " >&6; } ++ ++if test -n "$ZSTD_CFLAGS"; then ++ pkg_cv_ZSTD_CFLAGS="$ZSTD_CFLAGS" ++ elif test -n "$PKG_CONFIG"; then ++ if test -n "$PKG_CONFIG" && \ ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libzstd\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "libzstd") 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; then ++ pkg_cv_ZSTD_CFLAGS=`$PKG_CONFIG --cflags "libzstd" 2>/dev/null` ++ test "x$?" != "x0" && pkg_failed=yes ++else ++ pkg_failed=yes ++fi ++ else ++ pkg_failed=untried ++fi ++if test -n "$ZSTD_LIBS"; then ++ pkg_cv_ZSTD_LIBS="$ZSTD_LIBS" ++ elif test -n "$PKG_CONFIG"; then ++ if test -n "$PKG_CONFIG" && \ ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libzstd\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "libzstd") 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; then ++ pkg_cv_ZSTD_LIBS=`$PKG_CONFIG --libs "libzstd" 2>/dev/null` ++ test "x$?" != "x0" && pkg_failed=yes ++else ++ pkg_failed=yes ++fi ++ else ++ pkg_failed=untried ++fi ++ ++if test $pkg_failed = no; then ++ pkg_save_LDFLAGS="$LDFLAGS" ++ LDFLAGS="$LDFLAGS $pkg_cv_ZSTD_LIBS" ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++int ++main () ++{ ++ ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_link "$LINENO"; then : ++ ++else ++ pkg_failed=yes ++fi ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext ++ LDFLAGS=$pkg_save_LDFLAGS ++fi ++ ++ ++ ++if test $pkg_failed = yes; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ ++if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then ++ _pkg_short_errors_supported=yes ++else ++ _pkg_short_errors_supported=no ++fi ++ if test $_pkg_short_errors_supported = yes; then ++ ZSTD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libzstd" 2>&1` ++ else ++ ZSTD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libzstd" 2>&1` ++ fi ++ # Put the nasty error message in config.log where it belongs ++ echo "$ZSTD_PKG_ERRORS" >&5 ++ ++ ++ if test "$with_zstd" = yes; then ++ as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5 ++ fi ++ ++elif test $pkg_failed = untried; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ ++ if test "$with_zstd" = yes; then ++ as_fn_error $? "--with-zstd was given, but pkgconfig/libzstd.pc is not found" "$LINENO" 5 ++ fi ++ ++else ++ ZSTD_CFLAGS=$pkg_cv_ZSTD_CFLAGS ++ ZSTD_LIBS=$pkg_cv_ZSTD_LIBS ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++ ++ ++$as_echo "#define HAVE_ZSTD 1" >>confdefs.h ++ ++ ++fi ++ ++fi ++ ++ ++ + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else +@@ -17832,7 +17963,7 @@ WIN32LIBS="$WIN32LIBS $WIN32APILIBS" + # always want our bfd. + CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS" + ZLIBDIR=`echo $zlibdir | sed 's,\$(top_builddir)/,,g'` +- LDFLAGS="-L../bfd -L../libiberty $ZLIBDIR $LDFLAGS" ++ LDFLAGS="-L../bfd -L../libiberty $ZLIBDIR $ZSTD_LIBS $LDFLAGS" + intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'` + LIBS="-lbfd -liberty -lz $intl $LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ELF support in BFD" >&5 +@@ -17947,7 +18078,7 @@ fi + # always want our bfd. + CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS" + ZLIBDIR=`echo $zlibdir | sed 's,\$(top_builddir)/,,g'` +- LDFLAGS="-L../bfd -L../libiberty $ZLIBDIR $LDFLAGS" ++ LDFLAGS="-L../bfd -L../libiberty $ZLIBDIR $ZSTD_LIBS $LDFLAGS" + intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'` + LIBS="-lbfd -liberty -lz $intl $LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Mach-O support in BFD" >&5 +diff --git a/gdb/configure.ac b/gdb/configure.ac +index f7d6c6180c3..0c27b6accbc 100644 +--- a/gdb/configure.ac ++++ b/gdb/configure.ac +@@ -671,8 +671,10 @@ AC_SEARCH_LIBS(gethostbyname, nsl) + # Some systems (e.g. Solaris) have `socketpair' in libsocket. + AC_SEARCH_LIBS(socketpair, socket) + +-# Link in zlib if we can. This allows us to read compressed debug sections. ++# Link in zlib/zstd if we can. This allows us to read compressed debug ++# sections. + AM_ZLIB ++AC_ZSTD + + AM_ICONV + +-- +2.35.3 + diff --git a/fix-gdb-build-elf-support-check-lzstd.patch b/fix-gdb-build-elf-support-check-lzstd.patch new file mode 100644 index 0000000..929b6d8 --- /dev/null +++ b/fix-gdb-build-elf-support-check-lzstd.patch @@ -0,0 +1,101 @@ +From 1907d04cb6cb94052369995cf8373f2670908e2a Mon Sep 17 00:00:00 2001 +From: Pedro Alves +Date: Wed, 28 Sep 2022 11:33:30 +0100 +Subject: [PATCH] Fix GDB build: ELF support check & -lzstd + +GDB fails to build for me, on Ubuntu 20.04. I get: + + ... + CXXLD gdb + /usr/bin/ld: linux-tdep.o: in function `linux_corefile_thread(thread_info*, linux_corefile_thread_data*)': + /home/pedro/gdb/binutils-gdb/src/gdb/linux-tdep.c:1831: undefined reference to `gcore_elf_build_thread_register_notes(gdbarch*, thread_info*, gdb_signal, bfd*, std::unique_ptr >*, int*)' + /usr/bin/ld: linux-tdep.o: in function `linux_make_corefile_notes(gdbarch*, bfd*, int*)': + /home/pedro/gdb/binutils-gdb/src/gdb/linux-tdep.c:2117: undefined reference to `gcore_elf_make_tdesc_note(bfd*, std::unique_ptr >*, int*)' + collect2: error: ld returned 1 exit status + make[2]: *** [Makefile:2149: gdb] Error 1 + make[2]: Leaving directory '/home/pedro/gdb/binutils-gdb/build/gdb' + make[1]: *** [Makefile:11847: all-gdb] Error 2 + make[1]: Leaving directory '/home/pedro/gdb/binutils-gdb/build' + make: *** [Makefile:1004: all] Error 2 + +Those undefined functions exist in gdb/gcore-elf.c, which is only +included in the build if GDB's configure thinks that the target you're +configuring for is an ELF target. GDB's configure thinks my system +isn't ELF, which is incorrect. + +For the ELF support check, gdb/config.log shows: + + configure:17387: checking for ELF support in BFD + configure:17407: gcc -o conftest -I/home/pedro/gdb/binutils-gdb/src/gdb/../include -I../bfd -I/home/pedro/gdb/binutils-gdb/src/gdb/../bfd -g3 -O0 -L../bfd -L../libiberty -lzstd conftest.c -lbfd -liberty -lz -lncursesw -lm -ldl >&5 + /usr/bin/ld: ../bfd/libbfd.a(compress.o): in function `decompress_contents': + /home/pedro/gdb/binutils-gdb/src/bfd/compress.c:42: undefined reference to `ZSTD_decompress' + /usr/bin/ld: /home/pedro/gdb/binutils-gdb/src/bfd/compress.c:44: undefined reference to `ZSTD_isError' + /usr/bin/ld: ../bfd/libbfd.a(compress.o): in function `bfd_compress_section_contents': + /home/pedro/gdb/binutils-gdb/src/bfd/compress.c:195: undefined reference to `ZSTD_compress' + /usr/bin/ld: /home/pedro/gdb/binutils-gdb/src/bfd/compress.c:198: undefined reference to `ZSTD_isError' + collect2: error: ld returned 1 exit status + configure:17407: $? = 1 + ... + configure:17417: result: no + +Note how above, in the gcc command line, "-lzstd" appears before +"-lbfd". That explain the link failure. It should appear after, like +-lz does. + +This commit fixes it, by moving ZSTD_LIBS from LDFLAGS to LIBS, next +to -lz, in GDB_AC_CHECK_BFD, and regenerating gdb/configure. + +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29630 +Change-Id: I1f4128dde634e8ea04c9002904f1005a8b3a6863 +--- + gdb/acinclude.m4 | 4 ++-- + gdb/configure | 8 ++++---- + 2 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4 +index 28846119dcb..62fa66c7af3 100644 +--- a/gdb/acinclude.m4 ++++ b/gdb/acinclude.m4 +@@ -234,9 +234,9 @@ AC_DEFUN([GDB_AC_CHECK_BFD], [ + # always want our bfd. + CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS" + ZLIBDIR=`echo $zlibdir | sed 's,\$(top_builddir)/,,g'` +- LDFLAGS="-L../bfd -L../libiberty $ZLIBDIR $ZSTD_LIBS $LDFLAGS" ++ LDFLAGS="-L../bfd -L../libiberty $ZLIBDIR $LDFLAGS" + intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'` +- LIBS="-lbfd -liberty -lz $intl $LIBS" ++ LIBS="-lbfd -liberty -lz $ZSTD_LIBS $intl $LIBS" + AC_CACHE_CHECK( + [$1], + [$2], +diff --git a/gdb/configure b/gdb/configure +index 2fcba76b5e8..a5f33ce65d9 100755 +--- a/gdb/configure ++++ b/gdb/configure +@@ -17963,9 +17963,9 @@ WIN32LIBS="$WIN32LIBS $WIN32APILIBS" + # always want our bfd. + CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS" + ZLIBDIR=`echo $zlibdir | sed 's,\$(top_builddir)/,,g'` +- LDFLAGS="-L../bfd -L../libiberty $ZLIBDIR $ZSTD_LIBS $LDFLAGS" ++ LDFLAGS="-L../bfd -L../libiberty $ZLIBDIR $LDFLAGS" + intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'` +- LIBS="-lbfd -liberty -lz $intl $LIBS" ++ LIBS="-lbfd -liberty -lz $ZSTD_LIBS $intl $LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ELF support in BFD" >&5 + $as_echo_n "checking for ELF support in BFD... " >&6; } + if ${gdb_cv_var_elf+:} false; then : +@@ -18078,9 +18078,9 @@ fi + # always want our bfd. + CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS" + ZLIBDIR=`echo $zlibdir | sed 's,\$(top_builddir)/,,g'` +- LDFLAGS="-L../bfd -L../libiberty $ZLIBDIR $ZSTD_LIBS $LDFLAGS" ++ LDFLAGS="-L../bfd -L../libiberty $ZLIBDIR $LDFLAGS" + intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'` +- LIBS="-lbfd -liberty -lz $intl $LIBS" ++ LIBS="-lbfd -liberty -lz $ZSTD_LIBS $intl $LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Mach-O support in BFD" >&5 + $as_echo_n "checking for Mach-O support in BFD... " >&6; } + if ${gdb_cv_var_macho+:} false; then : +-- +2.35.3 + diff --git a/fixup-gdb-test-dw2-aranges.patch b/fixup-gdb-test-dw2-aranges.patch new file mode 100644 index 0000000..6438276 --- /dev/null +++ b/fixup-gdb-test-dw2-aranges.patch @@ -0,0 +1,21 @@ +From 81a7585502092b3c133534ac6ecb34fd56d05337 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Thu, 16 Feb 2023 12:56:41 +0100 +Subject: [PATCH 09/11] fixup gdb-test-dw2-aranges.patch + +--- + gdb/testsuite/gdb.dwarf2/dw2-aranges.S | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-aranges.S b/gdb/testsuite/gdb.dwarf2/dw2-aranges.S +index d5b9ca5a3c6..b811f6644cb 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-aranges.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-aranges.S +@@ -138,3 +138,4 @@ main: + .byte 0 /* aranges segment_size */ + + .Laranges_end: ++ .section .note.GNU-stack,"",@progbits +-- +2.35.3 + diff --git a/gdb-container-rh-pkg.patch b/gdb-container-rh-pkg.patch deleted file mode 100644 index ab56a5b..0000000 --- a/gdb-container-rh-pkg.patch +++ /dev/null @@ -1,30 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-container-rh-pkg.patch - -;; Add messages suggesting more recent RHEL gdbserver (RH BZ 1321114). -;;=fedora - -diff --git a/gdb/remote.c b/gdb/remote.c ---- a/gdb/remote.c -+++ b/gdb/remote.c -@@ -14343,7 +14343,17 @@ remote_target::pid_to_exec_file (int pid) - char *annex = NULL; - - if (packet_support (PACKET_qXfer_exec_file) != PACKET_ENABLE) -- return NULL; -+ { -+ warning (_("Remote gdbserver does not support determining executable " -+ "automatically.\n" -+"RHEL <=6.8 and <=7.2 versions of gdbserver do not support such automatic executable detection.\n" -+"The following versions of gdbserver support it:\n" -+"- Upstream version of gdbserver (unsupported) 7.10 or later\n" -+"- Red Hat Developer Toolset (DTS) version of gdbserver from DTS 4.0 or later (only on x86_64)\n" -+"- RHEL-7.3 versions of gdbserver (on any architecture)" -+)); -+ return NULL; -+ } - - inferior *inf = find_inferior_pid (this, pid); - if (inf == NULL) diff --git a/gdb-test-ivy-bridge.patch b/gdb-test-ivy-bridge.patch deleted file mode 100644 index 31c38e0..0000000 --- a/gdb-test-ivy-bridge.patch +++ /dev/null @@ -1,468 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-test-ivy-bridge.patch - -;; Test GDB opcodes/ disassembly of Intel Ivy Bridge instructions (BZ 696890). -;;=fedoratest - -diff --git a/gdb/testsuite/gdb.arch/amd64-ivy-bridge.S b/gdb/testsuite/gdb.arch/amd64-ivy-bridge.S -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/amd64-ivy-bridge.S -@@ -0,0 +1,98 @@ -+/* Copyright 2011 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . -+ -+ This file is part of the gdb testsuite. */ -+ -+ .globl _start -+_start: .text -+ -+/* gas/i386/x86-64-rdrnd.s */ -+ .att_syntax prefix -+ rdrand %bx -+ rdrand %ebx -+ rdrand %rbx -+ rdrand %r8w -+ rdrand %r8d -+ rdrand %r8 -+ -+ .intel_syntax noprefix -+ rdrand bx -+ rdrand ebx -+ rdrand rbx -+ rdrand r8w -+ rdrand r8d -+ rdrand r8 -+ -+/* gas/i386/x86-64-f16c.s */ -+ .att_syntax prefix -+ vcvtph2ps %xmm4,%ymm4 -+ vcvtph2ps (%r8),%ymm8 -+ vcvtph2ps %xmm4,%xmm6 -+ vcvtph2ps (%rcx),%xmm4 -+ vcvtps2ph $0x2,%ymm4,%xmm4 -+ vcvtps2ph $0x2,%ymm8,(%r8) -+ vcvtps2ph $0x2,%xmm4,%xmm4 -+ vcvtps2ph $0x2,%xmm4,(%rcx) -+ -+ .intel_syntax noprefix -+ vcvtph2ps ymm4,xmm4 -+ vcvtph2ps ymm8,XMMWORD PTR [r8] -+ vcvtph2ps ymm4,[rcx] -+ vcvtph2ps xmm6,xmm4 -+ vcvtph2ps xmm4,QWORD PTR [rcx] -+ vcvtph2ps xmm4,[rcx] -+ vcvtps2ph xmm4,ymm4,0x2 -+ vcvtps2ph XMMWORD PTR [rcx],ymm4,0x2 -+ vcvtps2ph [rcx],ymm4,0x2 -+ vcvtps2ph xmm4,xmm4,0x2 -+ vcvtps2ph QWORD PTR [r8],xmm8,0x2 -+ vcvtps2ph [rcx],xmm4,0x2 -+ -+/* gas/i386/x86-64-fsgs.s */ -+ .att_syntax prefix -+ rdfsbase %ebx -+ rdfsbase %rbx -+ rdfsbase %r8d -+ rdfsbase %r8 -+ rdgsbase %ebx -+ rdgsbase %rbx -+ rdgsbase %r8d -+ rdgsbase %r8 -+ wrfsbase %ebx -+ wrfsbase %rbx -+ wrfsbase %r8d -+ wrfsbase %r8 -+ wrgsbase %ebx -+ wrgsbase %rbx -+ wrgsbase %r8d -+ wrgsbase %r8 -+ -+ .intel_syntax noprefix -+ rdfsbase ebx -+ rdfsbase rbx -+ rdfsbase r8d -+ rdfsbase r8 -+ rdgsbase ebx -+ rdgsbase rbx -+ rdgsbase r8d -+ rdgsbase r8 -+ wrfsbase ebx -+ wrfsbase rbx -+ wrfsbase r8d -+ wrfsbase r8 -+ wrgsbase ebx -+ wrgsbase rbx -+ wrgsbase r8d -+ wrgsbase r8 -diff --git a/gdb/testsuite/gdb.arch/amd64-ivy-bridge.exp b/gdb/testsuite/gdb.arch/amd64-ivy-bridge.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/amd64-ivy-bridge.exp -@@ -0,0 +1,170 @@ -+# Copyright 2011 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+if {![istarget "x86_64-*-*"]} then { -+ return -+} -+ -+set testfile amd64-ivy-bridge -+set test compilation -+if [prepare_for_testing ${testfile}.exp ${testfile}.x ${testfile}.S [list debug "additional_flags=-m64 -nostdlib"]] { -+ unsupported $test -+ return -1 -+} -+pass $test -+ -+gdb_test_no_output "set disassembly-flavor att" -+# gas/i386/x86-64-rdrnd.d -+# gas/i386/x86-64-f16c.d -+# gas/i386/x86-64-fsgs.d -+gdb_test "disassemble/r _start" "\r -+Dump of assembler code for function _start:\r -+\[^\r\n\]+:\t66 0f c7 f3\t\( \)?rdrand %bx\r -+\[^\r\n\]+:\t0f c7 f3\t\( \)?rdrand %ebx\r -+\[^\r\n\]+:\t48 0f c7 f3\t\( \)?rdrand %rbx\r -+\[^\r\n\]+:\t66 41 0f c7 f0\t\( \)?rdrand %r8w\r -+\[^\r\n\]+:\t41 0f c7 f0\t\( \)?rdrand %r8d\r -+\[^\r\n\]+:\t49 0f c7 f0\t\( \)?rdrand %r8\r -+\[^\r\n\]+:\t66 0f c7 f3\t\( \)?rdrand %bx\r -+\[^\r\n\]+:\t0f c7 f3\t\( \)?rdrand %ebx\r -+\[^\r\n\]+:\t48 0f c7 f3\t\( \)?rdrand %rbx\r -+\[^\r\n\]+:\t66 41 0f c7 f0\t\( \)?rdrand %r8w\r -+\[^\r\n\]+:\t41 0f c7 f0\t\( \)?rdrand %r8d\r -+\[^\r\n\]+:\t49 0f c7 f0\t\( \)?rdrand %r8\r -+\[^\r\n\]+:\tc4 e2 7d 13 e4\t\( \)?vcvtph2ps %xmm4,%ymm4\r -+\[^\r\n\]+:\tc4 42 7d 13 00\t\( \)?vcvtph2ps \\(%r8\\),%ymm8\r -+\[^\r\n\]+:\tc4 e2 79 13 f4\t\( \)?vcvtph2ps %xmm4,%xmm6\r -+\[^\r\n\]+:\tc4 e2 79 13 21\t\( \)?vcvtph2ps \\(%rcx\\),%xmm4\r -+\[^\r\n\]+:\tc4 e3 7d 1d e4 02\t\( \)?vcvtps2ph \\\$0x2,%ymm4,%xmm4\r -+\[^\r\n\]+:\tc4 43 7d 1d 00 02\t\( \)?vcvtps2ph \\\$0x2,%ymm8,\\(%r8\\)\r -+\[^\r\n\]+:\tc4 e3 79 1d e4 02\t\( \)?vcvtps2ph \\\$0x2,%xmm4,%xmm4\r -+\[^\r\n\]+:\tc4 e3 79 1d 21 02\t\( \)?vcvtps2ph \\\$0x2,%xmm4,\\(%rcx\\)\r -+\[^\r\n\]+:\tc4 e2 7d 13 e4\t\( \)?vcvtph2ps %xmm4,%ymm4\r -+\[^\r\n\]+:\tc4 42 7d 13 00\t\( \)?vcvtph2ps \\(%r8\\),%ymm8\r -+\[^\r\n\]+:\tc4 e2 7d 13 21\t\( \)?vcvtph2ps \\(%rcx\\),%ymm4\r -+\[^\r\n\]+:\tc4 e2 79 13 f4\t\( \)?vcvtph2ps %xmm4,%xmm6\r -+\[^\r\n\]+:\tc4 e2 79 13 21\t\( \)?vcvtph2ps \\(%rcx\\),%xmm4\r -+\[^\r\n\]+:\tc4 e2 79 13 21\t\( \)?vcvtph2ps \\(%rcx\\),%xmm4\r -+\[^\r\n\]+:\tc4 e3 7d 1d e4 02\t\( \)?vcvtps2ph \\\$0x2,%ymm4,%xmm4\r -+\[^\r\n\]+:\tc4 e3 7d 1d 21 02\t\( \)?vcvtps2ph \\\$0x2,%ymm4,\\(%rcx\\)\r -+\[^\r\n\]+:\tc4 e3 7d 1d 21 02\t\( \)?vcvtps2ph \\\$0x2,%ymm4,\\(%rcx\\)\r -+\[^\r\n\]+:\tc4 e3 79 1d e4 02\t\( \)?vcvtps2ph \\\$0x2,%xmm4,%xmm4\r -+\[^\r\n\]+:\tc4 43 79 1d 00 02\t\( \)?vcvtps2ph \\\$0x2,%xmm8,\\(%r8\\)\r -+\[^\r\n\]+:\tc4 e3 79 1d 21 02\t\( \)?vcvtps2ph \\\$0x2,%xmm4,\\(%rcx\\)\r -+\[^\r\n\]+:\tf3 0f ae c3\t\( \)?rdfsbase %ebx\r -+\[^\r\n\]+:\tf3 48 0f ae c3\t\( \)?rdfsbase %rbx\r -+\[^\r\n\]+:\tf3 41 0f ae c0\t\( \)?rdfsbase %r8d\r -+\[^\r\n\]+:\tf3 49 0f ae c0\t\( \)?rdfsbase %r8\r -+\[^\r\n\]+:\tf3 0f ae cb\t\( \)?rdgsbase %ebx\r -+\[^\r\n\]+:\tf3 48 0f ae cb\t\( \)?rdgsbase %rbx\r -+\[^\r\n\]+:\tf3 41 0f ae c8\t\( \)?rdgsbase %r8d\r -+\[^\r\n\]+:\tf3 49 0f ae c8\t\( \)?rdgsbase %r8\r -+\[^\r\n\]+:\tf3 0f ae d3\t\( \)?wrfsbase %ebx\r -+\[^\r\n\]+:\tf3 48 0f ae d3\t\( \)?wrfsbase %rbx\r -+\[^\r\n\]+:\tf3 41 0f ae d0\t\( \)?wrfsbase %r8d\r -+\[^\r\n\]+:\tf3 49 0f ae d0\t\( \)?wrfsbase %r8\r -+\[^\r\n\]+:\tf3 0f ae db\t\( \)?wrgsbase %ebx\r -+\[^\r\n\]+:\tf3 48 0f ae db\t\( \)?wrgsbase %rbx\r -+\[^\r\n\]+:\tf3 41 0f ae d8\t\( \)?wrgsbase %r8d\r -+\[^\r\n\]+:\tf3 49 0f ae d8\t\( \)?wrgsbase %r8\r -+\[^\r\n\]+:\tf3 0f ae c3\t\( \)?rdfsbase %ebx\r -+\[^\r\n\]+:\tf3 48 0f ae c3\t\( \)?rdfsbase %rbx\r -+\[^\r\n\]+:\tf3 41 0f ae c0\t\( \)?rdfsbase %r8d\r -+\[^\r\n\]+:\tf3 49 0f ae c0\t\( \)?rdfsbase %r8\r -+\[^\r\n\]+:\tf3 0f ae cb\t\( \)?rdgsbase %ebx\r -+\[^\r\n\]+:\tf3 48 0f ae cb\t\( \)?rdgsbase %rbx\r -+\[^\r\n\]+:\tf3 41 0f ae c8\t\( \)?rdgsbase %r8d\r -+\[^\r\n\]+:\tf3 49 0f ae c8\t\( \)?rdgsbase %r8\r -+\[^\r\n\]+:\tf3 0f ae d3\t\( \)?wrfsbase %ebx\r -+\[^\r\n\]+:\tf3 48 0f ae d3\t\( \)?wrfsbase %rbx\r -+\[^\r\n\]+:\tf3 41 0f ae d0\t\( \)?wrfsbase %r8d\r -+\[^\r\n\]+:\tf3 49 0f ae d0\t\( \)?wrfsbase %r8\r -+\[^\r\n\]+:\tf3 0f ae db\t\( \)?wrgsbase %ebx\r -+\[^\r\n\]+:\tf3 48 0f ae db\t\( \)?wrgsbase %rbx\r -+\[^\r\n\]+:\tf3 41 0f ae d8\t\( \)?wrgsbase %r8d\r -+\[^\r\n\]+:\tf3 49 0f ae d8\t\( \)?wrgsbase %r8\r -+End of assembler dump\\." "att" -+ -+gdb_test_no_output "set disassembly-flavor intel" -+# gas/i386/x86-64-rdrnd-intel.d -+# gas/i386/x86-64-f16c-intel.d -+# gas/i386/x86-64-fsgs-intel.d -+gdb_test "disassemble/r _start" "\r -+Dump of assembler code for function _start:\r -+\[^\r\n\]+:\t66 0f c7 f3\t\( \)?rdrand bx\r -+\[^\r\n\]+:\t0f c7 f3\t\( \)?rdrand ebx\r -+\[^\r\n\]+:\t48 0f c7 f3\t\( \)?rdrand rbx\r -+\[^\r\n\]+:\t66 41 0f c7 f0\t\( \)?rdrand r8w\r -+\[^\r\n\]+:\t41 0f c7 f0\t\( \)?rdrand r8d\r -+\[^\r\n\]+:\t49 0f c7 f0\t\( \)?rdrand r8\r -+\[^\r\n\]+:\t66 0f c7 f3\t\( \)?rdrand bx\r -+\[^\r\n\]+:\t0f c7 f3\t\( \)?rdrand ebx\r -+\[^\r\n\]+:\t48 0f c7 f3\t\( \)?rdrand rbx\r -+\[^\r\n\]+:\t66 41 0f c7 f0\t\( \)?rdrand r8w\r -+\[^\r\n\]+:\t41 0f c7 f0\t\( \)?rdrand r8d\r -+\[^\r\n\]+:\t49 0f c7 f0\t\( \)?rdrand r8\r -+\[^\r\n\]+:\tc4 e2 7d 13 e4\t\( \)?vcvtph2ps ymm4,xmm4\r -+\[^\r\n\]+:\tc4 42 7d 13 00\t\( \)?vcvtph2ps ymm8,XMMWORD PTR \\\[r8\\\]\r -+\[^\r\n\]+:\tc4 e2 79 13 f4\t\( \)?vcvtph2ps xmm6,xmm4\r -+\[^\r\n\]+:\tc4 e2 79 13 21\t\( \)?vcvtph2ps xmm4,QWORD PTR \\\[rcx\\\]\r -+\[^\r\n\]+:\tc4 e3 7d 1d e4 02\t\( \)?vcvtps2ph xmm4,ymm4,0x2\r -+\[^\r\n\]+:\tc4 43 7d 1d 00 02\t\( \)?vcvtps2ph XMMWORD PTR \\\[r8\\\],ymm8,0x2\r -+\[^\r\n\]+:\tc4 e3 79 1d e4 02\t\( \)?vcvtps2ph xmm4,xmm4,0x2\r -+\[^\r\n\]+:\tc4 e3 79 1d 21 02\t\( \)?vcvtps2ph QWORD PTR \\\[rcx\\\],xmm4,0x2\r -+\[^\r\n\]+:\tc4 e2 7d 13 e4\t\( \)?vcvtph2ps ymm4,xmm4\r -+\[^\r\n\]+:\tc4 42 7d 13 00\t\( \)?vcvtph2ps ymm8,XMMWORD PTR \\\[r8\\\]\r -+\[^\r\n\]+:\tc4 e2 7d 13 21\t\( \)?vcvtph2ps ymm4,XMMWORD PTR \\\[rcx\\\]\r -+\[^\r\n\]+:\tc4 e2 79 13 f4\t\( \)?vcvtph2ps xmm6,xmm4\r -+\[^\r\n\]+:\tc4 e2 79 13 21\t\( \)?vcvtph2ps xmm4,QWORD PTR \\\[rcx\\\]\r -+\[^\r\n\]+:\tc4 e2 79 13 21\t\( \)?vcvtph2ps xmm4,QWORD PTR \\\[rcx\\\]\r -+\[^\r\n\]+:\tc4 e3 7d 1d e4 02\t\( \)?vcvtps2ph xmm4,ymm4,0x2\r -+\[^\r\n\]+:\tc4 e3 7d 1d 21 02\t\( \)?vcvtps2ph XMMWORD PTR \\\[rcx\\\],ymm4,0x2\r -+\[^\r\n\]+:\tc4 e3 7d 1d 21 02\t\( \)?vcvtps2ph XMMWORD PTR \\\[rcx\\\],ymm4,0x2\r -+\[^\r\n\]+:\tc4 e3 79 1d e4 02\t\( \)?vcvtps2ph xmm4,xmm4,0x2\r -+\[^\r\n\]+:\tc4 43 79 1d 00 02\t\( \)?vcvtps2ph QWORD PTR \\\[r8\\\],xmm8,0x2\r -+\[^\r\n\]+:\tc4 e3 79 1d 21 02\t\( \)?vcvtps2ph QWORD PTR \\\[rcx\\\],xmm4,0x2\r -+\[^\r\n\]+:\tf3 0f ae c3\t\( \)?rdfsbase ebx\r -+\[^\r\n\]+:\tf3 48 0f ae c3\t\( \)?rdfsbase rbx\r -+\[^\r\n\]+:\tf3 41 0f ae c0\t\( \)?rdfsbase r8d\r -+\[^\r\n\]+:\tf3 49 0f ae c0\t\( \)?rdfsbase r8\r -+\[^\r\n\]+:\tf3 0f ae cb\t\( \)?rdgsbase ebx\r -+\[^\r\n\]+:\tf3 48 0f ae cb\t\( \)?rdgsbase rbx\r -+\[^\r\n\]+:\tf3 41 0f ae c8\t\( \)?rdgsbase r8d\r -+\[^\r\n\]+:\tf3 49 0f ae c8\t\( \)?rdgsbase r8\r -+\[^\r\n\]+:\tf3 0f ae d3\t\( \)?wrfsbase ebx\r -+\[^\r\n\]+:\tf3 48 0f ae d3\t\( \)?wrfsbase rbx\r -+\[^\r\n\]+:\tf3 41 0f ae d0\t\( \)?wrfsbase r8d\r -+\[^\r\n\]+:\tf3 49 0f ae d0\t\( \)?wrfsbase r8\r -+\[^\r\n\]+:\tf3 0f ae db\t\( \)?wrgsbase ebx\r -+\[^\r\n\]+:\tf3 48 0f ae db\t\( \)?wrgsbase rbx\r -+\[^\r\n\]+:\tf3 41 0f ae d8\t\( \)?wrgsbase r8d\r -+\[^\r\n\]+:\tf3 49 0f ae d8\t\( \)?wrgsbase r8\r -+\[^\r\n\]+:\tf3 0f ae c3\t\( \)?rdfsbase ebx\r -+\[^\r\n\]+:\tf3 48 0f ae c3\t\( \)?rdfsbase rbx\r -+\[^\r\n\]+:\tf3 41 0f ae c0\t\( \)?rdfsbase r8d\r -+\[^\r\n\]+:\tf3 49 0f ae c0\t\( \)?rdfsbase r8\r -+\[^\r\n\]+:\tf3 0f ae cb\t\( \)?rdgsbase ebx\r -+\[^\r\n\]+:\tf3 48 0f ae cb\t\( \)?rdgsbase rbx\r -+\[^\r\n\]+:\tf3 41 0f ae c8\t\( \)?rdgsbase r8d\r -+\[^\r\n\]+:\tf3 49 0f ae c8\t\( \)?rdgsbase r8\r -+\[^\r\n\]+:\tf3 0f ae d3\t\( \)?wrfsbase ebx\r -+\[^\r\n\]+:\tf3 48 0f ae d3\t\( \)?wrfsbase rbx\r -+\[^\r\n\]+:\tf3 41 0f ae d0\t\( \)?wrfsbase r8d\r -+\[^\r\n\]+:\tf3 49 0f ae d0\t\( \)?wrfsbase r8\r -+\[^\r\n\]+:\tf3 0f ae db\t\( \)?wrgsbase ebx\r -+\[^\r\n\]+:\tf3 48 0f ae db\t\( \)?wrgsbase rbx\r -+\[^\r\n\]+:\tf3 41 0f ae d8\t\( \)?wrgsbase r8d\r -+\[^\r\n\]+:\tf3 49 0f ae d8\t\( \)?wrgsbase r8\r -+End of assembler dump\\." "intel" -diff --git a/gdb/testsuite/gdb.arch/i386-ivy-bridge.S b/gdb/testsuite/gdb.arch/i386-ivy-bridge.S -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/i386-ivy-bridge.S -@@ -0,0 +1,66 @@ -+/* Copyright 2011 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . -+ -+ This file is part of the gdb testsuite. */ -+ -+ .globl _start -+_start: .text -+ -+/* gas/i386/rdrnd.s */ -+ .att_syntax prefix -+ rdrand %bx -+ rdrand %ebx -+ -+ .intel_syntax noprefix -+ rdrand bx -+ rdrand ebx -+ -+/* gas/i386/f16c.s */ -+ .att_syntax prefix -+ vcvtph2ps %xmm4,%ymm4 -+ vcvtph2ps (%ecx),%ymm4 -+ vcvtph2ps %xmm4,%xmm6 -+ vcvtph2ps (%ecx),%xmm4 -+ vcvtps2ph $0x2,%ymm4,%xmm4 -+ vcvtps2ph $0x2,%ymm4,(%ecx) -+ vcvtps2ph $0x2,%xmm4,%xmm4 -+ vcvtps2ph $0x2,%xmm4,(%ecx) -+ -+ .intel_syntax noprefix -+ vcvtph2ps ymm4,xmm4 -+ vcvtph2ps ymm4,XMMWORD PTR [ecx] -+ vcvtph2ps ymm4,[ecx] -+ vcvtph2ps xmm6,xmm4 -+ vcvtph2ps xmm4,QWORD PTR [ecx] -+ vcvtph2ps xmm4,[ecx] -+ vcvtps2ph xmm4,ymm4,0x2 -+ vcvtps2ph XMMWORD PTR [ecx],ymm4,0x2 -+ vcvtps2ph [ecx],ymm4,0x2 -+ vcvtps2ph xmm4,xmm4,0x2 -+ vcvtps2ph QWORD PTR [ecx],xmm4,0x2 -+ vcvtps2ph [ecx],xmm4,0x2 -+ -+/* gas/i386/fsgs.s */ -+ .att_syntax prefix -+ rdfsbase %ebx -+ rdgsbase %ebx -+ wrfsbase %ebx -+ wrgsbase %ebx -+ -+ .intel_syntax noprefix -+ rdfsbase ebx -+ rdgsbase ebx -+ wrfsbase ebx -+ wrgsbase ebx -diff --git a/gdb/testsuite/gdb.arch/i386-ivy-bridge.exp b/gdb/testsuite/gdb.arch/i386-ivy-bridge.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/i386-ivy-bridge.exp -@@ -0,0 +1,106 @@ -+# Copyright 2011 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+if {![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"]} then { -+ return -+} -+ -+set testfile i386-ivy-bridge -+set test compilation -+if [prepare_for_testing ${testfile}.exp ${testfile}.x ${testfile}.S [list debug "additional_flags=-m32 -nostdlib"]] { -+ fail $test -+ return -1 -+} -+pass $test -+ -+gdb_test_no_output "set disassembly-flavor att" -+# gas/i386/rdrnd.d -+# gas/i386/f16c.d -+# gas/i386/fsgs.d -+gdb_test "disassemble/r _start" "\r -+Dump of assembler code for function _start:\r -+\[^\r\n\]+:\t66 0f c7 f3\t\( \)?rdrand %bx\r -+\[^\r\n\]+:\t0f c7 f3\t\( \)?rdrand %ebx\r -+\[^\r\n\]+:\t66 0f c7 f3\t\( \)?rdrand %bx\r -+\[^\r\n\]+:\t0f c7 f3\t\( \)?rdrand %ebx\r -+\[^\r\n\]+:\tc4 e2 7d 13 e4\t\( \)?vcvtph2ps %xmm4,%ymm4\r -+\[^\r\n\]+:\tc4 e2 7d 13 21\t\( \)?vcvtph2ps \\(%ecx\\),%ymm4\r -+\[^\r\n\]+:\tc4 e2 79 13 f4\t\( \)?vcvtph2ps %xmm4,%xmm6\r -+\[^\r\n\]+:\tc4 e2 79 13 21\t\( \)?vcvtph2ps \\(%ecx\\),%xmm4\r -+\[^\r\n\]+:\tc4 e3 7d 1d e4 02\t\( \)?vcvtps2ph \\\$0x2,%ymm4,%xmm4\r -+\[^\r\n\]+:\tc4 e3 7d 1d 21 02\t\( \)?vcvtps2ph \\\$0x2,%ymm4,\\(%ecx\\)\r -+\[^\r\n\]+:\tc4 e3 79 1d e4 02\t\( \)?vcvtps2ph \\\$0x2,%xmm4,%xmm4\r -+\[^\r\n\]+:\tc4 e3 79 1d 21 02\t\( \)?vcvtps2ph \\\$0x2,%xmm4,\\(%ecx\\)\r -+\[^\r\n\]+:\tc4 e2 7d 13 e4\t\( \)?vcvtph2ps %xmm4,%ymm4\r -+\[^\r\n\]+:\tc4 e2 7d 13 21\t\( \)?vcvtph2ps \\(%ecx\\),%ymm4\r -+\[^\r\n\]+:\tc4 e2 7d 13 21\t\( \)?vcvtph2ps \\(%ecx\\),%ymm4\r -+\[^\r\n\]+:\tc4 e2 79 13 f4\t\( \)?vcvtph2ps %xmm4,%xmm6\r -+\[^\r\n\]+:\tc4 e2 79 13 21\t\( \)?vcvtph2ps \\(%ecx\\),%xmm4\r -+\[^\r\n\]+:\tc4 e2 79 13 21\t\( \)?vcvtph2ps \\(%ecx\\),%xmm4\r -+\[^\r\n\]+:\tc4 e3 7d 1d e4 02\t\( \)?vcvtps2ph \\\$0x2,%ymm4,%xmm4\r -+\[^\r\n\]+:\tc4 e3 7d 1d 21 02\t\( \)?vcvtps2ph \\\$0x2,%ymm4,\\(%ecx\\)\r -+\[^\r\n\]+:\tc4 e3 7d 1d 21 02\t\( \)?vcvtps2ph \\\$0x2,%ymm4,\\(%ecx\\)\r -+\[^\r\n\]+:\tc4 e3 79 1d e4 02\t\( \)?vcvtps2ph \\\$0x2,%xmm4,%xmm4\r -+\[^\r\n\]+:\tc4 e3 79 1d 21 02\t\( \)?vcvtps2ph \\\$0x2,%xmm4,\\(%ecx\\)\r -+\[^\r\n\]+:\tc4 e3 79 1d 21 02\t\( \)?vcvtps2ph \\\$0x2,%xmm4,\\(%ecx\\)\r -+\[^\r\n\]+:\tf3 0f ae c3\t\( \)?rdfsbase %ebx\r -+\[^\r\n\]+:\tf3 0f ae cb\t\( \)?rdgsbase %ebx\r -+\[^\r\n\]+:\tf3 0f ae d3\t\( \)?wrfsbase %ebx\r -+\[^\r\n\]+:\tf3 0f ae db\t\( \)?wrgsbase %ebx\r -+\[^\r\n\]+:\tf3 0f ae c3\t\( \)?rdfsbase %ebx\r -+\[^\r\n\]+:\tf3 0f ae cb\t\( \)?rdgsbase %ebx\r -+\[^\r\n\]+:\tf3 0f ae d3\t\( \)?wrfsbase %ebx\r -+\[^\r\n\]+:\tf3 0f ae db\t\( \)?wrgsbase %ebx\r -+End of assembler dump\\." "att" -+ -+gdb_test_no_output "set disassembly-flavor intel" -+# gas/i386/rdrnd-intel.d -+# gas/i386/f16c-intel.d -+# gas/i386/fsgs-intel.d -+gdb_test "disassemble/r _start" "\r -+Dump of assembler code for function _start:\r -+\[^\r\n\]+:\t66 0f c7 f3\t\( \)?rdrand bx\r -+\[^\r\n\]+:\t0f c7 f3\t\( \)?rdrand ebx\r -+\[^\r\n\]+:\t66 0f c7 f3\t\( \)?rdrand bx\r -+\[^\r\n\]+:\t0f c7 f3\t\( \)?rdrand ebx\r -+\[^\r\n\]+:\tc4 e2 7d 13 e4\t\( \)?vcvtph2ps ymm4,xmm4\r -+\[^\r\n\]+:\tc4 e2 7d 13 21\t\( \)?vcvtph2ps ymm4,XMMWORD PTR \\\[ecx\\\]\r -+\[^\r\n\]+:\tc4 e2 79 13 f4\t\( \)?vcvtph2ps xmm6,xmm4\r -+\[^\r\n\]+:\tc4 e2 79 13 21\t\( \)?vcvtph2ps xmm4,QWORD PTR \\\[ecx\\\]\r -+\[^\r\n\]+:\tc4 e3 7d 1d e4 02\t\( \)?vcvtps2ph xmm4,ymm4,0x2\r -+\[^\r\n\]+:\tc4 e3 7d 1d 21 02\t\( \)?vcvtps2ph XMMWORD PTR \\\[ecx\\\],ymm4,0x2\r -+\[^\r\n\]+:\tc4 e3 79 1d e4 02\t\( \)?vcvtps2ph xmm4,xmm4,0x2\r -+\[^\r\n\]+:\tc4 e3 79 1d 21 02\t\( \)?vcvtps2ph QWORD PTR \\\[ecx\\\],xmm4,0x2\r -+\[^\r\n\]+:\tc4 e2 7d 13 e4\t\( \)?vcvtph2ps ymm4,xmm4\r -+\[^\r\n\]+:\tc4 e2 7d 13 21\t\( \)?vcvtph2ps ymm4,XMMWORD PTR \\\[ecx\\\]\r -+\[^\r\n\]+:\tc4 e2 7d 13 21\t\( \)?vcvtph2ps ymm4,XMMWORD PTR \\\[ecx\\\]\r -+\[^\r\n\]+:\tc4 e2 79 13 f4\t\( \)?vcvtph2ps xmm6,xmm4\r -+\[^\r\n\]+:\tc4 e2 79 13 21\t\( \)?vcvtph2ps xmm4,QWORD PTR \\\[ecx\\\]\r -+\[^\r\n\]+:\tc4 e2 79 13 21\t\( \)?vcvtph2ps xmm4,QWORD PTR \\\[ecx\\\]\r -+\[^\r\n\]+:\tc4 e3 7d 1d e4 02\t\( \)?vcvtps2ph xmm4,ymm4,0x2\r -+\[^\r\n\]+:\tc4 e3 7d 1d 21 02\t\( \)?vcvtps2ph XMMWORD PTR \\\[ecx\\\],ymm4,0x2\r -+\[^\r\n\]+:\tc4 e3 7d 1d 21 02\t\( \)?vcvtps2ph XMMWORD PTR \\\[ecx\\\],ymm4,0x2\r -+\[^\r\n\]+:\tc4 e3 79 1d e4 02\t\( \)?vcvtps2ph xmm4,xmm4,0x2\r -+\[^\r\n\]+:\tc4 e3 79 1d 21 02\t\( \)?vcvtps2ph QWORD PTR \\\[ecx\\\],xmm4,0x2\r -+\[^\r\n\]+:\tc4 e3 79 1d 21 02\t\( \)?vcvtps2ph QWORD PTR \\\[ecx\\\],xmm4,0x2\r -+\[^\r\n\]+:\tf3 0f ae c3\t\( \)?rdfsbase ebx\r -+\[^\r\n\]+:\tf3 0f ae cb\t\( \)?rdgsbase ebx\r -+\[^\r\n\]+:\tf3 0f ae d3\t\( \)?wrfsbase ebx\r -+\[^\r\n\]+:\tf3 0f ae db\t\( \)?wrgsbase ebx\r -+\[^\r\n\]+:\tf3 0f ae c3\t\( \)?rdfsbase ebx\r -+\[^\r\n\]+:\tf3 0f ae cb\t\( \)?rdgsbase ebx\r -+\[^\r\n\]+:\tf3 0f ae d3\t\( \)?wrfsbase ebx\r -+\[^\r\n\]+:\tf3 0f ae db\t\( \)?wrgsbase ebx\r -+End of assembler dump\\." "intel" diff --git a/gdb-testsuite-add-gdb.suse-debranding.exp.patch b/gdb-testsuite-add-gdb.suse-debranding.exp.patch new file mode 100644 index 0000000..1edf545 --- /dev/null +++ b/gdb-testsuite-add-gdb.suse-debranding.exp.patch @@ -0,0 +1,68 @@ +From b08bf94f170dd39db21cf8f62941f1866b6978c0 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Thu, 16 Feb 2023 11:36:47 +0100 +Subject: [PATCH 080/155] Add gdb.suse/debranding.exp + +--- + gdb/testsuite/gdb.suse/debranding.exp | 49 +++++++++++++++++++++++++++ + 1 file changed, 49 insertions(+) + create mode 100644 gdb/testsuite/gdb.suse/debranding.exp + +diff --git a/gdb/testsuite/gdb.suse/debranding.exp b/gdb/testsuite/gdb.suse/debranding.exp +new file mode 100644 +index 00000000000..cdee10b75a7 +--- /dev/null ++++ b/gdb/testsuite/gdb.suse/debranding.exp +@@ -0,0 +1,49 @@ ++# Copyright 2023 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++# There's a problem with dumping the entire output into gdb.log ++# on SLE-11, so redirect to file instead. Also means the gdb.log ++# is smaller. ++set f [standard_output_file "gdb-strings.txt"] ++ ++# Not using remote_exec due to using file redirection. ++set cmd "exec strings $GDB > $f" ++set status [catch $cmd msg] ++verbose -log "status: $status" ++verbose -log "msg: $msg" ++gdb_assert { $status == 0 } ++ ++set fp [open $f r] ++set output [read $fp] ++close $fp ++ ++set re {^.*(?:fedora|red[^a-z]?hat).*$} ++set matches [regexp -line -nocase -all -inline $re $output] ++ ++set disallowed_matches 0 ++set allowed_re "warning: deprecated Red Hat reloc" ++foreach match $matches { ++ if { [regexp -nocase $allowed_re $match] } { ++ verbose -log "allowed_match: '$match'" ++ continue ++ } ++ ++ verbose -log "disallowed_match: '$match'" ++ incr disallowed_matches ++} ++ ++gdb_assert { $disallowed_matches == 0 } ++ ++remote_file build delete $f +-- +2.35.3 + diff --git a/gdb-testsuite-add-xfail-case-in-gdb.python-py-record.patch b/gdb-testsuite-add-xfail-case-in-gdb.python-py-record.patch new file mode 100644 index 0000000..b6de320 --- /dev/null +++ b/gdb-testsuite-add-xfail-case-in-gdb.python-py-record.patch @@ -0,0 +1,57 @@ +From 835a10f8541c7c4150098c82e097c4f606475cfa Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Mon, 20 Feb 2023 11:16:02 +0100 +Subject: [PATCH] [gdb/testsuite] Add xfail case in + gdb.python/py-record-btrace.exp + +I came across: +... +gdb) PASS: gdb.python/py-record-btrace.exp: prepare record: stepi 100 +python insn = r.instruction_history^M +warning: Non-contiguous trace at instruction 1 (offset = 0x3e10).^M +(gdb) FAIL: gdb.python/py-record-btrace.exp: prepare record: python insn = r.i\ +nstruction_history +... + +I'm assuming it's the same root cause as for the already present XFAIL. + +Fix this by recognizing above warning in the xfail regexp. + +Tested on x86_64-linux, although sofar I was not able to trigger the warning +again. + +Approved-By: Markus T. Metzger +--- + gdb/testsuite/gdb.python/py-record-btrace.exp | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.python/py-record-btrace.exp b/gdb/testsuite/gdb.python/py-record-btrace.exp +index ca8740bc967..a930d17264d 100644 +--- a/gdb/testsuite/gdb.python/py-record-btrace.exp ++++ b/gdb/testsuite/gdb.python/py-record-btrace.exp +@@ -86,6 +86,11 @@ with_test_prefix "prepare record" { + "warning: Decode error \\($nonl_re*\\) at instruction $decimal" \ + "\\(offset = $hex, pc = $hex\\):" \ + "$nonl_re*\\."]] ++ set xfail_re_2 \ ++ [join \ ++ [list \ ++ "warning: Non-contiguous trace at instruction $decimal" \ ++ "\\(offset = $hex\\)\\."]] + + set got_xfail 0 + set cmd "python insn = r.instruction_history" +@@ -93,7 +98,7 @@ with_test_prefix "prepare record" { + -re "^[string_to_regexp $cmd]\r\n$::gdb_prompt $" { + pass $gdb_test_name + } +- -re -wrap "$xfail_re" { ++ -re -wrap "($xfail_re|$xfail_re_2)" { + if { $have_xfail } { + xfail $gdb_test_name + set got_xfail 1 + +base-commit: f168a48adf97a36c88c65a075b42e6b7083063df +-- +2.35.3 + diff --git a/gdb-testsuite-add-xfail-in-gdb.arch-i386-pkru.exp.patch b/gdb-testsuite-add-xfail-in-gdb.arch-i386-pkru.exp.patch new file mode 100644 index 0000000..ab67178 --- /dev/null +++ b/gdb-testsuite-add-xfail-in-gdb.arch-i386-pkru.exp.patch @@ -0,0 +1,154 @@ +From 1b89c346a99d89a06d9694ca4d47d040d4eebd5a Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Tue, 3 Jan 2023 16:41:05 +0100 +Subject: [PATCH 02/11] [gdb/testsuite] Add xfail in gdb.arch/i386-pkru.exp + +On a x86_64-linux machine with pkru register, I run into: +... +(gdb) PASS: gdb.arch/i386-pkru.exp: set pkru value +info register pkru^M +pkru 0x12345678 305419896^M +(gdb) FAIL: gdb.arch/i386-pkru.exp: read value after setting value +... + +This is a regression due to kernel commit e84ba47e313d ("x86/fpu: Hook up PKRU +onto ptrace()"). This is fixed by recent kernel commit 4a804c4f8356 +("x86/fpu: Allow PKRU to be (once again) written by ptrace."). + +The regression occurs for kernel versions v5.14-rc1 (the first tag containing +the regression) up to but excluding v6.2-rc1 (the first tag containing the fix). + +Fix this by adding an xfail for the appropriate kernel versions. + +Tested on x86_64-linux. + +PR testsuite/29790 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29790 +--- + gdb/testsuite/gdb.arch/i386-pkru.exp | 45 +++++++++++++++++++++++--- + gdb/testsuite/lib/gdb-utils.exp | 48 ++++++++++++++++++++++++++++ + 2 files changed, 89 insertions(+), 4 deletions(-) + +diff --git a/gdb/testsuite/gdb.arch/i386-pkru.exp b/gdb/testsuite/gdb.arch/i386-pkru.exp +index 7724a579631..5fe93db9b4b 100644 +--- a/gdb/testsuite/gdb.arch/i386-pkru.exp ++++ b/gdb/testsuite/gdb.arch/i386-pkru.exp +@@ -58,6 +58,26 @@ if { !$supports_pkru } { + return + } + ++# Linux kernel versions 5.14.0 to 6.1.x contain a regression related to writing ++# the PKRU using ptrace, see commit 4a804c4f8356 ("x86/fpu: Allow PKRU to be ++# (once again) written by ptrace."). ++set have_xfail 0 ++if { [istarget *-*-linux*] } { ++ set res [remote_exec target "uname -r"] ++ set status [lindex $res 0] ++ set output [lindex $res 1] ++ ++ set re ^($decimal)\\.($decimal)\\.($decimal) ++ if { $status == 0 ++ && [regexp $re $output dummy v1 v2 v3] == 1 } { ++ set v [list $v1 $v2 $v3] ++ set have_xfail \ ++ [expr \ ++ [version_compare [list 5 14 0] <= $v] \ ++ && [version_compare $v < [list 6 2 0]]] ++ } ++} ++ + # Test pkru register at startup + gdb_test "print /x \$pkru" "= $default_pkru_re" "pkru register" + +@@ -65,11 +85,28 @@ gdb_test "print /x \$pkru" "= $default_pkru_re" "pkru register" + gdb_breakpoint [ gdb_get_line_number "break here 1" ] + gdb_continue_to_breakpoint "break here 1" ".*break here 1.*" + +-gdb_test "info register pkru" ".*pkru.*0x12345678.*" "read pkru register" +-gdb_test "print /x \$pkru = 0x44444444" "= 0x44444444" "set pkru value" +-gdb_test "info register pkru" ".*pkru.*0x44444444.*" "read value after setting value" ++set val1 0x12345678 ++gdb_test "info register pkru" ".*pkru.*$val1.*" "read pkru register" ++ ++set val2 0x44444444 ++gdb_test "print /x \$pkru = $val2" "= $val2" "set pkru value" ++ ++set xval $val2 ++gdb_test_multiple "info register pkru" "read value after setting value" { ++ -re -wrap ".*pkru.*$val2.*" { ++ pass $gdb_test_name ++ } ++ -re -wrap ".*pkru.*$val1.*" { ++ if { $have_xfail } { ++ xfail $gdb_test_name ++ } else { ++ fail $gdb_test_name ++ } ++ set xval $val1 ++ } ++} + + gdb_breakpoint [ gdb_get_line_number "break here 2" ] + gdb_continue_to_breakpoint "break here 2" ".*break here 2.*" + +-gdb_test "print /x rd_value" "= 0x44444444" "variable after reading pkru" ++gdb_test "print /x rd_value" "= $xval" "variable after reading pkru" +diff --git a/gdb/testsuite/lib/gdb-utils.exp b/gdb/testsuite/lib/gdb-utils.exp +index ffdfb75557c..294d0998632 100644 +--- a/gdb/testsuite/lib/gdb-utils.exp ++++ b/gdb/testsuite/lib/gdb-utils.exp +@@ -72,3 +72,51 @@ proc style {str style} { + } + return "\033\\\[${style}m${str}\033\\\[m" + } ++ ++# Compare the version numbers in L1 to those in L2 using OP, and return ++# 1 if the comparison is true. ++ ++proc version_compare { l1 op l2 } { ++ set len [llength $l1] ++ if { $len != [llength $l2] } { ++ error "l2 not the same length as l1" ++ } ++ ++ switch -exact $op { ++ "==" - ++ "<" {} ++ "<=" { return [expr [version_compare $l1 < $l2] \ ++ || [version_compare $l1 == $l2]]} ++ default { error "unsupported op: $op" } ++ } ++ ++ # Handle ops < and ==. ++ set idx 0 ++ foreach v1 $l1 { ++ set v2 [lindex $l2 $idx] ++ incr idx ++ set last [expr $len == $idx] ++ ++ set cmp [expr $v1 $op $v2] ++ if { $op == "==" } { ++ if { $cmp } { ++ continue ++ } else { ++ return 0 ++ } ++ } else { ++ # $op == "<". ++ if { $cmp } { ++ return 1 ++ } else { ++ if { !$last && $v1 == $v2 } { ++ continue ++ } ++ return 0 ++ } ++ } ++ } ++ ++ return 1 ++} ++ +-- +2.35.3 + diff --git a/gdb-testsuite-add-xfail-in-gdb.python-py-record-btra.patch b/gdb-testsuite-add-xfail-in-gdb.python-py-record-btra.patch new file mode 100644 index 0000000..f398cab --- /dev/null +++ b/gdb-testsuite-add-xfail-in-gdb.python-py-record-btra.patch @@ -0,0 +1,98 @@ +From 221ecdef7cc008b01832840d1fbd25d94f8abdd1 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Tue, 14 Feb 2023 13:15:49 +0100 +Subject: [PATCH 04/11] [gdb/testsuite] Add xfail in + gdb.python/py-record-btrace.exp + +There's a HW bug affecting Processor Trace on some Intel processors +(Ice Lake to Raptor Lake microarchitectures). + +The bug was exposed by linux kernel commit 670638477aed +("perf/x86/intel/pt: Opportunistically use single range output mode"), +added in version v5.5.0, and was worked around by commit ce0d998be927 +("perf/x86/intel/pt: Fix sampling using single range output") in version +6.1.0. + +The bug manifests (on a Performance-core of an i7-1250U, an Alder Lake cpu) in +a single test-case: +... +(gdb) python insn = r.instruction_history^M +warning: Decode error (-20) at instruction 33 (offset = 0x3d6a, \ + pc = 0x400501): compressed return without call.^M +(gdb) FAIL: gdb.python/py-record-btrace.exp: prepare record: \ + python insn = r.instruction_history +... + +Add a corresponding XFAIL. + +Note that the i7-1250U has both Performance-cores and Efficient-cores, and on +an Efficient-Core the test-case runs without any problems, so if the testsuite +run is not pinned to a specific cpu, the test may either PASS or XFAIL. + +Tested on x86_64-linux: +- openSUSE Leap 15.4 with linux kernel version 5.14.21 +- openSUSE Tumbleweed with linux kernel version 6.1.8 + +PR testsuite/30075 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30075 +--- + gdb/testsuite/gdb.python/py-record-btrace.exp | 43 ++++++++++++++++++- + 1 file changed, 42 insertions(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.python/py-record-btrace.exp b/gdb/testsuite/gdb.python/py-record-btrace.exp +index 8204577b866..ca8740bc967 100644 +--- a/gdb/testsuite/gdb.python/py-record-btrace.exp ++++ b/gdb/testsuite/gdb.python/py-record-btrace.exp +@@ -64,7 +64,48 @@ with_test_prefix "prepare record" { + gdb_test "python print(r.method)" "btrace" + gdb_test "python print(r.format)" "pt|bts" + gdb_test "stepi 100" ".*" +- gdb_test_no_output "python insn = r.instruction_history" ++ ++ # There's a HW bug affecting Processor Trace on some Intel processors. ++ # The bug was exposed by linux kernel commit 670638477aed ++ # ("perf/x86/intel/pt: Opportunistically use single range output mode"), ++ # added in version v5.5.0, and was worked around by commit ce0d998be927 ++ # ("perf/x86/intel/pt: Fix sampling using single range output") in version ++ # 6.1.0. Detect the kernel version range for which the problem may ++ # manifest. ++ set have_xfail 0 ++ set v [linux_kernel_version] ++ if { $v != {} } { ++ set have_xfail \ ++ [expr [version_compare [list 5 5 0] <= $v] \ ++ && [version_compare $v < [list 6 1 0]]] ++ } ++ set nonl_re \[^\r\n\] ++ set xfail_re \ ++ [join \ ++ [list \ ++ "warning: Decode error \\($nonl_re*\\) at instruction $decimal" \ ++ "\\(offset = $hex, pc = $hex\\):" \ ++ "$nonl_re*\\."]] ++ ++ set got_xfail 0 ++ set cmd "python insn = r.instruction_history" ++ gdb_test_multiple $cmd "" { ++ -re "^[string_to_regexp $cmd]\r\n$::gdb_prompt $" { ++ pass $gdb_test_name ++ } ++ -re -wrap "$xfail_re" { ++ if { $have_xfail } { ++ xfail $gdb_test_name ++ set got_xfail 1 ++ } else { ++ fail $gdb_test_name ++ } ++ } ++ } ++ if { $got_xfail } { ++ return ++ } ++ + gdb_test_no_output "python call = r.function_call_history" + gdb_test_no_output "python i = insn\[0\]" + gdb_test_no_output "python c = call\[0\]" +-- +2.35.3 + diff --git a/gdb-testsuite-factor-out-proc-linux_kernel_version.patch b/gdb-testsuite-factor-out-proc-linux_kernel_version.patch new file mode 100644 index 0000000..daf8069 --- /dev/null +++ b/gdb-testsuite-factor-out-proc-linux_kernel_version.patch @@ -0,0 +1,81 @@ +From bbf4e4ba2a9bd73384268b0160d54e36edc92a12 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Tue, 14 Feb 2023 11:53:54 +0100 +Subject: [PATCH 03/11] [gdb/testsuite] Factor out proc linux_kernel_version + +Factor out new proc linux_kernel_version from test-case +gdb.arch/i386-pkru.exp. + +Tested on x86_64-linux. +--- + gdb/testsuite/gdb.arch/i386-pkru.exp | 20 ++++++-------------- + gdb/testsuite/lib/gdb.exp | 23 +++++++++++++++++++++++ + 2 files changed, 29 insertions(+), 14 deletions(-) + +diff --git a/gdb/testsuite/gdb.arch/i386-pkru.exp b/gdb/testsuite/gdb.arch/i386-pkru.exp +index 5fe93db9b4b..9bc9f9735e5 100644 +--- a/gdb/testsuite/gdb.arch/i386-pkru.exp ++++ b/gdb/testsuite/gdb.arch/i386-pkru.exp +@@ -62,20 +62,12 @@ if { !$supports_pkru } { + # the PKRU using ptrace, see commit 4a804c4f8356 ("x86/fpu: Allow PKRU to be + # (once again) written by ptrace."). + set have_xfail 0 +-if { [istarget *-*-linux*] } { +- set res [remote_exec target "uname -r"] +- set status [lindex $res 0] +- set output [lindex $res 1] +- +- set re ^($decimal)\\.($decimal)\\.($decimal) +- if { $status == 0 +- && [regexp $re $output dummy v1 v2 v3] == 1 } { +- set v [list $v1 $v2 $v3] +- set have_xfail \ +- [expr \ +- [version_compare [list 5 14 0] <= $v] \ +- && [version_compare $v < [list 6 2 0]]] +- } ++set v [linux_kernel_version] ++if { $v != {} } { ++ set have_xfail \ ++ [expr \ ++ [version_compare [list 5 14 0] <= $v] \ ++ && [version_compare $v < [list 6 2 0]]] + } + + # Test pkru register at startup +diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp +index 5104835a2a9..069a61038e6 100644 +--- a/gdb/testsuite/lib/gdb.exp ++++ b/gdb/testsuite/lib/gdb.exp +@@ -8551,5 +8551,28 @@ gdb_caching_proc has_hw_wp_support { + return $has_hw_wp_support + } + ++# Detect linux kernel version and return as list of 3 numbers: major, minor, ++# and patchlevel. On failure, return an empty list. ++ ++gdb_caching_proc linux_kernel_version { ++ if { ![istarget *-*-linux*] } { ++ return {} ++ } ++ ++ set res [remote_exec target "uname -r"] ++ set status [lindex $res 0] ++ set output [lindex $res 1] ++ if { $status != 0 } { ++ return {} ++ } ++ ++ set re ^($::decimal)\\.($::decimal)\\.($::decimal) ++ if { [regexp $re $output dummy v1 v2 v3] != 1 } { ++ return {} ++ } ++ ++ return [list $v1 $v2 $v3] ++} ++ + # Always load compatibility stuff. + load_lib future.exp +-- +2.35.3 + diff --git a/gdb-testsuite-fix-gdb.base-infoline-reloc-main-from-.patch b/gdb-testsuite-fix-gdb.base-infoline-reloc-main-from-.patch new file mode 100644 index 0000000..34a03a4 --- /dev/null +++ b/gdb-testsuite-fix-gdb.base-infoline-reloc-main-from-.patch @@ -0,0 +1,46 @@ +From 52ce02f7e38ed00f9e42fe4f272787652540c863 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Wed, 12 Oct 2022 16:50:16 +0200 +Subject: [PATCH 08/11] [gdb/testsuite] Fix + gdb.base/infoline-reloc-main-from-zero.exp with recent ld + +On openSUSE Tumbleweed (with ld 2.39) and test-case +gdb.base/infoline-reloc-main-from-zero.exp, I get: +... +gdb compile failed, ld: warning: infoline-reloc-main-from-zero has a LOAD \ + segment with RWX permissions +UNTESTED: gdb.base/infoline-reloc-main-from-zero.exp: \ + infoline-reloc-main-from-zero.exp +... + +Fix this by compiling with -Wl,--no-warn-rwx-segments. + +Tested on x86_64-linux. +--- + .../gdb.base/infoline-reloc-main-from-zero.exp | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp b/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp +index ef5fe8c24bc..a29668c9712 100644 +--- a/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp ++++ b/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp +@@ -29,7 +29,15 @@ if [get_compiler_info] { + + # Build executable with stripped startup code and text section starting at zero + +-set opts {debug "additional_flags=-nostdlib -emain -Wl,-Ttext=0x00 -Wl,-N"} ++set opts {} ++lappend opts debug ++lappend opts "additional_flags=-nostdlib -emain -Wl,-Ttext=0x00 -Wl,-N" ++ ++set ld_flags additional_flags=-Wl,--no-warn-rwx-segments ++if { [gdb_can_simple_compile ld-flags {int main () { return 0; }} executable \ ++ $ld_flags] } { ++ lappend opts $ld_flags ++} + + if {[build_executable $testfile.exp $testfile $srcfile $opts] == -1} { + untested "failed to compile" +-- +2.35.3 + diff --git a/gdb-testsuite-fix-gdb.base-nested-subp-2-3-.exp-with.patch b/gdb-testsuite-fix-gdb.base-nested-subp-2-3-.exp-with.patch new file mode 100644 index 0000000..d5d5adf --- /dev/null +++ b/gdb-testsuite-fix-gdb.base-nested-subp-2-3-.exp-with.patch @@ -0,0 +1,80 @@ +From a95556346e4336d2d6eeba74430212e833c065fb Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Wed, 12 Oct 2022 16:50:16 +0200 +Subject: [PATCH 10/11] [gdb/testsuite] Fix gdb.base/nested-subp{2,3}.exp with + recent ld + +On openSUSE Tumbleweed (with ld 2.39) I get for test-case +gdb.base/nested-subp2.exp: +... +gdb compile failed, ld: warning: tmp.o: requires executable stack \ + (because the .note.GNU-stack section is executable) +... + +Fix this by compiling with -Wl,--no-warn-execstack. + +Likewise in gdb.base/nested-subp3.exp + +Tested on x86_64-linux. +--- + gdb/testsuite/gdb.base/nested-subp2.exp | 15 ++++++++++++--- + gdb/testsuite/gdb.base/nested-subp3.exp | 15 ++++++++++++--- + 2 files changed, 24 insertions(+), 6 deletions(-) + +diff --git a/gdb/testsuite/gdb.base/nested-subp2.exp b/gdb/testsuite/gdb.base/nested-subp2.exp +index 876b797e49d..8cb57bd1ee7 100644 +--- a/gdb/testsuite/gdb.base/nested-subp2.exp ++++ b/gdb/testsuite/gdb.base/nested-subp2.exp +@@ -29,10 +29,19 @@ if ![support_nested_function_tests] { + return -1 + } + ++set flags {} ++lappend flags debug ++lappend flags additional_flags=-std=gnu99 ++ ++set ld_flags additional_flags=-Wl,--no-warn-execstack ++if { [gdb_can_simple_compile ld-flags {int main () { return 0; }} executable \ ++ $ld_flags] } { ++ lappend flags $ld_flags ++} ++ + if { [gdb_compile "${srcdir}/${subdir}/${testcase}.c" \ +- [standard_output_file "${testcase}"] \ +- executable \ +- [list debug "additional_flags=-std=gnu99"]] != "" } { ++ [standard_output_file "${testcase}"] \ ++ executable $flags] != "" } { + return -1 + } + +diff --git a/gdb/testsuite/gdb.base/nested-subp3.exp b/gdb/testsuite/gdb.base/nested-subp3.exp +index dd236f07c8f..31da8d47f84 100644 +--- a/gdb/testsuite/gdb.base/nested-subp3.exp ++++ b/gdb/testsuite/gdb.base/nested-subp3.exp +@@ -29,10 +29,19 @@ if ![support_nested_function_tests] { + return -1 + } + ++set flags {} ++lappend flags debug ++lappend flags additional_flags=-std=gnu99 ++ ++set ld_flags additional_flags=-Wl,--no-warn-execstack ++if { [gdb_can_simple_compile ld-flags {int main () { return 0; }} executable \ ++ $ld_flags] } { ++ lappend flags $ld_flags ++} ++ + if { [gdb_compile "${srcdir}/${subdir}/${testcase}.c" \ +- [standard_output_file "${testcase}"] \ +- executable \ +- [list debug "additional_flags=-std=gnu99"]] != "" } { ++ [standard_output_file "${testcase}"] \ ++ executable $flags] != "" } { + return -1 + } + +-- +2.35.3 + diff --git a/gdb-testsuite-fix-gdb.dwarf2-dw2-dir-file-name.exp-w.patch b/gdb-testsuite-fix-gdb.dwarf2-dw2-dir-file-name.exp-w.patch new file mode 100644 index 0000000..b55d768 --- /dev/null +++ b/gdb-testsuite-fix-gdb.dwarf2-dw2-dir-file-name.exp-w.patch @@ -0,0 +1,26 @@ +From 7ba9d8dda33a985a97c9ab922b84b894ffb2e288 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Thu, 16 Feb 2023 13:56:07 +0100 +Subject: [PATCH 11/11] [gdb/testsuite] Fix gdb.dwarf2/dw2-dir-file-name.exp + with recent ld + +--- + gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp +index 4d3f767f597..1fc34ef387b 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp ++++ b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp +@@ -317,6 +317,8 @@ puts -nonewline $f "\ + .byte 0x0 /* Terminator */ + " + ++puts -nonewline $f "\t.section\t.note.GNU-stack,\"\",@progbits" ++ + close $f + + set opts {} +-- +2.35.3 + diff --git a/gdb-testsuite-fix-gdb.threads-schedlock.exp-for-gcc-.patch b/gdb-testsuite-fix-gdb.threads-schedlock.exp-for-gcc-.patch new file mode 100644 index 0000000..0fbb118 --- /dev/null +++ b/gdb-testsuite-fix-gdb.threads-schedlock.exp-for-gcc-.patch @@ -0,0 +1,68 @@ +From f168a48adf97a36c88c65a075b42e6b7083063df Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Mon, 20 Feb 2023 11:16:02 +0100 +Subject: [PATCH] [gdb/testsuite] Fix gdb.threads/schedlock.exp for gcc 4.8.5 + +Since commit 9af467b8240 ("[gdb/testsuite] Fix gdb.threads/schedlock.exp on +fast cpu"), the test-case fails for gcc 4.8.5. + +The problem is that for gcc 4.8.5, the commit turned a two-line loop: +... +(gdb) next +78 while (*myp > 0) +(gdb) next +81 MAYBE_CALL_SOME_FUNCTION(); (*myp) ++; +(gdb) next +78 while (*myp > 0) +... +into a three-line loop: +... +(gdb) next +83 MAYBE_CALL_SOME_FUNCTION(); (*myp) ++; +(gdb) next +84 cnt++; +(gdb) next +85 } +(gdb) next +83 MAYBE_CALL_SOME_FUNCTION(); (*myp) ++; +(gdb) +... +and the test-case doesn't expect this. + +Fix this by reverting back to the original loop shape as much as possible by: +- removing the cnt++ line +- replacing "while (1)" with "while (one)", where one is a volatile variable + set to 1. + +Tested on x86_64-linux, using compilers: +- gcc 4.8.5, 7.5.0, 12.2.1 +- clang 4.0.1, 13.0.1 +--- + gdb/testsuite/gdb.threads/schedlock.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/gdb/testsuite/gdb.threads/schedlock.c b/gdb/testsuite/gdb.threads/schedlock.c +index 9859885b1a3..af3ca3e4c87 100644 +--- a/gdb/testsuite/gdb.threads/schedlock.c ++++ b/gdb/testsuite/gdb.threads/schedlock.c +@@ -75,13 +75,12 @@ volatile int call_function = 0; + void *thread_function(void *arg) { + int my_number = (long) arg; + unsigned long long int *myp = (unsigned long long int *) &args[my_number]; +- volatile unsigned int cnt = 0; ++ volatile unsigned int one = 1; + +- while (1) ++ while (one) + { + /* schedlock.exp: main loop. */ + MAYBE_CALL_SOME_FUNCTION(); (*myp) ++; +- cnt++; + } + + pthread_exit(NULL); + +base-commit: 4d69e6ec1a8ddd008f34af363dab73c014823074 +-- +2.35.3 + diff --git a/gdb-testsuite-fix-gdb.threads-schedlock.exp-on-fast-.patch b/gdb-testsuite-fix-gdb.threads-schedlock.exp-on-fast-.patch new file mode 100644 index 0000000..ab33660 --- /dev/null +++ b/gdb-testsuite-fix-gdb.threads-schedlock.exp-on-fast-.patch @@ -0,0 +1,97 @@ +From c25a24cc237721c51034f4425183f73e97cdccc1 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Mon, 6 Feb 2023 12:52:50 +0100 +Subject: [PATCH 06/11] [gdb/testsuite] Fix gdb.threads/schedlock.exp on fast + cpu + +Occasionally, I run into: +... +(gdb) PASS: gdb.threads/schedlock.exp: schedlock=on: cmd=continue: \ + set scheduler-locking on +continue^M +Continuing.^M +PASS: gdb.threads/schedlock.exp: schedlock=on: cmd=continue: \ + continue (with lock) +[Thread 0x7ffff746e700 (LWP 1339) exited]^M +No unwaited-for children left.^M +(gdb) Quit^M +(gdb) FAIL: gdb.threads/schedlock.exp: schedlock=on: cmd=continue: \ + stop all threads (with lock) (timeout) +... + +What happens is that this loop which is supposed to run "just short of forever": +... + /* Don't run forever. Run just short of it :) */ + while (*myp > 0) + { + /* schedlock.exp: main loop. */ + MAYBE_CALL_SOME_FUNCTION(); (*myp) ++; + } +... +finishes after 0x7fffffff iterations (when a signed wrap occurs), which on my +system takes only about 1.5 seconds. + +Fix this by: +- changing the pointed-at type of myp from signed to unsigned, which makes the + wrap defined behaviour (and which also make the loop run twice as long, + which is already enough to make it impossible for me to reproduce the FAIL. + But let's try to solve this more structurally). +- changing the pointed-at type of myp from int to long long, making the wrap + unlikely. +- making sure the loop runs forever, by setting the loop condition to 1. +- making sure the loop still contains different lines (as far as debug info is + concerned) by incrementing a volatile counter in the loop. +- making sure the program doesn't run forever in case of trouble, by adding an + "alarm (30)". + +Tested on x86_64-linux. + +PR testsuite/30074 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30074 +--- + gdb/testsuite/gdb.threads/schedlock.c | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/gdb/testsuite/gdb.threads/schedlock.c b/gdb/testsuite/gdb.threads/schedlock.c +index 7672140fdc8..9859885b1a3 100644 +--- a/gdb/testsuite/gdb.threads/schedlock.c ++++ b/gdb/testsuite/gdb.threads/schedlock.c +@@ -24,7 +24,7 @@ void *thread_function(void *arg); /* Pointer to function executed by each thread + + #define NUM 1 + +-unsigned int args[NUM+1]; ++unsigned long long int args[NUM+1]; + + int main() { + int res; +@@ -32,6 +32,8 @@ int main() { + void *thread_result; + long i; + ++ alarm (30); ++ + for (i = 1; i <= NUM; i++) + { + args[i] = 1; +@@ -72,13 +74,14 @@ volatile int call_function = 0; + + void *thread_function(void *arg) { + int my_number = (long) arg; +- int *myp = (int *) &args[my_number]; ++ unsigned long long int *myp = (unsigned long long int *) &args[my_number]; ++ volatile unsigned int cnt = 0; + +- /* Don't run forever. Run just short of it :) */ +- while (*myp > 0) ++ while (1) + { + /* schedlock.exp: main loop. */ + MAYBE_CALL_SOME_FUNCTION(); (*myp) ++; ++ cnt++; + } + + pthread_exit(NULL); +-- +2.35.3 + diff --git a/gdb-testsuite-handle-missing-.note.gnu-stack.patch b/gdb-testsuite-handle-missing-.note.gnu-stack.patch new file mode 100644 index 0000000..2f83592 --- /dev/null +++ b/gdb-testsuite-handle-missing-.note.gnu-stack.patch @@ -0,0 +1,1404 @@ +From dbcbd103d4cf39c2b7a87cf4caaf9c297580ec69 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Tue, 25 Oct 2022 14:14:34 +0200 +Subject: [PATCH 05/11] [gdb/testsuite] Handle missing .note.GNU-stack + +On openSUSE Tumbleweed I run into this for the dwarf assembly test-cases, and +some hardcoded assembly test-cases: +... + Running gdb.dwarf2/fission-absolute-dwo.exp ... + gdb compile failed, ld: warning: fission-absolute-dwo.o: \ + missing .note.GNU-stack section implies executable stack + ld: NOTE: This behaviour is deprecated and will be removed in a future \ + version of the linker + + === gdb Summary === + + # of untested testcases 1 +... + +Fix the dwarf assembly test-cases by adding the missing .note.GNU-stack in +proc Dwarf::assemble. + +Fix the hard-coded test-cases using this command: +... +$ for f in $(find gdb/testsuite/gdb.* -name *.S); do + if ! grep -q note.GNU-stack $f; then + echo -e "\t.section\t.note.GNU-stack,\"\",@progbits" >> $f; + fi; + done +... + +Likewise for .s files, and gdb/testsuite/lib/my-syscalls.S. + +The idiom for arm seems to be to use %progbits instead, see commit 9a5911c08be +("gdb/testsuite/gdb.dwarf2: Replace @ with % for ARM compatability"), so +hand-edit gdb/testsuite/gdb.arch/arm-disp-step.S to use %progbits instead. + +Note that dwarf assembly testcases use %progbits as decided by proc _section. + +Tested on x86_64-linux. + +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29674 +--- + gdb/testsuite/gdb.arch/amd64-break-on-asm-line.S | 1 + + gdb/testsuite/gdb.arch/amd64-disp-step-avx.S | 1 + + gdb/testsuite/gdb.arch/amd64-disp-step.S | 1 + + gdb/testsuite/gdb.arch/amd64-i386-address.S | 1 + + gdb/testsuite/gdb.arch/amd64-init-x87-values.S | 1 + + gdb/testsuite/gdb.arch/amd64-prologue-skip.S | 1 + + gdb/testsuite/gdb.arch/amd64-stap-expressions.S | 1 + + gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.S | 1 + + gdb/testsuite/gdb.arch/amd64-stap-wrong-subexp.S | 1 + + gdb/testsuite/gdb.arch/amd64-tailcall-self.S | 1 + + gdb/testsuite/gdb.arch/arc-analyze-prologue.S | 1 + + gdb/testsuite/gdb.arch/arc-decode-insn.S | 1 + + gdb/testsuite/gdb.arch/arc-disassembler-options.s | 1 + + gdb/testsuite/gdb.arch/arm-disp-step.S | 1 + + gdb/testsuite/gdb.arch/gdb1291.s | 1 + + gdb/testsuite/gdb.arch/gdb1431.s | 1 + + gdb/testsuite/gdb.arch/i386-cfi-notcurrent.S | 1 + + gdb/testsuite/gdb.arch/i386-disp-step.S | 1 + + gdb/testsuite/gdb.arch/i386-float.S | 1 + + gdb/testsuite/gdb.arch/i386-permbkpt.S | 1 + + gdb/testsuite/gdb.arch/mips-disassembler-options.s | 1 + + gdb/testsuite/gdb.arch/pa-nullify.s | 1 + + gdb/testsuite/gdb.arch/pa64-nullify.s | 1 + + gdb/testsuite/gdb.arch/powerpc-addpcis.s | 1 + + gdb/testsuite/gdb.arch/powerpc-altivec.s | 1 + + gdb/testsuite/gdb.arch/powerpc-altivec2.s | 1 + + gdb/testsuite/gdb.arch/powerpc-altivec3.s | 1 + + gdb/testsuite/gdb.arch/powerpc-lnia.s | 1 + + gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.s | 1 + + gdb/testsuite/gdb.arch/powerpc-power10.s | 2 ++ + gdb/testsuite/gdb.arch/powerpc-power7.s | 1 + + gdb/testsuite/gdb.arch/powerpc-power8.s | 1 + + gdb/testsuite/gdb.arch/powerpc-power9.s | 1 + + gdb/testsuite/gdb.arch/powerpc-prologue-frame.S | 1 + + gdb/testsuite/gdb.arch/powerpc-stackless.S | 1 + + gdb/testsuite/gdb.arch/powerpc-trap.s | 1 + + gdb/testsuite/gdb.arch/powerpc-vsx.s | 1 + + gdb/testsuite/gdb.arch/powerpc-vsx2.s | 1 + + gdb/testsuite/gdb.arch/powerpc-vsx3.s | 1 + + gdb/testsuite/gdb.arch/powerpc64-trap.s | 1 + + gdb/testsuite/gdb.arch/ppc64-atomic-inst.S | 1 + + gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.S | 1 + + gdb/testsuite/gdb.arch/pr25124.S | 1 + + gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-ld-lw-foo.s | 1 + + gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-mv.s | 1 + + gdb/testsuite/gdb.arch/s390-stackless.S | 1 + + gdb/testsuite/gdb.arch/sparc64-regs.S | 1 + + gdb/testsuite/gdb.arch/thumb-bx-pc.S | 1 + + gdb/testsuite/gdb.arch/thumb-singlestep.S | 1 + + gdb/testsuite/gdb.arch/thumb2-it.S | 1 + + gdb/testsuite/gdb.asm/asmsrc1.s | 1 + + gdb/testsuite/gdb.asm/asmsrc2.s | 1 + + gdb/testsuite/gdb.base/dup-sect.S | 1 + + gdb/testsuite/gdb.btrace/instruction_history.S | 1 + + gdb/testsuite/gdb.btrace/x86-tsx.S | 1 + + gdb/testsuite/gdb.compile/compile-constvar.S | 1 + + gdb/testsuite/gdb.disasm/am33.s | 1 + + gdb/testsuite/gdb.disasm/h8300s.s | 1 + + gdb/testsuite/gdb.disasm/hppa.s | 1 + + gdb/testsuite/gdb.disasm/mn10200.s | 1 + + gdb/testsuite/gdb.disasm/mn10300.s | 1 + + gdb/testsuite/gdb.disasm/sh3.s | 1 + + gdb/testsuite/gdb.disasm/t01_mov.s | 1 + + gdb/testsuite/gdb.disasm/t02_mova.s | 1 + + gdb/testsuite/gdb.disasm/t03_add.s | 1 + + gdb/testsuite/gdb.disasm/t04_sub.s | 1 + + gdb/testsuite/gdb.disasm/t05_cmp.s | 1 + + gdb/testsuite/gdb.disasm/t06_ari2.s | 1 + + gdb/testsuite/gdb.disasm/t07_ari3.s | 1 + + gdb/testsuite/gdb.disasm/t08_or.s | 1 + + gdb/testsuite/gdb.disasm/t09_xor.s | 1 + + gdb/testsuite/gdb.disasm/t10_and.s | 1 + + gdb/testsuite/gdb.disasm/t11_logs.s | 1 + + gdb/testsuite/gdb.disasm/t12_bit.s | 1 + + gdb/testsuite/gdb.disasm/t13_otr.s | 1 + + gdb/testsuite/gdb.dwarf2/dup-psym.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-hello-dbg.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-world-dbg.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-ada-ffffffff.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-anonymous-func.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-bad-elf-other.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-basic.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-canonicalize-type.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-case-insensitive-debug.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-compdir-oldgcc.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-compressed.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-const.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-cu-size.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-dos-drive.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-dummy-cu.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-empty-pc-range.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-entry-value.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-filename.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-icc-opaque.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-icycle.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-inheritance.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-inline-param.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-intercu.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-intermix.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-minsym-in-cu.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-noloc.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap-inner.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap-outer.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-op-call.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-op-out-param.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-op-stack-value.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-param-error.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-producer.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-restore.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-simple-locdesc.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-strp.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-unresolved.S | 1 + + gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.S | 1 + + gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.S | 1 + + gdb/testsuite/gdb.dwarf2/fission-reread.S | 1 + + gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.S | 1 + + gdb/testsuite/gdb.dwarf2/mac-fileno.S | 1 + + gdb/testsuite/gdb.dwarf2/pr11465.S | 1 + + gdb/testsuite/gdb.dwarf2/pr13961.S | 1 + + gdb/testsuite/gdb.linespec/break-asm-file0.s | 1 + + gdb/testsuite/gdb.linespec/break-asm-file1.s | 1 + + gdb/testsuite/gdb.mi/dw2-ref-missing-frame.S | 1 + + gdb/testsuite/gdb.tui/tui-layout-asm-short-prog.S | 1 + + gdb/testsuite/lib/dwarf.exp | 2 ++ + gdb/testsuite/lib/my-syscalls.S | 2 ++ + 135 files changed, 138 insertions(+) + +diff --git a/gdb/testsuite/gdb.arch/amd64-break-on-asm-line.S b/gdb/testsuite/gdb.arch/amd64-break-on-asm-line.S +index 99fa834adca..9af6c8ea5d0 100644 +--- a/gdb/testsuite/gdb.arch/amd64-break-on-asm-line.S ++++ b/gdb/testsuite/gdb.arch/amd64-break-on-asm-line.S +@@ -33,3 +33,4 @@ test: + nop /* Incorrect. */ + nop + nop ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step-avx.S b/gdb/testsuite/gdb.arch/amd64-disp-step-avx.S +index 32e5fc77be8..924deef224f 100644 +--- a/gdb/testsuite/gdb.arch/amd64-disp-step-avx.S ++++ b/gdb/testsuite/gdb.arch/amd64-disp-step-avx.S +@@ -75,3 +75,4 @@ done: + var128: + .8byte 0xaa55aa55aa55aa55 + .8byte 0x55aa55aa55aa55aa ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step.S b/gdb/testsuite/gdb.arch/amd64-disp-step.S +index c2249629a7a..cdf36cbc580 100644 +--- a/gdb/testsuite/gdb.arch/amd64-disp-step.S ++++ b/gdb/testsuite/gdb.arch/amd64-disp-step.S +@@ -179,3 +179,4 @@ test_abs_jmp_end: + test_rep_ret: + repz + ret ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/amd64-i386-address.S b/gdb/testsuite/gdb.arch/amd64-i386-address.S +index cec9898a2f5..fbc7ceadf66 100644 +--- a/gdb/testsuite/gdb.arch/amd64-i386-address.S ++++ b/gdb/testsuite/gdb.arch/amd64-i386-address.S +@@ -22,3 +22,4 @@ _start: .globl _start + int3 + nop + nop ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/amd64-init-x87-values.S b/gdb/testsuite/gdb.arch/amd64-init-x87-values.S +index 8b6dc02d005..de8607c84cf 100644 +--- a/gdb/testsuite/gdb.arch/amd64-init-x87-values.S ++++ b/gdb/testsuite/gdb.arch/amd64-init-x87-values.S +@@ -29,3 +29,4 @@ main: + nop + fld1 + nop ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/amd64-prologue-skip.S b/gdb/testsuite/gdb.arch/amd64-prologue-skip.S +index 096745e3311..1e18150bdf7 100644 +--- a/gdb/testsuite/gdb.arch/amd64-prologue-skip.S ++++ b/gdb/testsuite/gdb.arch/amd64-prologue-skip.S +@@ -26,3 +26,4 @@ pushrbp: .globl pushrbp + #define MINSYM nop; .globl minsym; minsym: nop + /*8*/ MINSYM + /*a*/ hlt ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/amd64-stap-expressions.S b/gdb/testsuite/gdb.arch/amd64-stap-expressions.S +index 0f0dfee84d6..05ba8fc593a 100644 +--- a/gdb/testsuite/gdb.arch/amd64-stap-expressions.S ++++ b/gdb/testsuite/gdb.arch/amd64-stap-expressions.S +@@ -41,3 +41,4 @@ main: + + xor %rax,%rax + ret ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.S b/gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.S +index 5bc8858d3c2..592a875d0fd 100644 +--- a/gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.S ++++ b/gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.S +@@ -40,3 +40,4 @@ main: + STAP_PROBE1(probe, fail2_probe, 23-@$16) + xor %rax,%rax + ret ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/amd64-stap-wrong-subexp.S b/gdb/testsuite/gdb.arch/amd64-stap-wrong-subexp.S +index fcf0b73d6e1..1545ff9d673 100644 +--- a/gdb/testsuite/gdb.arch/amd64-stap-wrong-subexp.S ++++ b/gdb/testsuite/gdb.arch/amd64-stap-wrong-subexp.S +@@ -25,3 +25,4 @@ main: + STAP_PROBE2(probe, bar, -4@-($4), -4@$-3+($22/$2)-$16) + xor %rax,%rax + ret ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-self.S b/gdb/testsuite/gdb.arch/amd64-tailcall-self.S +index f1a3404e865..676875288cd 100644 +--- a/gdb/testsuite/gdb.arch/amd64-tailcall-self.S ++++ b/gdb/testsuite/gdb.arch/amd64-tailcall-self.S +@@ -612,3 +612,4 @@ die10a: + .LASF2: + .string "argv" + .ident "GCC: (GNU) 4.9.2 20150212 (Red Hat 4.9.2-6)" ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/arc-analyze-prologue.S b/gdb/testsuite/gdb.arch/arc-analyze-prologue.S +index de6973f905c..ae7b71e7572 100644 +--- a/gdb/testsuite/gdb.arch/arc-analyze-prologue.S ++++ b/gdb/testsuite/gdb.arch/arc-analyze-prologue.S +@@ -901,3 +901,4 @@ main: + j_s [blink] + + .align 4 ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/arc-decode-insn.S b/gdb/testsuite/gdb.arch/arc-decode-insn.S +index 4228515684a..9f2ed9fb9df 100644 +--- a/gdb/testsuite/gdb.arch/arc-decode-insn.S ++++ b/gdb/testsuite/gdb.arch/arc-decode-insn.S +@@ -1000,3 +1000,4 @@ start_branch_tests: + + .Lend: + ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/arc-disassembler-options.s b/gdb/testsuite/gdb.arch/arc-disassembler-options.s +index cb226996360..5e063b957a4 100644 +--- a/gdb/testsuite/gdb.arch/arc-disassembler-options.s ++++ b/gdb/testsuite/gdb.arch/arc-disassembler-options.s +@@ -19,3 +19,4 @@ + foo: + lr r0, [tlbpd0] + .end foo ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/arm-disp-step.S b/gdb/testsuite/gdb.arch/arm-disp-step.S +index b67e83e56e0..9f687cd6024 100644 +--- a/gdb/testsuite/gdb.arch/arm-disp-step.S ++++ b/gdb/testsuite/gdb.arch/arm-disp-step.S +@@ -391,3 +391,4 @@ test_add_rn_pc_end: + bx lr + .size test_add_rn_pc, .-test_add_rn_pc + #endif ++ .section .note.GNU-stack,"",%progbits +diff --git a/gdb/testsuite/gdb.arch/gdb1291.s b/gdb/testsuite/gdb.arch/gdb1291.s +index 5efe33be200..9ee2b452de9 100644 +--- a/gdb/testsuite/gdb.arch/gdb1291.s ++++ b/gdb/testsuite/gdb.arch/gdb1291.s +@@ -126,3 +126,4 @@ _sub2: + .short 260 + .size _sub2, .-_sub2 + .ident "GCC: (GNU) 3.5.0 20040204 (experimental)" ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/gdb1431.s b/gdb/testsuite/gdb.arch/gdb1431.s +index 0b90f633c90..d373c47b14c 100644 +--- a/gdb/testsuite/gdb.arch/gdb1431.s ++++ b/gdb/testsuite/gdb.arch/gdb1431.s +@@ -126,3 +126,4 @@ _sub2: + .short 260 + .size _sub2, .-_sub2 + .ident "GCC: (GNU) 3.5.0 20040204 (experimental)" ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/i386-cfi-notcurrent.S b/gdb/testsuite/gdb.arch/i386-cfi-notcurrent.S +index 3ed983c96d4..97640530dff 100644 +--- a/gdb/testsuite/gdb.arch/i386-cfi-notcurrent.S ++++ b/gdb/testsuite/gdb.arch/i386-cfi-notcurrent.S +@@ -74,3 +74,4 @@ main: + .cfi_endproc + .LFE2: + .size main, .-main ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/i386-disp-step.S b/gdb/testsuite/gdb.arch/i386-disp-step.S +index af1ac54c9d1..e5f6a4c3669 100644 +--- a/gdb/testsuite/gdb.arch/i386-disp-step.S ++++ b/gdb/testsuite/gdb.arch/i386-disp-step.S +@@ -121,3 +121,4 @@ test_call_end: + .global test_ret + test_ret: + ret ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/i386-float.S b/gdb/testsuite/gdb.arch/i386-float.S +index 82c7902d08a..13bd2c3d77b 100644 +--- a/gdb/testsuite/gdb.arch/i386-float.S ++++ b/gdb/testsuite/gdb.arch/i386-float.S +@@ -36,3 +36,4 @@ SYMBOL(main): + val: .byte 0x00,0x00,0x45,0x07,0x11,0x19,0x22,0xe9,0xfe,0xbf + smallval: .byte 0xe9,0xd0,0xd7,0x65,0x81,0xb7,0x43,0xc6,0x5c,0x6a + bigval: .byte 0x6a,0x45,0x90,0xdc,0x03,0xc1,0xf8,0xc6,0xe5,0x03 ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/i386-permbkpt.S b/gdb/testsuite/gdb.arch/i386-permbkpt.S +index 1a17b2216b3..bdacfbda4a5 100644 +--- a/gdb/testsuite/gdb.arch/i386-permbkpt.S ++++ b/gdb/testsuite/gdb.arch/i386-permbkpt.S +@@ -28,3 +28,4 @@ + SYMBOL(main): + int3 + ret ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/mips-disassembler-options.s b/gdb/testsuite/gdb.arch/mips-disassembler-options.s +index bb7f95dd94c..7fc7cd5a8bd 100644 +--- a/gdb/testsuite/gdb.arch/mips-disassembler-options.s ++++ b/gdb/testsuite/gdb.arch/mips-disassembler-options.s +@@ -28,3 +28,4 @@ foo: + bar: + move $2, $8 + .end bar ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/pa-nullify.s b/gdb/testsuite/gdb.arch/pa-nullify.s +index 8b756bd9836..384a5f58502 100644 +--- a/gdb/testsuite/gdb.arch/pa-nullify.s ++++ b/gdb/testsuite/gdb.arch/pa-nullify.s +@@ -56,3 +56,4 @@ main: + bv,n %r0(%r2) + .EXIT + .PROCEND ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/pa64-nullify.s b/gdb/testsuite/gdb.arch/pa64-nullify.s +index f297699ed7a..6d253828ce0 100644 +--- a/gdb/testsuite/gdb.arch/pa64-nullify.s ++++ b/gdb/testsuite/gdb.arch/pa64-nullify.s +@@ -68,3 +68,4 @@ main: + bve,n (%r2) + .EXIT + .PROCEND ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/powerpc-addpcis.s b/gdb/testsuite/gdb.arch/powerpc-addpcis.s +index dfc922c27fb..84484ec6960 100644 +--- a/gdb/testsuite/gdb.arch/powerpc-addpcis.s ++++ b/gdb/testsuite/gdb.arch/powerpc-addpcis.s +@@ -33,3 +33,4 @@ main: + blr + + ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/powerpc-altivec.s b/gdb/testsuite/gdb.arch/powerpc-altivec.s +index 25400ddaf99..d9d66fd16df 100644 +--- a/gdb/testsuite/gdb.arch/powerpc-altivec.s ++++ b/gdb/testsuite/gdb.arch/powerpc-altivec.s +@@ -213,3 +213,4 @@ func: + .long 0x11e0e28e /* vupklsb v15,v28 */ + .long 0x110042ce /* vupklsh v8,v8 */ + .long 0x13201cc4 /* vxor v25,v0,v3 */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/powerpc-altivec2.s b/gdb/testsuite/gdb.arch/powerpc-altivec2.s +index f01e9a02ad9..4e74044df45 100644 +--- a/gdb/testsuite/gdb.arch/powerpc-altivec2.s ++++ b/gdb/testsuite/gdb.arch/powerpc-altivec2.s +@@ -133,3 +133,4 @@ func: + .long 0x11e0f7c3 /* vpopcntd v15,v30 */ + .long 0x105f36c7 /* vcmpgtud. v2,v31,v6 */ + .long 0x128f17c7 /* vcmpgtsd. v20,v15,v2 */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/powerpc-altivec3.s b/gdb/testsuite/gdb.arch/powerpc-altivec3.s +index ae9571c7372..843a6e8c05f 100644 +--- a/gdb/testsuite/gdb.arch/powerpc-altivec3.s ++++ b/gdb/testsuite/gdb.arch/powerpc-altivec3.s +@@ -86,3 +86,4 @@ func: + .long 0x11e90f4d /* vextuhrx r15,r9,v1 */ + .long 0x12b1878d /* vextuwrx r21,r17,v16 */ + .long 0x1295b5e3 /* vmsumudm v20,v21,v22,v23 */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/powerpc-lnia.s b/gdb/testsuite/gdb.arch/powerpc-lnia.s +index d81607d1043..86fd319ccb2 100644 +--- a/gdb/testsuite/gdb.arch/powerpc-lnia.s ++++ b/gdb/testsuite/gdb.arch/powerpc-lnia.s +@@ -31,3 +31,4 @@ main: + lnia 9 # /* set r9 */ + blr + ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.s b/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.s +index d39ec23bffe..ede6dc936a4 100644 +--- a/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.s ++++ b/gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.s +@@ -43,3 +43,4 @@ mydata: + .long 0xabbbcbdb # <<- loaded into vs7 + .long 0xacbcccdc # <<- + ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/powerpc-power10.s b/gdb/testsuite/gdb.arch/powerpc-power10.s +index 67ccdb42182..9a933d083ff 100644 +--- a/gdb/testsuite/gdb.arch/powerpc-power10.s ++++ b/gdb/testsuite/gdb.arch/powerpc-power10.s +@@ -637,3 +637,5 @@ func: + .quad 0x8006000105000000 /* xxspltiw vs0,0 */ + .quad 0x8006000305000000 /* xxspltiw vs0,3 */ + .quad 0x8006000805000000 /* xxspltiw vs0,8 */ ++ .section .note.GNU-stack,"",@progbits ++ +diff --git a/gdb/testsuite/gdb.arch/powerpc-power7.s b/gdb/testsuite/gdb.arch/powerpc-power7.s +index 92e9bc50eb8..329ed5e7a8a 100644 +--- a/gdb/testsuite/gdb.arch/powerpc-power7.s ++++ b/gdb/testsuite/gdb.arch/powerpc-power7.s +@@ -108,3 +108,4 @@ func: + .long 0x7d80e3a6 /* mtppr r12 */ + .long 0x7da2e3a6 /* mtppr32 r13 */ + .long 0x7d605264 /* tlbie r10,r11 */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/powerpc-power8.s b/gdb/testsuite/gdb.arch/powerpc-power8.s +index 4367a6f6e52..6a8dcc47a77 100644 +--- a/gdb/testsuite/gdb.arch/powerpc-power8.s ++++ b/gdb/testsuite/gdb.arch/powerpc-power8.s +@@ -185,3 +185,4 @@ func: + .long 0x7d81492d /* stwcx. r12,r1,r9 */ + .long 0x7da051ad /* stdcx. r13,0,r10 */ + .long 0x7da151ad /* stdcx. r13,r1,r10 */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/powerpc-power9.s b/gdb/testsuite/gdb.arch/powerpc-power9.s +index d15af59d279..09dcb38183a 100644 +--- a/gdb/testsuite/gdb.arch/powerpc-power9.s ++++ b/gdb/testsuite/gdb.arch/powerpc-power9.s +@@ -384,3 +384,4 @@ func: + .long 0xffd7048e /* mffscrni f30,0 */ + .long 0xffd71c8e /* mffscrni f30,3 */ + .long 0xfff8048e /* mffsl f31 */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/powerpc-prologue-frame.S b/gdb/testsuite/gdb.arch/powerpc-prologue-frame.S +index dd60fcac4e1..d7424ffc9b0 100644 +--- a/gdb/testsuite/gdb.arch/powerpc-prologue-frame.S ++++ b/gdb/testsuite/gdb.arch/powerpc-prologue-frame.S +@@ -33,3 +33,4 @@ FUNC_START(foo) + mr 1,11 + blr + FUNC_END(foo) ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/powerpc-stackless.S b/gdb/testsuite/gdb.arch/powerpc-stackless.S +index 29c16c147dc..452c2b8247b 100644 +--- a/gdb/testsuite/gdb.arch/powerpc-stackless.S ++++ b/gdb/testsuite/gdb.arch/powerpc-stackless.S +@@ -22,3 +22,4 @@ FUNC_START(main) + mtlr sp + blr + FUNC_END(main) ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/powerpc-trap.s b/gdb/testsuite/gdb.arch/powerpc-trap.s +index cc427911529..8e31c02a000 100644 +--- a/gdb/testsuite/gdb.arch/powerpc-trap.s ++++ b/gdb/testsuite/gdb.arch/powerpc-trap.s +@@ -29,3 +29,4 @@ main: + li 3, 0 + blr + ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/powerpc-vsx.s b/gdb/testsuite/gdb.arch/powerpc-vsx.s +index 7604b4a82a5..5ac2cace4fe 100644 +--- a/gdb/testsuite/gdb.arch/powerpc-vsx.s ++++ b/gdb/testsuite/gdb.arch/powerpc-vsx.s +@@ -170,3 +170,4 @@ func: + .long 0xf102e293 /* xxspltw vs40,vs60,2 */ + .long 0x7d00a699 /* lxvd2x vs40,0,r20 */ + .long 0x7d00a799 /* stxvd2x vs40,0,r20 */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/powerpc-vsx2.s b/gdb/testsuite/gdb.arch/powerpc-vsx2.s +index aa3dff6b7dc..71d9cf7af8f 100644 +--- a/gdb/testsuite/gdb.arch/powerpc-vsx2.s ++++ b/gdb/testsuite/gdb.arch/powerpc-vsx2.s +@@ -63,3 +63,4 @@ func: + .long 0xf360d52d /* xscvspdpn vs59,vs26 */ + .long 0xff0e168c /* fmrgow f24,f14,f2 */ + .long 0xfec72f8c /* fmrgew f22,f7,f5 */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/powerpc-vsx3.s b/gdb/testsuite/gdb.arch/powerpc-vsx3.s +index 8dd344dd78f..1e66d21f431 100644 +--- a/gdb/testsuite/gdb.arch/powerpc-vsx3.s ++++ b/gdb/testsuite/gdb.arch/powerpc-vsx3.s +@@ -139,3 +139,4 @@ func: + .long 0xfe766688 /* xscvdpqp v19,v12 */ + .long 0xfdb92688 /* xscvqpsdz v13,v4 */ + .long 0xfcf83ec8 /* xsiexpqp v7,v24,v7 */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/powerpc64-trap.s b/gdb/testsuite/gdb.arch/powerpc64-trap.s +index 6b20e7648aa..75c37afebe1 100644 +--- a/gdb/testsuite/gdb.arch/powerpc64-trap.s ++++ b/gdb/testsuite/gdb.arch/powerpc64-trap.s +@@ -31,3 +31,4 @@ main: + li 3, 0 + blr + ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/ppc64-atomic-inst.S b/gdb/testsuite/gdb.arch/ppc64-atomic-inst.S +index 0dbb25d84d3..9d6b4fed672 100644 +--- a/gdb/testsuite/gdb.arch/ppc64-atomic-inst.S ++++ b/gdb/testsuite/gdb.arch/ppc64-atomic-inst.S +@@ -59,3 +59,4 @@ main: + #else + .size .main,.-.main + #endif ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.S b/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.S +index 873a45af82a..db56803c3ff 100644 +--- a/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.S ++++ b/gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.S +@@ -98,3 +98,4 @@ test_atomic_sequences: + #else + .size .test_atomic_sequences,.-.test_atomic_sequences + #endif ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/pr25124.S b/gdb/testsuite/gdb.arch/pr25124.S +index 1f54cfd585c..7ed0a62ce5c 100644 +--- a/gdb/testsuite/gdb.arch/pr25124.S ++++ b/gdb/testsuite/gdb.arch/pr25124.S +@@ -33,3 +33,4 @@ main: + mov r0, #0 + bx lr + .size main, .-main ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-ld-lw-foo.s b/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-ld-lw-foo.s +index e0c538f8c3e..c12c16eab89 100644 +--- a/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-ld-lw-foo.s ++++ b/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-ld-lw-foo.s +@@ -72,3 +72,4 @@ foo: + addi sp,sp,32 + jr ra + .size foo, .-foo ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-mv.s b/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-mv.s +index aead673f09a..dfb0f361f99 100644 +--- a/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-mv.s ++++ b/gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-mv.s +@@ -45,3 +45,4 @@ foo: + addi sp,sp,32 + jr ra + .size foo, .-foo ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/s390-stackless.S b/gdb/testsuite/gdb.arch/s390-stackless.S +index 9763e1fc8d5..7d2265dcb3a 100644 +--- a/gdb/testsuite/gdb.arch/s390-stackless.S ++++ b/gdb/testsuite/gdb.arch/s390-stackless.S +@@ -31,3 +31,4 @@ main: la %r15,3(0,0) + .byte 0,1 + 1: st %r15,0(%r15) + br %r14 ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/sparc64-regs.S b/gdb/testsuite/gdb.arch/sparc64-regs.S +index cd9301baaa5..ff3c7411946 100644 +--- a/gdb/testsuite/gdb.arch/sparc64-regs.S ++++ b/gdb/testsuite/gdb.arch/sparc64-regs.S +@@ -134,3 +134,4 @@ test_fsr: + .align 8 + flags: .xword 0x0000000000000000 + .size flags, .-flags ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/thumb-bx-pc.S b/gdb/testsuite/gdb.arch/thumb-bx-pc.S +index d97c4bf865f..6d72265e4a7 100644 +--- a/gdb/testsuite/gdb.arch/thumb-bx-pc.S ++++ b/gdb/testsuite/gdb.arch/thumb-bx-pc.S +@@ -32,3 +32,4 @@ main: + mov r0, #0 + bx lr + .size main, .-main ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/thumb-singlestep.S b/gdb/testsuite/gdb.arch/thumb-singlestep.S +index 2a2e8e340e3..c0291a036f9 100644 +--- a/gdb/testsuite/gdb.arch/thumb-singlestep.S ++++ b/gdb/testsuite/gdb.arch/thumb-singlestep.S +@@ -38,3 +38,4 @@ main: + pop {r3, pc} + .size main, .-main + ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/thumb2-it.S b/gdb/testsuite/gdb.arch/thumb2-it.S +index 0b06c82f672..892c562d2eb 100644 +--- a/gdb/testsuite/gdb.arch/thumb2-it.S ++++ b/gdb/testsuite/gdb.arch/thumb2-it.S +@@ -180,3 +180,4 @@ it_breakpoints: + bx lr + + #endif /* __thumb2__ */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.asm/asmsrc1.s b/gdb/testsuite/gdb.asm/asmsrc1.s +index ddf87900842..35b39ca7e1a 100644 +--- a/gdb/testsuite/gdb.asm/asmsrc1.s ++++ b/gdb/testsuite/gdb.asm/asmsrc1.s +@@ -85,3 +85,4 @@ + gdbasm_datavar staticvar 5 + + .include "note.inc" ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.asm/asmsrc2.s b/gdb/testsuite/gdb.asm/asmsrc2.s +index e585ee22c3a..288b708f1f7 100644 +--- a/gdb/testsuite/gdb.asm/asmsrc2.s ++++ b/gdb/testsuite/gdb.asm/asmsrc2.s +@@ -19,3 +19,4 @@ + comment "mark: foo2 leave" + gdbasm_leave + gdbasm_end foo2 ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.base/dup-sect.S b/gdb/testsuite/gdb.base/dup-sect.S +index b33378ec454..2af269fffdf 100644 +--- a/gdb/testsuite/gdb.base/dup-sect.S ++++ b/gdb/testsuite/gdb.base/dup-sect.S +@@ -20,3 +20,4 @@ var1: .byte 1 + + .section sect2, "a" + var2: .byte 2 ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.btrace/instruction_history.S b/gdb/testsuite/gdb.btrace/instruction_history.S +index 8f9b8343453..23901a34446 100644 +--- a/gdb/testsuite/gdb.btrace/instruction_history.S ++++ b/gdb/testsuite/gdb.btrace/instruction_history.S +@@ -30,3 +30,4 @@ loop: + jmp .L1 + .L2: + ret /* bp.2 */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.btrace/x86-tsx.S b/gdb/testsuite/gdb.btrace/x86-tsx.S +index bc4009d0c23..0cfc329342e 100644 +--- a/gdb/testsuite/gdb.btrace/x86-tsx.S ++++ b/gdb/testsuite/gdb.btrace/x86-tsx.S +@@ -27,3 +27,4 @@ test: + .Lhandler: + mov $1, %eax + ret ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.compile/compile-constvar.S b/gdb/testsuite/gdb.compile/compile-constvar.S +index 83644cb4a5d..b2e178c952d 100644 +--- a/gdb/testsuite/gdb.compile/compile-constvar.S ++++ b/gdb/testsuite/gdb.compile/compile-constvar.S +@@ -93,3 +93,4 @@ + .LASF0: + .string "GNU C 4.8.2 20131212 (Red Hat 4.8.2-7) -mtune=generic -march=x86-64 -g" + .ident "GCC: (GNU) 4.8.2 20131212 (Red Hat 4.8.2-7)" ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.disasm/am33.s b/gdb/testsuite/gdb.disasm/am33.s +index a686cef2f74..e699bcffdeb 100644 +--- a/gdb/testsuite/gdb.disasm/am33.s ++++ b/gdb/testsuite/gdb.disasm/am33.s +@@ -522,3 +522,4 @@ dsp_autoincrement_tests: + mov_leq (r1+,4),r2 + mov_lne (r1+,4),r2 + mov_lra (r1+,4),r2 ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.disasm/h8300s.s b/gdb/testsuite/gdb.disasm/h8300s.s +index 6510d40ef4e..0fd86564267 100644 +--- a/gdb/testsuite/gdb.disasm/h8300s.s ++++ b/gdb/testsuite/gdb.disasm/h8300s.s +@@ -354,3 +354,4 @@ system_control_tests: + block_data_transfer_tests: + eepmov.b + eepmov.w ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.disasm/hppa.s b/gdb/testsuite/gdb.disasm/hppa.s +index 593d8bfefee..12ace7d3f15 100644 +--- a/gdb/testsuite/gdb.disasm/hppa.s ++++ b/gdb/testsuite/gdb.disasm/hppa.s +@@ -1736,3 +1736,4 @@ fmemLRbug_tests_4 + bv,n 0(%r2) + .EXIT + .PROCEND ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.disasm/mn10200.s b/gdb/testsuite/gdb.disasm/mn10200.s +index 32357b0401b..c48dd6431fd 100644 +--- a/gdb/testsuite/gdb.disasm/mn10200.s ++++ b/gdb/testsuite/gdb.disasm/mn10200.s +@@ -215,3 +215,4 @@ sub_tests: + sub 32767,a2 + sub 131071,a2 + subc d1,d2 ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.disasm/mn10300.s b/gdb/testsuite/gdb.disasm/mn10300.s +index 3ad6c95e6a1..e7ab6e4cd85 100644 +--- a/gdb/testsuite/gdb.disasm/mn10300.s ++++ b/gdb/testsuite/gdb.disasm/mn10300.s +@@ -298,3 +298,4 @@ sub_tests: + sub 131071,a1 + subc d1,d2 + ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.disasm/sh3.s b/gdb/testsuite/gdb.disasm/sh3.s +index e5969f5ea1a..ab70da38758 100644 +--- a/gdb/testsuite/gdb.disasm/sh3.s ++++ b/gdb/testsuite/gdb.disasm/sh3.s +@@ -52,3 +52,4 @@ _fp_misc_tests: + sts fpscr,r3 + sts.l fpscr,@-r3 + ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.disasm/t01_mov.s b/gdb/testsuite/gdb.disasm/t01_mov.s +index 6848304693f..d79d8aa70f7 100644 +--- a/gdb/testsuite/gdb.disasm/t01_mov.s ++++ b/gdb/testsuite/gdb.disasm/t01_mov.s +@@ -1105,3 +1105,4 @@ label: + + .end + ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.disasm/t02_mova.s b/gdb/testsuite/gdb.disasm/t02_mova.s +index 4615bcc0e0b..b16da0233e4 100644 +--- a/gdb/testsuite/gdb.disasm/t02_mova.s ++++ b/gdb/testsuite/gdb.disasm/t02_mova.s +@@ -236,3 +236,4 @@ _start: + mova/l.l @(0x12345678:32,@0x9ABCDEF0:32.w),er1 ;015F48D99ABCDEF012345678 + + .end ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.disasm/t03_add.s b/gdb/testsuite/gdb.disasm/t03_add.s +index 2b832475ba7..024ae61a2b7 100644 +--- a/gdb/testsuite/gdb.disasm/t03_add.s ++++ b/gdb/testsuite/gdb.disasm/t03_add.s +@@ -976,3 +976,4 @@ _start: + add.l @0x12345678:32,@0x9abcdef0:32 ;01046b2c1234567848109abcdef0 + + .end ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.disasm/t04_sub.s b/gdb/testsuite/gdb.disasm/t04_sub.s +index d851760d8ae..066f0236436 100644 +--- a/gdb/testsuite/gdb.disasm/t04_sub.s ++++ b/gdb/testsuite/gdb.disasm/t04_sub.s +@@ -975,3 +975,4 @@ _start: + sub.l @0x12345678:32,@0x9abcdef0:32 ;01046b2c1234567848309abcdef0 + + .end ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.disasm/t05_cmp.s b/gdb/testsuite/gdb.disasm/t05_cmp.s +index ee034f097c4..8d5b393dcbd 100644 +--- a/gdb/testsuite/gdb.disasm/t05_cmp.s ++++ b/gdb/testsuite/gdb.disasm/t05_cmp.s +@@ -919,3 +919,4 @@ _start: + cmp.l @0x12345678:32,@0x9abcdef0:32 ;01046b2c1234567848209abcdef0 + + .end ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.disasm/t06_ari2.s b/gdb/testsuite/gdb.disasm/t06_ari2.s +index 75a919510b4..dd0e3145547 100644 +--- a/gdb/testsuite/gdb.disasm/t06_ari2.s ++++ b/gdb/testsuite/gdb.disasm/t06_ari2.s +@@ -186,3 +186,4 @@ _start: + divs.l er3,er1 ;01d25331 + + .end ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.disasm/t07_ari3.s b/gdb/testsuite/gdb.disasm/t07_ari3.s +index 6ad7128d3ff..a4afef438be 100644 +--- a/gdb/testsuite/gdb.disasm/t07_ari3.s ++++ b/gdb/testsuite/gdb.disasm/t07_ari3.s +@@ -171,3 +171,4 @@ _start: + exts.l #2,@0x12345678:32 ;01046b281234567817e0 + + .end ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.disasm/t08_or.s b/gdb/testsuite/gdb.disasm/t08_or.s +index da4e216c58b..0fa35abb75e 100644 +--- a/gdb/testsuite/gdb.disasm/t08_or.s ++++ b/gdb/testsuite/gdb.disasm/t08_or.s +@@ -970,3 +970,4 @@ _start: + or.l @0x12345678:32,@0x9abcdef0:32 ;01046b2c1234567848409abcdef0 + + .end ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.disasm/t09_xor.s b/gdb/testsuite/gdb.disasm/t09_xor.s +index ccd479cb20a..05e75105f4d 100644 +--- a/gdb/testsuite/gdb.disasm/t09_xor.s ++++ b/gdb/testsuite/gdb.disasm/t09_xor.s +@@ -970,3 +970,4 @@ _start: + xor.l @0x12345678:32,@0x9abcdef0:32 ;01046b2c1234567848509abcdef0 + + .end ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.disasm/t10_and.s b/gdb/testsuite/gdb.disasm/t10_and.s +index 0459c109f5d..457b67e2483 100644 +--- a/gdb/testsuite/gdb.disasm/t10_and.s ++++ b/gdb/testsuite/gdb.disasm/t10_and.s +@@ -970,3 +970,4 @@ _start: + and.l @0x12345678:32,@0x9abcdef0:32 ;01046b2c1234567848609abcdef0 + + .end ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.disasm/t11_logs.s b/gdb/testsuite/gdb.disasm/t11_logs.s +index 4768591dd7e..228a6740c53 100644 +--- a/gdb/testsuite/gdb.disasm/t11_logs.s ++++ b/gdb/testsuite/gdb.disasm/t11_logs.s +@@ -1175,3 +1175,4 @@ _start: + rotr.l #2,@0x12345678:32 ;01046b281234567813f0 + + .end ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.disasm/t12_bit.s b/gdb/testsuite/gdb.disasm/t12_bit.s +index 4c45b2a02a1..2664a75ad6f 100644 +--- a/gdb/testsuite/gdb.disasm/t12_bit.s ++++ b/gdb/testsuite/gdb.disasm/t12_bit.s +@@ -174,3 +174,4 @@ _start: + bfst r3h,#0x34:8,@0x12345678:32 ;6a3812345678f334 + + .end ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.disasm/t13_otr.s b/gdb/testsuite/gdb.disasm/t13_otr.s +index 69db411ac52..812cbcf3306 100644 +--- a/gdb/testsuite/gdb.disasm/t13_otr.s ++++ b/gdb/testsuite/gdb.disasm/t13_otr.s +@@ -157,3 +157,4 @@ _start: + nop ;0000 + + .end ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dup-psym.S b/gdb/testsuite/gdb.dwarf2/dup-psym.S +index 6bffeab9d3c..d8932673cb5 100644 +--- a/gdb/testsuite/gdb.dwarf2/dup-psym.S ++++ b/gdb/testsuite/gdb.dwarf2/dup-psym.S +@@ -197,3 +197,4 @@ func_cu1: + .byte 1 + + .Lline1_end: ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-hello-dbg.S b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-hello-dbg.S +index 742bf5245cb..7a9e6168b12 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-hello-dbg.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-hello-dbg.S +@@ -149,3 +149,4 @@ LELTP: + .uleb128 0x1 + .byte 0x1 + LELT: ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-world-dbg.S b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-world-dbg.S +index cb875da2c4c..1771593b7e5 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-world-dbg.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-world-dbg.S +@@ -149,3 +149,4 @@ LELTP: + .uleb128 0x1 + .byte 0x1 + LELT: ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ada-ffffffff.S b/gdb/testsuite/gdb.dwarf2/dw2-ada-ffffffff.S +index 5ce56921d4e..2a1d4b5bc28 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-ada-ffffffff.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-ada-ffffffff.S +@@ -53,3 +53,4 @@ debug_end: + .byte 0x0 + .byte 0x0 + .byte 0x0 ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.S b/gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.S +index 0b8e8ccada3..c79fd5c7cbc 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.S +@@ -375,3 +375,4 @@ + + .section .debug_line + .Ldebug_line0: ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-anonymous-func.S b/gdb/testsuite/gdb.dwarf2/dw2-anonymous-func.S +index 3aa369aa6a3..3833799d017 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-anonymous-func.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-anonymous-func.S +@@ -246,3 +246,4 @@ func_cu2: + .byte 1 + + .Lline1_end: ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bad-elf-other.S b/gdb/testsuite/gdb.dwarf2/dw2-bad-elf-other.S +index 83d2147e8c3..3792e70a641 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-bad-elf-other.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-elf-other.S +@@ -27,3 +27,4 @@ some_func: + .size some_func,.-some_func + some_func_end: + nop ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.S b/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.S +index b4583716881..46178d58fad 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.S +@@ -71,3 +71,4 @@ debug_end: + .byte 0x0 + .byte 0x0 + .byte 0x0 ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-basic.S b/gdb/testsuite/gdb.dwarf2/dw2-basic.S +index 93eba201b8b..9be8b9963b5 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-basic.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-basic.S +@@ -197,3 +197,4 @@ func_cu1: + .byte 1 + + .Lline1_end: ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-canonicalize-type.S b/gdb/testsuite/gdb.dwarf2/dw2-canonicalize-type.S +index 2107d88b438..c74781b0de3 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-canonicalize-type.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-canonicalize-type.S +@@ -154,3 +154,4 @@ debug_end: + .byte 0x0 + .byte 0x0 + .byte 0x0 ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive-debug.S b/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive-debug.S +index e51a18186fd..f7dd7ca55e3 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive-debug.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive-debug.S +@@ -126,3 +126,4 @@ + + .byte 0x0 /* Terminator */ + .byte 0x0 /* Terminator */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-compdir-oldgcc.S b/gdb/testsuite/gdb.dwarf2/dw2-compdir-oldgcc.S +index 5128e252896..bc8317752e0 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-compdir-oldgcc.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-compdir-oldgcc.S +@@ -239,3 +239,4 @@ gcc43: .globl gcc43 + .uleb128 1 + .byte 1 + .Lgcc43_end: ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-compressed.S b/gdb/testsuite/gdb.dwarf2/dw2-compressed.S +index 00d7c3aa8fb..8c778423cd8 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-compressed.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-compressed.S +@@ -218,3 +218,4 @@ func_cu1: + .byte 0x9c + .byte 0x00 + .byte 0x92 ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-const.S b/gdb/testsuite/gdb.dwarf2/dw2-const.S +index 09263ff9b08..26fe111369c 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-const.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-const.S +@@ -249,3 +249,4 @@ func_cu1: + .byte 1 + + .Lline1_end: ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.S b/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.S +index 20061ba23e6..8b35f999614 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.S +@@ -113,3 +113,4 @@ + + .byte 0x0 /* Terminator */ + .byte 0x0 /* Terminator */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-cu-size.S b/gdb/testsuite/gdb.dwarf2/dw2-cu-size.S +index 1aad8a5af35..de5759877d2 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-cu-size.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-cu-size.S +@@ -107,3 +107,4 @@ + + .byte 0x0 /* Terminator .debug_abbrev + section. */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-dos-drive.S b/gdb/testsuite/gdb.dwarf2/dw2-dos-drive.S +index 205b7645d54..9d8e400c6a0 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-dos-drive.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-dos-drive.S +@@ -74,3 +74,4 @@ dieb: + .byte 0x0 + + .byte 0x0 ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.S b/gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.S +index 6f0a0a80346..4a28b1f0d7b 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.S +@@ -648,3 +648,4 @@ + .byte 0x0 + .byte 0x0 + ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-dummy-cu.S b/gdb/testsuite/gdb.dwarf2/dw2-dummy-cu.S +index 298658fbdbf..9bf275f13b4 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-dummy-cu.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-dummy-cu.S +@@ -31,3 +31,4 @@ main_end: + .section .debug_abbrev + .Ldebug_abbrev0: + .byte 0x0 ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.S b/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.S +index f6dbb91e14a..b2fb1fcb05c 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.S +@@ -106,3 +106,4 @@ var: .4byte 1 + + .byte 0x0 /* Terminator */ + .byte 0x0 /* Terminator */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-empty-pc-range.S b/gdb/testsuite/gdb.dwarf2/dw2-empty-pc-range.S +index 83cc71fb159..c9ad27b2b37 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-empty-pc-range.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-empty-pc-range.S +@@ -80,3 +80,4 @@ dieb: + .byte 0x0 + + .byte 0x0 ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-entry-value.S b/gdb/testsuite/gdb.dwarf2/dw2-entry-value.S +index 491a985823f..223044d7bf7 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-entry-value.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-entry-value.S +@@ -102,3 +102,4 @@ loclist: + .byte 0x0 + .byte 0x0 + .byte 0x0 ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-filename.S b/gdb/testsuite/gdb.dwarf2/dw2-filename.S +index 635577a2873..7895ab7a2bb 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-filename.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-filename.S +@@ -51,3 +51,4 @@ + + .byte 0x0 /* Terminator */ + .byte 0x0 /* Terminator */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-icc-opaque.S b/gdb/testsuite/gdb.dwarf2/dw2-icc-opaque.S +index 834b35e5f50..61e6e74d902 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-icc-opaque.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-icc-opaque.S +@@ -252,3 +252,4 @@ debug_info_seg3_end: + .byte 0x08 /* DW_FORM_string. */ + .2byte 0x0000 /* End abbrev. */ + .byte 0x00 /* End abbrev table. */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-icycle.S b/gdb/testsuite/gdb.dwarf2/dw2-icycle.S +index 4ccc7bb6947..e63966ccae6 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-icycle.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-icycle.S +@@ -246,3 +246,4 @@ p__top: + .Lline1_begin: + .byte 0 + ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inheritance.S b/gdb/testsuite/gdb.dwarf2/dw2-inheritance.S +index 9c4b576fd39..20b2a9f9c66 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-inheritance.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-inheritance.S +@@ -96,3 +96,4 @@ + + .byte 0x0 /* Terminator */ + .byte 0x0 /* Terminator */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-param.S b/gdb/testsuite/gdb.dwarf2/dw2-inline-param.S +index 1c79805c2b5..14958e6092d 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-param.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-param.S +@@ -150,3 +150,4 @@ + + .byte 0x0 /* Terminator */ + .byte 0x0 /* Terminator */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-intercu.S b/gdb/testsuite/gdb.dwarf2/dw2-intercu.S +index 3c9abadb947..d8857fe675d 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-intercu.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-intercu.S +@@ -314,3 +314,4 @@ func_cu1: + .byte 1 + + .Lline1_end: ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-intermix.S b/gdb/testsuite/gdb.dwarf2/dw2-intermix.S +index a2dd41f0514..208a14fdb5f 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-intermix.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-intermix.S +@@ -198,3 +198,4 @@ func_cu1: + .byte 1 + + .Lline1_end: ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust.S b/gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust.S +index 8f23b3cc7bc..0b8aec84c39 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust.S +@@ -132,3 +132,4 @@ c: .4byte 0 + + .byte 0x0 /* Terminator */ + .byte 0x0 /* Terminator */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-minsym-in-cu.S b/gdb/testsuite/gdb.dwarf2/dw2-minsym-in-cu.S +index 248908bb072..c87092c031a 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-minsym-in-cu.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-minsym-in-cu.S +@@ -115,3 +115,4 @@ func2: + + .byte 0x0 /* Terminator */ + .byte 0x0 /* Terminator */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.S b/gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.S +index f3fe651d92d..c55e86fb127 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.S +@@ -121,3 +121,4 @@ die221: + .string "GNU Modula-2 0.78 (20100402) grafted onto GCC 4.1.2" + .LASF2: + .string "" ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-noloc.S b/gdb/testsuite/gdb.dwarf2/dw2-noloc.S +index 988f0955041..5d7d326aa9f 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-noloc.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-noloc.S +@@ -324,3 +324,4 @@ resolvable: + + .byte 0x0 /* Terminator */ + .byte 0x0 /* Terminator */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap-inner.S b/gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap-inner.S +index 80f62c38a84..e3a02e795b7 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap-inner.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap-inner.S +@@ -178,3 +178,4 @@ inner: + .byte 1 + + .Lline1_end: ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap-outer.S b/gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap-outer.S +index a0bda9fa578..213b0bc3d9e 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap-outer.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap-outer.S +@@ -209,3 +209,4 @@ outer_after: + .byte 1 + + .Lline1_end: ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-op-call.S b/gdb/testsuite/gdb.dwarf2/dw2-op-call.S +index 3069f07ff78..60ef039314c 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-op-call.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-op-call.S +@@ -166,3 +166,4 @@ loclist: + + .byte 0x0 /* Terminator */ + .byte 0x0 /* Terminator */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-op-out-param.S b/gdb/testsuite/gdb.dwarf2/dw2-op-out-param.S +index 91657263288..51f9f09d1d7 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-op-out-param.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-op-out-param.S +@@ -675,3 +675,4 @@ int_param_two_reg_pieces: + .byte 0x0 + + .byte 0x0 ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-op-stack-value.S b/gdb/testsuite/gdb.dwarf2/dw2-op-stack-value.S +index 6c7ff185cfc..eff6467acbc 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-op-stack-value.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-op-stack-value.S +@@ -130,3 +130,4 @@ aa551234: .byte 0xaa, 0x55, 0x12, 0x34 + + .byte 0x0 /* Terminator */ + .byte 0x0 /* Terminator */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-param-error.S b/gdb/testsuite/gdb.dwarf2/dw2-param-error.S +index f22e6450848..a2a5a1d08a9 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-param-error.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-param-error.S +@@ -106,3 +106,4 @@ debug_end: + .byte 0x0 + .byte 0x0 + .byte 0x0 ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-producer.S b/gdb/testsuite/gdb.dwarf2/dw2-producer.S +index df83b67dfdd..011af698920 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-producer.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-producer.S +@@ -198,3 +198,4 @@ func_cu1: + .byte 1 + + .Lline1_end: ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.S b/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.S +index 38bbe013ddc..4780025dca5 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.S +@@ -149,3 +149,4 @@ + + .byte 0x0 /* Terminator */ + .byte 0x0 /* Terminator */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-restore.S b/gdb/testsuite/gdb.dwarf2/dw2-restore.S +index 8ac559f2c45..ad834e992df 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-restore.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-restore.S +@@ -47,3 +47,4 @@ foo: .cfi_startproc + jmp 1b + .cfi_endproc + .endfunc ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-simple-locdesc.S b/gdb/testsuite/gdb.dwarf2/dw2-simple-locdesc.S +index 90f5b8e3217..1da2a52e2dd 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-simple-locdesc.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-simple-locdesc.S +@@ -167,3 +167,4 @@ d: + .string "sizetype" + .LASF1: + .string "char" ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S +index b8a18f647b1..1245c1cf080 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S +@@ -397,3 +397,4 @@ loclist: + .byte 1 + + .Lline1_end: ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.S b/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.S +index dc392fe01d6..8bef4f062f1 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.S +@@ -66,3 +66,4 @@ debug_end: + .byte 0x0 + .byte 0x0 + .byte 0x0 ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-strp.S b/gdb/testsuite/gdb.dwarf2/dw2-strp.S +index 1857a2c10fa..f154b680f5f 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-strp.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-strp.S +@@ -176,3 +176,4 @@ + .string "hello world!\n" + .Lemptyname: + .string "" ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-unresolved.S b/gdb/testsuite/gdb.dwarf2/dw2-unresolved.S +index 2313e0c1c48..d1d78f15a05 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-unresolved.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-unresolved.S +@@ -178,3 +178,4 @@ SYMBOL(var): .byte 2 + + .byte 0x0 /* Terminator */ + .byte 0x0 /* Terminator */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.S b/gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.S +index d05e06c792c..5d402e9cbe7 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.S +@@ -90,3 +90,4 @@ + + .byte 0x0 /* Terminator */ + .byte 0x0 /* Terminator */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.S b/gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.S +index 38231f18f41..0d9ad40c82a 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.S ++++ b/gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.S +@@ -85,3 +85,4 @@ types_start: + .byte 0x0 + .byte 0x0 + .byte 0x0 ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/fission-reread.S b/gdb/testsuite/gdb.dwarf2/fission-reread.S +index c829fef32c7..92c6be49363 100644 +--- a/gdb/testsuite/gdb.dwarf2/fission-reread.S ++++ b/gdb/testsuite/gdb.dwarf2/fission-reread.S +@@ -460,3 +460,4 @@ SYMBOL(main): + .Ldebug_addr0: + .4byte .LFB0 /* DW_AT_low_pc */ + .4byte SYMBOL(baz) /* DW_AT_location */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.S b/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.S +index 268745275f4..5ec9c8c494b 100644 +--- a/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.S ++++ b/gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.S +@@ -164,3 +164,4 @@ __start_high_pc: + + .global __cu_high_pc + __cu_high_pc: ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/mac-fileno.S b/gdb/testsuite/gdb.dwarf2/mac-fileno.S +index 462781495a1..ca70acb421f 100644 +--- a/gdb/testsuite/gdb.dwarf2/mac-fileno.S ++++ b/gdb/testsuite/gdb.dwarf2/mac-fileno.S +@@ -209,3 +209,4 @@ func_cu1: + .uleb128 0x0 /* Included from line number 0 */ + .uleb128 0x0 /* Filename we just started (bug: number too small) */ + .byte 0x0 /* end of CU's macro information */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/pr11465.S b/gdb/testsuite/gdb.dwarf2/pr11465.S +index 28155090f23..eaf2925a768 100644 +--- a/gdb/testsuite/gdb.dwarf2/pr11465.S ++++ b/gdb/testsuite/gdb.dwarf2/pr11465.S +@@ -360,3 +360,4 @@ die149: .uleb128 0x16 /* DW_TAG_variable */ + .LASF4: + .string "GNU C++ 4.4.2" + .ident "GCC: (GNU) 4.4.2" ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.dwarf2/pr13961.S b/gdb/testsuite/gdb.dwarf2/pr13961.S +index d3b4acee53f..aa34a0bafce 100644 +--- a/gdb/testsuite/gdb.dwarf2/pr13961.S ++++ b/gdb/testsuite/gdb.dwarf2/pr13961.S +@@ -378,3 +378,4 @@ SYMBOL(main): + .LASF3: + .string "main" + ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.linespec/break-asm-file0.s b/gdb/testsuite/gdb.linespec/break-asm-file0.s +index 94f0ec0daa3..c3beb38cba4 100644 +--- a/gdb/testsuite/gdb.linespec/break-asm-file0.s ++++ b/gdb/testsuite/gdb.linespec/break-asm-file0.s +@@ -231,3 +231,4 @@ func: + .byte 1 + + .Lline1_end: ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.linespec/break-asm-file1.s b/gdb/testsuite/gdb.linespec/break-asm-file1.s +index 0106394d997..ff97bb3f977 100644 +--- a/gdb/testsuite/gdb.linespec/break-asm-file1.s ++++ b/gdb/testsuite/gdb.linespec/break-asm-file1.s +@@ -257,3 +257,4 @@ func: + .byte 1 + + .Lline1_end: ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.mi/dw2-ref-missing-frame.S b/gdb/testsuite/gdb.mi/dw2-ref-missing-frame.S +index c93c1cdddbf..886c70d8746 100644 +--- a/gdb/testsuite/gdb.mi/dw2-ref-missing-frame.S ++++ b/gdb/testsuite/gdb.mi/dw2-ref-missing-frame.S +@@ -163,3 +163,4 @@ + + .byte 0x0 /* Terminator */ + .byte 0x0 /* Terminator */ ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.tui/tui-layout-asm-short-prog.S b/gdb/testsuite/gdb.tui/tui-layout-asm-short-prog.S +index 4ac9785a5d5..bd81bfd21e1 100644 +--- a/gdb/testsuite/gdb.tui/tui-layout-asm-short-prog.S ++++ b/gdb/testsuite/gdb.tui/tui-layout-asm-short-prog.S +@@ -20,3 +20,4 @@ _start: + .rept 5 + nop + .endr ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp +index 6e8b1ccbe7f..29151574c0d 100644 +--- a/gdb/testsuite/lib/dwarf.exp ++++ b/gdb/testsuite/lib/dwarf.exp +@@ -2910,6 +2910,8 @@ namespace eval Dwarf { + + _write_deferred_output + ++ _section .note.GNU-stack "" progbits ++ + catch {close $_output_file} + set _output_file {} + } +diff --git a/gdb/testsuite/lib/my-syscalls.S b/gdb/testsuite/lib/my-syscalls.S +index 5fc38948217..7f06f9c398b 100644 +--- a/gdb/testsuite/lib/my-syscalls.S ++++ b/gdb/testsuite/lib/my-syscalls.S +@@ -54,3 +54,5 @@ my_execve_syscall: + #else + # error "Unsupported architecture" + #endif ++ ++ .section .note.GNU-stack,"",@progbits +-- +2.35.3 + diff --git a/gdb-testsuite-simplify-gdb.arch-amd64-disp-step-avx..patch b/gdb-testsuite-simplify-gdb.arch-amd64-disp-step-avx..patch new file mode 100644 index 0000000..42d9705 --- /dev/null +++ b/gdb-testsuite-simplify-gdb.arch-amd64-disp-step-avx..patch @@ -0,0 +1,146 @@ +From b40f43e9fd3e523c0c4b50b0dcd8ca743cb6b9a7 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Fri, 17 Feb 2023 15:33:18 +0100 +Subject: [PATCH] [gdb/testsuite] Simplify gdb.arch/amd64-disp-step-avx.exp + +On SLE-11, with glibc 2.11.3, I run into: +... +(gdb) PASS: gdb.arch/amd64-disp-step-avx.exp: vex3: \ + var128 has expected value after +continue^M +Continuing.^M +^M +Program received signal SIGSEGV, Segmentation fault.^M +0x0000000000400283 in _exit (status=0) at \ + ../sysdeps/unix/sysv/linux/_exit.c:33^M +33 ../sysdeps/unix/sysv/linux/_exit.c: No such file or directory.^M +(gdb) FAIL: gdb.arch/amd64-disp-step-avx.exp: \ + continue until exit at amd64-disp-step-avx +... + +This is not related to gdb, we get the same result by just running the exec. + +The problem is that the test-case: +- calls glibc's _exit, and +- uses -nostartfiles -static, putting the burden for any necessary + initialization for calling glibc's _exit on the test-case itself. + +So, when we get to the second insn in _exit: +... +000000000040acb0 <_exit>: + 40acb0: 48 63 d7 movslq %edi,%rdx + 40acb3: 64 4c 8b 14 25 00 00 mov %fs:0x0,%r10 +... +no glibc-related initialization is done, and we run into the segfault. + +Adding this (borrowed from __libc_start_main) in _start in the .S file is +sufficient to fix it: +... + .rept 200 + nop ++ call __pthread_initialize_minimal + .endr +... +But that already doesn't compile with say glibc 2.31, and regardless I think +this sort of fix is too fragile. + +We could of course fix this by simply not running to exit. But ideally we'd +have an exec that doesn't segfault when you just run it. + +Alternatively, we could hand-code an _exit syscall and bypass glibc +all together. But I'd rather fix this in a way that simplifies the test-case. + +Taking a step back, the -nostartfiles -static was added to address that the +xmm registers were not zero at main (which AFAICT is a valid thing to happen). + +[ The change itself silently broke the test-case, needing further fixing by +commit 40310f30a51 ("gdb: make gdb.arch/amd64-disp-step-avx.exp actually test +displaced stepping"). ] + +Instead, simplify things by reverting to the original situation: +- no -nostartfiles -static compilation flags, +- no _start in the .S file, +- use exit instead of _exit in the .S file, +and fix the original problem by setting the xmm registers to zero rather than +checking that they're zero. + +Now that we're no longer forcing -static, add nopie to the flags to prevent +compilation failure with target board unix/-fPIE/-pie. + +Tested on x86_64-linux. + +PR testsuite/30132 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30132 +--- + gdb/testsuite/gdb.arch/amd64-disp-step-avx.S | 12 ++---------- + gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp | 14 ++++---------- + 2 files changed, 6 insertions(+), 20 deletions(-) + +diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step-avx.S b/gdb/testsuite/gdb.arch/amd64-disp-step-avx.S +index 924deef224f..b39ee9f6567 100644 +--- a/gdb/testsuite/gdb.arch/amd64-disp-step-avx.S ++++ b/gdb/testsuite/gdb.arch/amd64-disp-step-avx.S +@@ -19,15 +19,7 @@ + instructions. */ + + .text +- +- .global _start,main +-_start: +- # The area at _start is used as the displaced stepping buffer. Put +- # more than enough nop instructions so that the instructions under test +- # below don't conflict with it. +- .rept 200 +- nop +- .endr ++ .global main + main: + nop + +@@ -66,7 +58,7 @@ ro_var: + + done: + mov $0,%rdi +- call _exit ++ call exit + hlt + + /* RIP-relative data for VEX3 test above. */ +diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp b/gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp +index a64c85bc0e9..e6bdc3c242f 100644 +--- a/gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp ++++ b/gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp +@@ -30,9 +30,7 @@ if { ![have_avx] } { + + standard_testfile .S + +-set options [list debug \ +- additional_flags=-static \ +- additional_flags=-nostartfiles] ++set options [list debug nopie] + if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $options] } { + return -1 + } +@@ -111,14 +109,10 @@ proc disp_step_func { func } { + + # Test a VEX2-encoded RIP-relative instruction. + with_test_prefix "vex2" { +- # This test writes to the 'xmm0' register. As the test is +- # statically linked, we know that the XMM registers should all +- # have the default value of 0 at this point in time. We're about +- # to run an AVX instruction that will modify $xmm0, but lets first +- # confirm that all XMM registers are 0. ++ # Initialize all XMM registers to 0. + for {set i 0 } { $i < 16 } { incr i } { +- gdb_test "p /x \$xmm${i}.uint128" " = 0x0" \ +- "xmm${i} has expected value before" ++ gdb_test_no_output "set \$xmm${i}.uint128 = 0" \ ++ "xmm${i} set to zero" + } + + disp_step_func "test_rip_vex2" + +base-commit: 8f25c476588b41f18ef7b026c81a6b415a809930 +-- +2.35.3 + diff --git a/gdb.changes b/gdb.changes index 8a03bb0..a523130 100644 --- a/gdb.changes +++ b/gdb.changes @@ -1,3 +1,37 @@ +------------------------------------------------------------------- +Thu Feb 16 10:57:10 UTC 2023 - Tom de Vries + +- Patches dropped (bsc#1207712): + * gdb-container-rh-pkg.patch +- Patches added (bsc#1207712): + * gdb-testsuite-add-gdb.suse-debranding.exp.patch +- Patches added (test-case fix): + * gdb-testsuite-fix-gdb.dwarf2-dw2-dir-file-name.exp-w.patch +- Patches added (fedora patch fixup): + * fixup-gdb-test-dw2-aranges.patch +- Patches added (master backports): + * gdb-testsuite-add-xfail-in-gdb.arch-i386-pkru.exp.patch + * gdb-testsuite-add-xfail-in-gdb.python-py-record-btra.patch + * gdb-testsuite-factor-out-proc-linux_kernel_version.patch + * gdb-testsuite-fix-gdb.base-infoline-reloc-main-from-.patch + * gdb-testsuite-fix-gdb.base-nested-subp-2-3-.exp-with.patch + * gdb-testsuite-fix-gdb.threads-schedlock.exp-on-fast-.patch + * gdb-testsuite-handle-missing-.note.gnu-stack.patch + * gdb-testsuite-simplify-gdb.arch-amd64-disp-step-avx..patch + * gdb-testsuite-fix-gdb.threads-schedlock.exp-for-gcc-.patch + * gdb-testsuite-add-xfail-case-in-gdb.python-py-record.patch + * add-elfcompress_zstd.patch + * binutils-gdb-support-zstd-compressed-debug-section.patch + * fix-gdb-build-elf-support-check-lzstd.patch +- Patches removed (dropped by fedora): + * gdb-test-ivy-bridge.patch +- Disable "BuildRequires: %{gcc}-fortran" for SLE-11. +- Maintenance script qa-local.sh: + * Add SLE-11 to configs. + * Build with --no-verify. +- Maintenance script qa.sh: + * Add -sle11. + ------------------------------------------------------------------- Tue Dec 13 10:39:19 UTC 2022 - Tom de Vries diff --git a/gdb.spec b/gdb.spec index 97cfe65..110fb88 100644 --- a/gdb.spec +++ b/gdb.spec @@ -1,7 +1,7 @@ # # spec file # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # Copyright (c) 2012 RedHat # # All modifications and additions to the file contributed by third parties @@ -210,7 +210,6 @@ Patch47: gdb-test-dw2-aranges.patch Patch48: gdb-test-expr-cumulative-archer.patch Patch49: gdb-physname-pr11734-test.patch Patch50: gdb-physname-pr12273-test.patch -Patch51: gdb-test-ivy-bridge.patch Patch52: gdb-runtest-pie-override.patch Patch53: gdb-glibc-strstr-workaround.patch Patch54: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch @@ -227,7 +226,6 @@ Patch65: gdb-fedora-libncursesw.patch Patch66: gdb-opcodes-clflushopt-test.patch Patch67: gdb-6.6-buildid-locate-rpm-scl.patch Patch68: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch -Patch69: gdb-container-rh-pkg.patch Patch70: gdb-rhbz1325795-framefilters-test.patch Patch71: gdb-linux_perf-bundle.patch Patch73: gdb-rhbz1398387-tab-crash-test.patch @@ -241,6 +239,7 @@ Patch74: gdb-rhbz1553104-s390x-arch12-test.patch # - gdb-6.3-rh-testversion-20041202.patch # - gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch # - gdb-6.8-bz466901-backtrace-full-prelinked.patch +# - gdb-container-rh-pkg.patch # # Broken: # - gdb-6.5-BEA-testsuite.patch @@ -251,6 +250,7 @@ Patch74: gdb-rhbz1553104-s390x-arch12-test.patch # Obsolete: # - gdb-6.7-charsign-test.patch # - gdb-6.7-ppc-clobbered-registers-O2-test.patch +# - gdb-test-ivy-bridge.patch (dropped by fedora) # Fedora patches fixup @@ -261,6 +261,7 @@ Patch503: fixup-gdb-glibc-strstr-workaround.patch Patch504: fixup-gdb-6.5-bz243845-stale-testing-zombie-test.patch Patch505: fixup-gdb-test-bt-cfi-without-die.patch Patch506: fixup-2-gdb-rhbz1553104-s390x-arch12-test.patch +Patch507: fixup-gdb-test-dw2-aranges.patch # openSUSE specific @@ -283,6 +284,8 @@ Patch1101: gdb-fix-selftest-fails-with-gdb-build-with-O2-flto.patch Patch1102: gdb-testsuite-fix-gdb-server-ext-run-exp-for-obs.patch # Tests the zypper install hints. Patch1103: gdb-testsuite-add-gdb.suse-zypper-hint.exp.patch +# Tests that no branding is leaked from sourcing the fedora package. +Patch1104: gdb-testsuite-add-gdb.suse-debranding.exp.patch # Patches to upstream @@ -351,10 +354,22 @@ Patch2035: gdb-add-support-for-readline-8.2.patch Patch2036: gdb-fix-assert-in-handle_jit_event.patch Patch2037: gdb-testsuite-fix-gdb.base-break-idempotent.exp-on-ppc.patch Patch2038: powerpc-fix-gdb.base-watchpoint.exp-on-power-9.patch +Patch2039: gdb-testsuite-handle-missing-.note.gnu-stack.patch +Patch2040: gdb-testsuite-fix-gdb.base-infoline-reloc-main-from-.patch +Patch2041: gdb-testsuite-fix-gdb.base-nested-subp-2-3-.exp-with.patch +Patch2042: add-elfcompress_zstd.patch +Patch2043: binutils-gdb-support-zstd-compressed-debug-section.patch +Patch2044: fix-gdb-build-elf-support-check-lzstd.patch # Backports from master, not yet available in next release. -# +Patch2075: gdb-testsuite-add-xfail-in-gdb.arch-i386-pkru.exp.patch +Patch2076: gdb-testsuite-factor-out-proc-linux_kernel_version.patch +Patch2077: gdb-testsuite-add-xfail-in-gdb.python-py-record-btra.patch +Patch2078: gdb-testsuite-fix-gdb.threads-schedlock.exp-on-fast-.patch +Patch2079: gdb-testsuite-simplify-gdb.arch-amd64-disp-step-avx..patch +Patch2080: gdb-testsuite-fix-gdb.threads-schedlock.exp-for-gcc-.patch +Patch2081: gdb-testsuite-add-xfail-case-in-gdb.python-py-record.patch # Backport from gdb-patches @@ -393,6 +408,12 @@ Patch2115: gdb-testsuite-fix-gdb.mi-mi-sym-info.exp-on-opensuse-tumbleweed. # +# Other. Needs comment for each patch. + +# Not a backport, but no need to upstream either. Should be able to drop +# it in next release. +Patch3000: gdb-testsuite-fix-gdb.dwarf2-dw2-dir-file-name.exp-w.patch + BuildRequires: bison BuildRequires: flex %if 0%{suse_version} > 1110 @@ -472,6 +493,10 @@ BuildRequires: libboost_regex-devel BuildRequires: libsource-highlight-devel %endif +%if 0%{?suse_version} >= 1500 +BuildRequires: libzstd-devel +%endif + %if %{build_testsuite} # Copied from gcc9/gcc.spec.in @@ -507,7 +532,15 @@ BuildRequires: libsource-highlight-devel BuildRequires: dejagnu BuildRequires: sharutils # gcc-objc++ is not covered by the GDB testsuite. + +%if 0%{?suse_version} >= 1200 +# Skip for SLE-11 due to: +# unresolvable: conflict for providers of libquadmath0 +# needed by libgfortran3 +# (provider libquadmath0-gcc5 is in conflict with libquadmath0) BuildRequires: %{gcc}-fortran +%endif + BuildRequires: %{gcc}-objc %ifarch %ada_arch BuildRequires: %{gcc}-ada @@ -700,7 +733,6 @@ find -name "*.info*"|xargs rm -f %patch48 -p1 %patch49 -p1 %patch50 -p1 -%patch51 -p1 %patch52 -p1 %patch53 -p1 %patch54 -p1 @@ -717,7 +749,6 @@ find -name "*.info*"|xargs rm -f %patch66 -p1 %patch67 -p1 %patch68 -p1 -%patch69 -p1 %patch70 -p1 %patch71 -p1 %patch73 -p1 @@ -731,6 +762,7 @@ find -name "*.info*"|xargs rm -f %patch504 -p1 %patch505 -p1 %patch506 -p1 +%patch507 -p1 %patch1000 -p1 %patch1001 -p1 @@ -739,6 +771,7 @@ find -name "*.info*"|xargs rm -f %patch1101 -p1 %patch1102 -p1 %patch1103 -p1 +%patch1104 -p1 %patch1500 -p1 %patch1501 -p1 @@ -793,6 +826,20 @@ find -name "*.info*"|xargs rm -f %patch2036 -p1 %patch2037 -p1 %patch2038 -p1 +%patch2039 -p1 +%patch2040 -p1 +%patch2041 -p1 +%patch2042 -p1 +%patch2043 -p1 +%patch2044 -p1 + +%patch2075 -p1 +%patch2076 -p1 +%patch2077 -p1 +%patch2078 -p1 +%patch2079 -p1 +%patch2080 -p1 +%patch2081 -p1 %patch2100 -p1 %patch2101 -p1 @@ -810,6 +857,8 @@ find -name "*.info*"|xargs rm -f %patch2113 -p1 %patch2115 -p1 +%patch3000 -p1 + #unpack libipt %if 0%{have_libipt} tar xzf %{SOURCE7} @@ -1152,7 +1201,8 @@ $CC -o ./orphanripper %{SOURCE2} -Wall -lutil -ggdb2 CHECK="$(echo $CHECK | sed 's#check//unix/[^ ]*#& &/-fPIE/-pie#g')" fi - ./orphanripper make %{?_smp_mflags} -k $CHECK || : + #./orphanripper make %{?_smp_mflags} -k $CHECK || : + ./orphanripper make %{?_smp_mflags} -k $CHECK RUNTESTFLAGS=gdb.python/py-record-btrace.exp ) for t in sum log do diff --git a/qa-local.sh b/qa-local.sh index 0474741..7014e9e 100644 --- a/qa-local.sh +++ b/qa-local.sh @@ -12,6 +12,7 @@ openSUSE_Leap_15.3 openSUSE_Factory SLE-15 SLE-12 +SLE-11 " usage () @@ -75,9 +76,9 @@ have_combo () if [ "$arch" = "i586" ]; then case $c in - SLE-*) + SLE-12|SLE-15) return 1 - ;; + ;; esac fi return 0 @@ -101,6 +102,7 @@ case "$n" in fi osc build \ --clean \ + --no-verify \ --trust-all-projects \ --no-service \ $c $arch \ @@ -132,6 +134,7 @@ case "$n" in mkdir -p $pkgs/$c.$arch osc build \ --clean \ + --no-verify \ --trust-all-projects \ --no-service \ -k $pkgs/$c.$arch \ @@ -184,6 +187,9 @@ case "$n" in SLE-12) bash qa.sh -local -sle12 $pkgs/gdb-testresults.$c.$arch ;; + SLE-11) + bash qa.sh -local -sle11 $pkgs/gdb-testresults.$c.$arch + ;; *) bash qa.sh -local $pkgs/gdb-testresults.$c.$arch ;; diff --git a/qa.sh b/qa.sh index b50fa90..487017e 100644 --- a/qa.sh +++ b/qa.sh @@ -23,7 +23,7 @@ usage () { echo "usage: $0 <1-5>" - echo " $0 -local [ -sle12 | -factory | -aarch64 | -powerpc64le | -s390 | -s390x ] " + echo " $0 -local [ -sle11 | -sle12 | -factory | -aarch64 | -powerpc64le | -s390 | -s390x ] " echo echo "Verify remote results at:" echo " ./binaries-testsuite.distro.arch/gdb-testresults" @@ -46,6 +46,7 @@ fi n="$1" shift +have_sle11=false have_sle12=false have_factory=false have_aarch64=false @@ -55,6 +56,9 @@ have_s390x=false if [ "$n" = "-local" ]; then while [ $# -gt 1 ]; do case $1 in + -sle11) + have_sle11=true + ;; -sle12) have_sle12=true ;; @@ -375,6 +379,52 @@ kfail_sle12=( "FAIL: gdb.guile/scm-disasm.exp: memory-port: disassemble" ) # kfail_sle12 +kfail_sle11=( + "${kfail_sle12[@]}" + + # For SLE-11, libipt is not enabled, so on intel we can run into + # https://sourceware.org/bugzilla/show_bug.cgi?id=30073 affecting + # many test-cases. + "FAIL: gdb.btrace/" + "FAIL: gdb.python/py-record-btrace" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=26956 + "FAIL: gdb.base/command-line-input.exp: print 1" + + # Due to using old python, 2.6. + # For instance, "ValueError: zero length field name in format". + "FAIL: gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event.exp: print test" + "FAIL: gdb.python/py-breakpoint.exp: test_bkpt_address: python gdb.Breakpoint\(" *{}".format\(str\(main_addr\)\)\)" + "FAIL: gdb.python/py-framefilter.exp: info frame filter after disable frame filter" + "FAIL: gdb.python/py-framefilter.exp: info frame filter after reenabling frame filter" + "FAIL: gdb.python/py-framefilter.exp: info frame filter after setting priority" + "FAIL: gdb.python/py-framefilter.exp: info frame filter before disable frame filter" + "FAIL: gdb.python/py-framefilter.exp: info frame filter before setting priority" + "FAIL: gdb.python/py-mi.exp: check tsrvw expression value \(unexpected output\)" + "FAIL: gdb.python/py-mi.exp: check tsrvw varobj value \(unexpected output\)" + "FAIL: gdb.python/py-mi.exp: create tsrvw varobj \(unexpected output\)" + "FAIL: gdb.python/py-prettyprint.exp: c\+\+: print tsrvw" + "FAIL: gdb.python/py-prettyprint.exp: c: print tsrvw" + "FAIL: gdb.python/py-value.exp: attempt to construct large value with small buffer" + "FAIL: gdb.python/py-value.exp: construct array value from buffer" + "FAIL: gdb.python/py-value.exp: construct value from buffer" + "FAIL: gdb.python/py-value.exp: print array value" + "FAIL: gdb.python/py-value.exp: print first array element" + "FAIL: gdb.python/py-value.exp: print out of bounds array element" + "FAIL: gdb.python/py-value.exp: print second array element" + "FAIL: gdb.python/py-value.exp: print third array element" + + # To be investigated. + "FAIL: gdb.base/compare-sections.exp: after run to main: compare-sections -r" + "FAIL: gdb.python/py-framefilter-thread.exp: bt no-filters" + + # Gdb runs out of virtual memory, we can expect an internal error. + "FAIL: gdb.base/gcore-excessive-memory.exp: attach \(GDB internal error\)" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=30154 + "FAIL: gdb.multi/multi-target-no-resumed.exp: inf_A=.: inf_B=.: send_gdb control C \(timeout\)" +) + kfail_factory=( # https://sourceware.org/bugzilla/show_bug.cgi?id=28463 "FAIL: gdb.ada/set_pckd_arr_elt.exp: scenario=minimal: print va.t\(1\) := 15" @@ -794,6 +844,9 @@ case $n in if $have_factory; then kfail+=("${kfail_factory[@]}") fi + if $have_sle11; then + kfail+=("${kfail_sle11[@]}") + fi if $have_sle12; then kfail+=("${kfail_sle12[@]}") fi