SHA256
1
0
forked from pool/elfutils

Accepting request 40226 from Base:System

checked in (request 40226)

OBS-URL: https://build.opensuse.org/request/show/40226
OBS-URL: https://build.opensuse.org/package/show/Base:System/elfutils?expand=0&rev=12
This commit is contained in:
OBS User autobuild 2010-05-25 08:29:39 +00:00 committed by Git OBS Bridge
parent 175fa1556a
commit 272768a3c4
15 changed files with 1331 additions and 1156 deletions

23
build.diff Normal file
View File

@ -0,0 +1,23 @@
---
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

View File

@ -1,16 +1,4 @@
From: Takashi Iwai <tiwai@novell.com>
Subject: Fix for kernel debuginfo files
References: https://bugzilla.novell.com/show_bug.cgi?id=468247, comments 17-20
References: https://bugzilla.novell.com/show_bug.cgi?id=433182
Above BZ originally occured with Systemtap testsuite (stmt_rel.exp).
# stap -e 'probe kernel.statement("bio_put@fs/bio.c:*") {}'
semantic error: libdw failure (dwarf_getsrcfiles): invalid DWARF
...
---
libdw/dwarf_getsrclines.c | 2 ++
1 file changed, 2 insertions(+)

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:114accfbfb80a136b076554c586d75a153e54e187f81715740b0d8570b0fb74d
size 1512351

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c3dbcc2ac3d12a00f1d8fee4fa3fa8b61dfa7491d9e790e4b6a2af542d739848
size 1777826

View File

@ -0,0 +1,83 @@
---
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 <libelf.h>
+#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/stat.h>
@@ -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;

View File

@ -1,9 +1,5 @@
From: unknown
Upstream: no
Subject: do not build po and tests components
--- elfutils/Makefile.am-dist 2007-07-04 12:05:20.000000000 +0200
+++ elfutils/Makefile.am 2007-07-04 12:05:25.000000000 +0200
--- 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.

View File

@ -0,0 +1,27 @@
Index: src/addr2line.c
===================================================================
--- src/addr2line.c.orig 2009-04-21 16:50:01.000000000 +0200
+++ src/addr2line.c 2009-08-20 13:11:58.000000000 +0200
@@ -446,11 +446,11 @@ handle_address (const char *string, Dwfl
{
bool parsed = false;
int n;
- char *name = NULL;
- if (sscanf (string, "(%m[^)])%" PRIiMAX "%n", &name, &addr, &n) == 2
+ char name[4096]; /* FIXME */
+ if (sscanf (string, "(%[^)])%" PRIiMAX "%n", name, &addr, &n) == 2
&& string[n] == '\0')
parsed = adjust_to_section (name, &addr, dwfl);
- else if (sscanf (string, "%m[^-+]%" PRIiMAX "%n", &name, &addr, &n) == 2
+ else if (sscanf (string, "%[^-+]%" PRIiMAX "%n", &name, &addr, &n) == 2
&& string[n] == '\0')
{
/* It was symbol+offset. */
@@ -471,7 +471,6 @@ handle_address (const char *string, Dwfl
}
}
- free (name);
if (!parsed)
return 1;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,154 @@
--- libdwfl/Makefile.am-dist 2009-02-19 15:35:22.000000000 +0100
+++ libdwfl/Makefile.am 2009-02-19 15:36:58.000000000 +0100
@@ -33,7 +33,8 @@
else
AM_CFLAGS =
endif
-AM_CFLAGS += -Wall -Werror -Wshadow -Wunused -Wformat=2 $(WEXTRA) -std=gnu99
+AM_CFLAGS += -Wall -Wshadow -Wunused -Wformat=2 $(WEXTRA) -std=gnu99
+AM_CFLAGS += -fgnu89-inline
INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl \
-I$(srcdir)/../libdw -I.. -I$(srcdir)/../lib
VERSION = 1
--- libdwfl/link_map.c-dist 2009-02-15 23:39:44.000000000 +0100
+++ libdwfl/link_map.c 2009-02-19 15:36:58.000000000 +0100
@@ -75,10 +75,10 @@
/* Examine an auxv data block and determine its format.
Return true iff we figured it out. */
static bool
-auxv_format_probe (const void *auxv, size_t size,
+auxv_format_probe (void *auxv, size_t size,
uint_fast8_t *elfclass, uint_fast8_t *elfdata)
{
- const union
+ union
{
char buf[size];
Elf32_auxv_t a32[size / sizeof (Elf32_auxv_t)];
@@ -301,7 +301,7 @@ report_r_debug (uint_fast8_t elfclass, u
return true;
}
- const union
+ union
{
Elf32_Addr a32[n];
Elf64_Addr a64[n];
@@ -568,7 +568,7 @@ consider_executable (Dwfl_Module *mod, G
d_val_vaddr, buffer_available,
memory_callback_arg))
{
- const union
+ union
{
Elf32_Addr a32;
Elf64_Addr a64;
@@ -626,10 +626,11 @@ find_executable (Dwfl *dwfl, GElf_Addr a
int
-dwfl_link_map_report (Dwfl *dwfl, const void *auxv, size_t auxv_size,
+dwfl_link_map_report (Dwfl *dwfl, const void *_auxv, size_t auxv_size,
Dwfl_Memory_Callback *memory_callback,
void *memory_callback_arg)
{
+ void *auxv = (void *)_auxv;
GElf_Addr r_debug_vaddr = 0;
uint_fast8_t elfclass = ELFCLASSNONE;
@@ -644,7 +645,7 @@ dwfl_link_map_report (Dwfl *dwfl, const
#define AUXV_SCAN(NN, BL) do \
{ \
- const Elf##NN##_auxv_t *av = auxv; \
+ Elf##NN##_auxv_t *av = auxv; \
for (size_t i = 0; i < auxv_size / sizeof av[0]; ++i) \
{ \
Elf##NN##_Addr val = BL##NN (av[i].a_un.a_val); \
@@ -718,7 +719,7 @@ dwfl_link_map_report (Dwfl *dwfl, const
(&out, &in, elfdata) != NULL))
{
/* We are looking for PT_DYNAMIC. */
- const union
+ union
{
Elf32_Phdr p32[phnum];
Elf64_Phdr p64[phnum];
@@ -806,7 +807,7 @@ dwfl_link_map_report (Dwfl *dwfl, const
(&out, &in, elfdata) != NULL))
{
/* We are looking for PT_DYNAMIC. */
- const union
+ union
{
Elf32_Dyn d32[dyn_filesz / sizeof (Elf32_Dyn)];
Elf64_Dyn d64[dyn_filesz / sizeof (Elf64_Dyn)];
--- libdw/Makefile.am-dist 2009-02-19 15:35:22.000000000 +0100
+++ libdw/Makefile.am 2009-02-19 15:36:58.000000000 +0100
@@ -35,6 +35,7 @@
AM_CFLAGS += -fpic
endif
AM_CFLAGS += -Wall -Werror -Wshadow -Wunused -Wformat=2 $(WEXTRA) -std=gnu99
+AM_CFLAGS += -fgnu89-inline
INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I.. -I$(srcdir)/../lib
VERSION = 1
--- libdw/libdw.h-dist 2008-12-10 23:21:29.000000000 +0100
+++ libdw/libdw.h 2009-02-19 15:36:58.000000000 +0100
@@ -67,7 +67,7 @@
#ifdef __GNUC_STDC_INLINE__
# define __libdw_extern_inline extern __inline __attribute__ ((__gnu_inline__))
#else
-# define __libdw_extern_inline extern __inline
+# define __libdw_extern_inline extern __inline __attribute__ ((gnu_inline))
#endif
--- src/Makefile.am-dist 2009-02-19 15:35:22.000000000 +0100
+++ src/Makefile.am 2009-02-19 15:37:25.000000000 +0100
@@ -37,6 +37,8 @@
$(if $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) \
$(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $(CFLAGS_$(*F))
+AM_CFLAGS += -fgnu89-inline
+
INCLUDES = -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl \
-I$(srcdir)/../libdw -I$(srcdir)/../libdwfl \
-I$(srcdir)/../libasm -I$(srcdir)/../lib -I..
--- src/ldgeneric.c-dist 2008-12-10 23:21:30.000000000 +0100
+++ src/ldgeneric.c 2009-02-19 15:36:58.000000000 +0100
@@ -63,6 +63,14 @@ struct unw_eh_frame_hdr
};
#define EH_FRAME_HDR_VERSION 1
+static inline int popcount(unsigned int val)
+{
+ int count = 0;
+ for (; val; val >>= 1)
+ if (val & 1)
+ count++;
+ return count;
+}
/* Prototypes for local functions. */
static const char **ld_generic_lib_extensions (struct ld_state *)
@@ -5830,7 +5838,7 @@ cannot create dynamic symbol table for o
/* We need one more array which contains the hash codes of the
symbol names. */
- hashcodes = (Elf32_Word *) xcalloc (__builtin_popcount ((int) ld_state.hash_style)
+ hashcodes = (Elf32_Word *) xcalloc (popcount ((int) ld_state.hash_style)
* nsym_dyn_allocated,
sizeof (Elf32_Word));
gnuhashcodes = hashcodes;
--- backends/ia64_retval.c-dist 2008-12-10 23:21:28.000000000 +0100
+++ backends/ia64_retval.c 2009-02-19 15:36:58.000000000 +0100
@@ -96,7 +96,7 @@ hfa_type (Dwarf_Die *typedie, const Dwar
If we find a datum that's not the same FP type as the first datum, punt.
If we count more than eight total homogeneous FP data, punt. */
- inline int hfa (const Dwarf_Op *loc, int nregs)
+ inline __attribute__((gnu_inline)) int hfa (const Dwarf_Op *loc, int nregs)
{
if (fpregs_used == 0)
*locp = loc;

View File

@ -1,50 +1,3 @@
-------------------------------------------------------------------
Tue May 11 20:01:23 UTC 2010 - tonyj@novell.com
- update to version 0.147 (fix bnc#588293)
- dropped patches for 10.3 and older
- dropped elfutils-0.97-ftruncate-mmap-fix, libelf-ignore-NOBITS, test and
build patches. According to jbl these were mistakenly checked in from
home:janblunck:debuginfo:libs/elfutils and the purpose of this project is
no longer known. Absense of any patch header makes confirmation difficult.
- Upstream changelog:
0.147
- libdw: Fixes in CFI handling, best possible handling of bogus CFA
ops.
- libdwfl: Ignore R_*_NONE relocs, works around old (binutils) ld -r
bugs.
0.146
- libdwfl: New function dwfl_core_file_report.
0.145
- Fix build with --disable-dependency-tracking.
- Fix build with most recent glibc headers.
- libelf: More robust to bogus section headers.
- libdw: Fix CFI decoding.
- libdwfl: Fix address bias returned by CFI accessors. Fix core
file module layout identification.
- readelf: Fix CFI decoding.
0.144
- libelf: New function elf_getphdrnum. Now support using more than
65536 program headers in a file.
- libdw: New function dwarf_aggregate_size for computing (constant)
type sizes, including array_type cases with nontrivial
calculation.
- readelf: Don't give errors for missing info under -a.
Handle Linux "VMCOREINFO" notes under -n.
0.143
- libdw: Various convenience functions for individual attributes now
use dwarf_attr_integrate to look up indirect inherited
attributes. Location expression handling now supports
DW_OP_implicit_value.
- libdwfl: Support automatic decompression of files in XZ format,
and of Linux kernel images made with bzip2 or LZMA (as well
as gzip).
-------------------------------------------------------------------
Wed Feb 10 12:21:51 CET 2010 - rguenther@suse.de

View File

@ -1,5 +1,5 @@
#
# spec file for package elfutils (Version 0.147)
# spec file for package elfutils (Version 0.142)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@ -20,21 +20,26 @@
Name: elfutils
License: GPLv2+
Version: 0.147
Release: 0
Version: 0.142
Release: 4
Summary: Higher-level library to access ELF
Group: System/Libraries
Url: http://elfutils.fedorahosted.org
Source: elfutils-%{version}.tar.bz2
Source: elfutils-%{version}-no-osl.tar.bz2
Source2: baselibs.conf
Patch1: elfutils-portability.patch
Patch2: elfutils-robustify.patch
Patch: elfutils-portability.patch
Patch1: elfutils-robustify.patch
Patch3: elfutils-no-po-test-build.diff
Patch4: libebl-prototype-fix.diff
Patch5: elfutils-uninitialized.diff
Patch6: elfutils-0.137-dwarf-header-check-fix.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
Patch12: elfutils-old-scanf-fix.diff
Patch13: elfutils-suse-10.3-fixes.diff
Patch20: elfutils-0.137-dwarf-header-check-fix.diff
Patch21: elfutils-uninitialized.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: bison flex
%description
This package provides a higher-level library to access ELF files. This
@ -190,12 +195,23 @@ Authors:
%prep
%setup -q -n elfutils-%{version}
%patch -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch3
%patch7
%patch8 -p1
%patch9 -p1
#%patch10 -p1
%patch11 -p1
%if %suse_version < 1100
%patch12
%endif
%if %suse_version == 1030
# only 10.3 gcc has a problem
%patch13
%endif
%patch20 -p1
%patch21
%build
autoreconf -fi
@ -206,7 +222,6 @@ make %{?jobs:-j%jobs};
make DESTDIR=$RPM_BUILD_ROOT install
# remove unneeded files
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
ls -lR $RPM_BUILD_ROOT%{_libdir}/libelf*
%post -n libebl1 -p /sbin/ldconfig
@ -259,7 +274,7 @@ rm -rf $RPM_BUILD_ROOT
%defattr(-,root,root)
%{_libdir}/libelf.so
%{_libdir}/libelf.a
#%{_libdir}/libelf_pic.a
%{_libdir}/libelf_pic.a
%{_includedir}/libelf.h
%{_includedir}/gelf.h
%{_includedir}/nlist.h

View File

@ -1,11 +1,5 @@
From: unknown
Upstream: no
References: none
Update from K&R to ANSI prototype. This fix should go upstream.
--- elfutils/libebl/eblopenbackend.c-dist 2008-01-28 14:21:23.000000000 +0100
+++ elfutils/libebl/eblopenbackend.c 2008-01-28 14:21:39.000000000 +0100
--- 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. */
@ -18,8 +12,8 @@ Update from K&R to ANSI prototype. This fix should go upstream.
{
Ebl *result;
size_t cnt;
--- elfutils/lib/dynamicsizehash.c-dist 2008-01-28 14:25:32.000000000 +0100
+++ elfutils/lib/dynamicsizehash.c 2008-01-28 14:25:52.000000000 +0100
--- 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 @@

View File

@ -0,0 +1,24 @@
---
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

126
test.diff Normal file
View File

@ -0,0 +1,126 @@
---
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 <assert.h>
#include <endian.h>
#include <libelf.h>
+#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <sys/param.h>
@@ -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);
}
}