From 56bc0b83ea81b7e959aaa4e1d01f8b36f2804a52 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 18 Dec 2006 22:38:08 +0000 Subject: Lock down libelf and elflint a bit more after import of Roland's changes. --- NEWS | 8 ++++++++ config/elfutils.spec.in | 34 +++++++++++++++++++++++++++++++--- configure.ac | 2 +- libdw/dwarf_getlocation.c | 12 ++++++------ libelf/ChangeLog | 4 +--- libelf/elf32_updatenull.c | 11 +++++++---- libelf/elf_error.c | 6 ++++-- src/ChangeLog | 2 +- src/elflint.c | 2 +- tests/Makefile.am | 1 + tests/msg_tst.c | 3 ++- 11 files changed, 63 insertions(+), 22 deletions(-) diff --git a/NEWS b/NEWS index d8fce778..095bebb3 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,11 @@ +Version 0.125: + +elflint: Compare DT_GNU_HASH tests. + +move archives into -static RPMs + +libelf, elflint: better support for core file handling + Version 0.124: libebl: sparc backend support for return value location diff --git a/config/elfutils.spec.in b/config/elfutils.spec.in index 57756158..770ea884 100644 --- a/config/elfutils.spec.in +++ b/config/elfutils.spec.in @@ -43,6 +43,15 @@ higher-level ELF access functionality. libdw provides access to the DWARF debugging information. libasm provides a programmable assembler interface. +%package devel-static +Summary: Static archives to handle compiled objects. +Group: Development/Tools +Requires: elfutils-devel = %{version}-%{release} + +%description devel-static +The elfutils-devel-static archive contains the static archives +with the code the handle compiled objects. + %package libelf Summary: Library to read and write ELF files. Group: Development/Tools @@ -65,6 +74,16 @@ applications for handling compiled objects. libelf allows you to access the internals of the ELF object file format, so you can see the different sections of an ELF file. +%package libelf-devel-static +Summary: Static archive of libelf +Group: Development/Tools +Requires: elfutils-libelf-devel = %{version}-%{release} +Conflicts: libelf-devel + +%description libelf-devel-static +The elfutils-libelf-static package contains the static archive +for libelf. + %prep %setup -q @@ -118,6 +137,7 @@ rm -rf ${RPM_BUILD_ROOT} %{_bindir}/eu-elfcmp %{_bindir}/eu-ranlib %{_bindir}/eu-strings +%{_bindir}/eu-objdump #%{_bindir}/eu-ld #%{_libdir}/libasm-%{version}.so %{_libdir}/libdw-%{version}.so @@ -134,12 +154,14 @@ rm -rf ${RPM_BUILD_ROOT} %{_includedir}/elfutils/libebl.h %{_includedir}/elfutils/libdw.h %{_includedir}/elfutils/libdwfl.h -#%{_libdir}/libasm.a %{_libdir}/libebl.a -%{_libdir}/libdw.a #%{_libdir}/libasm.so %{_libdir}/libdw.so +%files devel-static +%{_libdir}/libdw.a +#%{_libdir}/libasm.a + %files libelf %defattr(-,root,root) %{_libdir}/libelf-%{version}.so @@ -150,10 +172,16 @@ rm -rf ${RPM_BUILD_ROOT} %{_includedir}/libelf.h %{_includedir}/gelf.h %{_includedir}/nlist.h -%{_libdir}/libelf.a %{_libdir}/libelf.so +%files libelf-devel-static +%{_libdir}/libelf.a + %changelog +* Mon Dec 18 2006 Ulrich Drepper 0.125-1 +- elflint: Compare DT_GNU_HASH tests. +- move archives into -static RPMs + * Tue Oct 10 2006 Ulrich Drepper 0.124-1 - libebl: sparc backend support for return value location - libebl, libdwfl: backend register name support extended with more info diff --git a/configure.ac b/configure.ac index f3644f36..4c4ade1e 100644 --- a/configure.ac +++ b/configure.ac @@ -16,7 +16,7 @@ dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software Foundation, dnl Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. dnl -AC_INIT([Red Hat elfutils],[0.124],[http://bugzilla.redhat.com/bugzilla/], +AC_INIT([Red Hat elfutils],[0.125],[http://bugzilla.redhat.com/bugzilla/], [elfutils]) AC_CONFIG_AUX_DIR([config]) diff --git a/libdw/dwarf_getlocation.c b/libdw/dwarf_getlocation.c index cefd052b..f680aa96 100644 --- a/libdw/dwarf_getlocation.c +++ b/libdw/dwarf_getlocation.c @@ -471,13 +471,13 @@ dwarf_getlocation_addr (attr, address, llbufs, listlens, maxlocs) &attr_mem), &base) != 0) { - if (INTUSE(dwarf_errno) () == 0) - /* The compiler provided no base address when it should - have. Buggy GCC does this when it used absolute - addresses in the location list and no DW_AT_ranges. */ - base = 0; - else + if (INTUSE(dwarf_errno) () != 0) return -1; + + /* The compiler provided no base address when it should + have. Buggy GCC does this when it used absolute + addresses in the location list and no DW_AT_ranges. */ + base = 0; } } diff --git a/libelf/ChangeLog b/libelf/ChangeLog index 9ff24df2..f3cf6897 100644 --- a/libelf/ChangeLog +++ b/libelf/ChangeLog @@ -1,8 +1,6 @@ 2006-10-13 Roland McGrath - * elf32_updatenull.c: Look for phdr if e_phnum nonzero, regardless of - e_type. Diagnose ELF_E_INVALID_PHDR only for ET_REL, and not - if ELF_F_PERMISSIVE. + * elf32_updatenull.c: Look for and accept phdr also for ET_CORE. * elf_error.c (msgstr): Change ELF_E_INVALID_PHDR string. 2006-08-29 Roland McGrath diff --git a/libelf/elf32_updatenull.c b/libelf/elf32_updatenull.c index 0de48bea..b3299fe4 100644 --- a/libelf/elf32_updatenull.c +++ b/libelf/elf32_updatenull.c @@ -147,13 +147,16 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf, int *change_bop, size_t shnum) off_t size = elf_typesize (LIBELFBITS, ELF_T_EHDR, 1); /* Set the program header position. */ - if (elf->state.ELFW(elf,LIBELFBITS).phdr == NULL && ehdr->e_phnum != 0) + if (elf->state.ELFW(elf,LIBELFBITS).phdr == NULL + && (ehdr->e_type == ET_EXEC || ehdr->e_type == ET_DYN + || ehdr->e_type == ET_CORE)) (void) INTUSE(elfw2(LIBELFBITS,getphdr)) (elf); if (elf->state.ELFW(elf,LIBELFBITS).phdr != NULL) { - /* Only executables or shared objects have a program header. */ - if (unlikely (ehdr->e_type == ET_REL) - && (elf->flags & ELF_F_PERMISSIVE) == 0) + /* Only executables, shared objects, and core files have a program + header. */ + if (ehdr->e_type != ET_EXEC && ehdr->e_type != ET_DYN + && unlikely (ehdr->e_type != ET_CORE)) { __libelf_seterrno (ELF_E_INVALID_PHDR); return -1; diff --git a/libelf/elf_error.c b/libelf/elf_error.c index 3161b8b8..5e00372a 100644 --- a/libelf/elf_error.c +++ b/libelf/elf_error.c @@ -270,11 +270,13 @@ static const char msgstr[] = #define ELF_E_INVALID_PHDR_IDX \ (ELF_E_GROUP_NOT_REL_IDX \ + sizeof "only relocatable files can contain section groups") - N_("program header not allowed in relocatable files") + N_("program header only allowed in executables, shared objects, and \ +core files") "\0" #define ELF_E_NO_PHDR_IDX \ (ELF_E_INVALID_PHDR_IDX \ - + sizeof "program header not allowed in relocatable files") + + sizeof "program header only allowed in executables, shared objects, and \ +core files") N_("file has no program header") "\0" #define ELF_E_INVALID_OFFSET_IDX \ diff --git a/src/ChangeLog b/src/ChangeLog index 190c6732..58db2243 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -7,7 +7,7 @@ 2006-10-31 Roland McGrath * elflint.c (check_program_header): Don't complain about - p_filesz > p_memsz if p_memsz is zero and p_type is not PT_LOAD. + p_filesz > p_memsz if p_memsz is zero and p_type is PT_NOTE. 2006-09-19 Jakub Jelinek diff --git a/src/elflint.c b/src/elflint.c index 06930ca8..7a50a21b 100644 --- a/src/elflint.c +++ b/src/elflint.c @@ -3830,7 +3830,7 @@ program header offset in ELF header and PHDR entry do not match")); } if (phdr->p_filesz > phdr->p_memsz - && (phdr->p_memsz != 0 || phdr->p_type == PT_LOAD)) + && (phdr->p_memsz != 0 || phdr->p_type != PT_NOTE)) ERROR (gettext ("\ program header entry %d: file size greater than memory size\n"), cnt); diff --git a/tests/Makefile.am b/tests/Makefile.am index ab17761a..bc46c42e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -34,6 +34,7 @@ AM_CFLAGS = -Wall -Werror -Wextra -std=gnu99 \ $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) BUILT_RPATH = \$$ORIGIN/../libasm:\$$ORIGIN/../libdw:\$$ORIGIN/../backends:\$$ORIGIN/../libelf endif +CFLAGS := $(filter-out -Wall,$(CFLAGS)) AM_LDFLAGS = diff --git a/tests/msg_tst.c b/tests/msg_tst.c index 36debbe4..db078533 100644 --- a/tests/msg_tst.c +++ b/tests/msg_tst.c @@ -79,7 +79,8 @@ static struct { ELF_E_GROUP_NOT_REL, "only relocatable files can contain section groups" }, { ELF_E_INVALID_PHDR, - "program header not allowed in relocatable files" }, + "program header only allowed in executables, shared objects, \ +and core files" }, { ELF_E_NO_PHDR, "file has no program header" }, { ELF_E_INVALID_OFFSET, "invalid offset" } }; -- cgit v1.2.1