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-disable-commit-resumed-in-target_kill.patch b/gdb-disable-commit-resumed-in-target_kill.patch new file mode 100644 index 0000000..3da6c67 --- /dev/null +++ b/gdb-disable-commit-resumed-in-target_kill.patch @@ -0,0 +1,272 @@ +gdb: disable commit resumed in target_kill + +New in this version: + + - Better comment in target_kill + - Uncomment line in test to avoid hanging when exiting, when testing on + native-extended-gdbserver + +PR 28275 shows that doing a sequence of: + + - Run inferior in background (run &) + - kill that inferior + - Run again + +We get into this assertion: + + /home/smarchi/src/binutils-gdb/gdb/target.c:2590: internal-error: target_wait: Assertion `!proc_target->commit_resumed_state' failed. + + #0 internal_error_loc (file=0x5606b344e740 "/home/smarchi/src/binutils-gdb/gdb/target.c", line=2590, fmt=0x5606b344d6a0 "%s: Assertion `%s' failed.") at /home/smarchi/src/binutils-gdb/gdbsupport/errors.cc:54 + #1 0x00005606b6296475 in target_wait (ptid=..., status=0x7fffb9390630, options=...) at /home/smarchi/src/binutils-gdb/gdb/target.c:2590 + #2 0x00005606b5767a98 in startup_inferior (proc_target=0x5606bfccb2a0 , pid=3884857, ntraps=1, last_waitstatus=0x0, last_ptid=0x0) at /home/smarchi/src/binutils-gdb/gdb/nat/fork-inferior.c:482 + #3 0x00005606b4e6c9c5 in gdb_startup_inferior (pid=3884857, num_traps=1) at /home/smarchi/src/binutils-gdb/gdb/fork-child.c:132 + #4 0x00005606b50f14a5 in inf_ptrace_target::create_inferior (this=0x5606bfccb2a0 , exec_file=0x604000039f50 "/home/smarchi/build/binutils-gdb/gdb/test", allargs="", env=0x61500000a580, from_tty=1) + at /home/smarchi/src/binutils-gdb/gdb/inf-ptrace.c:105 + #5 0x00005606b53b6d23 in linux_nat_target::create_inferior (this=0x5606bfccb2a0 , exec_file=0x604000039f50 "/home/smarchi/build/binutils-gdb/gdb/test", allargs="", env=0x61500000a580, from_tty=1) + at /home/smarchi/src/binutils-gdb/gdb/linux-nat.c:978 + #6 0x00005606b512b79b in run_command_1 (args=0x0, from_tty=1, run_how=RUN_NORMAL) at /home/smarchi/src/binutils-gdb/gdb/infcmd.c:468 + #7 0x00005606b512c236 in run_command (args=0x0, from_tty=1) at /home/smarchi/src/binutils-gdb/gdb/infcmd.c:526 + +When running the kill command, commit_resumed_state for the +process_stratum_target (linux-nat, here) is true. After the kill, when +there are no more threads, commit_resumed_state is still true, as +nothing touches this flag during the kill operation. During the +subsequent run command, run_command_1 does: + + scoped_disable_commit_resumed disable_commit_resumed ("running"); + +We would think that this would clear the commit_resumed_state flag of +our native target, but that's not the case, because +scoped_disable_commit_resumed iterates on non-exited inferiors in order +to find active process targets. And after the kill, the inferior is +exited, and the native target was unpushed from it anyway. So +scoped_disable_commit_resumed doesn't touch the commit_resumed_state +flag of the native target, it stays true. When reaching target_wait, in +startup_inferior (to consume the initial expect stop events while the +inferior is starting up and working its way through the shell), +commit_resumed_state is true, breaking the contract saying that +commit_resumed_state is always false when calling the targets' wait +method. + +(note: to be correct, I think that startup_inferior should toggle +commit_resumed between the target_wait and target_resume calls, but I'll +ignore that for now) + +I can see multiple ways to fix this. In the end, we need +commit_resumed_state to be cleared by the time we get to that +target_wait. It could be done at the end of the kill command, or at the +beginning of the run command. + +To keep things in a coherent state, I'd like to make it so that after +the kill command, when the target is left with no threads, its +commit_resumed_state flag is left to false. This way, we can keep +working with the assumption that a target with no threads (and therefore +no running threads) has commit_resumed_state == false. + +Do this by adding a scoped_disable_commit_resumed in target_kill. It +clears the target's commit_resumed_state on entry, and leaves it false +if the target does not have any resumed thread on exit. That means, +even if the target has another inferior with stopped threads, +commit_resumed_state will be left to false, which makes sense. + +Add a test that tries to cover various combinations of actions done +while an inferior is running (and therefore while commit_resumed_state +is true on the process target). + +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28275 +Change-Id: I8e6fe6dc1f475055921520e58cab68024039a1e9 +Approved-By: Andrew Burgess + +--- + gdb/target.c | 9 ++ + .../gdb.base/run-control-while-bg-execution.c | 33 ++++++ + .../gdb.base/run-control-while-bg-execution.exp | 122 +++++++++++++++++++++ + 3 files changed, 164 insertions(+) + +diff --git a/gdb/target.c b/gdb/target.c +index 0c86b571e1c..0eae5307785 100644 +--- a/gdb/target.c ++++ b/gdb/target.c +@@ -908,6 +908,15 @@ add_deprecated_target_alias (const target_info &tinfo, const char *alias) + void + target_kill (void) + { ++ ++ /* If the commit_resume_state of the to-be-killed-inferior's process stratum ++ is true, and this inferior is the last live inferior with resumed threads ++ of that target, then we want to leave commit_resume_state to false, as the ++ target won't have any resumed threads anymore. We achieve this with ++ this scoped_disable_commit_resumed. On construction, it will set the flag ++ to false. On destruction, it will only set it to true if there are resumed ++ threads left. */ ++ scoped_disable_commit_resumed disable ("killing"); + current_inferior ()->top_target ()->kill (); + } + +diff --git a/gdb/testsuite/gdb.base/run-control-while-bg-execution.c b/gdb/testsuite/gdb.base/run-control-while-bg-execution.c +new file mode 100644 +index 00000000000..8092fadc8b9 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/run-control-while-bg-execution.c +@@ -0,0 +1,33 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2020-2022 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 . */ ++ // ++#include ++ ++static pid_t mypid = -1; ++ ++static void ++after_getpid (void) ++{ ++} ++ ++int ++main (void) ++{ ++ mypid = getpid (); ++ after_getpid (); ++ sleep (30); ++} +diff --git a/gdb/testsuite/gdb.base/run-control-while-bg-execution.exp b/gdb/testsuite/gdb.base/run-control-while-bg-execution.exp +new file mode 100644 +index 00000000000..5b4834f0b32 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/run-control-while-bg-execution.exp +@@ -0,0 +1,122 @@ ++# Copyright 2022 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 test aims at testing various operations after getting rid of an inferior ++# that was running in background, or while we have an inferior running in ++# background. The original intent was to expose cases where the commit-resumed ++# state of the process stratum target was not reset properly after killing an ++# inferior running in background, which would be a problem when trying to run ++# again. The test was expanded to test various combinations of ++# run-control-related actions done with an inferior running in background. ++ ++if {[use_gdb_stub]} { ++ unsupported "test requires running" ++ return ++} ++ ++standard_testfile ++ ++if {[build_executable "failed to prepare" $testfile $srcfile]} { ++ return ++} ++ ++# Run one variation of the test: ++# ++# 1. Start an inferior in the background with "run &" ++# 2. Do action 1 ++# 3. Do action 2 ++# ++# Action 1 indicates what to do with the inferior running in background: ++# ++# - kill: kill it ++# - detach: detach it ++# - add: add a new inferior and switch to it, leave the inferior running in ++# background alone ++# - none: do nothing, leave the inferior running in background alone ++# ++# Action 2 indicates what to do after that: ++# ++# - start: use the start command ++# - run: use the run command ++# - attach: start a process outside of GDB and attach it ++proc do_test { action1 action2 } { ++ save_vars { ::GDBFLAGS } { ++ append ::GDBFLAGS " -ex \"maintenance set target-non-stop on\"" ++ clean_restart $::binfile ++ } ++ ++ # Ensure we are at least after the getpid call, should we need it. ++ if { ![runto "after_getpid"] } { ++ return ++ } ++ ++ # Some commands below ask for confirmation. Turn that off for simplicity. ++ gdb_test "set confirm off" ++ gdb_test_multiple "continue &" "" { ++ -re ".*\r\n$::gdb_prompt " { ++ pass $gdb_test_name ++ } ++ } ++ ++ if { $action1 == "kill" } { ++ gdb_test "kill" "Inferior 1 .* killed.*" ++ } elseif { $action1 == "detach" } { ++ set child_pid [get_integer_valueof "mypid" -1] ++ if { $child_pid == -1 } { ++ fail "failed to extract child pid" ++ return ++ } ++ ++ gdb_test "detach" "Inferior 1 .* detached.*" "detach from first instance" ++ ++ # Kill the detached process, to avoid hanging when exiting GDBserver, ++ # when testing with the native-extended-gdbserver board. ++ remote_exec target "kill $child_pid" ++ } elseif { $action1 == "add" } { ++ gdb_test "add-inferior -exec $::binfile" \ ++ "Added inferior 2 on connection 1.*" "add-inferior" ++ gdb_test "inferior 2" "Switching to inferior 2 .*" ++ } elseif { $action1 == "none" } { ++ ++ } else { ++ error "invalid action 1" ++ } ++ ++ if { $action2 == "start" } { ++ gdb_test "start" "Temporary breakpoint $::decimal\(?:\.$::decimal\)?, main .*" ++ } elseif { $action2 == "run" } { ++ gdb_test "break main" "Breakpoint $::decimal at $::hex.*" ++ gdb_test "run" "Breakpoint $::decimal\(?:\.$::decimal\)?, main .*" ++ } elseif { $action2 == "attach" } { ++ set test_spawn_id [spawn_wait_for_attach $::binfile] ++ set test_pid [spawn_id_get_pid $test_spawn_id] ++ ++ if { [gdb_attach $test_pid] } { ++ gdb_test "detach" "Inferior $::decimal .* detached.*" \ ++ "detach from second instance" ++ } ++ ++ # Detach and kill this inferior so we don't leave it around. ++ kill_wait_spawned_process $test_spawn_id ++ } else { ++ error "invalid action 2" ++ } ++} ++ ++foreach_with_prefix action1 { kill detach add none } { ++ foreach_with_prefix action2 { start run attach } { ++ do_test $action1 $action2 ++ } ++} diff --git a/gdb-fix-assert-when-quitting-gdb-while-a-thread-is-stepping.patch b/gdb-fix-assert-when-quitting-gdb-while-a-thread-is-stepping.patch new file mode 100644 index 0000000..7034bb1 --- /dev/null +++ b/gdb-fix-assert-when-quitting-gdb-while-a-thread-is-stepping.patch @@ -0,0 +1,174 @@ +gdb: fix assert when quitting GDB while a thread is stepping + +This commit addresses one of the issues identified in PR gdb/28275. + +Bug gdb/28275 identifies a number of situations in which this assert: + + Assertion `!proc_target->commit_resumed_state' failed. + +could be triggered. There's actually a number of similar places where +this assert is found in GDB, the two of interest in gdb/28275 are in +target_wait and target_stop. + +In one of the comments: + + https://sourceware.org/bugzilla/show_bug.cgi?id=28275#c1 + +steps to trigger the assertion within target_stop were identified when +using a modified version of the gdb.threads/detach-step-over.exp test +script. + +In the gdb.threads/detach-step-over.exp test, we attach to a +multi-threaded inferior, and continue the inferior in asynchronous +(background) mode. Each thread is continuously hitting a conditional +breakpoint where the condition is always false. While the inferior is +running we detach. The goal is that we detach while GDB is performing a +step-over for the conditional breakpoint in at least one thread. + +While detaching, if a step-over is in progress, then GDB has to +complete the step over before we can detach. This involves calling +target_stop and target_wait (see prepare_for_detach). + +As far as gdb/28275 is concerned, the interesting part here, is the +the process_stratum_target::commit_resumed_state variable must be +false when target_stop and target_wait are called. + +This is currently ensured because, in detach_command (infrun.c), we +create an instance of scoped_disable_commit_resumed, this ensures that +when target_detach is called, ::commit_resumed_state will be false. + +The modification to the test that I propose here, and which exposed +the bug, is that, instead of using "detach" to detach from the +inferior, we instead use "quit". Quitting GDB after attaching to an +inferior will cause GDB to first detach, and then exit. + +When we quit GDB we end up calling target_detach via a different code +path, the stack looks like: + + #0 target_detach + #1 kill_or_detach + #2 quit_force + #3 quit_command + +Along this path there is no scoped_disable_commit_resumed created. +::commit_resumed_state can be true when we reach prepare_for_detach, +which calls target_wait and target_stop, so the assertion will trigger. + +In this commit, I propose fixing this by adding the creation of a +scoped_disable_commit_resumed into target_detach. This will ensure +that ::commit_resumed_state is false when calling prepare_for_detach +from within target_detach. + +I did consider placing the scoped_disable_commit_resumed in +prepare_for_detach, however, placing it in target_detach ensures that +the target's commit_resumed_state flag is left to false if the detached +inferior was the last one for that target. It's the same rationale as +for patch "gdb: disable commit resumed in target_kill" that comes later +in this series, but for detach instead of kill. + +detach_command still includes a scoped_disable_commit_resumed too, but I +think it is still relevant to cover the resumption at the end of the +function. + +Co-Authored-By: Simon Marchi +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28275 +Change-Id: Ie128f7aba6ef0e018859275eca372e6ea738e96f + +--- + gdb/target.c | 5 +++ + gdb/testsuite/gdb.threads/detach-step-over.exp | 52 ++++++++++++++++++++++++++ + 2 files changed, 57 insertions(+) + +diff --git a/gdb/target.c b/gdb/target.c +index 1ee051b520a..0c86b571e1c 100644 +--- a/gdb/target.c ++++ b/gdb/target.c +@@ -2558,6 +2558,9 @@ target_preopen (int from_tty) + void + target_detach (inferior *inf, int from_tty) + { ++ /* Thread's don't need to be resumed until the end of this function. */ ++ scoped_disable_commit_resumed disable_commit_resumed ("detaching"); ++ + /* After we have detached, we will clear the register cache for this inferior + by calling registers_changed_ptid. We must save the pid_ptid before + detaching, as the target detach method will clear inf->pid. */ +@@ -2588,6 +2591,8 @@ target_detach (inferior *inf, int from_tty) + inferior_ptid matches save_pid_ptid, but in our case, it does not + call it, as inferior_ptid has been reset. */ + reinit_frame_cache (); ++ ++ disable_commit_resumed.reset_and_commit (); + } + + void +diff --git a/gdb/testsuite/gdb.threads/detach-step-over.exp b/gdb/testsuite/gdb.threads/detach-step-over.exp +index ad9b08f549e..d2cb52423d9 100644 +--- a/gdb/testsuite/gdb.threads/detach-step-over.exp ++++ b/gdb/testsuite/gdb.threads/detach-step-over.exp +@@ -284,6 +284,56 @@ proc_with_prefix test_detach_command {condition_eval target_non_stop non_stop di + kill_wait_spawned_process $test_spawn_id + } + ++# Similar to the proc above, but this time, instead of detaching using ++# the 'detach' command, we quit GDB, this will also trigger a detach, but ++# through a slightly different path, which can expose different bugs. ++proc_with_prefix test_detach_quit {condition_eval target_non_stop \ ++ non_stop displaced} { ++ # If debugging with target remote, check whether the all-stop variant ++ # of the RSP is being used. If so, we can't run the background tests. ++ if {!$non_stop ++ && [target_info exists gdb_protocol] ++ && ([target_info gdb_protocol] == "remote" ++ || [target_info gdb_protocol] == "extended-remote")} { ++ start_gdb_for_test $condition_eval $target_non_stop \ ++ $non_stop $displaced ++ ++ gdb_test_multiple "maint show target-non-stop" "" { ++ -wrap -re "(is|currently) on.*" { ++ } ++ -wrap -re "(is|currently) off.*" { ++ return ++ } ++ } ++ } ++ ++ set test_spawn_id [spawn_wait_for_attach $::binfile] ++ set testpid [spawn_id_get_pid $test_spawn_id] ++ ++ set attempts 3 ++ for {set attempt 1} { $attempt <= $attempts } { incr attempt } { ++ with_test_prefix "iter $attempt" { ++ ++ start_gdb_for_test $condition_eval $target_non_stop \ ++ $non_stop $displaced ++ ++ if {![prepare_test_iter $testpid $non_stop \ ++ $attempt $attempts "$::decimal"]} { ++ kill_wait_spawned_process $test_spawn_id ++ return ++ } ++ ++ gdb_test_multiple "with confirm off -- quit" "" { ++ eof { ++ pass $gdb_test_name ++ } ++ } ++ } ++ } ++ ++ kill_wait_spawned_process $test_spawn_id ++} ++ + # The test program exits after a while, in case GDB crashes. Make it + # wait at least as long as we may wait before declaring a time out + # failure. +@@ -331,6 +381,8 @@ foreach_with_prefix breakpoint-condition-evaluation {"host" "target"} { + foreach_with_prefix displaced {"off" "auto"} { + test_detach_command ${breakpoint-condition-evaluation} \ + ${target-non-stop} ${non-stop} ${displaced} ++ test_detach_quit ${breakpoint-condition-evaluation} \ ++ ${target-non-stop} ${non-stop} ${displaced} + } + } + } diff --git a/gdb-fix-watchpoints-triggered.patch b/gdb-fix-watchpoints-triggered.patch deleted file mode 100644 index 830aa36..0000000 --- a/gdb-fix-watchpoints-triggered.patch +++ /dev/null @@ -1,47 +0,0 @@ -diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c -index 1e524b5942f..459bc13f398 100644 ---- a/gdb/breakpoint.c -+++ b/gdb/breakpoint.c -@@ -4916,6 +4916,7 @@ watchpoints_triggered (const target_waitstatus &ws) - affected by this data address as triggered, and all others as not - triggered. */ - -+ size_t triggered_cnt = 0; - for (breakpoint *b : all_breakpoints ()) - if (is_hardware_watchpoint (b)) - { -@@ -4932,6 +4933,7 @@ watchpoints_triggered (const target_waitstatus &ws) - if (newaddr == start) - { - w->watchpoint_triggered = watch_triggered_yes; -+ triggered_cnt++; - break; - } - } -@@ -4941,11 +4943,26 @@ watchpoints_triggered (const target_waitstatus &ws) - loc->length)) - { - w->watchpoint_triggered = watch_triggered_yes; -+ triggered_cnt++; - break; - } - } - } - -+ if (triggered_cnt == 0) -+ { -+ /* The target could report the data address. But none of the -+ watchpoints was affected by this data address, so mark all -+ watchpoints as unknown. */ -+ for (breakpoint *b : all_breakpoints ()) -+ if (is_hardware_watchpoint (b)) -+ { -+ struct watchpoint *w = (struct watchpoint *) b; -+ -+ w->watchpoint_triggered = watch_triggered_unknown; -+ } -+ } -+ - return 1; - } - 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-new-gdb_attach-to-check-attach-command.patch b/gdb-testsuite-add-new-gdb_attach-to-check-attach-command.patch new file mode 100644 index 0000000..272c878 --- /dev/null +++ b/gdb-testsuite-add-new-gdb_attach-to-check-attach-command.patch @@ -0,0 +1,49 @@ +gdb: testsuite: add new gdb_attach to check "attach" command + +This commit adds new gdb_attach to centralize the failure checking of +"attach" command. Return 0 if attach failed, otherwise return 1. + +Signed-off-by: Tiezhu Yang +Change-Id: I553cf386cef60c67d38e331904b4aa01e132104a + +--- + gdb/testsuite/lib/gdb.exp | 26 ++++++++++++++++++++++++++ + 1 file changed, 26 insertions(+) + +diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp +index 25c1572a53a..5104835a2a9 100644 +--- a/gdb/testsuite/lib/gdb.exp ++++ b/gdb/testsuite/lib/gdb.exp +@@ -5146,6 +5146,32 @@ proc can_spawn_for_attach { } { + return 1 + } + ++# Centralize the failure checking of "attach" command. ++# Return 0 if attach failed, otherwise return 1. ++ ++proc gdb_attach { testpid args } { ++ parse_args { ++ {pattern ""} ++ } ++ ++ if { [llength $args] != 0 } { ++ error "Unexpected arguments: $args" ++ } ++ ++ gdb_test_multiple "attach $testpid" "attach" { ++ -re -wrap "Attaching to.*ptrace: Operation not permitted\\." { ++ unsupported "$gdb_test_name (Operation not permitted)" ++ return 0 ++ } ++ -re -wrap "$pattern" { ++ pass $gdb_test_name ++ return 1 ++ } ++ } ++ ++ return 0 ++} ++ + # Kill a progress previously started with spawn_wait_for_attach, and + # reap its wait status. PROC_SPAWN_ID is the spawn id associated with + # the process. 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-break-idempotent.exp-on-ppc.patch b/gdb-testsuite-fix-gdb.base-break-idempotent.exp-on-ppc.patch new file mode 100644 index 0000000..48b6350 --- /dev/null +++ b/gdb-testsuite-fix-gdb.base-break-idempotent.exp-on-ppc.patch @@ -0,0 +1,93 @@ +gdb/testsuite: fix gdb.base/break-idempotent.exp on ppc + +When running the gdb.base/break-idempotent.exp test on ppc, I was +seeing some test failures (or rather errors), that looked like this: + + (gdb) watch local + Hardware watchpoint 2: local + + has_hw_wp_support: Hardware watchpoint detected + ERROR: no fileid for gcc2-power8 + ERROR: Couldn't send delete breakpoints to GDB. + ERROR OCCURED: can't read "gdb_spawn_id": no such variable + while executing + "expect { + -i 1000 -timeout 100 + -re ".*A problem internal to GDB has been detected" { + fail "$message (GDB internal error)" + gdb_internal_erro..." + ("uplevel" body line 1) + invoked from within + +What happens is that in break-idempotent.exp we basically do this: + + if {[prepare_for_testing "failed to prepare" $binfile $srcfile $opts]} { + continue + } + + # .... + + if {![skip_hw_watchpoint_tests]} { + test_break $always_inserted "watch" + } + +The problem with this is that skip_hw_watchpoint_tests, includes this: + + if { [istarget "i?86-*-*"] + || [istarget "x86_64-*-*"] + || [istarget "ia64-*-*"] + || [istarget "arm*-*-*"] + || [istarget "aarch64*-*-*"] + || ([istarget "powerpc*-*-linux*"] && [has_hw_wp_support]) + || [istarget "s390*-*-*"] } { + return 0 + } + +For powerpc only we call has_hw_wp_support. This is a caching proc +that runs a test within GDB to detect if we have hardware watchpoint +support or not. + +Unfortunately, to run this test we restart GDB, and when the test has +completed, we exit GDB. This means that in break-idempotent.exp, when +we call skip_hw_watchpoint_tests for the first time on powerpc, GDB +will unexpectedly be exited. When we later call delete_breakpoints we +see the errors I reported above. + +The fix is to call skip_hw_watchpoint_tests early, before we start GDB +as part of the break-idempotent.exp script, and store the result in a +variable, we can then check this variable in the script as needed. + +After this change break-idempotent.exp runs fine on powerpc. + +Co-authored-by: Andrew Burgess + +--- + gdb/testsuite/gdb.base/break-idempotent.exp | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.base/break-idempotent.exp b/gdb/testsuite/gdb.base/break-idempotent.exp +index 29002f103a8..837ac000b57 100644 +--- a/gdb/testsuite/gdb.base/break-idempotent.exp ++++ b/gdb/testsuite/gdb.base/break-idempotent.exp +@@ -36,6 +36,12 @@ + + standard_testfile + ++# The skip_hw_watchpoint_tests starts GDB on a small test program to ++# check if HW watchpoints are supported. We do not want to restart ++# GDB after this test script has itself started GDB, so call ++# skip_hw_watchpoint_tests first and cache the result. ++set skip_hw_watchpoint_tests_p [skip_hw_watchpoint_tests] ++ + # Force a breakpoint re-set in GDB. Currently this is done by + # reloading symbols with the "file" command. + +@@ -174,7 +180,7 @@ foreach_with_prefix pie { "nopie" "pie" } { + test_break $always_inserted "hbreak" + } + +- if {![skip_hw_watchpoint_tests]} { ++ if {!$skip_hw_watchpoint_tests_p} { + test_break $always_inserted "watch" + } + 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-fix-race-in-gdb.threads-detach-step-over.exp.patch b/gdb-testsuite-fix-race-in-gdb.threads-detach-step-over.exp.patch deleted file mode 100644 index ec3d24c..0000000 --- a/gdb-testsuite-fix-race-in-gdb.threads-detach-step-over.exp.patch +++ /dev/null @@ -1,76 +0,0 @@ -gdb-testsuite-fix-race-in-gdb.threads-detach-step-over.exp - -[gdb/testsuite] Fix race in gdb.threads/detach-step-over.exp - -On OBS with openSUSE Leap 15.2 and target board unix/m32, I run into: -... -FAIL: gdb.threads/detach-step-over.exp: \ - breakpoint-condition-evaluation=host: target-non-stop=off: non-stop=off: \ - displaced=off: iter 1: all threads running -... - -I can easily reproduce this by doing: -... - - # Wait a bit, to give time for the threads to hit the - # breakpoint. -- sleep 1 - - set running_count 0 - set interrupted 0 -... - -Fix this by counting the running threads in a loop. - -Tested on x86_64-linux. - ---- - gdb/testsuite/gdb.threads/detach-step-over.exp | 26 +++++++++++++++++++++++--- - 1 file changed, 23 insertions(+), 3 deletions(-) - -diff --git a/gdb/testsuite/gdb.threads/detach-step-over.exp b/gdb/testsuite/gdb.threads/detach-step-over.exp -index 27718551188..d6fba07b486 100644 ---- a/gdb/testsuite/gdb.threads/detach-step-over.exp -+++ b/gdb/testsuite/gdb.threads/detach-step-over.exp -@@ -203,7 +203,8 @@ proc test {condition_eval target_non_stop non_stop displaced} { - - set running_count 0 - set interrupted 0 -- gdb_test_multiple "info threads" "all threads running" { -+ set running_expected [expr ($n_threads + 1) * 2] -+ gdb_test_multiple "info threads" "threads running" { - -re "\\(running\\)" { - incr running_count - exp_continue -@@ -224,10 +225,29 @@ proc test {condition_eval target_non_stop non_stop displaced} { - } - } - } -- -re "$gdb_prompt $" { -- gdb_assert {$running_count == ($n_threads + 1) * 2} $gdb_test_name -+ -re "$gdb_prompt " { - } - } -+ if { $interrupted == 0 } { -+ while { $running_count < $running_expected } { -+ sleep 10 -+ set prev_running_count $running_count -+ set running_count 0 -+ gdb_test_multiple "info threads" "threads running" { -+ -re "\\(running\\)" { -+ incr running_count -+ exp_continue -+ } -+ -re "$gdb_prompt $" { -+ } -+ } -+ if { $running_count == $prev_running_count } { -+ break -+ } -+ } -+ gdb_assert {$running_count == $running_expected} \ -+ "all threads running" -+ } - - gdb_test "detach" "Detaching from.*" - 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-refactor-gdb.threads-detach-step-over.exp.patch b/gdb-testsuite-refactor-gdb.threads-detach-step-over.exp.patch new file mode 100644 index 0000000..5813b24 --- /dev/null +++ b/gdb-testsuite-refactor-gdb.threads-detach-step-over.exp.patch @@ -0,0 +1,305 @@ +gdb/testsuite: refactor gdb.threads/detach-step-over.exp + +Factor out some bits of gdb.threads/detach-step-over.exp to procs in +preparation to adding some new variations of the test. Rename the +existing "test" proc and make it use proc_with_prefix. + +Co-Authored-By: Simon Marchi +Change-Id: Ib4412545c81c8556029e0f7bfa9dd48d7a9f3189 + +--- + gdb/testsuite/gdb.threads/detach-step-over.exp | 238 ++++++++++++++----------- + 1 file changed, 138 insertions(+), 100 deletions(-) + +diff --git a/gdb/testsuite/gdb.threads/detach-step-over.exp b/gdb/testsuite/gdb.threads/detach-step-over.exp +index 917be2ef378..ad9b08f549e 100644 +--- a/gdb/testsuite/gdb.threads/detach-step-over.exp ++++ b/gdb/testsuite/gdb.threads/detach-step-over.exp +@@ -56,11 +56,11 @@ standard_testfile + + set bp_lineno [gdb_get_line_number "Set breakpoint here"] + +-# The test proper. See description above. +-proc test {condition_eval target_non_stop non_stop displaced} { +- # Number of threads started by the program. +- set n_threads 10 ++# Number of threads started by the program. ++set n_threads 10 + ++# Start GDB, configuring various settings according to the arguments. ++proc start_gdb_for_test {condition_eval target_non_stop non_stop displaced} { + save_vars { ::GDBFLAGS } { + append ::GDBFLAGS " -ex \"maint set target-non-stop $target_non_stop\"" + append ::GDBFLAGS " -ex \"set non-stop $non_stop\"" +@@ -69,10 +69,137 @@ proc test {condition_eval target_non_stop non_stop displaced} { + clean_restart $::binfile + } + ++ gdb_test_no_output "set breakpoint condition-evaluation $condition_eval" ++} ++ ++# Use the 'attach' command to attach to process with pid TESTPID. Return true ++# if we believe GDB has attached and we are back at the GDB prompt, otherwise, ++# return false. ++proc attach_to {testpid} { ++ with_timeout_factor 2 { ++ set attached 0 ++ set saw_attaching 0 ++ gdb_test_multiple "attach $testpid" "attach" { ++ -re "Attaching to program.*process $testpid\r\n" { ++ set saw_attaching 1 ++ exp_continue ++ } ++ -re "new threads in iteration" { ++ # Seen when "set debug libthread_db" is on. ++ exp_continue ++ } ++ -re "Reading symbols from|Expanding full symbols from" { ++ # Prevent -readnow timeout. ++ exp_continue ++ } ++ -re "is a zombie - the process has already terminated.*$::gdb_prompt " { ++ fail $gdb_test_name ++ } ++ -re "Unable to attach: .*$::gdb_prompt " { ++ fail $gdb_test_name ++ } ++ -re "\r\n$::gdb_prompt " { ++ if { $saw_attaching } { ++ set attached 1 ++ pass $gdb_test_name ++ } else { ++ fail $gdb_test_name ++ } ++ } ++ } ++ } ++ ++ return $attached ++} ++ ++# After attaching to a multi-threaded inferior in non-stop mode, we expect to ++# see a stop message from each thread. This proc waits for all of these stop ++# messages. TID_RE is a regexp used to match the thread-id of the stopped ++# thread. ++# ++# Return true if we saw a stop from each of the expected threads (based on the ++# global N_THREADS value), otherwise, return false. ++proc check_stops_after_non_stop_attach {tid_re} { ++ set any "\[^\r\n\]*" ++ ++ # In non-stop, we will see one stop per thread after the prompt. ++ set stops 0 ++ set test "seen all stops" ++ for {set thread 1} { $thread <= $::n_threads } { incr thread } { ++ if {[gdb_test_multiple "" $test { ++ -re "Thread ${tid_re} ${any} stopped" { ++ incr stops ++ } ++ }] != 0} { ++ break ++ } ++ } ++ ++ # If we haven't seen all stops, then the ++ # gdb_test_multiple in the loop above will have ++ # already issued a FAIL. ++ if {$stops != $::n_threads} { ++ return false ++ } ++ pass $test ++ return true ++} ++ ++# Prepare for a single test iteration. TESTPID is the pid of the process GDB ++# will be attached too. NON_STOP indicates if GDB is configured in non-stop ++# mode or not. ATTEMPT is the current attempt number, and ATTEMPTS is the ++# maximum number of attempts we plan to run. TID_RE is a string used to match ++# against a thread-id in GDB's stop messages. ++# ++# Return true if everything is prepared correctly, otherwise return false. ++proc prepare_test_iter {testpid non_stop attempt attempts tid_re} { ++ if {![attach_to $testpid]} { ++ return false ++ } ++ ++ if {$non_stop} { ++ if {![check_stops_after_non_stop_attach $tid_re]} { ++ return false ++ } ++ } ++ ++ gdb_test "break ${::srcfile}:${::bp_lineno} if 0" "Breakpoint.*" \ ++ "break LOC if 0" ++ ++ if {$attempt < $attempts} { ++ # Kick the time out timer for another round. ++ gdb_test "print again = 1" " = 1" "reset timer in the inferior" ++ # Show the time we had left in the logs, in case ++ # something goes wrong. ++ gdb_test "print seconds_left" " = .*" ++ } ++ ++ if {$non_stop} { ++ set cont_cmd "continue -a &" ++ } else { ++ set cont_cmd "continue &" ++ } ++ ++ set cont_cmd_re [string_to_regexp $cont_cmd] ++ gdb_test_multiple $cont_cmd "" { ++ -re "^$cont_cmd_re\r\nContinuing\.\r\n$::gdb_prompt " { ++ pass $gdb_test_name ++ } ++ } ++ ++ # Wait a bit, to give time for the threads to hit the ++ # breakpoint. ++ sleep 1 ++ ++ return true ++} ++ ++# The test proper. See the description at the top of the file. ++proc_with_prefix test_detach_command {condition_eval target_non_stop non_stop displaced} { + set test_spawn_id [spawn_wait_for_attach $::binfile] + set testpid [spawn_id_get_pid $test_spawn_id] + +- set any "\[^\r\n\]*" ++ start_gdb_for_test $condition_eval $target_non_stop $non_stop $displaced + + gdb_test "add-inferior" "Added inferior 2.*" + gdb_test "inferior 2" "Switching to .*" +@@ -84,8 +211,6 @@ proc test {condition_eval target_non_stop non_stop displaced} { + return + } + +- gdb_test_no_output "set breakpoint condition-evaluation $condition_eval" +- + # Get the PID of the test process. + set pid_inf2 "" + gdb_test_multiple "p mypid" "get pid of inferior 2" { +@@ -100,101 +225,12 @@ proc test {condition_eval target_non_stop non_stop displaced} { + with_test_prefix "iter $attempt" { + gdb_test "inferior 1" "Switching to .*" + +- with_timeout_factor 2 { +- set attached 0 +- set saw_attaching 0 +- set eperm 0 +- set test "attach" +- gdb_test_multiple "attach $testpid" $test { +- -re "Attaching to program.*process $testpid\r\n" { +- set saw_attaching 1 +- exp_continue +- } +- -re "new threads in iteration" { +- # Seen when "set debug libthread_db" is on. +- exp_continue +- } +- -re "Reading symbols from|Expanding full symbols from" { +- # Prevent -readnow timeout. +- exp_continue +- } +- -re "is a zombie - the process has already terminated.*$::gdb_prompt " { +- fail $gdb_test_name +- } +- -re "Unable to attach: .*$::gdb_prompt " { +- fail $gdb_test_name +- } +- -re "\r\n$::gdb_prompt " { +- if { $saw_attaching } { +- set attached 1 +- pass $test +- } else { +- fail $test +- } +- } +- } +- } +- +- if {!$attached} { ++ if {![prepare_test_iter $testpid $non_stop \ ++ $attempt $attempts "$::decimal\.$::decimal"]} { + kill_wait_spawned_process $test_spawn_id + return + } + +- if {$non_stop} { +- # In non-stop, we will see one stop per thread after +- # the prompt. +- set stops 0 +- set tid_re "$::decimal\.$::decimal" +- set test "seen all stops" +- for {set thread 1} { $thread <= $n_threads } { incr thread } { +- if {[gdb_test_multiple "" $test { +- -re "Thread ${tid_re} ${any} stopped" { +- incr stops +- } +- }] != 0} { +- break +- } +- } +- +- # If we haven't seen all stops, then the +- # gdb_test_multiple in the loop above will have +- # already issued a FAIL. +- if {$stops != $n_threads} { +- kill_wait_spawned_process $test_spawn_id +- return +- } +- pass $test +- } +- +- # Set threads stepping over a breakpoint continuously. +- gdb_test "break $::srcfile:$::bp_lineno if 0" "Breakpoint.*" \ +- "break LOC if 0" +- +- if {$attempt < $attempts} { +- # Kick the time out timer for another round. +- gdb_test "print again = 1" " = 1" "reset timer in the inferior" +- # Show the time we had left in the logs, in case +- # something goes wrong. +- gdb_test "print seconds_left" " = .*" +- } +- +- if {$non_stop} { +- set cont_cmd "continue -a &" +- } else { +- set cont_cmd "continue &" +- } +- +- set cont_cmd_re [string_to_regexp $cont_cmd] +- gdb_test_multiple $cont_cmd "" { +- -re "^$cont_cmd_re\r\nContinuing\.\r\n$::gdb_prompt " { +- pass $gdb_test_name +- } +- } +- +- # Wait a bit, to give time for the threads to hit the +- # breakpoint. +- sleep 1 +- + set running_count 0 + set interrupted 0 + gdb_test_multiple "info threads" "all threads running" { +@@ -219,7 +255,8 @@ proc test {condition_eval target_non_stop non_stop displaced} { + } + } + -re "$::gdb_prompt $" { +- gdb_assert {$running_count == ($n_threads + 1) * 2} $gdb_test_name ++ gdb_assert {$running_count == ($::n_threads + 1) * 2} \ ++ $gdb_test_name + } + } + +@@ -292,7 +329,8 @@ foreach_with_prefix breakpoint-condition-evaluation {"host" "target"} { + } + + foreach_with_prefix displaced {"off" "auto"} { +- test ${breakpoint-condition-evaluation} ${target-non-stop} ${non-stop} ${displaced} ++ test_detach_command ${breakpoint-condition-evaluation} \ ++ ${target-non-stop} ${non-stop} ${displaced} + } + } + } diff --git a/gdb-testsuite-remove-global-declarations-in-gdb.threads-detach-step-over.exp.patch b/gdb-testsuite-remove-global-declarations-in-gdb.threads-detach-step-over.exp.patch new file mode 100644 index 0000000..a53f78a --- /dev/null +++ b/gdb-testsuite-remove-global-declarations-in-gdb.threads-detach-step-over.exp.patch @@ -0,0 +1,127 @@ +gdb/testsuite: remove global declarations in gdb.threads/detach-step-over.exp + +Before doing further changes to this file, change to use the :: notation +instead of declaring global variables with the `global` keyword. + +Change-Id: I72301fd8f4693fea61aac054ba17245a1f4442fb +Approved-By: Andrew Burgess + +--- + gdb/testsuite/gdb.threads/detach-step-over.exp | 40 +++++++++++--------------- + 1 file changed, 17 insertions(+), 23 deletions(-) + +diff --git a/gdb/testsuite/gdb.threads/detach-step-over.exp b/gdb/testsuite/gdb.threads/detach-step-over.exp +index 15af7e0e723..917be2ef378 100644 +--- a/gdb/testsuite/gdb.threads/detach-step-over.exp ++++ b/gdb/testsuite/gdb.threads/detach-step-over.exp +@@ -58,24 +58,18 @@ set bp_lineno [gdb_get_line_number "Set breakpoint here"] + + # The test proper. See description above. + proc test {condition_eval target_non_stop non_stop displaced} { +- global binfile srcfile +- global gdb_prompt +- global decimal +- global bp_lineno +- global GDBFLAGS +- + # Number of threads started by the program. + set n_threads 10 + +- save_vars { GDBFLAGS } { +- append GDBFLAGS " -ex \"maint set target-non-stop $target_non_stop\"" +- append GDBFLAGS " -ex \"set non-stop $non_stop\"" +- append GDBFLAGS " -ex \"set displaced $displaced\"" +- append GDBFLAGS " -ex \"set schedule-multiple on\"" +- clean_restart $binfile ++ save_vars { ::GDBFLAGS } { ++ append ::GDBFLAGS " -ex \"maint set target-non-stop $target_non_stop\"" ++ append ::GDBFLAGS " -ex \"set non-stop $non_stop\"" ++ append ::GDBFLAGS " -ex \"set displaced $displaced\"" ++ append ::GDBFLAGS " -ex \"set schedule-multiple on\"" ++ clean_restart $::binfile + } + +- set test_spawn_id [spawn_wait_for_attach $binfile] ++ set test_spawn_id [spawn_wait_for_attach $::binfile] + set testpid [spawn_id_get_pid $test_spawn_id] + + set any "\[^\r\n\]*" +@@ -83,7 +77,7 @@ proc test {condition_eval target_non_stop non_stop displaced} { + gdb_test "add-inferior" "Added inferior 2.*" + gdb_test "inferior 2" "Switching to .*" + +- gdb_load $binfile ++ gdb_load $::binfile + if ![runto setup_done] then { + fail "can't run to setup_done" + kill_wait_spawned_process $test_spawn_id +@@ -95,7 +89,7 @@ proc test {condition_eval target_non_stop non_stop displaced} { + # Get the PID of the test process. + set pid_inf2 "" + gdb_test_multiple "p mypid" "get pid of inferior 2" { +- -re " = ($decimal)\r\n$gdb_prompt $" { ++ -re " = ($::decimal)\r\n$::gdb_prompt $" { + set pid_inf2 $expect_out(1,string) + pass $gdb_test_name + } +@@ -124,13 +118,13 @@ proc test {condition_eval target_non_stop non_stop displaced} { + # Prevent -readnow timeout. + exp_continue + } +- -re "is a zombie - the process has already terminated.*$gdb_prompt " { ++ -re "is a zombie - the process has already terminated.*$::gdb_prompt " { + fail $gdb_test_name + } +- -re "Unable to attach: .*$gdb_prompt " { ++ -re "Unable to attach: .*$::gdb_prompt " { + fail $gdb_test_name + } +- -re "\r\n$gdb_prompt " { ++ -re "\r\n$::gdb_prompt " { + if { $saw_attaching } { + set attached 1 + pass $test +@@ -173,7 +167,7 @@ proc test {condition_eval target_non_stop non_stop displaced} { + } + + # Set threads stepping over a breakpoint continuously. +- gdb_test "break $srcfile:$bp_lineno if 0" "Breakpoint.*" \ ++ gdb_test "break $::srcfile:$::bp_lineno if 0" "Breakpoint.*" \ + "break LOC if 0" + + if {$attempt < $attempts} { +@@ -192,7 +186,7 @@ proc test {condition_eval target_non_stop non_stop displaced} { + + set cont_cmd_re [string_to_regexp $cont_cmd] + gdb_test_multiple $cont_cmd "" { +- -re "^$cont_cmd_re\r\nContinuing\.\r\n$gdb_prompt " { ++ -re "^$cont_cmd_re\r\nContinuing\.\r\n$::gdb_prompt " { + pass $gdb_test_name + } + } +@@ -208,14 +202,14 @@ proc test {condition_eval target_non_stop non_stop displaced} { + incr running_count + exp_continue + } +- -re "Cannot execute this command while the target is running.*$gdb_prompt $" { ++ -re "Cannot execute this command while the target is running.*$::gdb_prompt $" { + # Testing against a remote server that doesn't do + # non-stop mode. Explicitly interrupt. This + # doesn't test the same code paths in GDB, but + # it's still something. + set interrupted 1 + gdb_test_multiple "interrupt" "" { +- -re "$gdb_prompt " { ++ -re "$::gdb_prompt " { + gdb_test_multiple "" $gdb_test_name { + -re "received signal SIGINT, Interrupt" { + pass $gdb_test_name +@@ -224,7 +218,7 @@ proc test {condition_eval target_non_stop non_stop displaced} { + } + } + } +- -re "$gdb_prompt $" { ++ -re "$::gdb_prompt $" { + gdb_assert {$running_count == ($n_threads + 1) * 2} $gdb_test_name + } + } 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 05fa390..d8c72fd 100644 --- a/gdb.changes +++ b/gdb.changes @@ -1,3 +1,142 @@ +------------------------------------------------------------------- +Fri Mar 3 12:41:21 UTC 2023 - Tom de Vries + +- Maintenance script qa.sh: + * Expand kfail pattern for PR29897. + * Add PR29965 kfail. + +------------------------------------------------------------------- +Thu Mar 2 08:28:32 UTC 2023 - Tom de Vries + +- Re-enable testing all test-cases, undoing accidental change in + previous commit. +- Add --with=for_chroot. + +------------------------------------------------------------------- +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 + +- Maintenance script qa.sh: + * Re-enable PR26284 kfails. + * Remove mention of PR28275. + * Add PR29897 kfail. +- Mention CVE-2018-7208 and CVE-2017-16829. + +------------------------------------------------------------------- +Tue Dec 13 09:52:56 UTC 2022 - Tom de Vries + +- Mention SLE-21561, bnc#1081527, and bnc#1068950. + +------------------------------------------------------------------- +Thu Dec 1 15:20:21 UTC 2022 - Tom de Vries + +- Patches added (gdb 12 release branch backports): + * gdb-disable-commit-resumed-in-target_kill.patch + * gdb-fix-assert-when-quitting-gdb-while-a-thread-is-stepping.patch + * gdb-testsuite-add-new-gdb_attach-to-check-attach-command.patch + * gdb-testsuite-refactor-gdb.threads-detach-step-over.exp.patch + * gdb-testsuite-remove-global-declarations-in-gdb.threads-detach-step-over.exp.patch + * gdbserver-switch-to-right-process-in-find_one_thread.patch +- Patches removed: + * gdb-testsuite-fix-race-in-gdb.threads-detach-step-over.exp.patch +- Maintenance script qa.sh: + * Disable PR26284 kfails. + * Add PR29841 kfails. + * Add kfail_powerpc64le_sle12, kfail_s390 and kfail_s390x. + * Add -s390 and -s390x. + * Add gdb.base/gdb-rhbz1156192-recursive-dlopen.exp kfail. + * Add PR26967 kfails. + * Move PR27027 kfails from kfail_factory to kfail. + * Add -ppc64le alias for -powerpc64le. + * Add gdb.threads/interrupt-while-step-over.exp kfail. + * Add gdb.tui/tui-layout-asm-short-prog.exp kfail. + * Add unix/-fPIE/-fpie overrides -static kfails. + * Add gdb.guile/scm-disasm.exp kfail. + * Add gdb.base/gnu_vector.exp to existing kfail. + * Add gdb.guile/scm-symtab.exp kfail. + * Add gdb.base/write_mem.exp kfail. + +------------------------------------------------------------------- +Tue Nov 22 15:03:04 UTC 2022 - Tom de Vries + +- Maintenance script qa.sh: + - Add openSUSE Leap 15.4 ppc64le to known clean configs. + +------------------------------------------------------------------- +Wed Nov 16 13:49:01 UTC 2022 - Tom de Vries + +- Maintenance script qa.sh: + - Update PR26363 internal error pattern. + - Add PR29790 kfail. + - Add -powerpc64le option. + - Generalize PR26915 kfail patterns. + - Move PR28478 patterns from kfail_factory to kfail. + - Add PR29781 and PR27813 kfails. + - Add SLE-15 ppc64le to known clean configs. + +------------------------------------------------------------------- +Tue Nov 15 08:14:11 UTC 2022 - Tom de Vries + +- Maintenance script qa-remote.sh: + * Use qa.sh alongside qa-remote.sh. +- Maintenance script qa.sh: + * Add PR29783 internal error. +- Patch removed (intended effect not observed): + * gdb-fix-watchpoints-triggered.patch + +------------------------------------------------------------------- +Fri Nov 11 12:06:44 UTC 2022 - Tom de Vries + +- Maintenance script qa.sh: + * Handle librpm == "" and nolibrpm == "". +- Maintenance script qa-remote.sh: + * Make "Get remote testsuite results" even more verbose. + * Make hardcoded pattern gdb-testresults-12.1-*.*.rpm more + generic. + * Add missing setting of rpm variable in "Getting rpms" case. +- Patches added (backport from trunk): + * gdb-testsuite-fix-gdb.base-break-idempotent.exp-on-ppc.patch + * powerpc-fix-gdb.base-watchpoint.exp-on-power-9.patch + +------------------------------------------------------------------- +Fri Oct 21 08:03:27 UTC 2022 - Tom de Vries + +- Maintenance script qa-remote.sh: + * Make "Get remote testsuite results" more verbose. + ------------------------------------------------------------------- Wed Oct 19 16:35:34 UTC 2022 - Tom de Vries @@ -891,6 +1030,7 @@ Tue Oct 19 08:00:06 UTC 2021 - Tom de Vries Mon Oct 18 17:46:06 UTC 2021 - Tom de Vries - 11.1 - Rebase to 11.1 release (as in fedora 35 @ 9cd9368): + * Implements SLE-21561. * GDB now supports general memory tagging functionality if the underlying architecture supports the proper primitives and hooks. Currently this is enabled only for AArch64 MTE. @@ -1986,6 +2126,7 @@ Wed Nov 7 15:04:28 UTC 2018 - tdevries@suse.com Tue Sep 11 15:01:59 UTC 2018 - matz@suse.com - Rebase to 8.2 release (as in fedora 29 @ c720d998): + * Contains fix for bnc#1081527, CVE-2018-7208. * 'symbol-file' and 'add-symbol-file' accept -o to add relative offset to all sections * pager accepts 'c' response to disable it for rest of command @@ -2044,6 +2185,7 @@ Tue Mar 27 14:01:27 UTC 2018 - matz@suse.com Fri Mar 9 16:27:10 UTC 2018 - matz@suse.com - Rebase to 8.1 release: + * Contains fix for bnc#1068950, CVE-2017-16829. * ptype/o prints offsets and sizes of members (like pahole) * tab-completion improved: quoting function names is not generally necessary anymore, completion offers for breakpoint don't include diff --git a/gdb.spec b/gdb.spec index edd1b74..24f942b 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 @@ -20,6 +20,7 @@ %define flavor @BUILD_FLAVOR@%{nil} %bcond_with ringdisabled +%bcond_with for_chroot %if "%flavor" == "testsuite" %if %{with ringdisabled} @@ -210,7 +211,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 +227,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 +240,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 +251,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 +262,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 +285,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 @@ -299,15 +303,16 @@ Patch1504: fix-gdb.mi-new-ui-mi-sync.exp.patch # FAIL: gdb.base/step-over-syscall.exp: fork: displaced=off: \ # pc after stepi matches insn addr after syscall Patch1505: gdb-testsuite-fix-gdb.base-step-over-syscall.exp-with-m32-amd-case.patch -# Fixes: -# FAIL: gdb.threads/detach-step-over.exp: \ -# breakpoint-condition-evaluation=host: target-non-stop=off: non-stop=off: \ -# displaced=off: iter 1: all threads running -Patch1506: gdb-testsuite-fix-race-in-gdb.threads-detach-step-over.exp.patch # Backports from release branch Patch1700: fix-core-file-detach-crash-corefiles-29275.patch +Patch1701: gdb-testsuite-add-new-gdb_attach-to-check-attach-command.patch +Patch1702: gdb-testsuite-remove-global-declarations-in-gdb.threads-detach-step-over.exp.patch +Patch1703: gdb-testsuite-refactor-gdb.threads-detach-step-over.exp.patch +Patch1704: gdb-fix-assert-when-quitting-gdb-while-a-thread-is-stepping.patch +Patch1705: gdbserver-switch-to-right-process-in-find_one_thread.patch +Patch1706: gdb-disable-commit-resumed-in-target_kill.patch # Backports from master, available in next release. @@ -348,10 +353,24 @@ Patch2033: gdb-testsuite-fix-have_mpx-test.patch Patch2034: gdb-testsuite-fix-gdb.dwarf2-dw2-unspecified-type-foo.c-with-m32.patch 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 @@ -383,8 +402,6 @@ Patch2111: gdb-testsuite-enable-some-test-cases-for-x86_64-m32.patch Patch2112: gdb-testsuite-fix-gdb.reverse-i387-env-reverse.exp-for-pie.patch # https://sourceware.org/pipermail/gdb-patches/2022-July/191107.html Patch2113: gdb-testsuite-fix-gdb.ada-literals.exp-with-aarch64.patch -# https://sourceware.org/bugzilla/show_bug.cgi?id=29423#c8 -Patch2114: gdb-fix-watchpoints-triggered.patch # https://sourceware.org/pipermail/gdb-patches/2022-September/192172.html Patch2115: gdb-testsuite-fix-gdb.mi-mi-sym-info.exp-on-opensuse-tumbleweed.patch @@ -392,6 +409,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 @@ -471,6 +494,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 @@ -506,7 +533,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 @@ -699,7 +734,6 @@ find -name "*.info*"|xargs rm -f %patch48 -p1 %patch49 -p1 %patch50 -p1 -%patch51 -p1 %patch52 -p1 %patch53 -p1 %patch54 -p1 @@ -716,7 +750,6 @@ find -name "*.info*"|xargs rm -f %patch66 -p1 %patch67 -p1 %patch68 -p1 -%patch69 -p1 %patch70 -p1 %patch71 -p1 %patch73 -p1 @@ -730,6 +763,7 @@ find -name "*.info*"|xargs rm -f %patch504 -p1 %patch505 -p1 %patch506 -p1 +%patch507 -p1 %patch1000 -p1 %patch1001 -p1 @@ -738,15 +772,21 @@ find -name "*.info*"|xargs rm -f %patch1101 -p1 %patch1102 -p1 %patch1103 -p1 +%patch1104 -p1 %patch1500 -p1 %patch1501 -p1 %patch1503 -p1 %patch1504 -p1 %patch1505 -p1 -%patch1506 -p1 %patch1700 -p1 +%patch1701 -p1 +%patch1702 -p1 +%patch1703 -p1 +%patch1704 -p1 +%patch1705 -p1 +%patch1706 -p1 %patch2000 -p1 %patch2001 -p1 @@ -785,6 +825,22 @@ find -name "*.info*"|xargs rm -f %patch2034 -p1 %patch2035 -p1 %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 @@ -800,9 +856,10 @@ find -name "*.info*"|xargs rm -f %patch2111 -p1 %patch2112 -p1 %patch2113 -p1 -%patch2114 -p1 %patch2115 -p1 +%patch3000 -p1 + #unpack libipt %if 0%{have_libipt} tar xzf %{SOURCE7} @@ -1145,7 +1202,15 @@ $CC -o ./orphanripper %{SOURCE2} -Wall -lutil -ggdb2 CHECK="$(echo $CHECK | sed 's#check//unix/[^ ]*#& &/-fPIE/-pie#g')" fi +%if %{with for_chroot} + # When we want to chroot into a local osc build and run a test-case, we + # need -M testsuite to add all the buildrequires, but there's no need + # to run the testsuite. Instead, fail %check to make sure %clean doesn't + # remove buildroot. + false +%else ./orphanripper make %{?_smp_mflags} -k $CHECK || : +%endif ) for t in sum log do diff --git a/gdbserver-switch-to-right-process-in-find_one_thread.patch b/gdbserver-switch-to-right-process-in-find_one_thread.patch new file mode 100644 index 0000000..170b2b4 --- /dev/null +++ b/gdbserver-switch-to-right-process-in-find_one_thread.patch @@ -0,0 +1,255 @@ +gdbserver: switch to right process in find_one_thread + +New in this version: add a dedicated test. + +When I do this: + + $ ./gdb -nx --data-directory=data-directory -q \ + /bin/sleep \ + -ex "maint set target-non-stop on" \ + -ex "tar ext :1234" \ + -ex "set remote exec-file /bin/sleep" \ + -ex "run 1231 &" \ + -ex add-inferior \ + -ex "inferior 2" + Reading symbols from /bin/sleep... + (No debugging symbols found in /bin/sleep) + Remote debugging using :1234 + Starting program: /bin/sleep 1231 + Reading /lib64/ld-linux-x86-64.so.2 from remote target... + warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead. + Reading /lib64/ld-linux-x86-64.so.2 from remote target... + Reading /usr/lib/debug/.build-id/a6/7a1408f18db3576757eea210d07ba3fc560dff.debug from remote target... + [New inferior 2] + Added inferior 2 on connection 1 (extended-remote :1234) + [Switching to inferior 2 [] ()] + (gdb) Reading /lib/x86_64-linux-gnu/libc.so.6 from remote target... + attach 3659848 + Attaching to process 3659848 + /home/smarchi/src/binutils-gdb/gdb/thread.c:85: internal-error: inferior_thread: Assertion `current_thread_ != nullptr' failed. + +Note the "attach" command just above. When doing it on the command-line +with a -ex switch, the bug doesn't trigger. + +The internal error of GDB is actually caused by GDBserver crashing, and +the error recovery of GDB is not on point. This patch aims to fix just +the GDBserver crash, not the GDB problem. + +GDBserver crashes with a segfault here: + + (gdb) bt + #0 0x00005555557fb3f4 in find_one_thread (ptid=...) at /home/smarchi/src/binutils-gdb/gdbserver/thread-db.cc:177 + #1 0x00005555557fd5cf in thread_db_thread_handle (ptid=, handle=0x7fffffffc400, handle_len=0x7fffffffc3f0) + at /home/smarchi/src/binutils-gdb/gdbserver/thread-db.cc:461 + #2 0x000055555578a0b6 in linux_process_target::thread_handle (this=0x5555558a64c0 , ptid=, handle=0x7fffffffc400, + handle_len=0x7fffffffc3f0) at /home/smarchi/src/binutils-gdb/gdbserver/linux-low.cc:6905 + #3 0x00005555556dfcc6 in handle_qxfer_threads_worker (thread=0x60b000000510, buffer=0x7fffffffc8a0) at /home/smarchi/src/binutils-gdb/gdbserver/server.cc:1645 + #4 0x00005555556e00e6 in operator() (__closure=0x7fffffffc5e0, thread=0x60b000000510) at /home/smarchi/src/binutils-gdb/gdbserver/server.cc:1696 + #5 0x00005555556f54be in for_each_thread >(struct {...}) (func=...) at /home/smarchi/src/binutils-gdb/gdbserver/gdbthread.h:159 + #6 0x00005555556e0242 in handle_qxfer_threads_proper (buffer=0x7fffffffc8a0) at /home/smarchi/src/binutils-gdb/gdbserver/server.cc:1694 + #7 0x00005555556e04ba in handle_qxfer_threads (annex=0x629000000213 "", readbuf=0x621000019100 '\276' ..., writebuf=0x0, offset=0, len=4097) + at /home/smarchi/src/binutils-gdb/gdbserver/server.cc:1732 + #8 0x00005555556e1989 in handle_qxfer (own_buf=0x629000000200 "qXfer:threads", packet_len=26, new_packet_len_p=0x7fffffffd630) at /home/smarchi/src/binutils-gdb/gdbserver/server.cc:2045 + #9 0x00005555556e720a in handle_query (own_buf=0x629000000200 "qXfer:threads", packet_len=26, new_packet_len_p=0x7fffffffd630) at /home/smarchi/src/binutils-gdb/gdbserver/server.cc:2685 + #10 0x00005555556f1a01 in process_serial_event () at /home/smarchi/src/binutils-gdb/gdbserver/server.cc:4176 + #11 0x00005555556f4457 in handle_serial_event (err=0, client_data=0x0) at /home/smarchi/src/binutils-gdb/gdbserver/server.cc:4514 + #12 0x0000555555820f56 in handle_file_event (file_ptr=0x607000000250, ready_mask=1) at /home/smarchi/src/binutils-gdb/gdbsupport/event-loop.cc:573 + #13 0x0000555555821895 in gdb_wait_for_event (block=1) at /home/smarchi/src/binutils-gdb/gdbsupport/event-loop.cc:694 + #14 0x000055555581f533 in gdb_do_one_event (mstimeout=-1) at /home/smarchi/src/binutils-gdb/gdbsupport/event-loop.cc:264 + #15 0x00005555556ec9fb in start_event_loop () at /home/smarchi/src/binutils-gdb/gdbserver/server.cc:3512 + #16 0x00005555556f0769 in captured_main (argc=4, argv=0x7fffffffe0d8) at /home/smarchi/src/binutils-gdb/gdbserver/server.cc:3992 + #17 0x00005555556f0e3f in main (argc=4, argv=0x7fffffffe0d8) at /home/smarchi/src/binutils-gdb/gdbserver/server.cc:4078 + +The reason is a wrong current process when find_one_thread is called. +The current process is the 2nd one, which was just attached. It does +not yet have thread_db data (proc->priv->thread_db is nullptr). As we +iterate on all threads of all process to fulfull the qxfer:threads:read +request, we get to a thread of process 1 for which we haven't read +thread_db information yet (lwp_info::thread_known is false), so we get +into find_one_thread. find_one_thread uses +`current_process ()->priv->thread_db`, assuming the current process +matches the ptid passed as a parameter, which is wrong. A segfault +happens when trying to dereference that thread_db pointer. + +Fix this by making find_one_thread not assume what the current process / +current thread is. If it needs to call into libthread_db, which we know +will try to read memory from the current process, then temporarily set +the current process. + +In the case where the thread is already know and we return early, we +don't need to switch process. + +Add a test to reproduce this specific situation. + +Change-Id: I09b00883e8b73b7e5f89d0f47cb4e9c0f3d6caaa +Approved-By: Andrew Burgess + +--- + gdb/testsuite/gdb.multi/attach-while-running.c | 26 +++++++++ + gdb/testsuite/gdb.multi/attach-while-running.exp | 73 ++++++++++++++++++++++++ + gdbserver/thread-db.cc | 29 ++++++---- + 3 files changed, 116 insertions(+), 12 deletions(-) + +diff --git a/gdb/testsuite/gdb.multi/attach-while-running.c b/gdb/testsuite/gdb.multi/attach-while-running.c +new file mode 100644 +index 00000000000..dd321dfe007 +--- /dev/null ++++ b/gdb/testsuite/gdb.multi/attach-while-running.c +@@ -0,0 +1,26 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2022 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 . */ ++ ++#include ++ ++int global_var = 123; ++ ++int ++main (void) ++{ ++ sleep (30); ++} +diff --git a/gdb/testsuite/gdb.multi/attach-while-running.exp b/gdb/testsuite/gdb.multi/attach-while-running.exp +new file mode 100644 +index 00000000000..125273d0524 +--- /dev/null ++++ b/gdb/testsuite/gdb.multi/attach-while-running.exp +@@ -0,0 +1,73 @@ ++# Copyright 2022 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 test was introduced to reproduce a specific bug in GDBserver, where ++# attaching an inferior while another one was running would trigger a segfault ++# in GDBserver. Reproducing the bug required specific circumstances: ++# ++# - The first process must be far enough to have loaded its libc or ++# libpthread (whatever triggers the loading of libthread_db), such that ++# its proc->priv->thread_db is not nullptr ++# ++# - However, its lwp must still be in the `!lwp->thread_known` state, ++# meaning GDBserver hasn't asked libthread_db to compute the thread ++# handle yet. That means, GDB must not have refreshed the thread list ++# yet, since that would cause the thread handles to be computed. That ++# means, no stopping on a breakpoint, since that causes a thread list ++# update. That's why the first inferior needs to be started with "run ++# &". ++# ++# - Attaching the second process would segfault GDBserver. ++# ++# All of this to say, if modifying this test, please keep in mind the original ++# intent. ++ ++standard_testfile ++ ++if [use_gdb_stub] { ++ unsupported "test requires running" ++ return ++} ++ ++if { [build_executable "failed to prepare" ${testfile} ${srcfile}] } { ++ return ++} ++ ++proc do_test {} { ++ save_vars { $::GDBFLAGS } { ++ append ::GDBFLAGS " -ex \"maint set target-non-stop on\"" ++ clean_restart $::binfile ++ } ++ ++ gdb_test_multiple "run &" "" { ++ -re ".*$::gdb_prompt " { ++ pass $gdb_test_name ++ } ++ } ++ gdb_test "add-inferior" "Added inferior 2 on connection 1 .*" ++ gdb_test "inferior 2" "Switching to inferior 2 .*" ++ ++ set spawn_id [spawn_wait_for_attach $::binfile] ++ set pid [spawn_id_get_pid $spawn_id] ++ ++ # This call would crash GDBserver. ++ gdb_attach $pid ++ ++ # Read a variable from the inferior, just to make sure the attach worked ++ # fine. ++ gdb_test "print global_var" " = 123" ++} ++ ++do_test +diff --git a/gdbserver/thread-db.cc b/gdbserver/thread-db.cc +index 6e0e2228a5f..bf98ca9557a 100644 +--- a/gdbserver/thread-db.cc ++++ b/gdbserver/thread-db.cc +@@ -155,30 +155,35 @@ thread_db_state_str (td_thr_state_e state) + } + #endif + +-/* Get thread info about PTID, accessing memory via the current +- thread. */ ++/* Get thread info about PTID. */ + + static int + find_one_thread (ptid_t ptid) + { +- td_thrhandle_t th; +- td_thrinfo_t ti; +- td_err_e err; +- struct lwp_info *lwp; +- struct thread_db *thread_db = current_process ()->priv->thread_db; +- int lwpid = ptid.lwp (); +- + thread_info *thread = find_thread_ptid (ptid); +- lwp = get_thread_lwp (thread); ++ lwp_info *lwp = get_thread_lwp (thread); + if (lwp->thread_known) + return 1; + +- /* Get information about this thread. */ +- err = thread_db->td_ta_map_lwp2thr_p (thread_db->thread_agent, lwpid, &th); ++ /* Get information about this thread. libthread_db will need to read some ++ memory, which will be done on the current process, so make PTID's process ++ the current one. */ ++ process_info *proc = find_process_pid (ptid.pid ()); ++ gdb_assert (proc != nullptr); ++ ++ scoped_restore_current_thread restore_thread; ++ switch_to_process (proc); ++ ++ thread_db *thread_db = proc->priv->thread_db; ++ td_thrhandle_t th; ++ int lwpid = ptid.lwp (); ++ td_err_e err = thread_db->td_ta_map_lwp2thr_p (thread_db->thread_agent, lwpid, ++ &th); + if (err != TD_OK) + error ("Cannot get thread handle for LWP %d: %s", + lwpid, thread_db_err_str (err)); + ++ td_thrinfo_t ti; + err = thread_db->td_thr_get_info_p (&th, &ti); + if (err != TD_OK) + error ("Cannot get thread info for LWP %d: %s", diff --git a/powerpc-fix-gdb.base-watchpoint.exp-on-power-9.patch b/powerpc-fix-gdb.base-watchpoint.exp-on-power-9.patch new file mode 100644 index 0000000..548908b --- /dev/null +++ b/powerpc-fix-gdb.base-watchpoint.exp-on-power-9.patch @@ -0,0 +1,138 @@ +PowerPC, fix gdb.base/watchpoint.exp on Power 9 + +Test gdb.base/watchpoint.exp generates 4 test errors on Power 9. The +test uses the test [target_info exists gdb,no_hardware_watchpoints] to +determine if the processor supports hardware watchpoints. The check +only examines the processor type to determine if it supports hardware +watchpoints. + +The PowerPC processors support hardware watchpoints with the +exception of Power 9. The hardware watchpoint support is disabled on +Power 9. The test skip_hw_watchpoint_tests must be used to correctly +determine if the PowerPC processor supports hardware watchpoints. + +This patch replaces the [target_info exists gdb,no_hardware_watchpoints] +with the skip_hw_watchpoint_tests_p check. With the patch, the test runs +on Power 9 with hardware watchpoint force-disabled. The test runs on +all other PowerPC processors with and without hardware watchpoints +enabled. + +The patch has been tested on Power 9 to verify the test only runs with +hardware breakpoints disabled. The patch has been tested on X86-64 with +no regression failures. The test fails on Power 10 due to an internal GDB +error due to resource management. The resource management issue will be +addressed in another patch. + +--- + gdb/testsuite/gdb.base/watchpoint.exp | 26 +++++++++++++++++++------- + 1 file changed, 19 insertions(+), 7 deletions(-) + +diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp +index 377d3f9ff43..1916cd37cf5 100644 +--- a/gdb/testsuite/gdb.base/watchpoint.exp ++++ b/gdb/testsuite/gdb.base/watchpoint.exp +@@ -15,6 +15,13 @@ + + # This file was written by Fred Fish. (fnf@cygnus.com) + ++# The skip_hw_watchpoint_tests checks if watchpoints are supported by the ++# processor. On PowerPC, the check runs a small test program under gdb ++# to determine if the Power processor supports HW watchpoints. The check ++# must be done before starting the test so as to not disrupt the execution ++# of the actual test. ++ ++set skip_hw_watchpoint_tests_p [skip_hw_watchpoint_tests] + + standard_testfile + +@@ -628,13 +635,14 @@ proc test_watch_location {} { + proc test_wide_location_1 {} { + global no_hw + global gdb_prompt ++ global skip_hw_watchpoint_tests_p + + # This test watches two words on most 32-bit ABIs, and one word on + # most 64-bit ABIs. + + # Platforms where the target can't watch such a large region + # should clear hw_expected below. +- if { $no_hw || [target_info exists gdb,no_hardware_watchpoints] ++ if { $no_hw || $skip_hw_watchpoint_tests_p + || [istarget arm*-*-*] + || ([istarget powerpc*-*-*] && ![is_lp64_target])} { + set hw_expected 0 +@@ -675,13 +683,14 @@ proc test_wide_location_1 {} { + proc test_wide_location_2 {} { + global no_hw + global gdb_prompt ++ global skip_hw_watchpoint_tests_p + + # This test watches four words on most 32-bit ABIs, and two words + # on 64-bit ABIs. + + # Platforms where the target can't watch such a large region + # should clear hw_expected below. +- if { $no_hw || [target_info exists gdb,no_hardware_watchpoints] ++ if { $no_hw || $skip_hw_watchpoint_tests_p + || [istarget arm*-*-*] + || [istarget powerpc*-*-*]} { + set hw_expected 0 +@@ -798,6 +807,7 @@ proc test_inaccessible_watchpoint {} { + + proc test_no_hw_watchpoints {} { + global testfile ++ global skip_hw_watchpoint_tests_p + + clean_restart $testfile + +@@ -843,7 +853,7 @@ proc test_no_hw_watchpoints {} { + + + # Re-enable hardware watchpoints if necessary. +- if ![target_info exists gdb,no_hardware_watchpoints] { ++ if {!$skip_hw_watchpoint_tests_p} { + gdb_test_no_output "set can-use-hw-watchpoints 1" "" + } + } +@@ -895,8 +905,9 @@ proc test_watchpoint_in_big_blob {} { + + proc test_watch_register_location {} { + global no_hw ++ global skip_hw_watchpoint_tests_p + +- if {!$no_hw && ![target_info exists gdb,no_hardware_watchpoints]} { ++ if {!$no_hw && !$skip_hw_watchpoint_tests_p} { + # Non-memory read/access watchpoints are not supported, they would + # require software read/access watchpoint support (which is not + # currently available). +@@ -920,10 +931,11 @@ test_no_hw_watchpoints + proc do_tests {} { + global testfile + global no_hw ++ global skip_hw_watchpoint_tests_p + + clean_restart $testfile + +- if {$no_hw || [target_info exists gdb,no_hardware_watchpoints]} { ++ if {$no_hw || $skip_hw_watchpoint_tests_p} { + gdb_test_no_output "set can-use-hw-watchpoints 0" "" + } + +@@ -942,7 +954,7 @@ proc do_tests {} { + # `initialize' anymore. + clean_restart $testfile + +- if {$no_hw || [target_info exists gdb,no_hardware_watchpoints]} { ++ if {$no_hw || $skip_hw_watchpoint_tests_p} { + gdb_test_no_output "set can-use-hw-watchpoints 0" "" + } + +@@ -979,7 +991,7 @@ proc do_tests {} { + # watchpoints force-disabled. + + do_tests +-if ![target_info exists gdb,no_hardware_watchpoints] { ++if {!$skip_hw_watchpoint_tests_p} { + with_test_prefix "no-hw" { + set no_hw 1 + do_tests 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-remote.sh b/qa-remote.sh index 706d7d9..d070c4b 100644 --- a/qa-remote.sh +++ b/qa-remote.sh @@ -1,5 +1,7 @@ #!/bin/sh +scriptdir=$(cd $(dirname $0); pwd -P) + pwd=$(pwd -P) root=$pwd/tmp-qa-remote @@ -39,6 +41,7 @@ get_item () arch="$2" if [ -d $root/binaries-testsuite.$c.$arch/gdb-testresults ]; then + echo "Already have $c $arch, skipping" return fi @@ -46,6 +49,8 @@ get_item () # Stale config, skip. return fi + + echo "Trying $c $arch" local dir dir=$pkgs/$c.$arch @@ -54,20 +59,32 @@ get_item () mkdir -p $dir fi - rpm=$(echo $dir/gdb-testresults-12.1-*.*.rpm) + rpm=$(echo $dir/gdb-testresults-*.*.rpm) rpm=$(for f in $rpm; do echo $f; done | grep -v nosrc) - if [ ! -f $rpm ]; then + rpm=$(basename $rpm) + if [ "$rpm" = "" ] || [ ! -f "$rpm" ]; then + echo "Getting rpms" osc getbinaries -q -M testsuite -d $dir $c $arch + rpm=$(echo $dir/gdb-testresults-*.rpm) + rpm=$(for f in $rpm; do echo $f; done | grep -v nosrc) + rpm=$(basename $rpm) + echo "Got rpm: $rpm" + else + echo "Already have rpm: $rpm" fi if [ ! -d $pkgs/gdb-testresults.$c.$arch ]; then ( + echo "Extracting rpm: $rpm" cd $dir extract $rpm ) + else + echo "Already extracted rpm: $rpm" fi if [ -d $dir/usr/share/doc/packages/gdb-testresults ]; then + echo "Renaming" mkdir $root/binaries-testsuite.$c.$arch mv \ $dir/usr/share/doc/packages/gdb-testresults \ @@ -75,6 +92,7 @@ get_item () fi if [ -d $root/binaries-testsuite.$c.$arch/gdb-testresults ]; then + echo "Cleaning up" rm -Rf $dir fi } @@ -90,6 +108,25 @@ cleanup () mkdir -p $root } +report_todo () +{ + c="$1" + arch="$2" + status="$3" + + if [ "$c" = "SLE-10_SDK" ]; then + # Stale config. + return + fi + + if [ "$c" = "SLE-11" ] && [ "$arch" = "x86_64" ] && [ "$status" = "unresolvable" ]; then + # This needs fixing, but is a known problem. + return + fi + + echo -e "Todo: $c\t$arch\t$status" +} + case "$n" in 1) cleanup @@ -102,6 +139,12 @@ case "$n" in | while read line; do get_item $line done + osc results -M testsuite \ + | grep -v succeeded \ + | awk '{print $1, $2, $4}' \ + | while read line; do + report_todo $line + done ;; 3) @@ -109,7 +152,7 @@ case "$n" in shift ( cd $root - bash $pwd/qa.sh $m + bash $scriptdir/qa.sh $m ) ;; diff --git a/qa.sh b/qa.sh index 1a25b2a..d98a24e 100644 --- a/qa.sh +++ b/qa.sh @@ -23,7 +23,7 @@ usage () { echo "usage: $0 <1-5>" - echo " $0 -local [ -sle12 | -factory ] " + echo " $0 -local [ -sle11 | -sle12 | -factory | -aarch64 | -powerpc64le | -s390 | -s390x ] " echo echo "Verify remote results at:" echo " ./binaries-testsuite.distro.arch/gdb-testresults" @@ -46,12 +46,19 @@ fi n="$1" shift +have_sle11=false have_sle12=false have_factory=false have_aarch64=false +have_powerpc64le=false +have_s390=false +have_s390x=false if [ "$n" = "-local" ]; then while [ $# -gt 1 ]; do case $1 in + -sle11) + have_sle11=true + ;; -sle12) have_sle12=true ;; @@ -61,6 +68,15 @@ if [ "$n" = "-local" ]; then -aarch64) have_aarch64=true ;; + -powerpc64le|-ppc64le) + have_powerpc64le=true + ;; + -s390) + have_s390=true + ;; + -s390x) + have_s390x=true + ;; *) echo "Don't know how to handle arg: $1" usage @@ -142,7 +158,10 @@ kfail=( "FAIL: gdb.threads/signal-while-stepping-over-bp-other-thread.exp: step \(pattern 3\)" # https://sourceware.org/bugzilla/show_bug.cgi?id=26915 "FAIL: gdb.threads/schedlock.exp: schedlock=off: .*: other threads ran - unlocked" - "FAIL: gdb.threads/watchthreads-threaded.exp: watchpoint on args\[3\] hit in thread" + "FAIL: gdb.threads/watchthreads-threaded.exp: watchpoint on args\[[1-3]\] hit in thread" + "FAIL: gdb.threads/watchthreads-threaded.exp: watch args\[[1-3]\]" + "FAIL: gdb.threads/watchthreads-threaded.exp: threaded watch loop" + "FAIL: gdb.threads/watchthreads-threaded.exp: combination of threaded watchpoints = 30 \+ initial values" # https://sourceware.org/bugzilla/show_bug.cgi?id=28479 "FAIL: gdb.mi/mi-nonstop.exp: wait for thread exit \(timeout\)" # https://sourceware.org/bugzilla/show_bug.cgi?id=26273 @@ -163,9 +182,9 @@ kfail=( "FAIL: gdb.base/info-os.exp: continue \(timeout\)" # https://sourceware.org/bugzilla/show_bug.cgi?id=26284 - # https://sourceware.org/bugzilla/show_bug.cgi?id=28275 # https://sourceware.org/bugzilla/show_bug.cgi?id=28343 "FAIL: gdb.threads/detach-step-over.exp: .*internal error" + # https://sourceware.org/bugzilla/show_bug.cgi?id=26363 "FAIL: gdb.xml/tdesc-reload.exp: .*internal error" # https://sourceware.org/bugzilla/show_bug.cgi?id=26761 @@ -222,9 +241,6 @@ kfail=( "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse xorpd" "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse xorps" - # Fedora test. Fails because it doesn't handle ppc64le. - "FAIL: gdb.arch/powerpc-bcl-prologue.exp: powerpc arch test" - # https://sourceware.org/bugzilla/show_bug.cgi?id=29419 # https://sourceware.org/bugzilla/show_bug.cgi?id=29409 "FAIL: gdb.opt/inline-small-func.exp: info breakpoints" @@ -254,7 +270,32 @@ kfail=( "FAIL: gdb.base/info-os.exp: get shared-memory regions" "FAIL: gdb.base/info-os.exp: get threads" - + #https://sourceware.org/bugzilla/show_bug.cgi?id=29790 + "FAIL: gdb.arch/i386-pkru.exp: read value after setting value" + "FAIL: gdb.arch/i386-pkru.exp: variable after reading pkru" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=28478 + "FAIL: gdb.gdb/selftest.exp: backtrace through signal handler" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29781 + "FAIL: gdb.mi/mi-multi-commands.exp: args=: look for second command output, command length .* \(timeout\)" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=27813 + "FAIL: .*.exp: .*tab complete .* \(clearing input line\) \(timeout\)" + "FAIL: .*.exp: .*cmd complete .*" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=27027 + # https://sourceware.org/bugzilla/show_bug.cgi?id=28464 + "FAIL: gdb.ada/mi_var_access.exp: Create varobj \(unexpected output\)" + "FAIL: gdb.ada/mi_var_access.exp: update at stop 2 \(unexpected output\)" + + # Fragile test-case, requires glibc to fail in a certain way, ignore. + "FAIL: gdb.base/gdb-rhbz1156192-recursive-dlopen.exp:" + + # GDB fails to print "Thread $x stopped" message for all threads, but + # subsequent info threads shows all threads stopped, and a previous + # info threads show all threads running. Not harmful. + "FAIL: gdb.threads/interrupt-while-step-over.exp: displaced-stepping=off: iter=[0-9]*: wait for stops \(timeout\)" ) # kfail kfail_sle12=( @@ -306,13 +347,85 @@ kfail_sle12=( # https://sourceware.org/bugzilla/show_bug.cgi?id=29245 # Python-2 related. "FAIL: gdb.python/py-mi-cmd.exp: -pycmd bk3 \(unexpected output\)" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=26967 + "FAIL: gdb.base/longjmp.exp: next over call_longjmp \(2\)" + "FAIL: gdb.base/longjmp.exp: next over longjmp\(1\)" + "FAIL: gdb.base/longjmp.exp: next over patt3" + "FAIL: gdb.base/premature-dummy-frame-removal.exp: p some_func \(\)" + "FAIL: gdb.base/premature-dummy-frame-removal.exp: set debug frame on" + + # Commit 2d77a94ff17 ("[gdb/testsuite] Require debug info for + # gdb.tui/tui-layout-asm-short-prog.exp") + "FAIL: gdb.tui/tui-layout-asm-short-prog.exp: check asm box contents" + "FAIL: gdb.tui/tui-layout-asm-short-prog.exp: check asm box contents again" + + # Test-cases that use -static but may turn out to be PIE when using + # unix/-fPIE/-fpie. + "FAIL: gdb.base/break-entry.exp: running to .* in runto" + "FAIL: gdb.base/catch-fork-static.exp: run to fork" + "FAIL: gdb.threads/staticthreads.exp: continue to main's call of sem_post" + "FAIL: gdb.threads/staticthreads.exp: handle SIG32 helps" + "FAIL: gdb.threads/staticthreads.exp: running to main in runto" + "FAIL: gdb.threads/staticthreads.exp: running to main in runto" + "FAIL: gdb.dwarf2/frame-inlined-in-outer-frame.exp: step back into _start" + "FAIL: gdb.dwarf2/frame-inlined-in-outer-frame.exp: step back into foo" + "FAIL: gdb.dwarf2/frame-inlined-in-outer-frame.exp: step into bar" + "FAIL: gdb.dwarf2/frame-inlined-in-outer-frame.exp: step into foo" + + # Fails on both i586 and s390x/-m31 for SLE-12-SP3, but does not reproduce + # on s390x/-m31 for SLE-12-SP5 with trunk. + "FAIL: gdb.guile/scm-disasm.exp: disassemble via memory port" + "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=27027 - # https://sourceware.org/bugzilla/show_bug.cgi?id=28464 - "FAIL: gdb.ada/mi_var_access.exp: Create varobj \(unexpected output\)" - "FAIL: gdb.ada/mi_var_access.exp: update at stop 2 \(unexpected output\)" # https://sourceware.org/bugzilla/show_bug.cgi?id=28463 "FAIL: gdb.ada/set_pckd_arr_elt.exp: scenario=minimal: print va.t\(1\) := 15" "FAIL: gdb.ada/set_pckd_arr_elt.exp: scenario=minimal: continue to update_small for va.t" @@ -333,8 +446,6 @@ kfail_factory=( "FAIL: gdb.threads/signal-command-handle-nopass.exp: step-over (yes|no): signal SIGUSR1" # https://sourceware.org/bugzilla/show_bug.cgi?id=28477 "FAIL: gdb.base/step-over-syscall.exp: clone: displaced=off: continue to marker \(clone\)" - # https://sourceware.org/bugzilla/show_bug.cgi?id=28478 - "FAIL: gdb.gdb/selftest.exp: backtrace through signal handler" # https://sourceware.org/bugzilla/show_bug.cgi?id=26867 "FAIL: gdb.threads/signal-sigtrap.exp: sigtrap thread 1: signal SIGTRAP reaches handler" # https://sourceware.org/bugzilla/show_bug.cgi?id=28510 @@ -366,6 +477,8 @@ kfail_factory=( # https://sourceware.org/bugzilla/show_bug.cgi?id=29706 "FAIL: gdb.base/eof-exit.exp: with non-dump terminal: with bracketed-paste-mode on: close GDB with eof \(missed the prompt\)" + # https://sourceware.org/bugzilla/show_bug.cgi?id=29965 + "FAIL: gdb.threads/process-exit-status-is-leader-exit-status.exp: iteration=.*: continue \(the program exited\)" ) # kfail_factory kfail_aarch64=( @@ -390,6 +503,140 @@ kfail_aarch64=( "FAIL: gdb.base/watchpoint-unaligned.exp: size8twice write" ) # kfail_aarch64 +kfail_powerpc64le=( + # https://sourceware.org/bugzilla/show_bug.cgi?id=29420 + "FAIL: gdb.ada/convvar_comp.exp: print \\\$item.started" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29814 + "FAIL: gdb.base/msym-bp-shl.exp: debug=0: before run: info breakpoint" + "FAIL: gdb.base/msym-bp-shl.exp: debug=1: before run: info breakpoint" + + # Commit a0eda3df5b7 ("PowerPC, fix support for printing the function + # return value for non-trivial values"). + "FAIL: gdb.cp/non-trivial-retval.exp: finish from" + "FAIL: gdb.ada/array_return.exp: value printed by finish of Create_Small_Float_Vector" + "FAIL: gdb.base/gnu_vector.exp: call add_structvecs" + + # Commit f68eca29d3b ("PowerPC, fix gdb.base/retval-large-struct.exp"). + "FAIL: gdb.base/retval-large-struct.exp: finish from return_large_struct" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29793 + "FAIL: gdb.cp/gdb2495.exp: call a function that raises an exception without a handler." + "FAIL: gdb.cp/gdb2495.exp: bt after returning from a popped frame" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29792 + "FAIL: gdb.opt/solib-intra-step.exp: second-hit" + + # Carl Love mentioned he's working on these. + # https://sourceware.org/bugzilla/show_bug.cgi?id=29793#c2 + "FAIL: gdb.reverse/finish-precsave.exp" + "FAIL: gdb.reverse/finish-reverse.exp" + + # Commit 29004660c94 ("PowerPC fix for gdb.server/sysroot.exp"). + "FAIL: gdb.server/sysroot.exp: sysroot=local: continue to printf" + "FAIL: gdb.server/sysroot.exp: sysroot=remote: continue to printf" + + # Known to run into timeouts. + "FAIL: gdb.gdb/python-helper.exp" + + # Fedora test. Fails because it doesn't handle ppc64le. + "FAIL: gdb.arch/powerpc-bcl-prologue.exp: powerpc arch test" + + # Commit 301fe55e9c4 ("PowerPC: bp-permanent.exp, kill-after-signal fix"). + "FAIL: gdb.base/kill-after-signal.exp: stepi" + "FAIL: gdb.base/bp-permanent.exp: always_inserted=off, sw_watchpoint=0: stepi signal with handler: mainline pc points at permanent breakpoint" + "FAIL: gdb.base/bp-permanent.exp: always_inserted=off, sw_watchpoint=1: stepi signal with handler: mainline pc points at permanent breakpoint" + "FAIL: gdb.base/bp-permanent.exp: always_inserted=on, sw_watchpoint=0: stepi signal with handler: mainline pc points at permanent breakpoint" + "FAIL: gdb.base/bp-permanent.exp: always_inserted=on, sw_watchpoint=1: stepi signal with handler: mainline pc points at permanent breakpoint" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29813 + "FAIL: gdb.base/vla-optimized-out.exp: o1: printed size of optimized out vla" + + # Commit 4d88ae0c7b5 ("[gdb/testsuite] Fix gdb.base/maint.exp on powerpc64le"). + "FAIL: gdb.base/maint.exp: maint print objfiles: symtabs" + + # Commit e7d69e72bfd ("gdb: always add the default register groups"). + "FAIL: gdb.xml/tdesc-regs.exp: maintenance print reggroups" + + # Commit 91836f41e20 ("Powerpc fix for gdb.base/unwind-on-each-insn.exp"). + "FAIL: gdb.base/inline-frame-cycle-unwind.exp: cycle at level [0-9]*: backtrace when the unwind is broken at frame [0-9]*" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29815 + "FAIL: gdb.reverse/finish-reverse-bkpt.exp: reverse-finish from void_func trips breakpoint at entry" + "FAIL: gdb.reverse/finish-reverse-bkpt.exp: no spurious proceed after breakpoint stop" + "FAIL: gdb.reverse/next-reverse-bkpt-over-sr.exp: reverse-next over call trips user breakpoint at function entry" + "FAIL: gdb.reverse/next-reverse-bkpt-over-sr.exp: stopped at the right callee call" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29816 + "FAIL: gdb.ada/float-bits.exp: print 16llf#4000921fb54442d18469898cc51701b8#" + "FAIL: gdb.ada/float-bits.exp: print \\\$foo:=16llf#4000921fb54442d18469898cc51701b8#" + "FAIL: gdb.ada/float-bits.exp: print internal long double variable after assignment" + + # Commit 8b272d7671f ("[gdb/testsuite] Fix gdb.guile/scm-symtab.exp for + # ppc64le"). + "FAIL: gdb.guile/scm-symtab.exp: test find-pc-line with resume address" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29897 + "FAIL: gdb.base/run-control-while-bg-execution.exp: action1=.*: action2=start: start \(GDB internal error\)" + "FAIL: gdb.base/run-control-while-bg-execution.exp: action1=.*: action2=run: run \(GDB internal error\)" +) + +kfail_powerpc64le_sle12=( + # Commit 85819864f7c ("[gdb/testsuite] Fix gdb.arch/altivec-regs.exp with + # gcc 4.8.5"). + "FAIL: gdb.arch/altivec-regs.exp: down to vector_fun" + "FAIL: gdb.arch/altivec-regs.exp: finish returned correct value" + "FAIL: gdb.arch/altivec-regs.exp: print vector parameter a" + "FAIL: gdb.arch/altivec-regs.exp: print vector parameter b" +) + +kfail_s390x_s390=( + # Commit 167f3beb655 ("[gdb/testsuite] Fix gdb.base/write_mem.exp for big + # endian") + "FAIL: gdb.base/write_mem.exp: x /xh main" +) + +# Plain s390 or s390x/-m31. +kfail_s390=( + "${kfail_s390x_s390[@]}" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29841 + "FAIL: gdb.reverse/.*.exp:" + + # Doesn't reproduce with trunk on SLE-12SP5. + "FAIL: gdb.guile/scm-ports.exp: buffered: test byte at sp, before flush" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29867 + "FAIL: gdb.guile/scm-lazy-string.exp: ptr: lazy string length 2 value" + "FAIL: gdb.guile/scm-lazy-string.exp: ptr: lazy string value" + "FAIL: gdb.guile/scm-lazy-string.exp: ptr: print ptr" + "FAIL: gdb.base/sym-file.exp: add-symbol-file sym-file-lib.so addr" + "FAIL: gdb.base/sym-file.exp: continue to breakpoint: gdb_add_symbol_file" + "FAIL: gdb.python/py-lazy-string.exp: ptr: lazy string length 2 value" + "FAIL: gdb.python/py-lazy-string.exp: ptr: lazy string value" + "FAIL: gdb.python/py-lazy-string.exp: ptr: print ptr" + "FAIL: gdb.python/py-nested-maps.exp: headers=on: pretty=off: exp='\*mm': depth=1: p \*mm" + "FAIL: gdb.python/py-nested-maps.exp: headers=on: pretty=off: exp='\*mm': depth=2: p \*mm" + "FAIL: gdb.python/py-nested-maps.exp: headers=on: pretty=off: exp='\*mm': depth=3: p \*mm" + "FAIL: gdb.python/py-nested-maps.exp: headers=on: pretty=off: exp='\*mm': depth=unlimited: p \*mm" + "FAIL: gdb.python/py-nested-maps.exp: pretty=off: exp='\*mm': depth=1: p \*mm" + "FAIL: gdb.python/py-nested-maps.exp: pretty=off: exp='\*mm': depth=2: p \*mm" + "FAIL: gdb.python/py-nested-maps.exp: pretty=off: exp='\*mm': depth=3: p \*mm" + "FAIL: gdb.python/py-nested-maps.exp: pretty=off: exp='\*mm': depth=unlimited: p \*mm" + "FAIL: gdb.python/py-nested-maps.exp: pretty=on: exp='\*mm': depth=1: p \*mm" + "FAIL: gdb.python/py-nested-maps.exp: pretty=on: exp='\*mm': depth=2: p \*mm" + "FAIL: gdb.python/py-nested-maps.exp: pretty=on: exp='\*mm': depth=3: p \*mm" + "FAIL: gdb.python/py-nested-maps.exp: pretty=on: exp='\*mm': depth=unlimited: p \*mm" + "FAIL: gdb.base/info-shared.exp:" + "FAIL: gdb.python/py-strfns.exp: p /d {char\[4\]} arg" + "FAIL: gdb.python/py-strfns.exp: p arg" +) + +# s390x/-m64. +kfail_s390x=( + "${kfail_s390x_s390[@]}" +) + case $n in 1) # 'FAIL: .* internal error' in gdb.sum. @@ -398,6 +645,8 @@ case $n in # Todo: apply kfail_factory/kfail_sle12 only when appropriate. kfail+=("${kfail_factory[@]}") kfail+=("${kfail_sle12[@]}") + kfail+=("${kfail_s390[@]}") + kfail+=("${kfail_powerpc64le[@]}") kfail_re=$(join "|" "${kfail[@]}") grep "^FAIL:.*internal error" binaries-testsuite*/gdb-testresults/*.sum \ | grep -E -v "$kfail_re" @@ -425,7 +674,7 @@ case $n in # https://sourceware.org/bugzilla/show_bug.cgi?id=26284 "infrun.c:[0-9]*: internal-error: finish_step_over: Assertion \`ecs->event_thread->control.trap_expected' failed." # https://sourceware.org/bugzilla/show_bug.cgi?id=26363 - ".i586.*i386-linux-nat.c:[0-9]*: internal-error: Got request for bad register number 41." + ".i586.*i386-linux-nat.c:[0-9]*: internal-error: Got request for bad register number [0-9]*." # https://sourceware.org/bugzilla/show_bug.cgi?id=26761 "thread.c:[0-9]*: internal-error: inferior_thread: Assertion \`current_thread_ \!= nullptr' failed." # https://sourceware.org/bugzilla/show_bug.cgi?id=19675 @@ -441,6 +690,15 @@ case $n in "record-full.c:[0-9]*: internal-error: ptid_t record_full_wait_1\(target_ops\*, ptid_t, target_waitstatus\*, target_wait_flags\): Assertion \`\(options & TARGET_WNOHANG\) != 0' failed." # https://sourceware.org/bugzilla/show_bug.cgi?id=26873 "infrun.c:[0-9]*: internal-error: resume_1: Assertion \`!\(thread_has_single_step_breakpoints_set \(tp\) && step\)' failed." + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29783 + "frame.c:[0-9]*: internal-error: get_selected_frame: Assertion \`selected_frame != NULL' failed." + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29841 + "regcache.c:[0-9]*: internal-error: raw_read: Assertion \`buf != NULL' failed." + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29897 + "displaced-stepping.c:[0-9]*: internal-error: prepare: Assertion \`buf.current_thread != thread' failed." ) kfail_re=$(join "|" "${kfail[@]}") @@ -539,6 +797,21 @@ case $n in done ) + ( + kfail+=("${kfail_powerpc64le[@]}") + + # Known clean config: SLE 15 / openSUSE 15.4 powerpc64le. + for config in SLE-15.ppc64le/gdb-testresults openSUSE_Leap_15.4.ppc64le/gdb-testresults; do + sums=("$config/gdb-ppc64le-suse-linux-m64.-fno-PIE.-no-pie.sum" + "$config/gdb-ppc64le-suse-linux-m64.sum") + done + + for sum in "${sums[@]}"; do + sum=binaries-testsuite.$sum + report_sum "$sum" + done + ) + ;; 5) @@ -546,12 +819,16 @@ case $n in | grep -v SLE-11) nolibrpm=$(ls -1 binaries-testsuite*/gdb-testresults/*.sum \ | grep SLE-11) - grep -c "PASS: gdb.suse/zypper-hint.exp: zypper hint printed (librpm)" \ - $librpm \ - | grep -E -v ":1" - grep -c "PASS: gdb.suse/zypper-hint.exp: zypper hint printed (no librpm)" \ - $nolibrpm \ - | grep -E -v ":1" + if [ "$librpm" != "" ]; then + grep -c "PASS: gdb.suse/zypper-hint.exp: zypper hint printed (librpm)" \ + $librpm \ + | grep -E -v ":1" + fi + if [ "$nolibrpm" != "" ]; then + grep -c "PASS: gdb.suse/zypper-hint.exp: zypper hint printed (no librpm)" \ + $nolibrpm \ + | grep -E -v ":1" + fi ;; -local) @@ -570,12 +847,28 @@ 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 if $have_aarch64; then kfail+=("${kfail_aarch64[@]}") fi + if $have_powerpc64le; then + kfail+=("${kfail_powerpc64le[@]}") + fi + if $have_powerpc64le && $have_sl12; then + kfail+=("${kfail_powerpc64le_sle12[@]}") + fi + if $have_s390; then + kfail+=("${kfail_s390[@]}") + fi + + if $have_s390x; then + kfail+=("${kfail_s390x[@]}") + fi for sum in "${sums[@]}"; do report_sum "$sum"