diff --git a/.gitignore b/.gitignore index 6e96ec1..a5b5128 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ /elfutils-0.167.tar.bz2 /elfutils-0.168.tar.bz2 /elfutils-0.169.tar.bz2 +/elfutils-0.170.tar.bz2 diff --git a/backtrace.ppc64le.fp.core.bz2 b/backtrace.ppc64le.fp.core.bz2 deleted file mode 100644 index e63babf..0000000 Binary files a/backtrace.ppc64le.fp.core.bz2 and /dev/null differ diff --git a/backtrace.ppc64le.fp.exec.bz2 b/backtrace.ppc64le.fp.exec.bz2 deleted file mode 100755 index ed1352a..0000000 Binary files a/backtrace.ppc64le.fp.exec.bz2 and /dev/null differ diff --git a/elfutils-0.169-dup-shstrtab.patch b/elfutils-0.169-dup-shstrtab.patch deleted file mode 100644 index d6095eb..0000000 --- a/elfutils-0.169-dup-shstrtab.patch +++ /dev/null @@ -1,98 +0,0 @@ -commit e014cbba4e16f717807bca88512d2875a1c17ee4 -Author: Mark Wielaard -Date: Wed Jun 7 14:05:36 2017 +0200 - - strip: Make sure old .shstrab is removed when eu-strip recreates it. - - Although we always recreate the .shstrtab section for the new output - file we never explicitly assumed it could be removed. It might not be - possible to remove it when the section string table is shared with - a symbol table. But if it is removable we should (and recreate it for - the new section list). - - Regression introduced in commit elfutils-0.163-33-gdf7dfab. - "Handle merged strtab/shstrtab string tables in strip and unstrip." - Add extra testcase to explicitly check for this case. - - https://sourceware.org/bugzilla/show_bug.cgi?id=21525 - - Signed-off-by: Mark Wielaard - -diff --git a/src/ChangeLog b/src/ChangeLog -index cbb77fc..6ac0ef2 100644 ---- a/src/ChangeLog -+++ b/src/ChangeLog -@@ -1,3 +1,7 @@ -+2017-06-06 Mark Wielaard -+ -+ * strip.c (handle_elf): Assume e_shstrndx section can be removed. -+ - 2017-04-20 Ulf Hermann - - * readelf.c: Include strings.h. -diff --git a/src/strip.c b/src/strip.c -index f747441..11b2a37 100644 ---- a/src/strip.c -+++ b/src/strip.c -@@ -711,11 +711,13 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, - in the sh_link or sh_info element it cannot be removed either - */ - for (cnt = 1; cnt < shnum; ++cnt) -- /* Check whether the section can be removed. */ -+ /* Check whether the section can be removed. Since we will create -+ a new .shstrtab assume it will be removed too. */ - if (remove_shdrs ? !(shdr_info[cnt].shdr.sh_flags & SHF_ALLOC) -- : ebl_section_strip_p (ebl, ehdr, &shdr_info[cnt].shdr, -- shdr_info[cnt].name, remove_comment, -- remove_debug)) -+ : (ebl_section_strip_p (ebl, ehdr, &shdr_info[cnt].shdr, -+ shdr_info[cnt].name, remove_comment, -+ remove_debug) -+ || cnt == ehdr->e_shstrndx)) - { - /* For now assume this section will be removed. */ - shdr_info[cnt].idx = 0; -@@ -1062,8 +1064,10 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, - } - - /* Test whether we are doing anything at all. */ -- if (cnt == idx) -- /* Nope, all removable sections are already gone. */ -+ if (cnt == idx -+ || (cnt == idx + 1 && shdr_info[ehdr->e_shstrndx].idx == 0)) -+ /* Nope, all removable sections are already gone. Or the only section -+ we would remove is the .shstrtab section which we will add again. */ - goto fail_close; - - /* Create the reference to the file with the debug info. */ -diff --git a/tests/ChangeLog b/tests/ChangeLog -index 5b0d486..5800946 100644 ---- a/tests/ChangeLog -+++ b/tests/ChangeLog -@@ -1,3 +1,7 @@ -+2017-06-06 Mark Wielaard -+ -+ * run-strip-test.sh: Test strip -g doesn't introduce extra .shstrtab. -+ - 2017-02-13 Ulf Hermann - Mark Wielaard - -diff --git a/tests/run-strip-test.sh b/tests/run-strip-test.sh -index 42aa988..280814e 100755 ---- a/tests/run-strip-test.sh -+++ b/tests/run-strip-test.sh -@@ -49,6 +49,14 @@ testrun ${abs_top_builddir}/src/unstrip -o testfile.unstrip testfile.temp testfi - testrun ${abs_top_builddir}/src/elfcmp --hash-inexact $original testfile.unstrip - } - -+# test strip -g -+testrun ${abs_top_builddir}/src/strip -g -o testfile.temp $original -+ -+# Buggy eu-strip created multiple .shstrtab sections -+shstrtab_SECS=$(testrun ${abs_top_builddir}/src/readelf -S testfile.temp | grep '.shstrtab' | wc --lines) -+test $shstrtab_SECS -eq 1 || -+ { echo "*** failure not just one '.shstrtab' testfile.temp ($shstrtab_SECS)"; status=1; } -+ - # Now strip in-place and make sure it is smaller. - SIZE_original=$(stat -c%s $original) - testrun ${abs_top_builddir}/src/strip $original diff --git a/elfutils-0.169-ppc64-fallback-unwinder.patch b/elfutils-0.169-ppc64-fallback-unwinder.patch deleted file mode 100644 index da727b5..0000000 --- a/elfutils-0.169-ppc64-fallback-unwinder.patch +++ /dev/null @@ -1,275 +0,0 @@ -From 1b2cd3f4dc581eed0fc1ee98f97aa492a19873b0 Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Sun, 21 May 2017 23:33:15 +0200 -Subject: [PATCH] ppc64: Add minimal fallback unwinder. - -This adds a minimal fallback unwinder for ppc64[le] in case we cannot find -CFI for a particular address. It simply always sets the program counter to -the link register, picks the previous stack pointer from the backchain, -and the previous link register from the LR save area. - -This is enough for some simple situations when we don't have CFI and -seems to work nicely in the case of perf with libdw powerpc support: -https://lkml.org/lkml/2017/5/18/998 - -Signed-off-by: Mark Wielaard ---- - backends/ChangeLog | 6 +++ - backends/Makefile.am | 2 +- - backends/ppc64_init.c | 1 + - backends/ppc64_unwind.c | 76 +++++++++++++++++++++++++++++++++ - tests/ChangeLog | 10 +++++ - tests/Makefile.am | 3 ++ - tests/backtrace-subr.sh | 2 +- - tests/backtrace.ppc64le.fp.core.bz2 | Bin 0 -> 37786 bytes - tests/backtrace.ppc64le.fp.exec.bz2 | Bin 0 -> 383808 bytes - tests/run-backtrace-fp-core-ppc64le.sh | 29 +++++++++++++ - 10 files changed, 127 insertions(+), 2 deletions(-) - create mode 100644 backends/ppc64_unwind.c - create mode 100644 tests/backtrace.ppc64le.fp.core.bz2 - create mode 100755 tests/backtrace.ppc64le.fp.exec.bz2 - create mode 100755 tests/run-backtrace-fp-core-ppc64le.sh - -index ff80a82..ac45a45 100644 ---- a/backends/Makefile.am -+++ b/backends/Makefile.am -@@ -98,7 +98,7 @@ am_libebl_ppc_pic_a_OBJECTS = $(ppc_SRCS:.c=.os) - - ppc64_SRCS = ppc64_init.c ppc64_symbol.c ppc64_retval.c \ - ppc64_corenote.c ppc_regs.c ppc_auxv.c ppc_attrs.c ppc_syscall.c \ -- ppc_cfi.c ppc_initreg.c ppc64_resolve_sym.c -+ ppc_cfi.c ppc_initreg.c ppc64_unwind.c ppc64_resolve_sym.c - libebl_ppc64_pic_a_SOURCES = $(ppc64_SRCS) - am_libebl_ppc64_pic_a_OBJECTS = $(ppc64_SRCS:.c=.os) - -diff --git a/backends/ppc64_init.c b/backends/ppc64_init.c -index 11d3a77..e567033 100644 ---- a/backends/ppc64_init.c -+++ b/backends/ppc64_init.c -@@ -73,6 +73,7 @@ ppc64_init (Elf *elf __attribute__ ((unused)), - eh->frame_nregs = (114 - 1) + 32; - HOOK (eh, set_initial_registers_tid); - HOOK (eh, dwarf_to_regno); -+ HOOK (eh, unwind); - HOOK (eh, resolve_sym_value); - - /* Find the function descriptor .opd table for resolve_sym_value. */ -diff --git a/backends/ppc64_unwind.c b/backends/ppc64_unwind.c -new file mode 100644 -index 0000000..4fa0b5a ---- /dev/null -+++ b/backends/ppc64_unwind.c -@@ -0,0 +1,76 @@ -+/* Get previous frame state for an existing frame state. -+ Copyright (C) 2017 Red Hat, Inc. -+ This file is part of elfutils. -+ -+ This file is free software; you can redistribute it and/or modify -+ it under the terms of either -+ -+ * the GNU Lesser General Public License as published by the Free -+ Software Foundation; either version 3 of the License, or (at -+ your option) any later version -+ -+ or -+ -+ * the GNU General Public License as published by the Free -+ Software Foundation; either version 2 of the License, or (at -+ your option) any later version -+ -+ or both in parallel, as here. -+ -+ elfutils 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 copies of the GNU General Public License and -+ the GNU Lesser General Public License along with this program. If -+ not, see . */ -+ -+#ifdef HAVE_CONFIG_H -+# include -+#endif -+ -+#define BACKEND ppc64_ -+ -+#define LR_REG 65 /* Not 108, see ppc_dwarf_to_regno. */ -+#define SP_REG 1 -+ -+#define LR_OFFSET 16 -+ -+#include "libebl_CPU.h" -+ -+/* Simplistic fallback frame unwinder. SP points to the backchain (contains -+ address of previous stack pointer). At SP offset 16 is the LR save area -+ (contains the value of the previous LR). */ -+ -+bool -+EBLHOOK(unwind) (Ebl *ebl __attribute__ ((unused)), -+ Dwarf_Addr pc __attribute__ ((unused)), -+ ebl_tid_registers_t *setfunc, ebl_tid_registers_get_t *getfunc, -+ ebl_pid_memory_read_t *readfunc, void *arg, -+ bool *signal_framep __attribute__ ((unused))) -+{ -+ Dwarf_Word sp, newSp, lr, newLr; -+ -+ /* Stack pointer points to the backchain which contains the previous sp. */ -+ if (! getfunc (SP_REG, 1, &sp, arg)) -+ sp = 0; -+ -+ /* Link register contains previous program counter. */ -+ if (! getfunc (LR_REG, 1, &lr, arg) -+ || lr == 0 -+ || ! setfunc (-1, 1, &lr, arg)) -+ return false; -+ -+ if (! readfunc(sp, &newSp, arg)) -+ newSp = 0; -+ -+ if (! readfunc(newSp + LR_OFFSET, &newLr, arg)) -+ newLr = 0; -+ -+ setfunc(SP_REG, 1, &newSp, arg); -+ setfunc(LR_REG, 1, &newLr, arg); -+ -+ /* Sanity check the stack grows down. */ -+ return newSp > sp; -+} -diff --git a/tests/Makefile.am b/tests/Makefile.am -index 3a12fe3..50648db 100644 ---- a/tests/Makefile.am -+++ b/tests/Makefile.am -@@ -117,6 +117,7 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \ - run-backtrace-native-core-biarch.sh run-backtrace-core-x86_64.sh \ - run-backtrace-fp-core-x86_64.sh \ - run-backtrace-fp-core-aarch64.sh \ -+ run-backtrace-fp-core-ppc64le.sh \ - run-backtrace-core-x32.sh \ - run-backtrace-core-i386.sh run-backtrace-fp-core-i386.sh \ - run-backtrace-core-ppc.sh \ -@@ -303,6 +304,8 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \ - backtrace-subr.sh backtrace.i386.core.bz2 backtrace.i386.exec.bz2 \ - run-backtrace-fp-core-i386.sh \ - backtrace.i386.fp.core.bz2 backtrace.i386.fp.exec.bz2 \ -+ run-backtrace-fp-core-ppc64le.sh \ -+ backtrace.ppc64le.fp.core.bz2 backtrace.ppc64le.fp.exec.bz2 \ - backtrace.x86_64.core.bz2 backtrace.x86_64.exec.bz2 \ - backtrace.x86_64.fp.core.bz2 backtrace.x86_64.fp.exec.bz2 \ - backtrace.ppc.core.bz2 backtrace.ppc.exec.bz2 \ -diff --git a/tests/backtrace-subr.sh b/tests/backtrace-subr.sh -index 9731c43..c1f3156 100644 ---- a/tests/backtrace-subr.sh -+++ b/tests/backtrace-subr.sh -@@ -59,7 +59,7 @@ check_backtracegen() - # Ignore it here as it is a bug of OS, not a bug of elfutils. - check_err() - { -- if [ $(egrep -v <$1 'dwfl_thread_getframes: (No DWARF information found|no matching address range|address out of range|Invalid register)$' \ -+ if [ $(egrep -v <$1 'dwfl_thread_getframes: (No DWARF information found|no matching address range|address out of range|Invalid register|\(null\))$' \ - | wc -c) \ - -eq 0 ] - then -diff --git a/tests/run-backtrace-fp-core-ppc64le.sh b/tests/run-backtrace-fp-core-ppc64le.sh -new file mode 100755 -index 0000000..326ca34 ---- /dev/null -+++ b/tests/run-backtrace-fp-core-ppc64le.sh -@@ -0,0 +1,29 @@ -+#! /bin/bash -+# Copyright (C) 2017 Red Hat, Inc. -+# This file is part of elfutils. -+# -+# This file 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. -+# -+# elfutils 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 . -+ -+. $srcdir/backtrace-subr.sh -+ -+# The binary is generated by compiling backtrace-child without unwind -+# information, but with -fno-omit-frame-pointer. -+# -+# gcc -static -O2 -fno-omit-frame-pointer -fno-asynchronous-unwind-tables \ -+# -D_GNU_SOURCE -pthread -o tests/backtrace.ppc64le.fp.exec -I. -Ilib \ -+# tests/backtrace-child.c -+# -+# The core is generated by calling tests/backtrace.ppc64le.fp.exec --gencore -+ -+check_core ppc64le.fp --- -1.8.3.1 - -diff -ru elfutils-0.169.orig/backends/Makefile.in elfutils-0.169/backends/Makefile.in ---- elfutils-0.169.orig/backends/Makefile.in 2017-05-30 21:43:28.725454717 +0200 -+++ elfutils-0.169/backends/Makefile.in 2017-05-30 21:43:55.681944556 +0200 -@@ -159,7 +159,7 @@ - ppc64_retval.$(OBJEXT) ppc64_corenote.$(OBJEXT) \ - ppc_regs.$(OBJEXT) ppc_auxv.$(OBJEXT) ppc_attrs.$(OBJEXT) \ - ppc_syscall.$(OBJEXT) ppc_cfi.$(OBJEXT) ppc_initreg.$(OBJEXT) \ -- ppc64_resolve_sym.$(OBJEXT) -+ ppc64_unwind.$(OBJEXT) ppc64_resolve_sym.$(OBJEXT) - libebl_ppc64_pic_a_OBJECTS = $(am_libebl_ppc64_pic_a_OBJECTS) - libebl_ppc_pic_a_AR = $(AR) $(ARFLAGS) - libebl_ppc_pic_a_LIBADD = -@@ -505,7 +505,7 @@ - am_libebl_ppc_pic_a_OBJECTS = $(ppc_SRCS:.c=.os) - ppc64_SRCS = ppc64_init.c ppc64_symbol.c ppc64_retval.c \ - ppc64_corenote.c ppc_regs.c ppc_auxv.c ppc_attrs.c ppc_syscall.c \ -- ppc_cfi.c ppc_initreg.c ppc64_resolve_sym.c -+ ppc_cfi.c ppc_initreg.c ppc64_unwind.c ppc64_resolve_sym.c - - libebl_ppc64_pic_a_SOURCES = $(ppc64_SRCS) - am_libebl_ppc64_pic_a_OBJECTS = $(ppc64_SRCS:.c=.os) -@@ -696,6 +696,7 @@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc64_resolve_sym.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc64_retval.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc64_symbol.Po@am__quote@ -+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc64_unwind.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc_attrs.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc_auxv.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppc_cfi.Po@am__quote@ -diff -ru elfutils-0.169.orig/tests/Makefile.in elfutils-0.169/tests/Makefile.in ---- elfutils-0.169.orig/tests/Makefile.in 2017-05-30 21:43:28.743454377 +0200 -+++ elfutils-0.169/tests/Makefile.in 2017-05-30 21:43:56.191934904 +0200 -@@ -174,7 +174,8 @@ - run-backtrace-native-biarch.sh run-backtrace-native-core.sh \ - run-backtrace-native-core-biarch.sh \ - run-backtrace-core-x86_64.sh run-backtrace-fp-core-x86_64.sh \ -- run-backtrace-fp-core-aarch64.sh run-backtrace-core-x32.sh \ -+ run-backtrace-fp-core-aarch64.sh \ -+ run-backtrace-fp-core-ppc64le.sh run-backtrace-core-x32.sh \ - run-backtrace-core-i386.sh run-backtrace-fp-core-i386.sh \ - run-backtrace-core-ppc.sh run-backtrace-core-s390x.sh \ - run-backtrace-core-s390.sh run-backtrace-core-aarch64.sh \ -@@ -1174,6 +1175,8 @@ - backtrace-subr.sh backtrace.i386.core.bz2 backtrace.i386.exec.bz2 \ - run-backtrace-fp-core-i386.sh \ - backtrace.i386.fp.core.bz2 backtrace.i386.fp.exec.bz2 \ -+ run-backtrace-fp-core-ppc64le.sh \ -+ backtrace.ppc64le.fp.core.bz2 backtrace.ppc64le.fp.exec.bz2 \ - backtrace.x86_64.core.bz2 backtrace.x86_64.exec.bz2 \ - backtrace.x86_64.fp.core.bz2 backtrace.x86_64.fp.exec.bz2 \ - backtrace.ppc.core.bz2 backtrace.ppc.exec.bz2 \ -@@ -2924,6 +2927,13 @@ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ -+ "$$tst" $(AM_TESTS_FD_REDIRECT) -+run-backtrace-fp-core-ppc64le.sh.log: run-backtrace-fp-core-ppc64le.sh -+ @p='run-backtrace-fp-core-ppc64le.sh'; \ -+ b='run-backtrace-fp-core-ppc64le.sh'; \ -+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ -+ --log-file $$b.log --trs-file $$b.trs \ -+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) - run-backtrace-core-x32.sh.log: run-backtrace-core-x32.sh - @p='run-backtrace-core-x32.sh'; \ diff --git a/elfutils-0.169-s390x-ptrace.patch b/elfutils-0.169-s390x-ptrace.patch deleted file mode 100644 index 86e51e8..0000000 --- a/elfutils-0.169-s390x-ptrace.patch +++ /dev/null @@ -1,27 +0,0 @@ -commit 1dd301b7c302b9df980946e2d04ca99748754991 -Author: Mark Wielaard -Date: Mon Jul 17 17:26:25 2017 +0200 - - backends: Swap sys/ptrace.h and asm/ptrace.h include order on s390. - - glibc 2.26 changed the sys/ptrace.h header so that it cannot be included - after asm/ptrace.h. We still need to include the kernel asm/ptrace.h for - the ptrace_area definition. Including it after sys/ptrace.h works against - both old and new glibc. - - Signed-off-by: Mark Wielaard - -diff --git a/backends/s390_initreg.c b/backends/s390_initreg.c -index 011305c..23bf8ed 100644 ---- a/backends/s390_initreg.c -+++ b/backends/s390_initreg.c -@@ -34,8 +34,8 @@ - #include - #if defined(__s390__) && defined(__linux__) - # include --# include - # include -+# include - #endif - - #define BACKEND s390_ diff --git a/elfutils-0.169-strip-data-marker-symbols.patch b/elfutils-0.169-strip-data-marker-symbols.patch deleted file mode 100644 index 37cede8..0000000 --- a/elfutils-0.169-strip-data-marker-symbols.patch +++ /dev/null @@ -1,553 +0,0 @@ -commit 17bfd57dd13f81b8ed5d1ee5109355bc377cf76c -Author: Mark Wielaard -Date: Thu Jul 20 22:34:29 2017 +0200 - - strip: Deal with ARM data marker symbols pointing to debug sections. - - ARM data marker symbols "$d" indicate the start of a sequence of data - items in a section. For data only sections no data marker symbol is - necessary, but may be put pointing to the start of the section. - binutils however has a bug which places a data marker symbol somewhere - inside the section (at least for .debug_frame). - https://sourceware.org/bugzilla/show_bug.cgi?id=21809 - - When strip finds a symbol pointing to a debug section that would be - put into the .debug file then it will copy over the whole symbol table. - This isn't necessary because the symbol is redundant. - - Add an ebl hook to recognize data marker symbols with implementations - for arm and aarch64. Use it in strip to strip such symbols from the - symbol table if they point to a debug section. - - Signed-off-by: Mark Wielaard - -diff --git a/backends/aarch64_init.c b/backends/aarch64_init.c -index 0866494..fad923f 100644 ---- a/backends/aarch64_init.c -+++ b/backends/aarch64_init.c -@@ -1,5 +1,5 @@ - /* Initialization of AArch64 specific backend library. -- Copyright (C) 2013 Red Hat, Inc. -+ Copyright (C) 2013, 2017 Red Hat, Inc. - This file is part of elfutils. - - This file is free software; you can redistribute it and/or modify -@@ -56,6 +56,7 @@ aarch64_init (Elf *elf __attribute__ ((unused)), - HOOK (eh, reloc_simple_type); - HOOK (eh, return_value_location); - HOOK (eh, check_special_symbol); -+ HOOK (eh, data_marker_symbol); - HOOK (eh, abi_cfi); - - /* X0-X30 (31 regs) + SP + 1 Reserved + ELR, 30 Reserved regs (34-43) -diff --git a/backends/aarch64_symbol.c b/backends/aarch64_symbol.c -index 76999e4..da3382e 100644 ---- a/backends/aarch64_symbol.c -+++ b/backends/aarch64_symbol.c -@@ -1,5 +1,5 @@ - /* AArch64 specific symbolic name handling. -- Copyright (C) 2013, 2015 Red Hat, Inc. -+ Copyright (C) 2013, 2015, 2017 Red Hat, Inc. - This file is part of elfutils. - - This file is free software; you can redistribute it and/or modify -@@ -90,3 +90,15 @@ aarch64_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, const GElf_Sym *sym, - - return false; - } -+ -+/* A data mapping symbol is a symbol with "$d" name or "$d." name, -+ STT_NOTYPE, STB_LOCAL and st_size of zero. The indicate the stat of a -+ sequence of data items. */ -+bool -+aarch64_data_marker_symbol (const GElf_Sym *sym, const char *sname) -+{ -+ return (sym != NULL && sname != NULL -+ && sym->st_size == 0 && GELF_ST_BIND (sym->st_info) == STB_LOCAL -+ && GELF_ST_TYPE (sym->st_info) == STT_NOTYPE -+ && (strcmp (sname, "$d") == 0 || strncmp (sname, "$d.", 3) == 0)); -+} -diff --git a/backends/arm_init.c b/backends/arm_init.c -index caadac6..f2b1b11 100644 ---- a/backends/arm_init.c -+++ b/backends/arm_init.c -@@ -1,5 +1,5 @@ - /* Initialization of Arm specific backend library. -- Copyright (C) 2002, 2005, 2009, 2013, 2014, 2015 Red Hat, Inc. -+ Copyright (C) 2002, 2005, 2009, 2013, 2014, 2015, 2017 Red Hat, Inc. - This file is part of elfutils. - Written by Ulrich Drepper , 2002. - -@@ -64,6 +64,7 @@ arm_init (Elf *elf __attribute__ ((unused)), - HOOK (eh, abi_cfi); - HOOK (eh, check_reloc_target_type); - HOOK (eh, symbol_type_name); -+ HOOK (eh, data_marker_symbol); - - /* We only unwind the core integer registers. */ - eh->frame_nregs = 16; -diff --git a/backends/arm_symbol.c b/backends/arm_symbol.c -index da4a50a..3edda72 100644 ---- a/backends/arm_symbol.c -+++ b/backends/arm_symbol.c -@@ -1,5 +1,5 @@ - /* Arm specific symbolic name handling. -- Copyright (C) 2002-2009, 2014, 2015 Red Hat, Inc. -+ Copyright (C) 2002-2009, 2014, 2015, 2017 Red Hat, Inc. - This file is part of elfutils. - - This file is free software; you can redistribute it and/or modify -@@ -32,6 +32,7 @@ - - #include - #include -+#include - - #define BACKEND arm_ - #include "libebl_CPU.h" -@@ -142,3 +143,15 @@ arm_symbol_type_name (int type, - } - return NULL; - } -+ -+/* A data mapping symbol is a symbol with "$d" name or "$d." name, -+ * STT_NOTYPE, STB_LOCAL and st_size of zero. The indicate the stat of a -+ * sequence of data items. */ -+bool -+arm_data_marker_symbol (const GElf_Sym *sym, const char *sname) -+{ -+ return (sym != NULL && sname != NULL -+ && sym->st_size == 0 && GELF_ST_BIND (sym->st_info) == STB_LOCAL -+ && GELF_ST_TYPE (sym->st_info) == STT_NOTYPE -+ && (strcmp (sname, "$d") == 0 || strncmp (sname, "$d.", 3) == 0)); -+} -diff --git a/libebl/Makefile.am b/libebl/Makefile.am -index 6f945eb..2491df8 100644 ---- a/libebl/Makefile.am -+++ b/libebl/Makefile.am -@@ -1,6 +1,6 @@ - ## Process this file with automake to create Makefile.in - ## --## Copyright (C) 2000-2010, 2013, 2016 Red Hat, Inc. -+## Copyright (C) 2000-2010, 2013, 2016, 2017 Red Hat, Inc. - ## This file is part of elfutils. - ## - ## This file is free software; you can redistribute it and/or modify -@@ -53,7 +53,8 @@ gen_SOURCES = eblopenbackend.c eblclosebackend.c \ - eblsysvhashentrysize.c eblauxvinfo.c eblcheckobjattr.c \ - ebl_check_special_section.c ebl_syscall_abi.c eblabicfi.c \ - eblstother.c eblinitreg.c ebldwarftoregno.c eblnormalizepc.c \ -- eblunwind.c eblresolvesym.c eblcheckreloctargettype.c -+ eblunwind.c eblresolvesym.c eblcheckreloctargettype.c \ -+ ebl_data_marker_symbol.c - - libebl_a_SOURCES = $(gen_SOURCES) - -diff --git a/libebl/ebl-hooks.h b/libebl/ebl-hooks.h -index b725374..f3a0e64 100644 ---- a/libebl/ebl-hooks.h -+++ b/libebl/ebl-hooks.h -@@ -1,5 +1,5 @@ - /* Backend hook signatures internal interface for libebl. -- Copyright (C) 2000-2011, 2013, 2014, 2016 Red Hat, Inc. -+ Copyright (C) 2000-2011, 2013, 2014, 2016, 2017 Red Hat, Inc. - This file is part of elfutils. - - This file is free software; you can redistribute it and/or modify -@@ -121,6 +121,9 @@ bool EBLHOOK(relative_reloc_p) (int); - bool EBLHOOK(check_special_symbol) (Elf *, GElf_Ehdr *, const GElf_Sym *, - const char *, const GElf_Shdr *); - -+/* Check if this is a data marker symbol. e.g. '$d' symbols for ARM. */ -+bool EBLHOOK(data_marker_symbol) (const GElf_Sym *sym, const char *sname); -+ - /* Check whether only valid bits are set on the st_other symbol flag. - Standard ST_VISIBILITY have already been masked off. */ - bool EBLHOOK(check_st_other_bits) (unsigned char st_other); -diff --git a/libebl/ebl_data_marker_symbol.c b/libebl/ebl_data_marker_symbol.c -new file mode 100644 -index 0000000..922d720 ---- /dev/null -+++ b/libebl/ebl_data_marker_symbol.c -@@ -0,0 +1,44 @@ -+/* Check whether a symbol is a special data marker. -+ Copyright (C) 2017 Red Hat, Inc. -+ This file is part of elfutils. -+ -+ This file is free software; you can redistribute it and/or modify -+ it under the terms of either -+ -+ * the GNU Lesser General Public License as published by the Free -+ Software Foundation; either version 3 of the License, or (at -+ your option) any later version -+ -+ or -+ -+ * the GNU General Public License as published by the Free -+ Software Foundation; either version 2 of the License, or (at -+ your option) any later version -+ -+ or both in parallel, as here. -+ -+ elfutils 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 copies of the GNU General Public License and -+ the GNU Lesser General Public License along with this program. If -+ not, see . */ -+ -+#ifdef HAVE_CONFIG_H -+# include -+#endif -+ -+#include -+#include -+ -+ -+bool -+ebl_data_marker_symbol (Ebl *ebl, const GElf_Sym *sym, const char *sname) -+{ -+ if (ebl == NULL) -+ return false; -+ -+ return ebl->data_marker_symbol (sym, sname); -+} -diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c -index f3a65cf..1f81477 100644 ---- a/libebl/eblopenbackend.c -+++ b/libebl/eblopenbackend.c -@@ -1,5 +1,5 @@ - /* Generate ELF backend handle. -- Copyright (C) 2000-2016 Red Hat, Inc. -+ Copyright (C) 2000-2017 Red Hat, Inc. - This file is part of elfutils. - - This file is free software; you can redistribute it and/or modify -@@ -184,6 +184,7 @@ static bool default_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, - const GElf_Sym *sym, - const char *name, - const GElf_Shdr *destshdr); -+static bool default_data_marker_symbol (const GElf_Sym *sym, const char *sname); - static bool default_check_st_other_bits (unsigned char st_other); - static bool default_check_special_section (Ebl *, int, - const GElf_Shdr *, const char *); -@@ -235,6 +236,7 @@ fill_defaults (Ebl *result) - result->none_reloc_p = default_none_reloc_p; - result->relative_reloc_p = default_relative_reloc_p; - result->check_special_symbol = default_check_special_symbol; -+ result->data_marker_symbol = default_data_marker_symbol; - result->check_st_other_bits = default_check_st_other_bits; - result->bss_plt_p = default_bss_plt_p; - result->return_value_location = default_return_value_location; -@@ -672,6 +674,13 @@ default_check_special_symbol (Elf *elf __attribute__ ((unused)), - } - - static bool -+default_data_marker_symbol (const GElf_Sym *sym __attribute__ ((unused)), -+ const char *sname __attribute__ ((unused))) -+{ -+ return false; -+} -+ -+static bool - default_check_st_other_bits (unsigned char st_other __attribute__ ((unused))) - { - return false; -diff --git a/libebl/libebl.h b/libebl/libebl.h -index 87896e4..882bdb9 100644 ---- a/libebl/libebl.h -+++ b/libebl/libebl.h -@@ -1,5 +1,5 @@ - /* Interface for libebl. -- Copyright (C) 2000-2010, 2013, 2014, 2015, 2016 Red Hat, Inc. -+ Copyright (C) 2000-2010, 2013, 2014, 2015, 2016, 2017 Red Hat, Inc. - This file is part of elfutils. - - This file is free software; you can redistribute it and/or modify -@@ -156,6 +156,10 @@ extern bool ebl_check_special_symbol (Ebl *ebl, GElf_Ehdr *ehdr, - const GElf_Sym *sym, const char *name, - const GElf_Shdr *destshdr); - -+/* Check if this is a data marker symbol. e.g. '$d' symbols for ARM. */ -+extern bool ebl_data_marker_symbol (Ebl *ebl, const GElf_Sym *sym, -+ const char *sname); -+ - /* Check whether only valid bits are set on the st_other symbol flag. */ - extern bool ebl_check_st_other_bits (Ebl *ebl, unsigned char st_other); - -diff --git a/src/strip.c b/src/strip.c -index 4a35ea1..773ed54 100644 ---- a/src/strip.c -+++ b/src/strip.c -@@ -1,5 +1,5 @@ - /* Discard section not used at runtime from object files. -- Copyright (C) 2000-2012, 2014, 2015, 2016 Red Hat, Inc. -+ Copyright (C) 2000-2012, 2014, 2015, 2016, 2017 Red Hat, Inc. - This file is part of elfutils. - Written by Ulrich Drepper , 2000. - -@@ -960,8 +960,19 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, - if (shdr_info[scnidx].idx == 0) - /* This symbol table has a real symbol in - a discarded section. So preserve the -- original table in the debug file. */ -- shdr_info[cnt].debug_data = symdata; -+ original table in the debug file. Unless -+ it is a redundant data marker to a debug -+ (data only) section. */ -+ if (! (ebl_section_strip_p (ebl, ehdr, -+ &shdr_info[scnidx].shdr, -+ shdr_info[scnidx].name, -+ remove_comment, -+ remove_debug) -+ && ebl_data_marker_symbol (ebl, sym, -+ elf_strptr (elf, -+ shdr_info[cnt].shdr.sh_link, -+ sym->st_name)))) -+ shdr_info[cnt].debug_data = symdata; - } - } - -@@ -1293,7 +1304,10 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, - shdr_info[cnt].shdr.sh_name = dwelf_strent_off (shdr_info[cnt].se); - - /* Update the section header from the input file. Some fields -- might be section indeces which now have to be adjusted. */ -+ might be section indeces which now have to be adjusted. Keep -+ the index to the "current" sh_link in case we need it to lookup -+ symbol table names. */ -+ size_t sh_link = shdr_info[cnt].shdr.sh_link; - if (shdr_info[cnt].shdr.sh_link != 0) - shdr_info[cnt].shdr.sh_link = - shdr_info[shdr_info[cnt].shdr.sh_link].idx; -@@ -1492,13 +1506,17 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, - /* The symbol points to a section that is discarded - but isn't preserved in the debug file. Check that - this is a section or group signature symbol -- for a section which has been removed. */ -+ for a section which has been removed. Or a special -+ data marker symbol to a debug section. */ - { - elf_assert (GELF_ST_TYPE (sym->st_info) == STT_SECTION - || ((shdr_info[sidx].shdr.sh_type - == SHT_GROUP) - && (shdr_info[sidx].shdr.sh_info -- == inner))); -+ == inner)) -+ || ebl_data_marker_symbol (ebl, sym, -+ elf_strptr (elf, sh_link, -+ sym->st_name))); - } - } - -diff --git a/tests/Makefile.am b/tests/Makefile.am -index 7fd4b21..edfdb53 100644 ---- a/tests/Makefile.am -+++ b/tests/Makefile.am -@@ -81,7 +81,7 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \ - run-strip-test3.sh run-strip-test4.sh run-strip-test5.sh \ - run-strip-test6.sh run-strip-test7.sh run-strip-test8.sh \ - run-strip-test9.sh run-strip-test10.sh run-strip-test11.sh \ -- run-strip-nothing.sh \ -+ run-strip-nothing.sh run-strip-g.sh \ - run-strip-groups.sh run-strip-reloc.sh run-strip-strmerge.sh \ - run-strip-nobitsalign.sh run-strip-remove-keep.sh \ - run-unstrip-test.sh run-unstrip-test2.sh run-unstrip-test3.sh \ -@@ -176,7 +176,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \ - run-strip-test4.sh run-strip-test5.sh run-strip-test6.sh \ - run-strip-test7.sh run-strip-test8.sh run-strip-groups.sh \ - run-strip-test9.sh run-strip-test10.sh run-strip-test11.sh \ -- run-strip-nothing.sh run-strip-remove-keep.sh \ -+ run-strip-nothing.sh run-strip-remove-keep.sh run-strip-g.sh \ - run-strip-strmerge.sh run-strip-nobitsalign.sh \ - testfile-nobitsalign.bz2 testfile-nobitsalign.strip.bz2 \ - run-strip-reloc.sh hello_i386.ko.bz2 hello_x86_64.ko.bz2 \ -diff --git a/tests/run-strip-g.sh b/tests/run-strip-g.sh -new file mode 100755 -index 0000000..1303819 ---- /dev/null -+++ b/tests/run-strip-g.sh -@@ -0,0 +1,102 @@ -+#! /bin/sh -+# Copyright (C) 2017 Red Hat, Inc. -+# This file is part of elfutils. -+# -+# This file 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. -+# -+# elfutils 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 . -+ -+. $srcdir/test-subr.sh -+ -+# When stripping just the debug sections/symbols we keep the symtab -+# in the main ELF file. There should be no symbols pointing into the -+# debug sections and so there should not be a copy in the debug file -+# except for a NOBITS one. -+ -+tempfiles a.out strip.out debug.out readelf.out -+ -+echo Create debug a.out. -+echo "int main() { return 1; }" | gcc -g -xc - -+ -+echo strip -g to file with debug file -+testrun ${abs_top_builddir}/src/strip -g -o strip.out -f debug.out || -+ { echo "*** failed to strip -g -o strip.out -f debug.out a.out"; exit -1; } -+ -+status=0 -+testrun ${abs_top_builddir}/src/readelf -S strip.out > readelf.out -+grep SYMTAB readelf.out || status=$? -+echo $status -+if test $status -ne 0; then -+ echo no symtab found in strip.out -+ exit 1 -+fi -+ -+status=0 -+testrun ${abs_top_builddir}/src/readelf -S debug.out > readelf.out -+grep SYMTAB readelf.out || status=$? -+echo $status -+if test $status -ne 1; then -+ echo symtab found in debug.out -+ exit 1 -+fi -+ -+# arm (with data marker in .debug_frame). See tests/run-addrcfi.sh -+testfiles testfilearm -+ -+echo arm strip -g to file with debug file -+testrun ${abs_top_builddir}/src/strip -g -o strip.out -f debug.out testfilearm || -+ { echo "*** failed to strip -g -o strip.out -f debug.out a.out"; exit -1; } -+ -+status=0 -+testrun ${abs_top_builddir}/src/readelf -S strip.out > readelf.out -+grep SYMTAB readelf.out || status=$? -+echo $status -+if test $status -ne 0; then -+ echo no symtab found in strip.out -+ exit 1 -+fi -+ -+status=0 -+testrun ${abs_top_builddir}/src/readelf -S debug.out > readelf.out -+grep SYMTAB readelf.out || status=$? -+echo $status -+if test $status -ne 1; then -+ echo symtab found in debug.out -+ exit 1 -+fi -+ -+# aarch64 (with data marker in .debug_frame). See tests/run-addrcfi.sh -+testfiles testfileaarch64 -+ -+echo aarch64 strip -g to file with debug file -+testrun ${abs_top_builddir}/src/strip -g -o strip.out -f debug.out testfileaarch64 || -+ { echo "*** failed to strip -g -o strip.out -f debug.out a.out"; exit -1; } -+ -+status=0 -+testrun ${abs_top_builddir}/src/readelf -S strip.out > readelf.out -+grep SYMTAB readelf.out || status=$? -+echo $status -+if test $status -ne 0; then -+ echo no symtab found in strip.out -+ exit 1 -+fi -+ -+status=0 -+testrun ${abs_top_builddir}/src/readelf -S debug.out > readelf.out -+grep SYMTAB readelf.out || status=$? -+echo $status -+if test $status -ne 1; then -+ echo symtab found in debug.out -+ exit 1 -+fi -+ -+exit 0 -diff -ru elfutils-0.169.orig/libebl/Makefile.in elfutils-0.169/libebl/Makefile.in ---- elfutils-0.169.orig/libebl/Makefile.in 2017-07-21 12:49:56.824083447 +0200 -+++ elfutils-0.169/libebl/Makefile.in 2017-07-21 12:50:44.169036296 +0200 -@@ -163,7 +163,8 @@ - eblstother.$(OBJEXT) eblinitreg.$(OBJEXT) \ - ebldwarftoregno.$(OBJEXT) eblnormalizepc.$(OBJEXT) \ - eblunwind.$(OBJEXT) eblresolvesym.$(OBJEXT) \ -- eblcheckreloctargettype.$(OBJEXT) -+ eblcheckreloctargettype.$(OBJEXT) \ -+ ebl_data_marker_symbol.$(OBJEXT) - am_libebl_a_OBJECTS = $(am__objects_1) - libebl_a_OBJECTS = $(am_libebl_a_OBJECTS) - AM_V_P = $(am__v_P_@AM_V@) -@@ -405,7 +406,8 @@ - eblsysvhashentrysize.c eblauxvinfo.c eblcheckobjattr.c \ - ebl_check_special_section.c ebl_syscall_abi.c eblabicfi.c \ - eblstother.c eblinitreg.c ebldwarftoregno.c eblnormalizepc.c \ -- eblunwind.c eblresolvesym.c eblcheckreloctargettype.c -+ eblunwind.c eblresolvesym.c eblcheckreloctargettype.c \ -+ ebl_data_marker_symbol.c - - libebl_a_SOURCES = $(gen_SOURCES) - noinst_HEADERS = libeblP.h ebl-hooks.h -diff -ru elfutils-0.169.orig/tests/Makefile.in elfutils-0.169/tests/Makefile.in ---- elfutils-0.169.orig/tests/Makefile.in 2017-07-21 12:49:56.849082894 +0200 -+++ elfutils-0.169/tests/Makefile.in 2017-07-21 12:50:44.461029838 +0200 -@@ -139,17 +139,18 @@ - run-strip-test4.sh run-strip-test5.sh run-strip-test6.sh \ - run-strip-test7.sh run-strip-test8.sh run-strip-test9.sh \ - run-strip-test10.sh run-strip-test11.sh run-strip-nothing.sh \ -- run-strip-groups.sh run-strip-reloc.sh run-strip-strmerge.sh \ -- run-strip-nobitsalign.sh run-strip-remove-keep.sh \ -- run-unstrip-test.sh run-unstrip-test2.sh run-unstrip-test3.sh \ -- run-unstrip-test4.sh run-unstrip-M.sh run-elfstrmerge-test.sh \ -- run-ecp-test.sh run-ecp-test2.sh run-alldts.sh \ -- run-elflint-test.sh run-elflint-self.sh run-ranlib-test.sh \ -- run-ranlib-test2.sh run-ranlib-test3.sh run-ranlib-test4.sh \ -- run-addrscopes.sh run-strings-test.sh run-funcscopes.sh \ -- run-find-prologues.sh run-allregs.sh run-addrcfi.sh \ -- run-nm-self.sh run-readelf-self.sh run-readelf-test1.sh \ -- run-readelf-test2.sh run-readelf-test3.sh run-readelf-test4.sh \ -+ run-strip-g.sh run-strip-groups.sh run-strip-reloc.sh \ -+ run-strip-strmerge.sh run-strip-nobitsalign.sh \ -+ run-strip-remove-keep.sh run-unstrip-test.sh \ -+ run-unstrip-test2.sh run-unstrip-test3.sh run-unstrip-test4.sh \ -+ run-unstrip-M.sh run-elfstrmerge-test.sh run-ecp-test.sh \ -+ run-ecp-test2.sh run-alldts.sh run-elflint-test.sh \ -+ run-elflint-self.sh run-ranlib-test.sh run-ranlib-test2.sh \ -+ run-ranlib-test3.sh run-ranlib-test4.sh run-addrscopes.sh \ -+ run-strings-test.sh run-funcscopes.sh run-find-prologues.sh \ -+ run-allregs.sh run-addrcfi.sh run-nm-self.sh \ -+ run-readelf-self.sh run-readelf-test1.sh run-readelf-test2.sh \ -+ run-readelf-test3.sh run-readelf-test4.sh \ - run-readelf-twofiles.sh run-readelf-macro.sh \ - run-readelf-loc.sh run-readelf-aranges.sh run-readelf-line.sh \ - run-readelf-z.sh run-native-test.sh run-bug1-test.sh \ -@@ -1046,7 +1047,7 @@ - run-strip-test4.sh run-strip-test5.sh run-strip-test6.sh \ - run-strip-test7.sh run-strip-test8.sh run-strip-groups.sh \ - run-strip-test9.sh run-strip-test10.sh run-strip-test11.sh \ -- run-strip-nothing.sh run-strip-remove-keep.sh \ -+ run-strip-nothing.sh run-strip-remove-keep.sh run-strip-g.sh \ - run-strip-strmerge.sh run-strip-nobitsalign.sh \ - testfile-nobitsalign.bz2 testfile-nobitsalign.strip.bz2 \ - run-strip-reloc.sh hello_i386.ko.bz2 hello_x86_64.ko.bz2 \ -@@ -2340,6 +2341,13 @@ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ -+ "$$tst" $(AM_TESTS_FD_REDIRECT) -+run-strip-g.sh.log: run-strip-g.sh -+ @p='run-strip-g.sh'; \ -+ b='run-strip-g.sh'; \ -+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ -+ --log-file $$b.log --trs-file $$b.trs \ -+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) - run-strip-groups.sh.log: run-strip-groups.sh - @p='run-strip-groups.sh'; \ diff --git a/elfutils-0.169-strip-empty.patch b/elfutils-0.169-strip-empty.patch deleted file mode 100644 index 13d0c0f..0000000 --- a/elfutils-0.169-strip-empty.patch +++ /dev/null @@ -1,235 +0,0 @@ -commit b065d4a401e2120c11c92357b213a85e6d70f300 -Author: Mark Wielaard -Date: Wed Jun 7 20:32:38 2017 +0200 - - strip: Don't generate empty output file when nothing to do. - - If there was nothing to do strip would skip generating a separate - debug file if one was requested, but it would also not finish the - creation of a new output file (with the non-stripped sections). - Also if there was an error any partially created output would be kept. - - Make sure that when the -o output file option is given we always generate - a complete output file (except on error). Also make sure that when the -f - debug file option is given it is only generated when it is not empty. - - Add testcase run-strip-nothing.sh that tests the various combinations. - - https://sourceware.org/bugzilla/show_bug.cgi?id=21522 - - Signed-off-by: Mark Wielaard - -diff --git a/src/ChangeLog b/src/ChangeLog -index 6ac0ef2..e19122e 100644 ---- a/src/ChangeLog -+++ b/src/ChangeLog -@@ -1,3 +1,9 @@ -+2017-06-07 Mark Wielaard -+ -+ * strip.c (handle_elf): Introduce new handle_elf boolean. Use it to -+ determine whether to create an output and/or debug file. Remove new -+ output file on error. -+ - 2017-06-06 Mark Wielaard - - * strip.c (handle_elf): Assume e_shstrndx section can be removed. -diff --git a/src/strip.c b/src/strip.c -index 11b2a37..2bf95f9 100644 ---- a/src/strip.c -+++ b/src/strip.c -@@ -1063,15 +1063,17 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, - shdr_info[cnt].se = dwelf_strtab_add (shst, shdr_info[cnt].name); - } - -- /* Test whether we are doing anything at all. */ -- if (cnt == idx -- || (cnt == idx + 1 && shdr_info[ehdr->e_shstrndx].idx == 0)) -- /* Nope, all removable sections are already gone. Or the only section -- we would remove is the .shstrtab section which we will add again. */ -- goto fail_close; -- -- /* Create the reference to the file with the debug info. */ -- if (debug_fname != NULL && !remove_shdrs) -+ /* Test whether we are doing anything at all. Either all removable -+ sections are already gone. Or the only section we would remove is -+ the .shstrtab section which we would add again. */ -+ bool removing_sections = !(cnt == idx -+ || (cnt == idx + 1 -+ && shdr_info[ehdr->e_shstrndx].idx == 0)); -+ if (output_fname == NULL && !removing_sections) -+ goto fail_close; -+ -+ /* Create the reference to the file with the debug info (if any). */ -+ if (debug_fname != NULL && !remove_shdrs && removing_sections) - { - /* Add the section header string table section name. */ - shdr_info[cnt].se = dwelf_strtab_add_len (shst, ".gnu_debuglink", 15); -@@ -1759,7 +1761,8 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, - /* Remove any relocations between debug sections in ET_REL - for the debug file when requested. These relocations are always - zero based between the unallocated sections. */ -- if (debug_fname != NULL && reloc_debug && ehdr->e_type == ET_REL) -+ if (debug_fname != NULL && removing_sections -+ && reloc_debug && ehdr->e_type == ET_REL) - { - scn = NULL; - cnt = 0; -@@ -1997,7 +2000,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, - - /* Now that we have done all adjustments to the data, - we can actually write out the debug file. */ -- if (debug_fname != NULL) -+ if (debug_fname != NULL && removing_sections) - { - /* Finally write the file. */ - if (unlikely (elf_update (debugelf, ELF_C_WRITE) == -1)) -@@ -2230,7 +2233,11 @@ cannot set access and modification date of '%s'"), - - /* Close the file descriptor if we created a new file. */ - if (output_fname != NULL) -- close (fd); -+ { -+ close (fd); -+ if (result != 0) -+ unlink (output_fname); -+ } - - return result; - } -diff --git a/tests/ChangeLog b/tests/ChangeLog -index 5800946..5550eac 100644 ---- a/tests/ChangeLog -+++ b/tests/ChangeLog -@@ -1,3 +1,9 @@ -+2017-06-07 Mark Wielaard -+ -+ * run-strip-nothing.sh: New test. -+ * Makefile.am (TESTS): Add run-strip-nothing.sh. -+ (EXTRA_DIST): Likewise. -+ - 2017-06-06 Mark Wielaard - - * run-strip-test.sh: Test strip -g doesn't introduce extra .shstrtab. -diff --git a/tests/Makefile.am b/tests/Makefile.am -index 3a12fe3..28e997c 100644 ---- a/tests/Makefile.am -+++ b/tests/Makefile.am -@@ -81,6 +81,7 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \ - run-strip-test3.sh run-strip-test4.sh run-strip-test5.sh \ - run-strip-test6.sh run-strip-test7.sh run-strip-test8.sh \ - run-strip-test9.sh run-strip-test10.sh run-strip-test11.sh \ -+ run-strip-nothing.sh \ - run-strip-groups.sh run-strip-reloc.sh run-strip-strmerge.sh \ - run-strip-nobitsalign.sh \ - run-unstrip-test.sh run-unstrip-test2.sh run-unstrip-test3.sh \ -@@ -174,6 +175,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \ - run-strip-test4.sh run-strip-test5.sh run-strip-test6.sh \ - run-strip-test7.sh run-strip-test8.sh run-strip-groups.sh \ - run-strip-test9.sh run-strip-test10.sh run-strip-test11.sh \ -+ run-strip-nothing.sh \ - run-strip-strmerge.sh run-strip-nobitsalign.sh \ - testfile-nobitsalign.bz2 testfile-nobitsalign.strip.bz2 \ - run-strip-reloc.sh hello_i386.ko.bz2 hello_x86_64.ko.bz2 \ -diff --git a/tests/run-strip-nothing.sh b/tests/run-strip-nothing.sh -new file mode 100755 -index 0000000..e80bd90 ---- /dev/null -+++ b/tests/run-strip-nothing.sh -@@ -0,0 +1,62 @@ -+#! /bin/sh -+# Copyright (C) 2017 Red Hat, Inc. -+# This file is part of elfutils. -+# -+# This file 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. -+# -+# elfutils 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 . -+ -+. $srcdir/test-subr.sh -+ -+# If there is nothing to strip then -o output should be identical to input. -+# And there should not be an (empty) -f debug file. -+ -+tempfiles a.out strip.out debug.out -+ -+# Create no-debug a.out. -+echo "int main() { return 1; }" | gcc -xc - -+ -+# strip to file -+testrun ${abs_top_builddir}/src/strip -g -o strip.out || -+ { echo "*** failed to strip -g -o strip.out a.out"; exit -1; } -+ -+testrun ${abs_top_builddir}/src/elfcmp a.out strip.out || -+ { echo "*** failed strip.out different from a.out"; exit -1; } -+ -+# strip original -+testrun ${abs_top_builddir}/src/strip -g || -+ { echo "*** failed to strip -g a.out"; exit -1; } -+ -+testrun ${abs_top_builddir}/src/elfcmp strip.out a.out || -+ { echo "*** failed a.out different from strip.out"; exit -1; } -+ -+# strip to file with debug file -+testrun ${abs_top_builddir}/src/strip -g -o strip.out -f debug.out || -+ { echo "*** failed to strip -g -o strip.out -f debug.out a.out"; exit -1; } -+ -+testrun ${abs_top_builddir}/src/elfcmp a.out strip.out || -+ { echo "*** failed strip.out different from a.out (with debug)"; exit -1; } -+ -+test ! -f debug.out || -+ { echo "*** failed strip.out and debug.out exist"; exit -1; } -+ -+# strip original with debug file -+testrun ${abs_top_builddir}/src/strip -g -f debug.out || -+ { echo "*** failed to strip -g -f debug.out a.out"; exit -1; } -+ -+testrun ${abs_top_builddir}/src/elfcmp strip.out a.out || -+ { echo "*** failed a.out different from strip.out (with debug)"; exit -1; } -+ -+test ! -f debug.out || -+ { echo "*** failed a.out and debug.out exist"; exit -1; } -+ -+exit 0 ---- elfutils-0.169/tests/Makefile.in.orig 2017-06-07 21:48:55.475994222 +0200 -+++ elfutils-0.169/tests/Makefile.in 2017-06-07 21:49:20.441430261 +0200 -@@ -138,8 +138,8 @@ - run-strip-test.sh run-strip-test2.sh run-strip-test3.sh \ - run-strip-test4.sh run-strip-test5.sh run-strip-test6.sh \ - run-strip-test7.sh run-strip-test8.sh run-strip-test9.sh \ -- run-strip-test10.sh run-strip-test11.sh run-strip-groups.sh \ -- run-strip-reloc.sh run-strip-strmerge.sh \ -+ run-strip-test10.sh run-strip-test11.sh run-strip-nothing.sh \ -+ run-strip-groups.sh run-strip-reloc.sh run-strip-strmerge.sh \ - run-strip-nobitsalign.sh run-unstrip-test.sh \ - run-unstrip-test2.sh run-unstrip-test3.sh run-unstrip-test4.sh \ - run-unstrip-M.sh run-elfstrmerge-test.sh run-ecp-test.sh \ -@@ -1046,6 +1046,7 @@ - run-strip-test4.sh run-strip-test5.sh run-strip-test6.sh \ - run-strip-test7.sh run-strip-test8.sh run-strip-groups.sh \ - run-strip-test9.sh run-strip-test10.sh run-strip-test11.sh \ -+ run-strip-nothing.sh \ - run-strip-strmerge.sh run-strip-nobitsalign.sh \ - testfile-nobitsalign.bz2 testfile-nobitsalign.strip.bz2 \ - run-strip-reloc.sh hello_i386.ko.bz2 hello_x86_64.ko.bz2 \ -@@ -2332,6 +2333,13 @@ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ -+ "$$tst" $(AM_TESTS_FD_REDIRECT) -+run-strip-nothing.sh.log: run-strip-nothing.sh -+ @p='run-strip-nothing.sh'; \ -+ b='run-strip-nothing.sh'; \ -+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ -+ --log-file $$b.log --trs-file $$b.trs \ -+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) - run-strip-groups.sh.log: run-strip-groups.sh - @p='run-strip-groups.sh'; \ diff --git a/elfutils-0.169-strip-keep-remove-section.patch b/elfutils-0.169-strip-keep-remove-section.patch deleted file mode 100644 index d864e60..0000000 --- a/elfutils-0.169-strip-keep-remove-section.patch +++ /dev/null @@ -1,1063 +0,0 @@ -commit d03be4f70c688a8c675935973663014c3c4bba76 -Author: Mark Wielaard -Date: Fri Jul 14 17:09:40 2017 +0200 - - strip: Add --keep-section=SECTION and --remove-section=SECTION. - - Adds two new output options: - - --keep-section=SECTION Keep the named section. SECTION is an extended - wildcard pattern. May be given more than once. - - --remove-section=SECTION Remove the named section. SECTION is an - extended wildcard pattern. May be given more than - once. Only non-allocated sections can be removed. - - The --remove-section was already partially implemented, but only for the - .comment section. The short option -R is to be compatible with binutils. - - The new testcase makes sure that various combinations of kept/removed - sections pull the correct dependencies into the output and/or debug files. - - https://bugzilla.redhat.com/show_bug.cgi?id=1465997 - - Signed-off-by: Mark Wielaard - -diff --git a/ChangeLog b/ChangeLog -index 0d6cd2b..c9db732 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,7 @@ -+2017-07-14 Mark Wielaard -+ -+ * NEWS: Add 0.170 section and new strip options. -+ - 2017-05-05 Mark Wielaard - - * configure.ac: Set version to 0.169. Update copyright year. -diff --git a/NEWS b/NEWS -index eb7dd97..b69aef4 100644 ---- a/NEWS -+++ b/NEWS -@@ -1,3 +1,7 @@ -+Version 0.170 -+ -+strip: Add -R, --remove-section=SECTION and --keep-section=SECTION. -+ - Version 0.169 - - backends: Add support for EM_PPC64 GNU_ATTRIBUTES. -diff --git a/src/ChangeLog b/src/ChangeLog -index e19122e..0b60fc7 100644 ---- a/src/ChangeLog -+++ b/src/ChangeLog -@@ -1,3 +1,16 @@ -+2017-07-14 Mark Wielaard -+ -+ * strip (OPT_KEEP_SECTION): New define. -+ (options): Add documentation for remove-section. Add keep-section. -+ (struct section_pattern): New data type. -+ (keep_secs, remove_secs): New globals. -+ (add_pattern, free_sec_patterns, free_patterns, section_name_matches): -+ New functions. -+ (main): Call free_patterns. -+ (parse_opt): Handle 'R' and OPT_KEEP_SECTION. Check remove_comment -+ on ARGP_KEY_SUCCESS. -+ (handle_elf): Handle and sanity check keep_secs and remove_secs. -+ - 2017-06-07 Mark Wielaard - - * strip.c (handle_elf): Introduce new handle_elf boolean. Use it to -diff --git a/src/strip.c b/src/strip.c -index 2bf95f9..4a35ea1 100644 ---- a/src/strip.c -+++ b/src/strip.c -@@ -26,6 +26,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -60,6 +61,7 @@ ARGP_PROGRAM_BUG_ADDRESS_DEF = PACKAGE_BUGREPORT; - #define OPT_PERMISSIVE 0x101 - #define OPT_STRIP_SECTIONS 0x102 - #define OPT_RELOC_DEBUG 0x103 -+#define OPT_KEEP_SECTION 0x104 - - - /* Definitions of arguments for argp functions. */ -@@ -83,7 +85,8 @@ static const struct argp_option options[] = - N_("Resolve all trivial relocations between debug sections if the removed sections are placed in a debug file (only relevant for ET_REL files, operation is not reversable, needs -f)"), 0 }, - { "remove-comment", OPT_REMOVE_COMMENT, NULL, 0, - N_("Remove .comment section"), 0 }, -- { "remove-section", 'R', "SECTION", OPTION_HIDDEN, NULL, 0 }, -+ { "remove-section", 'R', "SECTION", 0, N_("Remove the named section. SECTION is an extended wildcard pattern. May be given more than once. Only non-allocated sections can be removed."), 0 }, -+ { "keep-section", OPT_KEEP_SECTION, "SECTION", 0, N_("Keep the named section. SECTION is an extended wildcard pattern. May be given more than once."), 0 }, - { "permissive", OPT_PERMISSIVE, NULL, 0, - N_("Relax a few rules to handle slightly broken ELF files"), 0 }, - { NULL, 0, NULL, 0, NULL, 0 } -@@ -157,6 +160,58 @@ static bool permissive; - /* If true perform relocations between debug sections. */ - static bool reloc_debug; - -+/* Sections the user explicitly wants to keep or remove. */ -+struct section_pattern -+{ -+ char *pattern; -+ struct section_pattern *next; -+}; -+ -+static struct section_pattern *keep_secs = NULL; -+static struct section_pattern *remove_secs = NULL; -+ -+static void -+add_pattern (struct section_pattern **patterns, const char *pattern) -+{ -+ struct section_pattern *p = xmalloc (sizeof *p); -+ p->pattern = xstrdup (pattern); -+ p->next = *patterns; -+ *patterns = p; -+} -+ -+static void -+free_sec_patterns (struct section_pattern *patterns) -+{ -+ struct section_pattern *pattern = patterns; -+ while (pattern != NULL) -+ { -+ struct section_pattern *p = pattern; -+ pattern = p->next; -+ free (p->pattern); -+ free (p); -+ } -+} -+ -+static void -+free_patterns (void) -+{ -+ free_sec_patterns (keep_secs); -+ free_sec_patterns (remove_secs); -+} -+ -+static bool -+section_name_matches (struct section_pattern *patterns, const char *name) -+{ -+ struct section_pattern *pattern = patterns; -+ while (pattern != NULL) -+ { -+ if (fnmatch (pattern->pattern, name, FNM_EXTMATCH) == 0) -+ return true; -+ pattern = pattern->next; -+ } -+ return false; -+} -+ - - int - main (int argc, char *argv[]) -@@ -207,6 +262,7 @@ Only one input file allowed together with '-o' and '-f'")); - while (++remaining < argc); - } - -+ free_patterns (); - return result; - } - -@@ -257,14 +313,13 @@ parse_opt (int key, char *arg, struct argp_state *state) - break; - - case 'R': -- if (!strcmp (arg, ".comment")) -+ if (fnmatch (arg, ".comment", FNM_EXTMATCH) == 0) - remove_comment = true; -- else -- { -- argp_error (state, -- gettext ("-R option supports only .comment section")); -- return EINVAL; -- } -+ add_pattern (&remove_secs, arg); -+ break; -+ -+ case OPT_KEEP_SECTION: -+ add_pattern (&keep_secs, arg); - break; - - case 'g': -@@ -284,6 +339,16 @@ parse_opt (int key, char *arg, struct argp_state *state) - case 's': /* Ignored for compatibility. */ - break; - -+ case ARGP_KEY_SUCCESS: -+ if (remove_comment == true -+ && section_name_matches (keep_secs, ".comment")) -+ { -+ argp_error (state, -+ gettext ("cannot both keep and remove .comment section")); -+ return EINVAL; -+ } -+ break; -+ - default: - return ARGP_ERR_UNKNOWN; - } -@@ -622,6 +687,28 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, - goto fail_close; - } - -+ /* Sanity check the user. */ -+ if (section_name_matches (remove_secs, shdr_info[cnt].name)) -+ { -+ if ((shdr_info[cnt].shdr.sh_flags & SHF_ALLOC) != 0) -+ { -+ error (0, 0, -+ gettext ("Cannot remove allocated section '%s'"), -+ shdr_info[cnt].name); -+ result = 1; -+ goto fail_close; -+ } -+ -+ if (section_name_matches (keep_secs, shdr_info[cnt].name)) -+ { -+ error (0, 0, -+ gettext ("Cannot both keep and remove section '%s'"), -+ shdr_info[cnt].name); -+ result = 1; -+ goto fail_close; -+ } -+ } -+ - /* Mark them as present but not yet investigated. */ - shdr_info[cnt].idx = 1; - -@@ -709,6 +796,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, - know how to handle them - - if a section is referred to from a section which is not removed - in the sh_link or sh_info element it cannot be removed either -+ - the user might have explicitly said to remove or keep a section - */ - for (cnt = 1; cnt < shnum; ++cnt) - /* Check whether the section can be removed. Since we will create -@@ -717,8 +805,13 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, - : (ebl_section_strip_p (ebl, ehdr, &shdr_info[cnt].shdr, - shdr_info[cnt].name, remove_comment, - remove_debug) -- || cnt == ehdr->e_shstrndx)) -+ || cnt == ehdr->e_shstrndx -+ || section_name_matches (remove_secs, shdr_info[cnt].name))) - { -+ /* The user might want to explicitly keep this one. */ -+ if (section_name_matches (keep_secs, shdr_info[cnt].name)) -+ continue; -+ - /* For now assume this section will be removed. */ - shdr_info[cnt].idx = 0; - -@@ -2174,14 +2267,14 @@ while computing checksum for debug information")); - if (shdr_info != NULL) - { - /* For some sections we might have created an table to map symbol -- table indices. */ -- if (any_symtab_changes) -- for (cnt = 1; cnt <= shdridx; ++cnt) -- { -- free (shdr_info[cnt].newsymidx); -- if (shdr_info[cnt].debug_data != NULL) -- free (shdr_info[cnt].debug_data->d_buf); -- } -+ table indices. Or we might kept (original) data around to put -+ into the .debug file. */ -+ for (cnt = 1; cnt <= shdridx; ++cnt) -+ { -+ free (shdr_info[cnt].newsymidx); -+ if (shdr_info[cnt].debug_data != NULL) -+ free (shdr_info[cnt].debug_data->d_buf); -+ } - - /* Free data we allocated for the .gnu_debuglink section. */ - free (debuglink_buf); -diff --git a/tests/ChangeLog b/tests/ChangeLog -index ecf6263..3dd6f2a 100644 ---- a/tests/ChangeLog -+++ b/tests/ChangeLog -@@ -1,3 +1,9 @@ -+2017-07-14 Mark Wielaard -+ -+ * run-strip-remove-keep.sh: New test. -+ * Makefile.am (TESTS): Add run-strip-remove-keep.sh. -+ (EXTRA_DIST): Likewise. -+ - 2017-06-07 Mark Wielaard - - * run-strip-nothing.sh: New test. -diff --git a/tests/Makefile.am b/tests/Makefile.am -index 0aa16da..7fd4b21 100644 ---- a/tests/Makefile.am -+++ b/tests/Makefile.am -@@ -83,7 +83,7 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \ - run-strip-test9.sh run-strip-test10.sh run-strip-test11.sh \ - run-strip-nothing.sh \ - run-strip-groups.sh run-strip-reloc.sh run-strip-strmerge.sh \ -- run-strip-nobitsalign.sh \ -+ run-strip-nobitsalign.sh run-strip-remove-keep.sh \ - run-unstrip-test.sh run-unstrip-test2.sh run-unstrip-test3.sh \ - run-unstrip-test4.sh run-unstrip-M.sh run-elfstrmerge-test.sh \ - run-ecp-test.sh run-ecp-test2.sh run-alldts.sh \ -@@ -176,7 +176,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \ - run-strip-test4.sh run-strip-test5.sh run-strip-test6.sh \ - run-strip-test7.sh run-strip-test8.sh run-strip-groups.sh \ - run-strip-test9.sh run-strip-test10.sh run-strip-test11.sh \ -- run-strip-nothing.sh \ -+ run-strip-nothing.sh run-strip-remove-keep.sh \ - run-strip-strmerge.sh run-strip-nobitsalign.sh \ - testfile-nobitsalign.bz2 testfile-nobitsalign.strip.bz2 \ - run-strip-reloc.sh hello_i386.ko.bz2 hello_x86_64.ko.bz2 \ -diff --git a/tests/run-strip-remove-keep.sh b/tests/run-strip-remove-keep.sh -new file mode 100755 -index 0000000..92647fa ---- /dev/null -+++ b/tests/run-strip-remove-keep.sh -@@ -0,0 +1,688 @@ -+#! /bin/sh -+# Copyright (C) 2017 Red Hat, Inc. -+# This file is part of elfutils. -+# -+# This file 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. -+# -+# elfutils 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 . -+ -+. $srcdir/test-subr.sh -+ -+# strip -o output and -f debug files -+tempfiles testfile.elf testfile.debug -+ -+# A random 32bit testfile -+testfiles testfile -+ -+# Explicitly keep .strtab (but not .symtab, so .strtab will be in both). 32bit -+echo strip --keep-section=.strtab testfile -+testrun ${abs_top_builddir}/src/strip --keep-section=.strtab -o testfile.elf -f testfile.debug testfile -+echo elflint testfile.elf -+testrun ${abs_top_builddir}/src/elflint --gnu testfile.elf -+echo elflint testfile.debug -+testrun ${abs_top_builddir}/src/elflint --gnu -d testfile.debug -+echo readelf testfile.elf -+testrun_compare ${abs_top_builddir}/src/readelf -S testfile.elf <<\EOF -+There are 27 section headers, starting at offset 0xaf8: -+ -+Section Headers: -+[Nr] Name Type Addr Off Size ES Flags Lk Inf Al -+[ 0] NULL 00000000 000000 000000 0 0 0 0 -+[ 1] .interp PROGBITS 080480f4 0000f4 000013 0 A 0 0 1 -+[ 2] .note.ABI-tag NOTE 08048108 000108 000020 0 A 0 0 4 -+[ 3] .hash HASH 08048128 000128 000030 4 A 4 0 4 -+[ 4] .dynsym DYNSYM 08048158 000158 000070 16 A 5 1 4 -+[ 5] .dynstr STRTAB 080481c8 0001c8 00008e 0 A 0 0 1 -+[ 6] .gnu.version GNU_versym 08048256 000256 00000e 2 A 4 0 2 -+[ 7] .gnu.version_r GNU_verneed 08048264 000264 000030 0 A 5 1 4 -+[ 8] .rel.got REL 08048294 000294 000008 8 A 4 19 4 -+[ 9] .rel.plt REL 0804829c 00029c 000020 8 A 4 11 4 -+[10] .init PROGBITS 080482bc 0002bc 000018 0 AX 0 0 4 -+[11] .plt PROGBITS 080482d4 0002d4 000050 4 AX 0 0 4 -+[12] .text PROGBITS 08048330 000330 00018c 0 AX 0 0 16 -+[13] .fini PROGBITS 080484bc 0004bc 00001e 0 AX 0 0 4 -+[14] .rodata PROGBITS 080484dc 0004dc 000008 0 A 0 0 4 -+[15] .data PROGBITS 080494e4 0004e4 000010 0 WA 0 0 4 -+[16] .eh_frame PROGBITS 080494f4 0004f4 000004 0 WA 0 0 4 -+[17] .ctors PROGBITS 080494f8 0004f8 000008 0 WA 0 0 4 -+[18] .dtors PROGBITS 08049500 000500 000008 0 WA 0 0 4 -+[19] .got PROGBITS 08049508 000508 000020 4 WA 0 0 4 -+[20] .dynamic DYNAMIC 08049528 000528 0000a0 8 WA 5 0 4 -+[21] .bss NOBITS 080495c8 0005c8 00001c 0 WA 0 0 4 -+[22] .comment PROGBITS 00000000 0005c8 000170 0 0 0 1 -+[23] .note NOTE 00000000 000738 0000a0 0 0 0 1 -+[24] .strtab STRTAB 00000000 0007d8 000235 0 0 0 1 -+[25] .gnu_debuglink PROGBITS 00000000 000a10 000014 0 0 0 4 -+[26] .shstrtab STRTAB 00000000 000a24 0000d1 0 0 0 1 -+ -+EOF -+echo readelf testfile.debug -+testrun_compare ${abs_top_builddir}/src/readelf -S testfile.debug <<\EOF -+There are 35 section headers, starting at offset 0x463c: -+ -+Section Headers: -+[Nr] Name Type Addr Off Size ES Flags Lk Inf Al -+[ 0] NULL 00000000 000000 000000 0 0 0 0 -+[ 1] .interp NOBITS 080480f4 0000f4 000013 0 A 0 0 1 -+[ 2] .note.ABI-tag NOTE 08048108 0000f4 000020 0 A 0 0 4 -+[ 3] .hash NOBITS 08048128 000114 000030 4 A 4 0 4 -+[ 4] .dynsym NOBITS 08048158 000114 000070 16 A 5 1 4 -+[ 5] .dynstr NOBITS 080481c8 000114 00008e 0 A 0 0 1 -+[ 6] .gnu.version NOBITS 08048256 000114 00000e 2 A 4 0 2 -+[ 7] .gnu.version_r NOBITS 08048264 000114 000030 0 A 5 1 4 -+[ 8] .rel.got NOBITS 08048294 000114 000008 8 A 4 19 4 -+[ 9] .rel.plt NOBITS 0804829c 000114 000020 8 A 4 11 4 -+[10] .init NOBITS 080482bc 000114 000018 0 AX 0 0 4 -+[11] .plt NOBITS 080482d4 000114 000050 4 AX 0 0 4 -+[12] .text NOBITS 08048330 000120 00018c 0 AX 0 0 16 -+[13] .fini NOBITS 080484bc 000120 00001e 0 AX 0 0 4 -+[14] .rodata NOBITS 080484dc 000120 000008 0 A 0 0 4 -+[15] .data NOBITS 080494e4 000120 000010 0 WA 0 0 4 -+[16] .eh_frame NOBITS 080494f4 000120 000004 0 WA 0 0 4 -+[17] .ctors NOBITS 080494f8 000120 000008 0 WA 0 0 4 -+[18] .dtors NOBITS 08049500 000120 000008 0 WA 0 0 4 -+[19] .got NOBITS 08049508 000120 000020 4 WA 0 0 4 -+[20] .dynamic NOBITS 08049528 000120 0000a0 8 WA 5 0 4 -+[21] .sbss PROGBITS 080495c8 000120 000000 0 W 0 0 1 -+[22] .bss NOBITS 080495c8 000120 00001c 0 WA 0 0 4 -+[23] .stab PROGBITS 00000000 000120 000720 12 24 0 4 -+[24] .stabstr STRTAB 00000000 000840 001934 0 0 0 1 -+[25] .comment NOBITS 00000000 002174 000170 0 0 0 1 -+[26] .debug_aranges PROGBITS 00000000 002174 000060 0 0 0 1 -+[27] .debug_pubnames PROGBITS 00000000 0021d4 000055 0 0 0 1 -+[28] .debug_info PROGBITS 00000000 002229 001678 0 0 0 1 -+[29] .debug_abbrev PROGBITS 00000000 0038a1 0001d2 0 0 0 1 -+[30] .debug_line PROGBITS 00000000 003a73 000223 0 0 0 1 -+[31] .note NOTE 00000000 003c96 0000a0 0 0 0 1 -+[32] .shstrtab STRTAB 00000000 003d36 00012e 0 0 0 1 -+[33] .symtab SYMTAB 00000000 003e64 0005a0 16 34 68 4 -+[34] .strtab STRTAB 00000000 004404 000235 0 0 0 1 -+ -+EOF -+ -+# Explicitly keep .symtab (pulls in .strtab, so they will both be in elf). 32bit -+echo strip --keep-section=.symtab testfile -+testrun ${abs_top_builddir}/src/strip --keep-section=.symtab -o testfile.elf -f testfile.debug testfile -+echo elflint testfile.elf -+testrun ${abs_top_builddir}/src/elflint --gnu testfile.elf -+echo elflint testfile.debug -+testrun ${abs_top_builddir}/src/elflint --gnu -d testfile.debug -+echo readelf testfile.elf -+testrun_compare ${abs_top_builddir}/src/readelf -S testfile.elf <<\EOF -+There are 28 section headers, starting at offset 0x1010: -+ -+Section Headers: -+[Nr] Name Type Addr Off Size ES Flags Lk Inf Al -+[ 0] NULL 00000000 000000 000000 0 0 0 0 -+[ 1] .interp PROGBITS 080480f4 0000f4 000013 0 A 0 0 1 -+[ 2] .note.ABI-tag NOTE 08048108 000108 000020 0 A 0 0 4 -+[ 3] .hash HASH 08048128 000128 000030 4 A 4 0 4 -+[ 4] .dynsym DYNSYM 08048158 000158 000070 16 A 5 1 4 -+[ 5] .dynstr STRTAB 080481c8 0001c8 00008e 0 A 0 0 1 -+[ 6] .gnu.version GNU_versym 08048256 000256 00000e 2 A 4 0 2 -+[ 7] .gnu.version_r GNU_verneed 08048264 000264 000030 0 A 5 1 4 -+[ 8] .rel.got REL 08048294 000294 000008 8 A 4 19 4 -+[ 9] .rel.plt REL 0804829c 00029c 000020 8 A 4 11 4 -+[10] .init PROGBITS 080482bc 0002bc 000018 0 AX 0 0 4 -+[11] .plt PROGBITS 080482d4 0002d4 000050 4 AX 0 0 4 -+[12] .text PROGBITS 08048330 000330 00018c 0 AX 0 0 16 -+[13] .fini PROGBITS 080484bc 0004bc 00001e 0 AX 0 0 4 -+[14] .rodata PROGBITS 080484dc 0004dc 000008 0 A 0 0 4 -+[15] .data PROGBITS 080494e4 0004e4 000010 0 WA 0 0 4 -+[16] .eh_frame PROGBITS 080494f4 0004f4 000004 0 WA 0 0 4 -+[17] .ctors PROGBITS 080494f8 0004f8 000008 0 WA 0 0 4 -+[18] .dtors PROGBITS 08049500 000500 000008 0 WA 0 0 4 -+[19] .got PROGBITS 08049508 000508 000020 4 WA 0 0 4 -+[20] .dynamic DYNAMIC 08049528 000528 0000a0 8 WA 5 0 4 -+[21] .bss NOBITS 080495c8 0005c8 00001c 0 WA 0 0 4 -+[22] .comment PROGBITS 00000000 0005c8 000170 0 0 0 1 -+[23] .note NOTE 00000000 000738 0000a0 0 0 0 1 -+[24] .symtab SYMTAB 00000000 0007d8 000510 16 25 59 4 -+[25] .strtab STRTAB 00000000 000ce8 000235 0 0 0 1 -+[26] .gnu_debuglink PROGBITS 00000000 000f20 000014 0 0 0 4 -+[27] .shstrtab STRTAB 00000000 000f34 0000d9 0 0 0 1 -+ -+EOF -+echo readelf testfile.debug -+testrun_compare ${abs_top_builddir}/src/readelf -S testfile.debug <<\EOF -+There are 35 section headers, starting at offset 0x3e64: -+ -+Section Headers: -+[Nr] Name Type Addr Off Size ES Flags Lk Inf Al -+[ 0] NULL 00000000 000000 000000 0 0 0 0 -+[ 1] .interp NOBITS 080480f4 0000f4 000013 0 A 0 0 1 -+[ 2] .note.ABI-tag NOTE 08048108 0000f4 000020 0 A 0 0 4 -+[ 3] .hash NOBITS 08048128 000114 000030 4 A 4 0 4 -+[ 4] .dynsym NOBITS 08048158 000114 000070 16 A 5 1 4 -+[ 5] .dynstr NOBITS 080481c8 000114 00008e 0 A 0 0 1 -+[ 6] .gnu.version NOBITS 08048256 000114 00000e 2 A 4 0 2 -+[ 7] .gnu.version_r NOBITS 08048264 000114 000030 0 A 5 1 4 -+[ 8] .rel.got NOBITS 08048294 000114 000008 8 A 4 19 4 -+[ 9] .rel.plt NOBITS 0804829c 000114 000020 8 A 4 11 4 -+[10] .init NOBITS 080482bc 000114 000018 0 AX 0 0 4 -+[11] .plt NOBITS 080482d4 000114 000050 4 AX 0 0 4 -+[12] .text NOBITS 08048330 000120 00018c 0 AX 0 0 16 -+[13] .fini NOBITS 080484bc 000120 00001e 0 AX 0 0 4 -+[14] .rodata NOBITS 080484dc 000120 000008 0 A 0 0 4 -+[15] .data NOBITS 080494e4 000120 000010 0 WA 0 0 4 -+[16] .eh_frame NOBITS 080494f4 000120 000004 0 WA 0 0 4 -+[17] .ctors NOBITS 080494f8 000120 000008 0 WA 0 0 4 -+[18] .dtors NOBITS 08049500 000120 000008 0 WA 0 0 4 -+[19] .got NOBITS 08049508 000120 000020 4 WA 0 0 4 -+[20] .dynamic NOBITS 08049528 000120 0000a0 8 WA 5 0 4 -+[21] .sbss PROGBITS 080495c8 000120 000000 0 W 0 0 1 -+[22] .bss NOBITS 080495c8 000120 00001c 0 WA 0 0 4 -+[23] .stab PROGBITS 00000000 000120 000720 12 24 0 4 -+[24] .stabstr STRTAB 00000000 000840 001934 0 0 0 1 -+[25] .comment NOBITS 00000000 002174 000170 0 0 0 1 -+[26] .debug_aranges PROGBITS 00000000 002174 000060 0 0 0 1 -+[27] .debug_pubnames PROGBITS 00000000 0021d4 000055 0 0 0 1 -+[28] .debug_info PROGBITS 00000000 002229 001678 0 0 0 1 -+[29] .debug_abbrev PROGBITS 00000000 0038a1 0001d2 0 0 0 1 -+[30] .debug_line PROGBITS 00000000 003a73 000223 0 0 0 1 -+[31] .note NOTE 00000000 003c96 0000a0 0 0 0 1 -+[32] .shstrtab STRTAB 00000000 003d36 00012e 0 0 0 1 -+[33] .symtab NOBITS 00000000 003e64 0005a0 16 34 68 4 -+[34] .strtab NOBITS 00000000 003e64 000235 0 0 0 1 -+ -+EOF -+ -+# A random 64bit testfile -+testfiles testfile69.so -+# Explicitly keep .strtab (but not .symtab, so .strtab will be in both). 64bit -+echo strip --keep-section=.strtab testfile69.so -+testrun ${abs_top_builddir}/src/strip --keep-section=.strtab -o testfile.elf -f testfile.debug testfile69.so -+echo elflint testfile.elf -+testrun ${abs_top_builddir}/src/elflint --gnu testfile.elf -+echo elflint testfile.debug -+testrun ${abs_top_builddir}/src/elflint --gnu -d testfile.debug -+echo readelf testfile.elf -+testrun_compare ${abs_top_builddir}/src/readelf -S testfile.elf <<\EOF -+There are 27 section headers, starting at offset 0xad8: -+ -+Section Headers: -+[Nr] Name Type Addr Off Size ES Flags Lk Inf Al -+[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0 -+[ 1] .note.gnu.build-id NOTE 0000000000000190 00000190 00000024 0 A 0 0 4 -+[ 2] .gnu.hash GNU_HASH 00000000000001b8 000001b8 0000003c 0 A 3 0 8 -+[ 3] .dynsym DYNSYM 00000000000001f8 000001f8 00000108 24 A 4 2 8 -+[ 4] .dynstr STRTAB 0000000000000300 00000300 00000077 0 A 0 0 1 -+[ 5] .gnu.version GNU_versym 0000000000000378 00000378 00000016 2 A 3 0 2 -+[ 6] .gnu.version_r GNU_verneed 0000000000000390 00000390 00000020 0 A 4 1 8 -+[ 7] .rela.dyn RELA 00000000000003b0 000003b0 00000060 24 A 3 0 8 -+[ 8] .rela.plt RELA 0000000000000410 00000410 00000018 24 A 3 10 8 -+[ 9] .init PROGBITS 0000000000000428 00000428 00000018 0 AX 0 0 4 -+[10] .plt PROGBITS 0000000000000440 00000440 00000020 16 AX 0 0 16 -+[11] .text PROGBITS 0000000000000460 00000460 00000128 0 AX 0 0 16 -+[12] .fini PROGBITS 0000000000000588 00000588 0000000e 0 AX 0 0 4 -+[13] .eh_frame_hdr PROGBITS 0000000000000598 00000598 00000024 0 A 0 0 4 -+[14] .eh_frame PROGBITS 00000000000005c0 000005c0 00000084 0 A 0 0 8 -+[15] .ctors PROGBITS 0000000000200648 00000648 00000010 0 WA 0 0 8 -+[16] .dtors PROGBITS 0000000000200658 00000658 00000010 0 WA 0 0 8 -+[17] .jcr PROGBITS 0000000000200668 00000668 00000008 0 WA 0 0 8 -+[18] .data.rel.ro PROGBITS 0000000000200670 00000670 00000008 0 WA 0 0 8 -+[19] .dynamic DYNAMIC 0000000000200678 00000678 00000180 16 WA 4 0 8 -+[20] .got PROGBITS 00000000002007f8 000007f8 00000018 8 WA 0 0 8 -+[21] .got.plt PROGBITS 0000000000200810 00000810 00000020 8 WA 0 0 8 -+[22] .bss NOBITS 0000000000200830 00000830 00000010 0 WA 0 0 8 -+[23] .comment PROGBITS 0000000000000000 00000830 0000002c 1 MS 0 0 1 -+[24] .strtab STRTAB 0000000000000000 0000085c 00000175 0 0 0 1 -+[25] .gnu_debuglink PROGBITS 0000000000000000 000009d4 00000014 0 0 0 4 -+[26] .shstrtab STRTAB 0000000000000000 000009e8 000000ee 0 0 0 1 -+ -+EOF -+echo readelf testfile.debug -+testrun_compare ${abs_top_builddir}/src/readelf -S testfile.debug <<\EOF -+There are 27 section headers, starting at offset 0x918: -+ -+Section Headers: -+[Nr] Name Type Addr Off Size ES Flags Lk Inf Al -+[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0 -+[ 1] .note.gnu.build-id NOTE 0000000000000190 00000190 00000024 0 A 0 0 4 -+[ 2] .gnu.hash NOBITS 00000000000001b8 000001b8 0000003c 0 A 3 0 8 -+[ 3] .dynsym NOBITS 00000000000001f8 000001b8 00000108 24 A 4 2 8 -+[ 4] .dynstr NOBITS 0000000000000300 000001b8 00000077 0 A 0 0 1 -+[ 5] .gnu.version NOBITS 0000000000000378 000001b8 00000016 2 A 3 0 2 -+[ 6] .gnu.version_r NOBITS 0000000000000390 000001b8 00000020 0 A 4 1 8 -+[ 7] .rela.dyn NOBITS 00000000000003b0 000001b8 00000060 24 A 3 0 8 -+[ 8] .rela.plt NOBITS 0000000000000410 000001b8 00000018 24 A 3 10 8 -+[ 9] .init NOBITS 0000000000000428 000001b8 00000018 0 AX 0 0 4 -+[10] .plt NOBITS 0000000000000440 000001c0 00000020 16 AX 0 0 16 -+[11] .text NOBITS 0000000000000460 000001c0 00000128 0 AX 0 0 16 -+[12] .fini NOBITS 0000000000000588 000001c0 0000000e 0 AX 0 0 4 -+[13] .eh_frame_hdr NOBITS 0000000000000598 000001c0 00000024 0 A 0 0 4 -+[14] .eh_frame NOBITS 00000000000005c0 000001c0 00000084 0 A 0 0 8 -+[15] .ctors NOBITS 0000000000200648 000001c0 00000010 0 WA 0 0 8 -+[16] .dtors NOBITS 0000000000200658 000001c0 00000010 0 WA 0 0 8 -+[17] .jcr NOBITS 0000000000200668 000001c0 00000008 0 WA 0 0 8 -+[18] .data.rel.ro NOBITS 0000000000200670 000001c0 00000008 0 WA 0 0 8 -+[19] .dynamic NOBITS 0000000000200678 000001c0 00000180 16 WA 4 0 8 -+[20] .got NOBITS 00000000002007f8 000001c0 00000018 8 WA 0 0 8 -+[21] .got.plt NOBITS 0000000000200810 000001c0 00000020 8 WA 0 0 8 -+[22] .bss NOBITS 0000000000200830 000001c0 00000010 0 WA 0 0 8 -+[23] .comment NOBITS 0000000000000000 000001c0 0000002c 1 MS 0 0 1 -+[24] .shstrtab STRTAB 0000000000000000 000001c0 000000e7 0 0 0 1 -+[25] .symtab SYMTAB 0000000000000000 000002a8 000004f8 24 26 44 8 -+[26] .strtab STRTAB 0000000000000000 000007a0 00000175 0 0 0 1 -+ -+EOF -+ -+# Explicitly keep .symtab (pulls in .strtab, so they will both be in elf). 64bit -+# Use --remove-comment to make sure testfile.debug isn't empty. -+echo strip --keep-section=.symtab --remove-comment testfile69.so -+testrun ${abs_top_builddir}/src/strip --keep-section=.symtab --remove-comment -o testfile.elf -f testfile.debug testfile69.so -+echo elflint testfile.elf -+testrun ${abs_top_builddir}/src/elflint --gnu testfile.elf -+echo elflint testfile.debug -+testrun ${abs_top_builddir}/src/elflint --gnu -d testfile.debug -+echo readelf testfile.elf -+testrun_compare ${abs_top_builddir}/src/readelf -S testfile.elf <<\EOF -+There are 27 section headers, starting at offset 0xf90: -+ -+Section Headers: -+[Nr] Name Type Addr Off Size ES Flags Lk Inf Al -+[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0 -+[ 1] .note.gnu.build-id NOTE 0000000000000190 00000190 00000024 0 A 0 0 4 -+[ 2] .gnu.hash GNU_HASH 00000000000001b8 000001b8 0000003c 0 A 3 0 8 -+[ 3] .dynsym DYNSYM 00000000000001f8 000001f8 00000108 24 A 4 2 8 -+[ 4] .dynstr STRTAB 0000000000000300 00000300 00000077 0 A 0 0 1 -+[ 5] .gnu.version GNU_versym 0000000000000378 00000378 00000016 2 A 3 0 2 -+[ 6] .gnu.version_r GNU_verneed 0000000000000390 00000390 00000020 0 A 4 1 8 -+[ 7] .rela.dyn RELA 00000000000003b0 000003b0 00000060 24 A 3 0 8 -+[ 8] .rela.plt RELA 0000000000000410 00000410 00000018 24 A 3 10 8 -+[ 9] .init PROGBITS 0000000000000428 00000428 00000018 0 AX 0 0 4 -+[10] .plt PROGBITS 0000000000000440 00000440 00000020 16 AX 0 0 16 -+[11] .text PROGBITS 0000000000000460 00000460 00000128 0 AX 0 0 16 -+[12] .fini PROGBITS 0000000000000588 00000588 0000000e 0 AX 0 0 4 -+[13] .eh_frame_hdr PROGBITS 0000000000000598 00000598 00000024 0 A 0 0 4 -+[14] .eh_frame PROGBITS 00000000000005c0 000005c0 00000084 0 A 0 0 8 -+[15] .ctors PROGBITS 0000000000200648 00000648 00000010 0 WA 0 0 8 -+[16] .dtors PROGBITS 0000000000200658 00000658 00000010 0 WA 0 0 8 -+[17] .jcr PROGBITS 0000000000200668 00000668 00000008 0 WA 0 0 8 -+[18] .data.rel.ro PROGBITS 0000000000200670 00000670 00000008 0 WA 0 0 8 -+[19] .dynamic DYNAMIC 0000000000200678 00000678 00000180 16 WA 4 0 8 -+[20] .got PROGBITS 00000000002007f8 000007f8 00000018 8 WA 0 0 8 -+[21] .got.plt PROGBITS 0000000000200810 00000810 00000020 8 WA 0 0 8 -+[22] .bss NOBITS 0000000000200830 00000830 00000010 0 WA 0 0 8 -+[23] .symtab SYMTAB 0000000000000000 00000830 000004e0 24 24 43 8 -+[24] .strtab STRTAB 0000000000000000 00000d10 00000175 0 0 0 1 -+[25] .gnu_debuglink PROGBITS 0000000000000000 00000e88 00000014 0 0 0 4 -+[26] .shstrtab STRTAB 0000000000000000 00000e9c 000000ed 0 0 0 1 -+ -+EOF -+echo readelf testfile.debug -+testrun_compare ${abs_top_builddir}/src/readelf -S testfile.debug <<\EOF -+There are 27 section headers, starting at offset 0x2d8: -+ -+Section Headers: -+[Nr] Name Type Addr Off Size ES Flags Lk Inf Al -+[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0 -+[ 1] .note.gnu.build-id NOTE 0000000000000190 00000190 00000024 0 A 0 0 4 -+[ 2] .gnu.hash NOBITS 00000000000001b8 000001b8 0000003c 0 A 3 0 8 -+[ 3] .dynsym NOBITS 00000000000001f8 000001b8 00000108 24 A 4 2 8 -+[ 4] .dynstr NOBITS 0000000000000300 000001b8 00000077 0 A 0 0 1 -+[ 5] .gnu.version NOBITS 0000000000000378 000001b8 00000016 2 A 3 0 2 -+[ 6] .gnu.version_r NOBITS 0000000000000390 000001b8 00000020 0 A 4 1 8 -+[ 7] .rela.dyn NOBITS 00000000000003b0 000001b8 00000060 24 A 3 0 8 -+[ 8] .rela.plt NOBITS 0000000000000410 000001b8 00000018 24 A 3 10 8 -+[ 9] .init NOBITS 0000000000000428 000001b8 00000018 0 AX 0 0 4 -+[10] .plt NOBITS 0000000000000440 000001c0 00000020 16 AX 0 0 16 -+[11] .text NOBITS 0000000000000460 000001c0 00000128 0 AX 0 0 16 -+[12] .fini NOBITS 0000000000000588 000001c0 0000000e 0 AX 0 0 4 -+[13] .eh_frame_hdr NOBITS 0000000000000598 000001c0 00000024 0 A 0 0 4 -+[14] .eh_frame NOBITS 00000000000005c0 000001c0 00000084 0 A 0 0 8 -+[15] .ctors NOBITS 0000000000200648 000001c0 00000010 0 WA 0 0 8 -+[16] .dtors NOBITS 0000000000200658 000001c0 00000010 0 WA 0 0 8 -+[17] .jcr NOBITS 0000000000200668 000001c0 00000008 0 WA 0 0 8 -+[18] .data.rel.ro NOBITS 0000000000200670 000001c0 00000008 0 WA 0 0 8 -+[19] .dynamic NOBITS 0000000000200678 000001c0 00000180 16 WA 4 0 8 -+[20] .got NOBITS 00000000002007f8 000001c0 00000018 8 WA 0 0 8 -+[21] .got.plt NOBITS 0000000000200810 000001c0 00000020 8 WA 0 0 8 -+[22] .bss NOBITS 0000000000200830 000001c0 00000010 0 WA 0 0 8 -+[23] .comment PROGBITS 0000000000000000 000001c0 0000002c 1 MS 0 0 1 -+[24] .shstrtab STRTAB 0000000000000000 000001ec 000000e7 0 0 0 1 -+[25] .symtab NOBITS 0000000000000000 000002d8 000004f8 24 26 44 8 -+[26] .strtab NOBITS 0000000000000000 000002d8 00000175 0 0 0 1 -+ -+EOF -+ -+# Explicitly remove .symtab (but not .strtab, so it will be in both). 32bit -+echo strip -g --remove-section=.symtab testfile -+testrun ${abs_top_builddir}/src/strip -g --remove-section=.symtab -o testfile.elf -f testfile.debug testfile -+echo elflint testfile.elf -+testrun ${abs_top_builddir}/src/elflint --gnu testfile.elf -+echo elflint testfile.debug -+testrun ${abs_top_builddir}/src/elflint --gnu -d testfile.debug -+echo readelf testfile.elf -+testrun_compare ${abs_top_builddir}/src/readelf -S testfile.elf <<\EOF -+There are 28 section headers, starting at offset 0xafc: -+ -+Section Headers: -+[Nr] Name Type Addr Off Size ES Flags Lk Inf Al -+[ 0] NULL 00000000 000000 000000 0 0 0 0 -+[ 1] .interp PROGBITS 080480f4 0000f4 000013 0 A 0 0 1 -+[ 2] .note.ABI-tag NOTE 08048108 000108 000020 0 A 0 0 4 -+[ 3] .hash HASH 08048128 000128 000030 4 A 4 0 4 -+[ 4] .dynsym DYNSYM 08048158 000158 000070 16 A 5 1 4 -+[ 5] .dynstr STRTAB 080481c8 0001c8 00008e 0 A 0 0 1 -+[ 6] .gnu.version GNU_versym 08048256 000256 00000e 2 A 4 0 2 -+[ 7] .gnu.version_r GNU_verneed 08048264 000264 000030 0 A 5 1 4 -+[ 8] .rel.got REL 08048294 000294 000008 8 A 4 19 4 -+[ 9] .rel.plt REL 0804829c 00029c 000020 8 A 4 11 4 -+[10] .init PROGBITS 080482bc 0002bc 000018 0 AX 0 0 4 -+[11] .plt PROGBITS 080482d4 0002d4 000050 4 AX 0 0 4 -+[12] .text PROGBITS 08048330 000330 00018c 0 AX 0 0 16 -+[13] .fini PROGBITS 080484bc 0004bc 00001e 0 AX 0 0 4 -+[14] .rodata PROGBITS 080484dc 0004dc 000008 0 A 0 0 4 -+[15] .data PROGBITS 080494e4 0004e4 000010 0 WA 0 0 4 -+[16] .eh_frame PROGBITS 080494f4 0004f4 000004 0 WA 0 0 4 -+[17] .ctors PROGBITS 080494f8 0004f8 000008 0 WA 0 0 4 -+[18] .dtors PROGBITS 08049500 000500 000008 0 WA 0 0 4 -+[19] .got PROGBITS 08049508 000508 000020 4 WA 0 0 4 -+[20] .dynamic DYNAMIC 08049528 000528 0000a0 8 WA 5 0 4 -+[21] .sbss PROGBITS 080495c8 0005c8 000000 0 W 0 0 1 -+[22] .bss NOBITS 080495c8 0005c8 00001c 0 WA 0 0 4 -+[23] .comment PROGBITS 00000000 0005c8 000170 0 0 0 1 -+[24] .note NOTE 00000000 000738 0000a0 0 0 0 1 -+[25] .strtab STRTAB 00000000 0007d8 000235 0 0 0 1 -+[26] .gnu_debuglink PROGBITS 00000000 000a10 000014 0 0 0 4 -+[27] .shstrtab STRTAB 00000000 000a24 0000d7 0 0 0 1 -+ -+EOF -+echo readelf testfile.debug -+testrun_compare ${abs_top_builddir}/src/readelf -S testfile.debug <<\EOF -+There are 35 section headers, starting at offset 0x463c: -+ -+Section Headers: -+[Nr] Name Type Addr Off Size ES Flags Lk Inf Al -+[ 0] NULL 00000000 000000 000000 0 0 0 0 -+[ 1] .interp NOBITS 080480f4 0000f4 000013 0 A 0 0 1 -+[ 2] .note.ABI-tag NOTE 08048108 0000f4 000020 0 A 0 0 4 -+[ 3] .hash NOBITS 08048128 000114 000030 4 A 4 0 4 -+[ 4] .dynsym NOBITS 08048158 000114 000070 16 A 5 1 4 -+[ 5] .dynstr NOBITS 080481c8 000114 00008e 0 A 0 0 1 -+[ 6] .gnu.version NOBITS 08048256 000114 00000e 2 A 4 0 2 -+[ 7] .gnu.version_r NOBITS 08048264 000114 000030 0 A 5 1 4 -+[ 8] .rel.got NOBITS 08048294 000114 000008 8 A 4 19 4 -+[ 9] .rel.plt NOBITS 0804829c 000114 000020 8 A 4 11 4 -+[10] .init NOBITS 080482bc 000114 000018 0 AX 0 0 4 -+[11] .plt NOBITS 080482d4 000114 000050 4 AX 0 0 4 -+[12] .text NOBITS 08048330 000120 00018c 0 AX 0 0 16 -+[13] .fini NOBITS 080484bc 000120 00001e 0 AX 0 0 4 -+[14] .rodata NOBITS 080484dc 000120 000008 0 A 0 0 4 -+[15] .data NOBITS 080494e4 000120 000010 0 WA 0 0 4 -+[16] .eh_frame NOBITS 080494f4 000120 000004 0 WA 0 0 4 -+[17] .ctors NOBITS 080494f8 000120 000008 0 WA 0 0 4 -+[18] .dtors NOBITS 08049500 000120 000008 0 WA 0 0 4 -+[19] .got NOBITS 08049508 000120 000020 4 WA 0 0 4 -+[20] .dynamic NOBITS 08049528 000120 0000a0 8 WA 5 0 4 -+[21] .sbss NOBITS 080495c8 000120 000000 0 W 0 0 1 -+[22] .bss NOBITS 080495c8 000120 00001c 0 WA 0 0 4 -+[23] .stab PROGBITS 00000000 000120 000720 12 24 0 4 -+[24] .stabstr STRTAB 00000000 000840 001934 0 0 0 1 -+[25] .comment NOBITS 00000000 002174 000170 0 0 0 1 -+[26] .debug_aranges PROGBITS 00000000 002174 000060 0 0 0 1 -+[27] .debug_pubnames PROGBITS 00000000 0021d4 000055 0 0 0 1 -+[28] .debug_info PROGBITS 00000000 002229 001678 0 0 0 1 -+[29] .debug_abbrev PROGBITS 00000000 0038a1 0001d2 0 0 0 1 -+[30] .debug_line PROGBITS 00000000 003a73 000223 0 0 0 1 -+[31] .note NOTE 00000000 003c96 0000a0 0 0 0 1 -+[32] .shstrtab STRTAB 00000000 003d36 00012e 0 0 0 1 -+[33] .symtab SYMTAB 00000000 003e64 0005a0 16 34 68 4 -+[34] .strtab STRTAB 00000000 004404 000235 0 0 0 1 -+ -+EOF -+ -+# Explicitly remove both .symtab and .strtab. Keep .stab and .stabstr 32bit -+echo strip -g --remove-section=".s[yt][mr]tab" --keep-section=".stab*" testfile -+testrun ${abs_top_builddir}/src/strip -g --remove-section=".s[yt][mr]tab" --keep-section=".stab*" -o testfile.elf -f testfile.debug testfile -+echo elflint testfile.elf -+testrun ${abs_top_builddir}/src/elflint --gnu testfile.elf -+echo elflint testfile.debug -+testrun ${abs_top_builddir}/src/elflint --gnu -d testfile.debug -+echo readelf testfile.elf -+testrun_compare ${abs_top_builddir}/src/readelf -S testfile.elf <<\EOF -+There are 29 section headers, starting at offset 0x2920: -+ -+Section Headers: -+[Nr] Name Type Addr Off Size ES Flags Lk Inf Al -+[ 0] NULL 00000000 000000 000000 0 0 0 0 -+[ 1] .interp PROGBITS 080480f4 0000f4 000013 0 A 0 0 1 -+[ 2] .note.ABI-tag NOTE 08048108 000108 000020 0 A 0 0 4 -+[ 3] .hash HASH 08048128 000128 000030 4 A 4 0 4 -+[ 4] .dynsym DYNSYM 08048158 000158 000070 16 A 5 1 4 -+[ 5] .dynstr STRTAB 080481c8 0001c8 00008e 0 A 0 0 1 -+[ 6] .gnu.version GNU_versym 08048256 000256 00000e 2 A 4 0 2 -+[ 7] .gnu.version_r GNU_verneed 08048264 000264 000030 0 A 5 1 4 -+[ 8] .rel.got REL 08048294 000294 000008 8 A 4 19 4 -+[ 9] .rel.plt REL 0804829c 00029c 000020 8 A 4 11 4 -+[10] .init PROGBITS 080482bc 0002bc 000018 0 AX 0 0 4 -+[11] .plt PROGBITS 080482d4 0002d4 000050 4 AX 0 0 4 -+[12] .text PROGBITS 08048330 000330 00018c 0 AX 0 0 16 -+[13] .fini PROGBITS 080484bc 0004bc 00001e 0 AX 0 0 4 -+[14] .rodata PROGBITS 080484dc 0004dc 000008 0 A 0 0 4 -+[15] .data PROGBITS 080494e4 0004e4 000010 0 WA 0 0 4 -+[16] .eh_frame PROGBITS 080494f4 0004f4 000004 0 WA 0 0 4 -+[17] .ctors PROGBITS 080494f8 0004f8 000008 0 WA 0 0 4 -+[18] .dtors PROGBITS 08049500 000500 000008 0 WA 0 0 4 -+[19] .got PROGBITS 08049508 000508 000020 4 WA 0 0 4 -+[20] .dynamic DYNAMIC 08049528 000528 0000a0 8 WA 5 0 4 -+[21] .sbss PROGBITS 080495c8 0005c8 000000 0 W 0 0 1 -+[22] .bss NOBITS 080495c8 0005c8 00001c 0 WA 0 0 4 -+[23] .stab PROGBITS 00000000 0005c8 000720 12 24 0 4 -+[24] .stabstr STRTAB 00000000 000ce8 001934 0 0 0 1 -+[25] .comment PROGBITS 00000000 00261c 000170 0 0 0 1 -+[26] .note NOTE 00000000 00278c 0000a0 0 0 0 1 -+[27] .gnu_debuglink PROGBITS 00000000 00282c 000014 0 0 0 4 -+[28] .shstrtab STRTAB 00000000 002840 0000de 0 0 0 1 -+ -+EOF -+echo readelf testfile.debug -+testrun_compare ${abs_top_builddir}/src/readelf -S testfile.debug <<\EOF -+There are 35 section headers, starting at offset 0x25e8: -+ -+Section Headers: -+[Nr] Name Type Addr Off Size ES Flags Lk Inf Al -+[ 0] NULL 00000000 000000 000000 0 0 0 0 -+[ 1] .interp NOBITS 080480f4 0000f4 000013 0 A 0 0 1 -+[ 2] .note.ABI-tag NOTE 08048108 0000f4 000020 0 A 0 0 4 -+[ 3] .hash NOBITS 08048128 000114 000030 4 A 4 0 4 -+[ 4] .dynsym NOBITS 08048158 000114 000070 16 A 5 1 4 -+[ 5] .dynstr NOBITS 080481c8 000114 00008e 0 A 0 0 1 -+[ 6] .gnu.version NOBITS 08048256 000114 00000e 2 A 4 0 2 -+[ 7] .gnu.version_r NOBITS 08048264 000114 000030 0 A 5 1 4 -+[ 8] .rel.got NOBITS 08048294 000114 000008 8 A 4 19 4 -+[ 9] .rel.plt NOBITS 0804829c 000114 000020 8 A 4 11 4 -+[10] .init NOBITS 080482bc 000114 000018 0 AX 0 0 4 -+[11] .plt NOBITS 080482d4 000114 000050 4 AX 0 0 4 -+[12] .text NOBITS 08048330 000120 00018c 0 AX 0 0 16 -+[13] .fini NOBITS 080484bc 000120 00001e 0 AX 0 0 4 -+[14] .rodata NOBITS 080484dc 000120 000008 0 A 0 0 4 -+[15] .data NOBITS 080494e4 000120 000010 0 WA 0 0 4 -+[16] .eh_frame NOBITS 080494f4 000120 000004 0 WA 0 0 4 -+[17] .ctors NOBITS 080494f8 000120 000008 0 WA 0 0 4 -+[18] .dtors NOBITS 08049500 000120 000008 0 WA 0 0 4 -+[19] .got NOBITS 08049508 000120 000020 4 WA 0 0 4 -+[20] .dynamic NOBITS 08049528 000120 0000a0 8 WA 5 0 4 -+[21] .sbss NOBITS 080495c8 000120 000000 0 W 0 0 1 -+[22] .bss NOBITS 080495c8 000120 00001c 0 WA 0 0 4 -+[23] .stab NOBITS 00000000 000120 000720 12 24 0 4 -+[24] .stabstr NOBITS 00000000 000120 001934 0 0 0 1 -+[25] .comment NOBITS 00000000 000120 000170 0 0 0 1 -+[26] .debug_aranges PROGBITS 00000000 000120 000060 0 0 0 1 -+[27] .debug_pubnames PROGBITS 00000000 000180 000055 0 0 0 1 -+[28] .debug_info PROGBITS 00000000 0001d5 001678 0 0 0 1 -+[29] .debug_abbrev PROGBITS 00000000 00184d 0001d2 0 0 0 1 -+[30] .debug_line PROGBITS 00000000 001a1f 000223 0 0 0 1 -+[31] .note NOTE 00000000 001c42 0000a0 0 0 0 1 -+[32] .shstrtab STRTAB 00000000 001ce2 00012e 0 0 0 1 -+[33] .symtab SYMTAB 00000000 001e10 0005a0 16 34 68 4 -+[34] .strtab STRTAB 00000000 0023b0 000235 0 0 0 1 -+ -+EOF -+ -+# Explicitly remove .symtab (but not .strtab, so it will be in both). 64bit -+echo strip -g --remove-section=.symtab testfile69.so -+testrun ${abs_top_builddir}/src/strip -g --remove-section=.symtab -o testfile.elf -f testfile.debug testfile69.so -+echo elflint testfile.elf -+testrun ${abs_top_builddir}/src/elflint --gnu testfile.elf -+echo elflint testfile.debug -+testrun ${abs_top_builddir}/src/elflint --gnu -d testfile.debug -+echo readelf testfile.elf -+testrun_compare ${abs_top_builddir}/src/readelf -S testfile.elf <<\EOF -+There are 27 section headers, starting at offset 0xad8: -+ -+Section Headers: -+[Nr] Name Type Addr Off Size ES Flags Lk Inf Al -+[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0 -+[ 1] .note.gnu.build-id NOTE 0000000000000190 00000190 00000024 0 A 0 0 4 -+[ 2] .gnu.hash GNU_HASH 00000000000001b8 000001b8 0000003c 0 A 3 0 8 -+[ 3] .dynsym DYNSYM 00000000000001f8 000001f8 00000108 24 A 4 2 8 -+[ 4] .dynstr STRTAB 0000000000000300 00000300 00000077 0 A 0 0 1 -+[ 5] .gnu.version GNU_versym 0000000000000378 00000378 00000016 2 A 3 0 2 -+[ 6] .gnu.version_r GNU_verneed 0000000000000390 00000390 00000020 0 A 4 1 8 -+[ 7] .rela.dyn RELA 00000000000003b0 000003b0 00000060 24 A 3 0 8 -+[ 8] .rela.plt RELA 0000000000000410 00000410 00000018 24 A 3 10 8 -+[ 9] .init PROGBITS 0000000000000428 00000428 00000018 0 AX 0 0 4 -+[10] .plt PROGBITS 0000000000000440 00000440 00000020 16 AX 0 0 16 -+[11] .text PROGBITS 0000000000000460 00000460 00000128 0 AX 0 0 16 -+[12] .fini PROGBITS 0000000000000588 00000588 0000000e 0 AX 0 0 4 -+[13] .eh_frame_hdr PROGBITS 0000000000000598 00000598 00000024 0 A 0 0 4 -+[14] .eh_frame PROGBITS 00000000000005c0 000005c0 00000084 0 A 0 0 8 -+[15] .ctors PROGBITS 0000000000200648 00000648 00000010 0 WA 0 0 8 -+[16] .dtors PROGBITS 0000000000200658 00000658 00000010 0 WA 0 0 8 -+[17] .jcr PROGBITS 0000000000200668 00000668 00000008 0 WA 0 0 8 -+[18] .data.rel.ro PROGBITS 0000000000200670 00000670 00000008 0 WA 0 0 8 -+[19] .dynamic DYNAMIC 0000000000200678 00000678 00000180 16 WA 4 0 8 -+[20] .got PROGBITS 00000000002007f8 000007f8 00000018 8 WA 0 0 8 -+[21] .got.plt PROGBITS 0000000000200810 00000810 00000020 8 WA 0 0 8 -+[22] .bss NOBITS 0000000000200830 00000830 00000010 0 WA 0 0 8 -+[23] .comment PROGBITS 0000000000000000 00000830 0000002c 1 MS 0 0 1 -+[24] .strtab STRTAB 0000000000000000 0000085c 00000175 0 0 0 1 -+[25] .gnu_debuglink PROGBITS 0000000000000000 000009d4 00000014 0 0 0 4 -+[26] .shstrtab STRTAB 0000000000000000 000009e8 000000ee 0 0 0 1 -+ -+EOF -+echo readelf testfile.debug -+testrun_compare ${abs_top_builddir}/src/readelf -S testfile.debug <<\EOF -+There are 27 section headers, starting at offset 0x918: -+ -+Section Headers: -+[Nr] Name Type Addr Off Size ES Flags Lk Inf Al -+[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0 -+[ 1] .note.gnu.build-id NOTE 0000000000000190 00000190 00000024 0 A 0 0 4 -+[ 2] .gnu.hash NOBITS 00000000000001b8 000001b8 0000003c 0 A 3 0 8 -+[ 3] .dynsym NOBITS 00000000000001f8 000001b8 00000108 24 A 4 2 8 -+[ 4] .dynstr NOBITS 0000000000000300 000001b8 00000077 0 A 0 0 1 -+[ 5] .gnu.version NOBITS 0000000000000378 000001b8 00000016 2 A 3 0 2 -+[ 6] .gnu.version_r NOBITS 0000000000000390 000001b8 00000020 0 A 4 1 8 -+[ 7] .rela.dyn NOBITS 00000000000003b0 000001b8 00000060 24 A 3 0 8 -+[ 8] .rela.plt NOBITS 0000000000000410 000001b8 00000018 24 A 3 10 8 -+[ 9] .init NOBITS 0000000000000428 000001b8 00000018 0 AX 0 0 4 -+[10] .plt NOBITS 0000000000000440 000001c0 00000020 16 AX 0 0 16 -+[11] .text NOBITS 0000000000000460 000001c0 00000128 0 AX 0 0 16 -+[12] .fini NOBITS 0000000000000588 000001c0 0000000e 0 AX 0 0 4 -+[13] .eh_frame_hdr NOBITS 0000000000000598 000001c0 00000024 0 A 0 0 4 -+[14] .eh_frame NOBITS 00000000000005c0 000001c0 00000084 0 A 0 0 8 -+[15] .ctors NOBITS 0000000000200648 000001c0 00000010 0 WA 0 0 8 -+[16] .dtors NOBITS 0000000000200658 000001c0 00000010 0 WA 0 0 8 -+[17] .jcr NOBITS 0000000000200668 000001c0 00000008 0 WA 0 0 8 -+[18] .data.rel.ro NOBITS 0000000000200670 000001c0 00000008 0 WA 0 0 8 -+[19] .dynamic NOBITS 0000000000200678 000001c0 00000180 16 WA 4 0 8 -+[20] .got NOBITS 00000000002007f8 000001c0 00000018 8 WA 0 0 8 -+[21] .got.plt NOBITS 0000000000200810 000001c0 00000020 8 WA 0 0 8 -+[22] .bss NOBITS 0000000000200830 000001c0 00000010 0 WA 0 0 8 -+[23] .comment NOBITS 0000000000000000 000001c0 0000002c 1 MS 0 0 1 -+[24] .shstrtab STRTAB 0000000000000000 000001c0 000000e7 0 0 0 1 -+[25] .symtab SYMTAB 0000000000000000 000002a8 000004f8 24 26 44 8 -+[26] .strtab STRTAB 0000000000000000 000007a0 00000175 0 0 0 1 -+ -+EOF -+ -+# Explicitly remove both .symtab and .strtab. Keep .comment section. 64bit -+echo strip -g --remove-section=".s[yt][mr]tab" --keep-section=.comment testfile69.so -+testrun ${abs_top_builddir}/src/strip -g --remove-section=".s[yt][mr]tab" --keep-section=.comment -o testfile.elf -f testfile.debug testfile69.so -+echo elflint testfile.elf -+testrun ${abs_top_builddir}/src/elflint --gnu testfile.elf -+echo elflint testfile.debug -+testrun ${abs_top_builddir}/src/elflint --gnu -d testfile.debug -+echo readelf testfile.elf -+testrun_compare ${abs_top_builddir}/src/readelf -S testfile.elf <<\EOF -+There are 26 section headers, starting at offset 0x958: -+ -+Section Headers: -+[Nr] Name Type Addr Off Size ES Flags Lk Inf Al -+[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0 -+[ 1] .note.gnu.build-id NOTE 0000000000000190 00000190 00000024 0 A 0 0 4 -+[ 2] .gnu.hash GNU_HASH 00000000000001b8 000001b8 0000003c 0 A 3 0 8 -+[ 3] .dynsym DYNSYM 00000000000001f8 000001f8 00000108 24 A 4 2 8 -+[ 4] .dynstr STRTAB 0000000000000300 00000300 00000077 0 A 0 0 1 -+[ 5] .gnu.version GNU_versym 0000000000000378 00000378 00000016 2 A 3 0 2 -+[ 6] .gnu.version_r GNU_verneed 0000000000000390 00000390 00000020 0 A 4 1 8 -+[ 7] .rela.dyn RELA 00000000000003b0 000003b0 00000060 24 A 3 0 8 -+[ 8] .rela.plt RELA 0000000000000410 00000410 00000018 24 A 3 10 8 -+[ 9] .init PROGBITS 0000000000000428 00000428 00000018 0 AX 0 0 4 -+[10] .plt PROGBITS 0000000000000440 00000440 00000020 16 AX 0 0 16 -+[11] .text PROGBITS 0000000000000460 00000460 00000128 0 AX 0 0 16 -+[12] .fini PROGBITS 0000000000000588 00000588 0000000e 0 AX 0 0 4 -+[13] .eh_frame_hdr PROGBITS 0000000000000598 00000598 00000024 0 A 0 0 4 -+[14] .eh_frame PROGBITS 00000000000005c0 000005c0 00000084 0 A 0 0 8 -+[15] .ctors PROGBITS 0000000000200648 00000648 00000010 0 WA 0 0 8 -+[16] .dtors PROGBITS 0000000000200658 00000658 00000010 0 WA 0 0 8 -+[17] .jcr PROGBITS 0000000000200668 00000668 00000008 0 WA 0 0 8 -+[18] .data.rel.ro PROGBITS 0000000000200670 00000670 00000008 0 WA 0 0 8 -+[19] .dynamic DYNAMIC 0000000000200678 00000678 00000180 16 WA 4 0 8 -+[20] .got PROGBITS 00000000002007f8 000007f8 00000018 8 WA 0 0 8 -+[21] .got.plt PROGBITS 0000000000200810 00000810 00000020 8 WA 0 0 8 -+[22] .bss NOBITS 0000000000200830 00000830 00000010 0 WA 0 0 8 -+[23] .comment PROGBITS 0000000000000000 00000830 0000002c 1 MS 0 0 1 -+[24] .gnu_debuglink PROGBITS 0000000000000000 0000085c 00000014 0 0 0 4 -+[25] .shstrtab STRTAB 0000000000000000 00000870 000000e6 0 0 0 1 -+ -+EOF -+echo readelf testfile.debug -+testrun_compare ${abs_top_builddir}/src/readelf -S testfile.debug <<\EOF -+There are 27 section headers, starting at offset 0x918: -+ -+Section Headers: -+[Nr] Name Type Addr Off Size ES Flags Lk Inf Al -+[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0 -+[ 1] .note.gnu.build-id NOTE 0000000000000190 00000190 00000024 0 A 0 0 4 -+[ 2] .gnu.hash NOBITS 00000000000001b8 000001b8 0000003c 0 A 3 0 8 -+[ 3] .dynsym NOBITS 00000000000001f8 000001b8 00000108 24 A 4 2 8 -+[ 4] .dynstr NOBITS 0000000000000300 000001b8 00000077 0 A 0 0 1 -+[ 5] .gnu.version NOBITS 0000000000000378 000001b8 00000016 2 A 3 0 2 -+[ 6] .gnu.version_r NOBITS 0000000000000390 000001b8 00000020 0 A 4 1 8 -+[ 7] .rela.dyn NOBITS 00000000000003b0 000001b8 00000060 24 A 3 0 8 -+[ 8] .rela.plt NOBITS 0000000000000410 000001b8 00000018 24 A 3 10 8 -+[ 9] .init NOBITS 0000000000000428 000001b8 00000018 0 AX 0 0 4 -+[10] .plt NOBITS 0000000000000440 000001c0 00000020 16 AX 0 0 16 -+[11] .text NOBITS 0000000000000460 000001c0 00000128 0 AX 0 0 16 -+[12] .fini NOBITS 0000000000000588 000001c0 0000000e 0 AX 0 0 4 -+[13] .eh_frame_hdr NOBITS 0000000000000598 000001c0 00000024 0 A 0 0 4 -+[14] .eh_frame NOBITS 00000000000005c0 000001c0 00000084 0 A 0 0 8 -+[15] .ctors NOBITS 0000000000200648 000001c0 00000010 0 WA 0 0 8 -+[16] .dtors NOBITS 0000000000200658 000001c0 00000010 0 WA 0 0 8 -+[17] .jcr NOBITS 0000000000200668 000001c0 00000008 0 WA 0 0 8 -+[18] .data.rel.ro NOBITS 0000000000200670 000001c0 00000008 0 WA 0 0 8 -+[19] .dynamic NOBITS 0000000000200678 000001c0 00000180 16 WA 4 0 8 -+[20] .got NOBITS 00000000002007f8 000001c0 00000018 8 WA 0 0 8 -+[21] .got.plt NOBITS 0000000000200810 000001c0 00000020 8 WA 0 0 8 -+[22] .bss NOBITS 0000000000200830 000001c0 00000010 0 WA 0 0 8 -+[23] .comment NOBITS 0000000000000000 000001c0 0000002c 1 MS 0 0 1 -+[24] .shstrtab STRTAB 0000000000000000 000001c0 000000e7 0 0 0 1 -+[25] .symtab SYMTAB 0000000000000000 000002a8 000004f8 24 26 44 8 -+[26] .strtab STRTAB 0000000000000000 000007a0 00000175 0 0 0 1 -+ -+EOF -+ -+exit 0 -diff -ur elfutils-0.169.orig/tests/Makefile.in elfutils-0.169/tests/Makefile.in ---- elfutils-0.169.orig/tests/Makefile.in 2017-07-17 11:25:44.681190429 +0200 -+++ elfutils-0.169/tests/Makefile.in 2017-07-17 11:25:56.177935408 +0200 -@@ -140,16 +140,16 @@ - run-strip-test7.sh run-strip-test8.sh run-strip-test9.sh \ - run-strip-test10.sh run-strip-test11.sh run-strip-nothing.sh \ - run-strip-groups.sh run-strip-reloc.sh run-strip-strmerge.sh \ -- run-strip-nobitsalign.sh run-unstrip-test.sh \ -- run-unstrip-test2.sh run-unstrip-test3.sh run-unstrip-test4.sh \ -- run-unstrip-M.sh run-elfstrmerge-test.sh run-ecp-test.sh \ -- run-ecp-test2.sh run-alldts.sh run-elflint-test.sh \ -- run-elflint-self.sh run-ranlib-test.sh run-ranlib-test2.sh \ -- run-ranlib-test3.sh run-ranlib-test4.sh run-addrscopes.sh \ -- run-strings-test.sh run-funcscopes.sh run-find-prologues.sh \ -- run-allregs.sh run-addrcfi.sh run-nm-self.sh \ -- run-readelf-self.sh run-readelf-test1.sh run-readelf-test2.sh \ -- run-readelf-test3.sh run-readelf-test4.sh \ -+ run-strip-nobitsalign.sh run-strip-remove-keep.sh \ -+ run-unstrip-test.sh run-unstrip-test2.sh run-unstrip-test3.sh \ -+ run-unstrip-test4.sh run-unstrip-M.sh run-elfstrmerge-test.sh \ -+ run-ecp-test.sh run-ecp-test2.sh run-alldts.sh \ -+ run-elflint-test.sh run-elflint-self.sh run-ranlib-test.sh \ -+ run-ranlib-test2.sh run-ranlib-test3.sh run-ranlib-test4.sh \ -+ run-addrscopes.sh run-strings-test.sh run-funcscopes.sh \ -+ run-find-prologues.sh run-allregs.sh run-addrcfi.sh \ -+ run-nm-self.sh run-readelf-self.sh run-readelf-test1.sh \ -+ run-readelf-test2.sh run-readelf-test3.sh run-readelf-test4.sh \ - run-readelf-twofiles.sh run-readelf-macro.sh \ - run-readelf-loc.sh run-readelf-aranges.sh run-readelf-line.sh \ - run-readelf-z.sh run-native-test.sh run-bug1-test.sh \ -@@ -1046,7 +1046,7 @@ - run-strip-test4.sh run-strip-test5.sh run-strip-test6.sh \ - run-strip-test7.sh run-strip-test8.sh run-strip-groups.sh \ - run-strip-test9.sh run-strip-test10.sh run-strip-test11.sh \ -- run-strip-nothing.sh \ -+ run-strip-nothing.sh run-strip-remove-keep.sh \ - run-strip-strmerge.sh run-strip-nobitsalign.sh \ - testfile-nobitsalign.bz2 testfile-nobitsalign.strip.bz2 \ - run-strip-reloc.sh hello_i386.ko.bz2 hello_x86_64.ko.bz2 \ -@@ -2368,6 +2368,13 @@ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ -+ "$$tst" $(AM_TESTS_FD_REDIRECT) -+run-strip-remove-keep.sh.log: run-strip-remove-keep.sh -+ @p='run-strip-remove-keep.sh'; \ -+ b='run-strip-remove-keep.sh'; \ -+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ -+ --log-file $$b.log --trs-file $$b.trs \ -+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) - run-unstrip-test.sh.log: run-unstrip-test.sh - @p='run-unstrip-test.sh'; \ diff --git a/elfutils.spec b/elfutils.spec index ba49f32..6978ad4 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -1,7 +1,7 @@ Name: elfutils Summary: A collection of utilities and DSOs to handle ELF files and DWARF data -Version: 0.169 -%global baserelease 8 +Version: 0.170 +%global baserelease 1 URL: http://elfutils.org/ %global source_url ftp://sourceware.org/pub/elfutils/%{version}/ License: GPLv3+ and (GPLv2+ or LGPLv3+) @@ -11,8 +11,8 @@ Release: %{baserelease}%{?dist} %global provide_yama_scope 0 -%if 0%{?fedora} -%global provide_yama_scope (%fedora >= 22) +%if 0%{?fedora} >= 22 || 0%{?rhel} >= 7 +%global provide_yama_scope 1 %endif %global depsuffix %{?_isa}%{!?_isa:-%{_arch}} @@ -20,14 +20,6 @@ Release: %{baserelease}%{?dist} Source: %{?source_url}%{name}-%{version}.tar.bz2 # Patches -Patch1: elfutils-0.169-ppc64-fallback-unwinder.patch -Source1: backtrace.ppc64le.fp.exec.bz2 -Source2: backtrace.ppc64le.fp.core.bz2 -Patch2: elfutils-0.169-dup-shstrtab.patch -Patch3: elfutils-0.169-strip-empty.patch -Patch4: elfutils-0.169-strip-keep-remove-section.patch -Patch5: elfutils-0.169-s390x-ptrace.patch -Patch6: elfutils-0.169-strip-data-marker-symbols.patch Requires: elfutils-libelf%{depsuffix} = %{version}-%{release} Requires: elfutils-libs%{depsuffix} = %{version}-%{release} @@ -178,13 +170,6 @@ profiling) of processes. %setup -q # Apply patches -%patch1 -p1 -b .ppc64_unwind -cp %SOURCE1 %SOURCE2 tests/ -%patch2 -p1 -b .shstrtab_dup -%patch3 -p1 -b .strip_empty -%patch4 -p1 -b .strip_keep_remove -%patch5 -p1 -b .s390_ptrace -%patch6 -p1 -b .data_markers find . -name \*.sh ! -perm -0100 -print | xargs chmod +x @@ -315,6 +300,10 @@ rm -rf ${RPM_BUILD_ROOT} %endif %changelog +* Thu Aug 3 2017 Mark Wielaard - 0.170-1 +- New upstream release. Remove upstreamed patches. +- provide_yama_scope for either fedora >= 22 and rhel >= 7. + * Wed Aug 02 2017 Fedora Release Engineering - 0.169-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild diff --git a/sources b/sources index 6547a41..cc6dd59 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (elfutils-0.169.tar.bz2) = 0a81a20bb2aff533d035d6b76f1403437b2e11bce390db57e34b8c26e4b9b3150346d83dddcbfbbdc58063f046ca3223508dba35c6ce88e375d201e7a777a8b9 +SHA512 (elfutils-0.170.tar.bz2) = bcfabe5fc500369bff72794bf060bfeef2f1a66a5bd7d2a1642adb7d54f6431bf48f13d0305433590539f3979188ce649d4fe70382f02c3be2ff24bf4c2d571a