Hello community,
here is the log from the commit of package elfutils
checked in at Mon Oct 6 17:12:49 CEST 2008.
--------
New Changes file:
--- /dev/null 2008-04-22 03:09:48.000000000 +0200
+++ /mounts/work_src_done/STABLE/elfutils/elfutils.changes 2008-10-06 17:12:10.718525000 +0200
@@ -0,0 +1,90 @@
+-------------------------------------------------------------------
+Tue Aug 26 17:52:21 CEST 2008 - tiwai@suse.de
+
+- updated to version 0.135:
+ * libdwfl: bug fixes
+- updated to version 0.134:
+ * libdwfl, libelf: bug fixes
+- updated to version 0.133:
+ * readelf, elflint, libebl: SHT_GNU_ATTRIBUTE section handling
+ (readelf -A)
+ * libdwfl: bug fixes and optimization in relocation handling
+- updated to version 0.132:
+ * libcpu: Implement x86 and x86-64 disassembler.
+ * libasm: Add interface for disassembler.
+- fixed post scripts
+
+-------------------------------------------------------------------
+Fri Feb 29 19:17:35 CET 2008 - dmueller@suse.de
+
+- fix build for older distributions
+
+-------------------------------------------------------------------
+Mon Jan 28 14:24:36 CET 2008 - tiwai@suse.de
+
+- fix compile errors regarding missing prototypes.
+
+-------------------------------------------------------------------
+Tue Nov 20 14:47:20 CET 2007 - tiwai@suse.de
+
+- fix off64_t in libelf.h again...
+
+-------------------------------------------------------------------
+Tue Nov 20 10:36:32 CET 2007 - tiwai@suse.de
+
+- updated to version 0.131
+ * libdw: DW_FORM_ref_addr support
+ dwarf_formref entry point now deprecated
+ bug fixes for oddly-formatted DWARF
+ * libdwfl: bug fixes in offline archive support
+ apply partial relocations for dwfl_module_address_section
+ on ET_REL
+ * libebl: powerpc backend support for Altivec registers
+
+-------------------------------------------------------------------
+Mon Oct 22 18:40:18 CEST 2007 - tiwai@suse.de
+
+- fix comiple errors regarding missing off64_t definitions
+ in libelf.h
+
+-------------------------------------------------------------------
+Mon Oct 22 15:18:07 CEST 2007 - tiwai@suse.de
+
+- updated to version 0.129:
+ readelf: new options --hex-dump (or -x), --strings (or -p)
+- updated to version 0.130
+ * readelf: -p option can take an argument like -x for one
+ section
+ * libelf: new function elf_getdata_rawchunk, replaces
+ gelf_rawchunk;
+ new functions gelf_getnote, gelf_getauxv, gelf_update_auxv
+ * libdwfl: new functions dwfl_build_id_find_elf,
+ dwfl_build_id_find_debuginfo, dwfl_module_build_id,
+ dwfl_module_report_build_id;
+ support dynamic symbol tables found via phdrs;
+ dwfl_standard_find_debuginfo now uses build IDs when available
+ * libebl: backend improvements for sparc, alpha, powerpc
+
+-------------------------------------------------------------------
+Thu Oct 4 15:28:43 CEST 2007 - rguenther@suse.de
+
+- fix build with gcc-4.3, same patch as for the copy in rpm
+
+-------------------------------------------------------------------
+Wed Jul 4 12:20:22 CEST 2007 - tiwai@suse.de
+
+- updated to version 0.128
+ * auto-tool fixes
+
+-------------------------------------------------------------------
+Mon Jun 11 01:05:12 CEST 2007 - ro@suse.de
+
+- use __attribute__ ((gnu_inline)) to fix build with gcc-4.2
+
+-------------------------------------------------------------------
+Mon May 21 12:19:46 CEST 2007 - tiwai@suse.de
+
+- initial packages, built from elfutils-0.127.
+ A problematic file regarding the license is removed from the
+ tarball.
+
New Changes file:
libebl.changes: same change
calling whatdependson for head-i586
New:
----
build.diff
elfutils-0.135-no-osl.tar.bz2
elfutils-0.137-fixes.patch
elfutils-0.97-ftruncate-mmap-fix.diff
elfutils.changes
elfutils-no-po-test-build.diff
elfutils-portability.patch
elfutils-robustify.patch
elfutils.spec
libebl.changes
libebl-prototype-fix.diff
libelf-ignore-NOBITS-sh_offset.patch
test.diff
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ elfutils.spec ++++++
#
# spec file for package elfutils (Version 0.135)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
Name: elfutils
License: GPL v2 or later
Version: 0.135
Release: 1
Summary: A collection of utilities and DSOs to handle compiled objects
Group: Development/Tools/Other
Url: http://elfutils.fedorahosted.org
Source: elfutils-%{version}-no-osl.tar.bz2
Patch: elfutils-portability.patch
Patch1: elfutils-robustify.patch
Patch3: elfutils-no-po-test-build.diff
Patch7: libebl-prototype-fix.diff
Patch8: elfutils-0.97-ftruncate-mmap-fix.diff
Patch9: libelf-ignore-NOBITS-sh_offset.patch
Patch10: test.diff
Patch11: build.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Elfutils is a collection of utilities, including ld (a linker), nm (for
listing symbols from object files), size (for listing the section sizes
of an object or archive file), strip (for discarding symbols), readline
(the see the raw ELF file structures), and elflint (to check for
well-formed ELF files). Also included are numerous helper libraries
which implement DWARF, ELF, and machine-specific ELF handling.
Authors:
--------
Jeff Johnson
Jakub Jelinek
Ulrich Drepper
%package -n libasm1
Summary: A collection of utilities and DSOs to handle compiled objects
Group: Development/Tools/Other
License: GPL v2 or later
%description -n libasm1
Elfutils is a collection of utilities, including ld (a linker), nm (for
listing symbols from object files), size (for listing the section sizes
of an object or archive file), strip (for discarding symbols), readline
(the see the raw ELF file structures), and elflint (to check for
well-formed ELF files). Also included are numerous helper libraries
which implement DWARF, ELF, and machine-specific ELF handling.
Authors:
--------
Jeff Johnson
Jakub Jelinek
Ulrich Drepper
%package -n libasm-devel
Summary: A collection of utilities and DSOs to handle compiled objects
Group: Development/Tools/Other
License: GPL v2 or later
Requires: glibc-devel, libasm1 = %{version}
%description -n libasm-devel
Elfutils is a collection of utilities, including ld (a linker), nm (for
listing symbols from object files), size (for listing the section sizes
of an object or archive file), strip (for discarding symbols), readline
(the see the raw ELF file structures), and elflint (to check for
well-formed ELF files). Also included are numerous helper libraries
which implement DWARF, ELF, and machine-specific ELF handling.
Authors:
--------
Jeff Johnson
Jakub Jelinek
Ulrich Drepper
%package -n libebl1
Summary: A collection of utilities and DSOs to handle compiled objects
Group: Development/Tools/Other
License: GPL v2 or later
%description -n libebl1
Elfutils is a collection of utilities, including ld (a linker), nm (for
listing symbols from object files), size (for listing the section sizes
of an object or archive file), strip (for discarding symbols), readline
(the see the raw ELF file structures), and elflint (to check for
well-formed ELF files). Also included are numerous helper libraries
which implement DWARF, ELF, and machine-specific ELF handling.
Authors:
--------
Jeff Johnson
Jakub Jelinek
Ulrich Drepper
%package -n libebl-devel
Summary: Include Files and Libraries mandatory for Development
Group: Development/Libraries/C and C++
License: GPL v2 or later
Requires: glibc-devel, libebl1 = %{version}, libdw-devel = %{version}
%description -n libebl-devel
This package contains all necessary include files and libraries needed
to develop applications that require these.
Authors:
--------
Ulrich Drepper
%package -n libelf1
Summary: Library to read and write ELF files
Group: System/Libraries
License: GPL v2 or later
%description -n libelf1
This package provide a high-level library to read and write ELF files.
This is a part of elfutils package.
Authors:
--------
Ulrich Drepper
%package -n libelf-devel
Summary: Include Files and Libraries mandatory for Development
Group: Development/Libraries/C and C++
License: GPL v2 or later
Requires: glibc-devel, libelf1 = %{version}
Conflicts: libelf0-devel
%description -n libelf-devel
This package contains all necessary include files and libraries needed
to develop applications that require these.
%package -n libdw1
Summary: Library to access DWARF debugging information
Group: System/Libraries
License: GPL v2 or later
%description -n libdw1
This package provide a high-level library to access the DWARF debugging
information. This is a part of elfutils package.
Authors:
--------
Ulrich Drepper
%package -n libdw-devel
Summary: Include Files and Libraries mandatory for Development.
Group: Development/Libraries/C and C++
License: GPL v2 or later
Requires: glibc-devel, libdw1 = %{version}, libelf-devel = %{version}
%description -n libdw-devel
This package contains all necessary include files and libraries needed
to develop applications that require these.
Authors:
--------
Ulrich Drepper
%prep
%setup -q -n elfutils-%{version}
%patch -p1
%patch1 -p1
%patch3
%patch7
%patch8 -p1
%patch9 -p1
#%patch10 -p1
%patch11 -p1
%build
autoreconf -fi
%configure --program-prefix=eu-
make
%install
make DESTDIR=$RPM_BUILD_ROOT install
# remove unneeded files
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
%post -n libebl1 -p /sbin/ldconfig
%post -n libelf1 -p /sbin/ldconfig
%post -n libdw1 -p /sbin/ldconfig
%postun -n libebl1 -p /sbin/ldconfig
%postun -n libelf1 -p /sbin/ldconfig
%postun -n libdw1 -p /sbin/ldconfig
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc AUTHORS ChangeLog COPYING EXCEPTION NEWS NOTES README THANKS TODO
%{_bindir}/*
%files -n libasm1
%defattr(-,root,root)
%{_libdir}/libasm.so.*
%{_libdir}/libasm-%{version}.so
%files -n libasm-devel
%defattr(-,root,root)
%{_libdir}/libasm.so
%{_libdir}/libasm.a
%dir %{_includedir}/elfutils
%{_includedir}/elfutils/libasm.h
%files -n libebl1
%defattr(-,root,root)
%{_libdir}/elfutils
%files -n libebl-devel
%defattr(-,root,root)
%{_libdir}/libebl.a
%dir %{_includedir}/elfutils
%{_includedir}/elfutils/libebl.h
%files -n libelf1
%defattr(-,root,root)
%{_libdir}/libelf.so.*
%{_libdir}/libelf-%{version}.so
%files -n libelf-devel
%defattr(-,root,root)
%{_libdir}/libelf.so
%{_libdir}/libelf.a
%{_libdir}/libelf_pic.a
%{_includedir}/libelf.h
%{_includedir}/gelf.h
%{_includedir}/nlist.h
%dir %{_includedir}/elfutils
%{_includedir}/elfutils/elf-knowledge.h
%files -n libdw1
%defattr(-,root,root)
%{_libdir}/libdw.so.*
%{_libdir}/libdw-%{version}.so
%files -n libdw-devel
%defattr(-,root,root)
%{_libdir}/libdw.a
%{_libdir}/libdw.so
%{_includedir}/dwarf.h
%dir %{_includedir}/elfutils
%{_includedir}/elfutils/libdw.h
%{_includedir}/elfutils/libdwfl.h
%changelog
* Tue Aug 26 2008 tiwai@suse.de
- updated to version 0.135:
* libdwfl: bug fixes
- updated to version 0.134:
* libdwfl, libelf: bug fixes
- updated to version 0.133:
* readelf, elflint, libebl: SHT_GNU_ATTRIBUTE section handling
(readelf -A)
* libdwfl: bug fixes and optimization in relocation handling
- updated to version 0.132:
* libcpu: Implement x86 and x86-64 disassembler.
* libasm: Add interface for disassembler.
- fixed post scripts
* Fri Feb 29 2008 dmueller@suse.de
- fix build for older distributions
* Mon Jan 28 2008 tiwai@suse.de
- fix compile errors regarding missing prototypes.
* Tue Nov 20 2007 tiwai@suse.de
- fix off64_t in libelf.h again...
* Tue Nov 20 2007 tiwai@suse.de
- updated to version 0.131
* libdw: DW_FORM_ref_addr support
dwarf_formref entry point now deprecated
bug fixes for oddly-formatted DWARF
* libdwfl: bug fixes in offline archive support
apply partial relocations for dwfl_module_address_section
on ET_REL
* libebl: powerpc backend support for Altivec registers
* Mon Oct 22 2007 tiwai@suse.de
- fix comiple errors regarding missing off64_t definitions
in libelf.h
* Mon Oct 22 2007 tiwai@suse.de
- updated to version 0.129:
readelf: new options --hex-dump (or -x), --strings (or -p)
- updated to version 0.130
* readelf: -p option can take an argument like -x for one
section
* libelf: new function elf_getdata_rawchunk, replaces
gelf_rawchunk;
new functions gelf_getnote, gelf_getauxv, gelf_update_auxv
* libdwfl: new functions dwfl_build_id_find_elf,
dwfl_build_id_find_debuginfo, dwfl_module_build_id,
dwfl_module_report_build_id;
support dynamic symbol tables found via phdrs;
dwfl_standard_find_debuginfo now uses build IDs when available
* libebl: backend improvements for sparc, alpha, powerpc
* Thu Oct 04 2007 rguenther@suse.de
- fix build with gcc-4.3, same patch as for the copy in rpm
* Wed Jul 04 2007 tiwai@suse.de
- updated to version 0.128
* auto-tool fixes
* Mon Jun 11 2007 ro@suse.de
- use __attribute__ ((gnu_inline)) to fix build with gcc-4.2
* Mon May 21 2007 tiwai@suse.de
- initial packages, built from elfutils-0.127.
A problematic file regarding the license is removed from the
tarball.
++++++ build.diff ++++++
---
libelf/Makefile.am | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Index: b/libelf/Makefile.am
===================================================================
--- a/libelf/Makefile.am
+++ b/libelf/Makefile.am
@@ -125,11 +125,12 @@ libelf.so: libelf_pic.a libelf.map
else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
fi
-install: install-am libelf.so
+install: install-am libelf.so libelf_pic.a
$(mkinstalldirs) $(DESTDIR)$(libdir)
- $(INSTALL_PROGRAM) libelf.so $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so
+ $(INSTALL) -m644 libelf.so $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so
ln -fs libelf-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libelf.so.$(VERSION)
ln -fs libelf.so.$(VERSION) $(DESTDIR)$(libdir)/libelf.so
+ $(INSTALL) -m644 libelf_pic.a $(DESTDIR)$(libdir)/libelf_pic.a
uninstall: uninstall-am
rm -f $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so
++++++ elfutils-0.137-fixes.patch ++++++
---
libdwfl/linux-proc-maps.c | 3 +++
libelf/elf_begin.c | 22 +++++++++++++++++-----
libelf/libelfP.h | 2 +-
3 files changed, 21 insertions(+), 6 deletions(-)
Index: b/libdwfl/linux-proc-maps.c
===================================================================
--- a/libdwfl/linux-proc-maps.c
+++ b/libdwfl/linux-proc-maps.c
@@ -267,6 +267,9 @@ read_proc_memory (void *arg, void *data,
{
const int fd = *(const int *) arg;
ssize_t nread = pread64 (fd, data, maxread, (off64_t) address);
+ /* Some kernels don't actually let us do this read, ignore those errors. */
+ if (nread < 0 && (errno == EINVAL || errno == EPERM))
+ return 0;
if (nread > 0 && (size_t) nread < minread)
nread = 0;
return nread;
Index: b/libelf/elf_begin.c
===================================================================
--- a/libelf/elf_begin.c
+++ b/libelf/elf_begin.c
@@ -110,8 +110,14 @@ get_shnum (void *map_address, unsigned c
} ehdr_mem;
bool is32 = e_ident[EI_CLASS] == ELFCLASS32;
+ // e_shnum shoff
+
/* Make the ELF header available. */
- if (e_ident[EI_DATA] == MY_ELFDATA)
+ if (e_ident[EI_DATA] == MY_ELFDATA
+ && (ALLOW_UNALIGNED
+ || (((size_t) e_ident
+ & ((is32 ? __alignof__ (Elf32_Ehdr) : __alignof__ (Elf64_Ehdr))
+ - 1)) == 0)))
ehdr.p = e_ident;
else
{
@@ -130,8 +136,11 @@ get_shnum (void *map_address, unsigned c
else
memcpy (&ehdr_mem, e_ident, sizeof (Elf32_Ehdr));
- CONVERT (ehdr_mem.e32.e_shnum);
- CONVERT (ehdr_mem.e32.e_shoff);
+ if (e_ident[EI_DATA] != MY_ELFDATA)
+ {
+ CONVERT (ehdr_mem.e32.e_shnum);
+ CONVERT (ehdr_mem.e32.e_shoff);
+ }
}
else
{
@@ -143,8 +152,11 @@ get_shnum (void *map_address, unsigned c
else
memcpy (&ehdr_mem, e_ident, sizeof (Elf64_Ehdr));
- CONVERT (ehdr_mem.e64.e_shnum);
- CONVERT (ehdr_mem.e64.e_shoff);
+ if (e_ident[EI_DATA] != MY_ELFDATA)
+ {
+ CONVERT (ehdr_mem.e64.e_shnum);
+ CONVERT (ehdr_mem.e64.e_shoff);
+ }
}
}
Index: b/libelf/libelfP.h
===================================================================
--- a/libelf/libelfP.h
+++ b/libelf/libelfP.h
@@ -453,7 +453,7 @@ extern int __libelf_version_initialized
version, binary class, and type. */
extern const uint_fast8_t __libelf_type_aligns[EV_NUM - 1][ELFCLASSNUM - 1][ELF_T_NUM] attribute_hidden;
# define __libelf_type_align(class, type) \
- (__libelf_type_aligns[LIBELF_EV_IDX][class][type] ?: 1)
+ (__libelf_type_aligns[LIBELF_EV_IDX][class - 1][type] ?: 1)
#else
# define __libelf_type_align(class, type) 1
#endif
++++++ elfutils-0.97-ftruncate-mmap-fix.diff ++++++
---
libelf/elf_update.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
Index: b/libelf/elf_update.c
===================================================================
--- a/libelf/elf_update.c
+++ b/libelf/elf_update.c
@@ -53,6 +53,7 @@
#endif
#include
+#include
#include
#include
#include
@@ -100,6 +101,33 @@ write_file (Elf *elf, off_t size, int ch
#endif
}
+ /*
+ * We may have truncated the file so lets update the mapping before
+ * actually writing to the file.
+ */
+ /*
+ else if (elf->map_address != NULL && elf->parent == NULL
+ && (elf->maximum_size != ~((size_t) 0)
+ && size != elf->maximum_size))
+ {
+ void *new_address;
+ int ret;
+ fprintf(stderr, "sync old: %p\n", elf->map_address);
+ ret = msync(elf->map_address, elf->maximum_size, MS_SYNC);
+ if (ret)
+ perror("msync failed");
+ new_address = mremap (elf->map_address, elf->maximum_size,
+ size, MREMAP_MAYMOVE);
+ if (unlikely (new_address == MAP_FAILED)) {
+ __libelf_seterrno (ELF_E_WRITE_ERROR);
+ return -1;
+ }
+
+ fprintf(stderr, "old: %p, new: %p\n", elf->map_address, new_address);
+ elf->map_address = new_address;
+ }
+ */
+
if (elf->map_address != NULL)
{
/* The file is mmaped. */
@@ -141,6 +169,32 @@ write_file (Elf *elf, off_t size, int ch
size = -1;
}
+ if (elf->map_address != NULL && elf->parent == NULL
+ && (elf->maximum_size != ~((size_t) 0)
+ && (size > 0 && (size_t)size != elf->maximum_size)))
+ {
+ /*
+ * We may have truncated the file so lets update the mapping before
+ * actually writing to the file.
+ */
+ void *new_address;
+ int ret;
+
+ fprintf(stderr, "sync old: %p\n", elf->map_address);
+ ret = msync(elf->map_address, elf->maximum_size, MS_SYNC);
+ if (ret)
+ perror("msync failed");
+ new_address = mremap (elf->map_address, elf->maximum_size,
+ size, MREMAP_MAYMOVE);
+ if (unlikely (new_address == MAP_FAILED)) {
+ __libelf_seterrno (ELF_E_WRITE_ERROR);
+ return -1;
+ }
+
+ fprintf(stderr, "old: %p, new: %p\n", elf->map_address, new_address);
+ elf->map_address = new_address;
+ }
+
if (size != -1 && elf->parent == NULL)
elf->maximum_size = size;
++++++ elfutils-no-po-test-build.diff ++++++
--- Makefile.am-dist 2007-07-04 12:05:20.000000000 +0200
+++ Makefile.am 2007-07-04 12:05:25.000000000 +0200
@@ -29,7 +29,7 @@
# Add doc back when we have some real content.
SUBDIRS = config m4 lib libelf libebl libdwfl libdw libcpu libasm backends \
- src po tests
+ src
EXTRA_DIST = elfutils.spec GPG-KEY NOTES EXCEPTION
++++++ elfutils-portability.patch ++++++
++++ 1113 lines (skipped)
++++++ elfutils-robustify.patch ++++++
++++ 1566 lines (skipped)
++++++ libebl-prototype-fix.diff ++++++
--- libebl/eblopenbackend.c-dist 2008-01-28 14:21:23.000000000 +0100
+++ libebl/eblopenbackend.c 2008-01-28 14:21:39.000000000 +0100
@@ -253,10 +253,7 @@ fill_defaults (Ebl *result)
/* Find an appropriate backend for the file associated with ELF. */
static Ebl *
-openbackend (elf, emulation, machine)
- Elf *elf;
- const char *emulation;
- GElf_Half machine;
+openbackend (Elf *elf, const char *emulation, GElf_Half machine)
{
Ebl *result;
size_t cnt;
--- lib/dynamicsizehash.c-dist 2008-01-28 14:25:32.000000000 +0100
+++ lib/dynamicsizehash.c 2008-01-28 14:25:52.000000000 +0100
@@ -65,10 +65,7 @@
static size_t
-lookup (htab, hval, val)
- NAME *htab;
- unsigned long int hval;
- TYPE val __attribute__ ((unused));
+lookup (NAME *htab, unsigned long int hval, TYPE val __attribute__((unused)))
{
/* First hash function: simply take the modul but prevent zero. */
size_t idx = 1 + hval % htab->size;
++++++ libelf-ignore-NOBITS-sh_offset.patch ++++++
---
libelf/elf32_updatenull.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
Index: b/libelf/elf32_updatenull.c
===================================================================
--- a/libelf/elf32_updatenull.c
+++ b/libelf/elf32_updatenull.c
@@ -331,10 +331,11 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf
if (elf->flags & ELF_F_LAYOUT)
{
- size = MAX ((GElf_Word) size,
- shdr->sh_offset
- + (shdr->sh_type != SHT_NOBITS
- ? shdr->sh_size : 0));
+ /* Even the sh_offset is only the "conceptual" possition
+ in the file. So completely ignore NOBITS sections. */
+ if (shdr->sh_type != SHT_NOBITS)
+ size = MAX ((GElf_Word) size,
+ shdr->sh_offset + shdr->sh_size);
/* The alignment must be a power of two. This is a
requirement from the ELF specification. Additionally
++++++ test.diff ++++++
---
libelf/elf32_updatenull.c | 35 +++++++++++++++++++++++++++++++----
1 file changed, 31 insertions(+), 4 deletions(-)
Index: b/libelf/elf32_updatenull.c
===================================================================
--- a/libelf/elf32_updatenull.c
+++ b/libelf/elf32_updatenull.c
@@ -55,6 +55,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -144,7 +145,7 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf
return -1;
/* At least the ELF header is there. */
- off_t size = elf_typesize (LIBELFBITS, ELF_T_EHDR, 1);
+ off_t size = elf_typesize (LIBELFBITS, ELF_T_EHDR, 1), old_size;
/* Set the program header position. */
if (elf->state.ELFW(elf,LIBELFBITS).phdr == NULL
@@ -166,9 +167,12 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf
{
/* The user is supposed to fill out e_phoff. Use it and
e_phnum to determine the maximum extend. */
+ old_size = size;
size = MAX ((size_t) size,
ehdr->e_phoff
+ elf_typesize (LIBELFBITS, ELF_T_PHDR, ehdr->e_phnum));
+ fprintf(stderr, "e_phoff: old=%ld, new=%ld\n", (long) old_size,
+ (long) size);
}
else
{
@@ -176,8 +180,11 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf
elf_typesize (LIBELFBITS, ELF_T_EHDR, 1),
ehdr_flags);
+ old_size = size;
/* We need no alignment here. */
size += elf_typesize (LIBELFBITS, ELF_T_PHDR, ehdr->e_phnum);
+ fprintf(stderr, "e_phnum: old=%ld, new=%ld\n", (long) old_size,
+ (long) size);
}
}
@@ -334,9 +341,13 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf
/* Even the sh_offset is only the "conceptual" possition
in the file. So completely ignore NOBITS sections. */
if (shdr->sh_type != SHT_NOBITS)
- size = MAX ((GElf_Word) size,
- shdr->sh_offset + shdr->sh_size);
-
+ {
+ old_size = size;
+ size = MAX ((GElf_Word) size,
+ shdr->sh_offset + shdr->sh_size);
+ fprintf(stderr, "sh_offset: old=%ld, new=%ld\n",
+ (long) old_size, (long) size);
+ }
/* The alignment must be a power of two. This is a
requirement from the ELF specification. Additionally
we test for the alignment of the section being large
@@ -355,7 +366,11 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf
update_if_changed (shdr->sh_addralign, sh_align,
scn->shdr_flags);
+ old_size = size;
size = (size + sh_align - 1) & ~(sh_align - 1);
+ fprintf(stderr, "sh_align: old=%ld, new=%ld\n",
+ (long) old_size, (long) size);
+
int offset_changed = 0;
update_if_changed (shdr->sh_offset, (GElf_Word) size,
offset_changed);
@@ -373,8 +388,11 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf
update_if_changed (shdr->sh_size, (GElf_Word) offset,
changed);
+ old_size = size;
if (shdr->sh_type != SHT_NOBITS)
size += offset;
+ fprintf(stderr, "sh_size: old=%ld, new=%ld\n",
+ (long) old_size, (long) size);
scn->flags |= changed;
}
@@ -401,9 +419,12 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf
{
/* The user is supposed to fill out e_phoff. Use it and
e_phnum to determine the maximum extend. */
+ old_size = size;
size = MAX ((GElf_Word) size,
(ehdr->e_shoff
+ (elf_typesize (LIBELFBITS, ELF_T_SHDR, shnum))));
+ fprintf(stderr, "e_shoff: old=%ld, new=%ld\n", (long) old_size,
+ (long) size);
}
else
{
@@ -413,7 +434,10 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf
want to be surprised by architectures with less strict
alignment rules. */
#define SHDR_ALIGN sizeof (ElfW2(LIBELFBITS,Off))
+ old_size = size;
size = (size + SHDR_ALIGN - 1) & ~(SHDR_ALIGN - 1);
+ fprintf(stderr, "e_shoff(align): old=%ld, new=%ld\n",
+ (long) old_size, (long) size);
update_if_changed (ehdr->e_shoff, (GElf_Word) size, elf->flags);
update_if_changed (ehdr->e_shentsize,
@@ -421,7 +445,10 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf
ehdr_flags);
/* Account for the section header size. */
+ old_size = size;
size += elf_typesize (LIBELFBITS, ELF_T_SHDR, shnum);
+ fprintf(stderr, "shnum: old=%ld, new=%ld\n", (long) old_size,
+ (long) size);
}
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org