From: Mark Wielaard Date: Thu, 3 Aug 2017 10:37:37 +0000 (+0200) Subject: Merge tag 'elfutils-0.170' into mjw/RH-DTS X-Git-Tag: dts-0.170 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=766df1e15c1e8f8bc9890e7538eb2ef15a6516dc;p=thirdparty%2Felfutils.git Merge tag 'elfutils-0.170' into mjw/RH-DTS elfutils 0.170 release Conflicts: libcpu/Makefile.am libdw/Makefile.am tests/Makefile.am --- 766df1e15c1e8f8bc9890e7538eb2ef15a6516dc diff --cc backends/Makefile.am index 96004dcc7,37dc2d20f..03b9d2019 --- a/backends/Makefile.am +++ b/backends/Makefile.am @@@ -46,32 -45,8 +46,33 @@@ lib_LIBRARIES = libebl_static_pic. libelf = ../libelf/libelf.so libdw = ../libdw/libdw.so + libeu = ../lib/libeu.a +# The following is minimal set of backends that we link with libdw to +# avoid dlopen. Note repeats files below because some backends reuse +# each others files. +static_SRCS = i386_init.c i386_symbol.c i386_corenote.c i386_cfi.c \ + i386_retval.c i386_regs.c i386_auxv.c i386_syscall.c \ + i386_initreg.c i386_unwind.c \ + x86_64_init.c x86_64_symbol.c x86_64_corenote.c x86_64_cfi.c \ + x86_64_retval.c x86_64_regs.c x86_64_syscall.c \ + x86_64_initreg.c x86_64_unwind.c x32_corenote.c \ + ia64_init.c ia64_symbol.c ia64_regs.c ia64_retval.c \ + aarch64_init.c aarch64_regs.c aarch64_symbol.c \ + aarch64_corenote.c aarch64_retval.c aarch64_cfi.c \ + aarch64_initreg.c aarch64_unwind.c \ + ppc_init.c ppc_symbol.c ppc_retval.c ppc_regs.c \ + ppc_corenote.c ppc_auxv.c ppc_attrs.c ppc_syscall.c \ + ppc_cfi.c ppc_initreg.c \ + ppc64_init.c ppc64_symbol.c ppc64_retval.c ppc64_corenote.c \ - ppc64_resolve_sym.c \ ++ ppc64_resolve_sym.c ppc64_unwind.c \ + s390_init.c s390_symbol.c s390_regs.c s390_retval.c \ + s390_corenote.c s390x_corenote.c s390_cfi.c s390_initreg.c \ + s390_unwind.c bpf_init.c bpf_regs.c + +libebl_static_pic_a_SOURCES = $(static_SRCS) +am_libebl_static_pic_a_OBJECTS = $(static_SRCS:.c=.os) + i386_SRCS = i386_init.c i386_symbol.c i386_corenote.c i386_cfi.c \ i386_retval.c i386_regs.c i386_auxv.c i386_syscall.c \ i386_initreg.c i386_unwind.c diff --cc libcpu/Makefile.am index 33c30a902,94de56efb..d16ba69be --- a/libcpu/Makefile.am +++ b/libcpu/Makefile.am @@@ -50,10 -48,6 +50,8 @@@ x86_64_disasm.o: x86_64.mnemonics $(src noinst_LIBRARIES += libcpu_bpf.a libcpu_bpf_a_SOURCES = bpf_disasm.c libcpu_bpf_a_CFLAGS = $(AM_CFLAGS) -Wno-format-nonliteral +libcpu_static_pic_a_SOURCES += $(libcpu_bpf_a_SOURCES) +bpf_disasm_CFLAGS = -fPIC -Wno-format-nonliteral - endif %_defs: $(srcdir)/defs/i386 $(AM_V_GEN)m4 -D$* -DDISASSEMBLER $< > $@T diff --cc libdw/Makefile.am index 4cb36716f,ff8c291e0..b3e781d80 --- a/libdw/Makefile.am +++ b/libdw/Makefile.am @@@ -90,22 -89,8 +90,23 @@@ libdw_a_SOURCES = dwarf_begin.c dwarf_b dwarf_aggregate_size.c dwarf_getlocation_implicit_pointer.c \ dwarf_getlocation_die.c dwarf_getlocation_attr.c \ dwarf_getalt.c dwarf_setalt.c dwarf_cu_getdwarf.c \ - dwarf_cu_die.c dwarf_peel_type.c + dwarf_cu_die.c dwarf_peel_type.c dwarf_default_lower_bound.c +# Minimal library with symbols needed by those libebl backends that we +# ship statically. This is so that e.g. strip doesn't end up bringing +# in the whole of libdw, and depending on libbz2, liblzma, etc. +libdw_static_pic_a_SOURCES = libdw_form.c dwarf_child.c dwarf_attr.c \ + dwarf_attr_integrate.c dwarf_formref_die.c dwarf_error.c \ + dwarf_tag.c dwarf_formref.c \ + dwarf_abbrev_hash.c dwarf_sig8_hash.c \ + dwarf_formudata.c libdw_findcu.c dwarf_offdie.c \ + dwarf_getabbrev.c dwarf_nextcu.c libdw_alloc.c \ + dwarf_hasattr_integrate.c dwarf_hasattr.c \ + dwarf_aggregate_size.c dwarf_siblingof.c dwarf_formsdata.c \ + dwarf_srclang.c dwarf_formflag.c dwarf_diecu.c \ - dwarf_bytesize.c dwarf_bitsize.c dwarf_peel_type.c ++ dwarf_bytesize.c dwarf_bitsize.c dwarf_peel_type.c \ ++ dwarf_default_lower_bound.c + if MAINTAINER_MODE BUILT_SOURCES = $(srcdir)/known-dwarf.h MAINTAINERCLEANFILES = $(srcdir)/known-dwarf.h @@@ -116,21 -101,21 +117,24 @@@ endi libdw_pic_a_SOURCES = am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os) +am_libdw_static_pic_a_OBJECTS = $(libdw_static_pic_a_SOURCES:.c=.os) - libdw_so_SOURCES = - libdw.so$(EXEEXT): $(srcdir)/libdw.map libdw_pic.a ../libdwelf/libdwelf_pic.a \ + libdw_so_LIBS = libdw_pic.a ../libdwelf/libdwelf_pic.a \ - ../libdwfl/libdwfl_pic.a ../libebl/libebl.a + ../libdwfl/libdwfl_pic.a ../libebl/libebl.a \ + ../backends/libebl_static_pic.a \ - ../libcpu/libcpu_static_pic.a \ - ../libelf/libelf.so ++ ../libcpu/libcpu_static_pic.a + libdw_so_DEPS = ../lib/libeu.a ../libelf/libelf.so + libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(zip_LIBS) + libdw_so_SOURCES = + libdw.so$(EXEEXT): $(srcdir)/libdw.map $(libdw_so_LIBS) $(libdw_so_DEPS) # The rpath is necessary for libebl because its $ORIGIN use will # not fly in a setuid executable that links in libdw. - $(AM_V_CCLD)$(LINK) -shared -o $@ -Wl,--soname,$@.$(VERSION),-z,defs \ + $(AM_V_CCLD)$(LINK) -shared -o $@ \ + -Wl,--soname,$@.$(VERSION),-z,defs,-z,relro \ -Wl,--enable-new-dtags,-rpath,$(pkglibdir) \ -Wl,--version-script,$<,--no-undefined \ - -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\ - -ldl -lz $(argp_LDADD) $(zip_LIBS) + -Wl,--whole-archive $(libdw_so_LIBS) -Wl,--no-whole-archive \ + $(libdw_so_LDLIBS) @$(textrel_check) $(AM_V_at)ln -fs $@ $@.$(VERSION) diff --cc libebl/Makefile.am index 7034b61cb,2491df809..6d5b07f6c --- a/libebl/Makefile.am +++ b/libebl/Makefile.am @@@ -53,9 -53,9 +53,10 @@@ gen_SOURCES = eblopenbackend.c eblclose 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_CFLAGS = -fvisibility=hidden $(AM_CFLAGS) libebl_a_SOURCES = $(gen_SOURCES) noinst_HEADERS = libeblP.h ebl-hooks.h diff --cc tests/Makefile.am index d17ffd473,3735084fe..483f3878f --- a/tests/Makefile.am +++ b/tests/Makefile.am @@@ -80,9 -80,10 +80,10 @@@ TESTS = run-arextract.sh run-arsymtest. newscn 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-test9.sh run-strip-test10.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-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 \ diff --cc tests/run-strip-g.sh index 000000000,13038195d..8024aa527 mode 000000,100755..100755 --- a/tests/run-strip-g.sh +++ b/tests/run-strip-g.sh @@@ -1,0 -1,102 +1,77 @@@ + #! /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