update to 0.158 [release 0.158-1mamba;Sat Feb 22 2014]

This commit is contained in:
Silvan Calarco 2024-01-05 22:04:00 +01:00
parent 6984d69045
commit de90cc3242
7 changed files with 4108 additions and 0 deletions

View File

@ -1,2 +1,10 @@
# elfutils
Elfutils is a collection of utilities, including:
* nm (for listing symbols from object files)
* size (for listing the section sizes of an object or archive file)
* strip (for discarding symbols)
* readelf (to see the raw ELF file structures)
* elflint (to check for well-formed ELF files)
Also included are numerous helper libraries which implement DWARF, ELF, and machine-specific ELF handling.

View File

@ -0,0 +1,53 @@
diff -up elfutils-0.131/libelf/Makefile.am.gcc43~ elfutils-0.131/libelf/Makefile.am
--- elfutils-0.131/libelf/Makefile.am.gcc43~ 2007-10-04 17:10:42.000000000 +0000
+++ elfutils-0.131/libelf/Makefile.am 2007-11-24 14:05:43.000000000 +0000
@@ -33,7 +33,7 @@ endif
if BUILD_STATIC
AM_CFLAGS += -fpic
endif
-AM_CFLAGS += -Wall -Wshadow -Werror -Wunused -Wextra -Wformat=2 -std=gnu99 \
+AM_CFLAGS += -Wall -Wshadow -Werror -Wno-unused -Wextra -Wformat=2 -std=gnu99 \
$($(*F)_CFLAGS)
INCLUDES = -I$(srcdir) -I$(top_srcdir)/lib -I..
GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include)
diff -up elfutils-0.131/libelf/Makefile.in.gcc43~ elfutils-0.131/libelf/Makefile.in
--- elfutils-0.131/libelf/Makefile.in.gcc43~ 2007-11-24 14:06:15.000000000 +0000
+++ elfutils-0.131/libelf/Makefile.in 2007-11-24 14:06:27.000000000 +0000
@@ -252,11 +251,11 @@ target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
@MUDFLAP_FALSE@AM_CFLAGS = $(am__append_1) -Wall -Wshadow -Werror \
-@MUDFLAP_FALSE@ -Wunused -Wextra -Wformat=2 -std=gnu99 \
+@MUDFLAP_FALSE@ -Wno-unused -Wextra -Wformat=2 -std=gnu99 \
@MUDFLAP_FALSE@ $($(*F)_CFLAGS)
@MUDFLAP_TRUE@AM_CFLAGS = -fmudflap $(am__append_1) -Wall -Wshadow \
-@MUDFLAP_TRUE@ -Werror -Wunused -Wextra -Wformat=2 -std=gnu99 \
-@MUDFLAP_TRUE@ $($(*F)_CFLAGS)
+@MUDFLAP_TRUE@ -Werror -Wno-unused -Wextra -Wformat=2 \
+@MUDFLAP_TRUE@ -std=gnu99 $($(*F)_CFLAGS)
INCLUDES = -I$(srcdir) -I$(top_srcdir)/lib -I..
GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include)
COMPILE.os = $(filter-out -fprofile-arcs, $(filter-out -ftest-coverage, \
diff -up elfutils-0.131/src/ld.h.gcc43~ elfutils-0.131/src/ld.h
--- elfutils-0.131/src/ld.h.gcc43~ 2007-06-05 23:23:47.000000000 +0000
+++ elfutils-0.131/src/ld.h 2007-11-24 14:05:43.000000000 +0000
@@ -1087,19 +1087,5 @@ extern bool dynamically_linked_p (void);
/* Checked whether the symbol is undefined and referenced from a DSO. */
extern bool linked_from_dso_p (struct scninfo *scninfo, size_t symidx);
-extern inline bool
-linked_from_dso_p (struct scninfo *scninfo, size_t symidx)
-{
- struct usedfiles *file = scninfo->fileinfo;
-
- /* If this symbol is not undefined in this file it cannot come from
- a DSO. */
- if (symidx < file->nlocalsymbols)
- return false;
-
- struct symbol *sym = file->symref[symidx];
-
- return sym->defined && sym->in_dso;
-}
#endif /* ld.h */

View File

@ -0,0 +1,59 @@
http://bugs.gentoo.org/show_bug.cgi?id=204208
libelf.h should use __off64_t, as off64_t is not always defined.
2008-01-03 Martin von Gagern
diff -ur elfutils-0.131/libelf/libelf.h elfutils/libelf/libelf.h
--- elfutils-0.131/libelf/libelf.h 2007-11-11 20:29:00.000000000 +0100
+++ elfutils/libelf/libelf.h 2008-01-03 23:15:36.000000000 +0100
@@ -95,7 +95,7 @@
Elf_Type d_type; /* Type of this piece of data. */
unsigned int d_version; /* ELF version. */
size_t d_size; /* Size in bytes. */
- off64_t d_off; /* Offset into section. */
+ __off64_t d_off; /* Offset into section. */
size_t d_align; /* Alignment in section. */
} Elf_Data;
@@ -157,7 +157,7 @@
uid_t ar_uid; /* User ID. */
gid_t ar_gid; /* Group ID. */
mode_t ar_mode; /* File mode. */
- off64_t ar_size; /* File size. */
+ __off64_t ar_size; /* File size. */
char *ar_rawname; /* Original name of archive member. */
} Elf_Arhdr;
@@ -198,13 +198,13 @@
extern int elf_end (Elf *__elf);
/* Update ELF descriptor and write file to disk. */
-extern off64_t elf_update (Elf *__elf, Elf_Cmd __cmd);
+extern __off64_t elf_update (Elf *__elf, Elf_Cmd __cmd);
/* Determine what kind of file is associated with ELF. */
extern Elf_Kind elf_kind (Elf *__elf) __attribute__ ((__pure__));
/* Get the base offset for an object file. */
-extern off64_t elf_getbase (Elf *__elf);
+extern __off64_t elf_getbase (Elf *__elf);
/* Retrieve file identification data. */
@@ -302,7 +302,7 @@
would be for TYPE. The resulting Elf_Data pointer is valid until
elf_end (ELF) is called. */
extern Elf_Data *elf_getdata_rawchunk (Elf *__elf,
- off64_t __offset, size_t __size,
+ __off64_t __offset, size_t __size,
Elf_Type __type);
@@ -314,7 +314,7 @@
extern Elf_Arhdr *elf_getarhdr (Elf *__elf);
/* Return offset in archive for current file ELF. */
-extern off64_t elf_getaroff (Elf *__elf);
+extern __off64_t elf_getaroff (Elf *__elf);
/* Select archive element at OFFSET. */
extern size_t elf_rand (Elf *__elf, size_t __offset);

View File

@ -0,0 +1,199 @@
2006-09-19 Jakub Jelinek <jakub@redhat.com>
* strip.c (handle_elf): Formatting. If any relocation sections
stripped into separate debug info reference symtab that is kept,
emit symtab/strtab also into the separate debug info file.
--- elfutils/src/strip.c
+++ elfutils/src/strip.c
@@ -399,6 +399,7 @@ handle_elf (int fd, Elf *elf, const char
Elf_Scn *newscn;
struct Ebl_Strent *se;
Elf32_Word *newsymidx;
+ void *debug_data;
} *shdr_info = NULL;
Elf_Scn *scn;
size_t cnt;
@@ -826,6 +827,37 @@ handle_elf (int fd, Elf *elf, const char
The ones that are not removed in the stripped file are SHT_NOBITS. */
if (debug_fname != NULL)
{
+ /* libbfd and apps using it don't cope with separate debuginfo objects
+ with relocation sections against SHT_NOBITS .symtab/.strtab
+ - libbfd isn't able to look up the .symtab/.strtab in the stripped
+ object instead. As a workaround, emit .symtab/.strtab in both
+ places. */
+ for (cnt = 1; cnt < shnum; ++cnt)
+ {
+ if (shdr_info[cnt].idx == 0
+ && (shdr_info[cnt].shdr.sh_type == SHT_REL
+ || shdr_info[cnt].shdr.sh_type == SHT_RELA)
+ && (shdr_info[cnt].shdr.sh_flags & SHF_ALLOC) == 0)
+ {
+ Elf32_Word symtabidx = shdr_info[cnt].old_sh_link;
+ struct shdr_info *si = &shdr_info[symtabidx];
+ si->debug_data = "";
+ shdr_info[si->old_sh_link].debug_data = "";
+ if (si->symtab_idx)
+ shdr_info[si->symtab_idx].debug_data = "";
+
+ if (si->shdr.sh_type != SHT_SYMTAB
+ || (si->shdr.sh_flags & SHF_ALLOC)
+ || shdr_info[si->old_sh_link].shdr.sh_type != SHT_STRTAB
+ || (shdr_info[si->old_sh_link].shdr.sh_flags & SHF_ALLOC)
+ || (si->symtab_idx
+ && (shdr_info[si->symtab_idx].shdr.sh_flags
+ & SHF_ALLOC)))
+ error (EXIT_FAILURE, 0,
+ gettext ("invalid symtab/strtab referenced by nonallocated section"));
+ }
+ }
+
for (cnt = 1; cnt < shnum; ++cnt)
{
scn = elf_newscn (debugelf);
@@ -835,6 +867,7 @@ handle_elf (int fd, Elf *elf, const char
elf_errmsg (-1));
bool discard_section = (shdr_info[cnt].idx > 0
+ && shdr_info[cnt].debug_data == NULL
&& shdr_info[cnt].shdr.sh_type != SHT_NOTE
&& cnt != ehdr->e_shstrndx);
@@ -865,6 +898,13 @@ handle_elf (int fd, Elf *elf, const char
*debugdata = *shdr_info[cnt].data;
if (discard_section)
debugdata->d_buf = NULL;
+ else if (shdr_info[cnt].debug_data != NULL)
+ {
+ shdr_info[cnt].debug_data = xmalloc (debugdata->d_size);
+ memcpy (shdr_info[cnt].debug_data, debugdata->d_buf,
+ debugdata->d_size);
+ debugdata->d_buf = shdr_info[cnt].debug_data;
+ }
}
/* Finish the ELF header. Fill in the fields not handled by
@@ -1056,7 +1096,7 @@ handle_elf (int fd, Elf *elf, const char
shdr_info[shdr_info[cnt].shdr.sh_info].idx;
/* Get the data from the old file if necessary. We already
- created the data for the section header string table. */
+ created the data for the section header string table. */
if (cnt < shnum)
{
if (shdr_info[cnt].data == NULL)
@@ -1283,6 +1323,13 @@ handle_elf (int fd, Elf *elf, const char
if (shdr_info[shdr_info[cnt].old_sh_link].newsymidx == NULL)
continue;
+ /* If the symbol table is not discarded, but additionally
+ duplicated in separate debug file and this section
+ is discarded, don't adjust anything. */
+ if (shdr_info[cnt].idx == 0
+ && shdr_info[shdr_info[cnt].old_sh_link].debug_data != NULL)
+ continue;
+
Elf32_Word *newsymidx
= shdr_info[shdr_info[cnt].old_sh_link].newsymidx;
Elf_Data *d = elf_getdata (shdr_info[cnt].idx == 0
@@ -1341,6 +1388,13 @@ handle_elf (int fd, Elf *elf, const char
if (shdr_info[symtabidx].newsymidx == NULL)
continue;
+ /* If the symbol table is not discarded, but additionally
+ duplicated in separate debug file and this section
+ is discarded, don't adjust anything. */
+ if (shdr_info[cnt].idx == 0
+ && shdr_info[symtabidx].debug_data != NULL)
+ continue;
+
assert (shdr_info[cnt].idx > 0);
/* The hash section in the new file. */
@@ -1460,7 +1514,7 @@ handle_elf (int fd, Elf *elf, const char
chain[hidx] = inner;
}
}
- }
+ }
}
else if (shdr_info[cnt].shdr.sh_type == SHT_GNU_versym)
{
@@ -1473,6 +1527,13 @@ handle_elf (int fd, Elf *elf, const char
if (shdr_info[symtabidx].newsymidx == NULL)
continue;
+ /* If the symbol table is not discarded, but additionally
+ duplicated in separate debug file and this section
+ is discarded, don't adjust anything. */
+ if (shdr_info[cnt].idx == 0
+ && shdr_info[symtabidx].debug_data != NULL)
+ continue;
+
assert (shdr_info[cnt].idx > 0);
/* The symbol version section in the new file. */
@@ -1515,20 +1576,27 @@ handle_elf (int fd, Elf *elf, const char
else if (shdr_info[cnt].shdr.sh_type == SHT_GROUP)
{
/* Check whether the associated symbol table changed. */
- if (shdr_info[shdr_info[cnt].old_sh_link].newsymidx != NULL)
- {
- /* Yes the symbol table changed. Update the section
- header of the section group. */
- scn = elf_getscn (newelf, shdr_info[cnt].idx);
- GElf_Shdr shdr_mem;
- GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
- assert (shdr != NULL);
+ if (shdr_info[shdr_info[cnt].old_sh_link].newsymidx == NULL)
+ continue;
- size_t stabidx = shdr_info[cnt].old_sh_link;
- shdr->sh_info = shdr_info[stabidx].newsymidx[shdr->sh_info];
+ /* If the symbol table is not discarded, but additionally
+ duplicated in separate debug file and this section
+ is discarded, don't adjust anything. */
+ if (shdr_info[cnt].idx == 0
+ && shdr_info[shdr_info[cnt].old_sh_link].debug_data != NULL)
+ continue;
- (void) gelf_update_shdr (scn, shdr);
- }
+ /* Yes the symbol table changed. Update the section
+ header of the section group. */
+ scn = elf_getscn (newelf, shdr_info[cnt].idx);
+ GElf_Shdr shdr_mem;
+ GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
+ assert (shdr != NULL);
+
+ size_t stabidx = shdr_info[cnt].old_sh_link;
+ shdr->sh_info = shdr_info[stabidx].newsymidx[shdr->sh_info];
+
+ (void) gelf_update_shdr (scn, shdr);
}
}
}
@@ -1658,7 +1726,10 @@ handle_elf (int fd, Elf *elf, const char
table indices. */
if (any_symtab_changes)
for (cnt = 1; cnt <= shdridx; ++cnt)
- free (shdr_info[cnt].newsymidx);
+ {
+ free (shdr_info[cnt].newsymidx);
+ free (shdr_info[cnt].debug_data);
+ }
/* Free the memory. */
if ((shnum + 2) * sizeof (struct shdr_info) > MAX_STACK_ALLOC)
--- elfutils/tests/run-strip-test5.sh.~1~
+++ elfutils/tests/run-strip-test5.sh
@@ -1,5 +1,5 @@
original=testfile8
-stripped=testfile16
-debugfile=testfile16.debug
+stripped=testfile16.symtab
+debugfile=testfile16.symtab.debug
. $srcdir/run-strip-test.sh

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

219
elfutils.spec Normal file
View File

@ -0,0 +1,219 @@
%define libname libelf
%define _program_prefix eu-
Name: elfutils
Version: 0.158
Release: 1mamba
Summary: A collection of utilities and DSOs to handle compiled objects
Group: Development/Tools
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: htpps://fedorahosted.org/elfutils/
Source: https://fedorahosted.org/releases/e/l/elfutils/%{version}/elfutils-%{version}.tar.bz2
# NOTE: manual intervetion needed for updates, upstream files don't have version in name
Patch1: https://fedorahosted.org/releases/e/l/elfutils/%{version}/elfutils-%{version}-robustify.patch
Patch2: https://fedorahosted.org/releases/e/l/elfutils/%{version}/elfutils-%{version}-portability.patch
Patch3: %{name}-0.131-strip-copy-symtab.patch
Patch4: %{name}-0.131-gcc43.patch
Patch5: %{name}-0.131-off64_t.patch
License: Open Software License
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
## AUTOBUILDREQ-END
BuildRequires: gettext-devel
BuildRequires: gcc >= 3.4
BuildRequires: bison >= 1.875
BuildRequires: flex >= 2.5.4a
BuildRequires: bzip2
Requires: %{libname} = %{version}-%{release}
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
Elfutils is a collection of utilities, including:
* nm (for listing symbols from object files)
* size (for listing the section sizes of an object or archive file)
* strip (for discarding symbols)
* readelf (to see the raw ELF file structures)
* elflint (to check for well-formed ELF files)
Also included are numerous helper libraries which implement DWARF, ELF, and machine-specific ELF handling.
%package devel
Summary: Devel package for %{name}
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
%description devel
The %{name}-devel package contains the libraries to create applications for handling compiled objects.
* libebl provides some higher-level ELF access functionality
* libdw provides access to the DWARF debugging information
* libasm provides a programmable assembler interface
%package -n %{libname}
Summary: Library to read and write ELF files
Group: System/Libraries
Provides: elfutils-libelf
Obsoletes: elfutils-libelf
%description -n %{libname}
The %{libname} package provides a DSO which allows reading and writing ELF files on a high level.
Third party programs depend on this package to read internals of ELF files.
The programs of the %{name} package use it also to generate new ELF files.
%package -n %{libname}-devel
Summary: Development support for libelf
Group: Development/Libraries
Requires: %{libname} = %{version}-%{release}
Provides: elfutils-libelf-devel
Obsoletes: elfutils-libelf-devel
%description -n %{libname}-devel
The %{libname}-devel package contains the libraries to create 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.
%prep
%setup -q
#%patch3 -p1
%patch2 -p1
%patch1 -p1
#%patch5 -p1
#sed -i "s|-Werror||" src/Makefile.in tests/Makefile.in libelf/Makefile.in
%build
RPM_OPT_FLAGS="${RPM_OPT_FLAGS/-Wall/}"
%configure \
--program-prefix=%{_program_prefix} \
CFLAGS="$RPM_OPT_FLAGS -fexceptions -D__NO_INLINE__"
%if "%{_host}" == "%{_build}"
%make %{?_smp_mflags}
%ifnarch arm
%make check
%endif
%else
make CC=%{_build}-gcc -C lib libeu.a
make CC=%{_build}-gcc -C libcpu i386_gendis
mv libcpu/i386_gendis libcpu/i386_gendis.build
sed -i "s|\./i386_gendis|./i386_gendis.build|" libcpu/Makefile
make -C libcpu clean
make -C lib clean
%make || %make
%endif
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%makeinstall
chmod +x %{buildroot}%{_libdir}/lib*.so*
chmod +x %{buildroot}%{_libdir}/%{name}/lib*.so*
# Remove unpackaged files
rm -f %{buildroot}%{_bindir}/%{_program_prefix}{ld,objdump}
rm -f %{buildroot}%{_includedir}/%{name}/libasm.h
rm -f %{buildroot}%{_libdir}/libasm-%{version}.so
rm -f %{buildroot}%{_libdir}/libasm.{a,so,so.*}
%find_lang %{name}
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%files -f %{name}.lang
%defattr(-,root,root)
%{_bindir}/%{_program_prefix}ar
%{_bindir}/%{_program_prefix}make-debug-archive
%{_bindir}/%{_program_prefix}elflint
%{_bindir}/%{_program_prefix}nm
%{_bindir}/%{_program_prefix}readelf
%{_bindir}/%{_program_prefix}size
%{_bindir}/%{_program_prefix}stack
%{_bindir}/%{_program_prefix}strip
%{_bindir}/%{_program_prefix}unstrip
%{_bindir}/%{_program_prefix}findtextrel
%{_bindir}/%{_program_prefix}addr2line
%{_bindir}/%{_program_prefix}elfcmp
%{_bindir}/%{_program_prefix}ranlib
%{_bindir}/%{_program_prefix}strings
%{_libdir}/libdw-%{version}.so
%{_libdir}/libdw.so.*
%dir %{_libdir}/%{name}
%{_libdir}/%{name}/lib*.so
%doc AUTHORS COPYING ChangeLog NEWS README THANKS TODO
%files devel
%defattr(-,root,root)
%{_includedir}/dwarf.h
%dir %{_includedir}/%{name}
%{_includedir}/%{name}/elf-knowledge.h
%{_includedir}/%{name}/libebl.h
%{_includedir}/%{name}/libdw.h
%{_includedir}/%{name}/libdwfl.h
%{_includedir}/%{name}/version.h
%{_libdir}/libebl.a
%{_libdir}/libdw.a
%{_libdir}/libdw.so
%files -n %{libname}
%defattr(-,root,root)
%{_libdir}/libelf-%{version}.so
%{_libdir}/libelf.so.*
%files -n %{libname}-devel
%defattr(-,root,root)
%{_includedir}/libelf.h
%{_includedir}/gelf.h
%{_includedir}/nlist.h
%{_libdir}/libelf.a
%{_libdir}/libelf.so
%changelog
* Sat Feb 22 2014 Silvan Calarco <silvan.calarco@mambasoft.it> 0.158-1mamba
- update to 0.158
* Sat Nov 09 2013 Automatic Build System <autodist@mambasoft.it> 0.157-1mamba
- automatic version update by autodist
* Mon Sep 23 2013 Automatic Build System <autodist@mambasoft.it> 0.156-1mamba
- automatic version update by autodist
* Sat Dec 01 2012 Automatic Build System <autodist@mambasoft.it> 0.155-1mamba
- update to 0.155
* Wed Jan 12 2011 Automatic Build System <autodist@mambasoft.it> 0.148-2mamba
- automatic update by autodist
* Sun Nov 21 2010 Automatic Build System <autodist@mambasoft.it> 0.148-1mamba
- automatic update by autodist
* Wed Jun 16 2010 Silvan Calarco <silvan.calarco@mambasoft.it> 0.147-1mamba
- update to 0.147
* Mon Apr 12 2010 Silvan Calarco <silvan.calarco@mambasoft.it> 0.145-1mamba
- update to 0.145
* Wed Jul 01 2009 Automatic Build System <autodist@mambasoft.it> 0.141-1mamba
- update to 0.141
* Tue Feb 17 2009 Silvan Calarco <silvan.calarco@mambasoft.it> 0.131-2mamba
- add off64_t patch
* Sun May 18 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 0.131-1mamba
- update to 0.131
- rename elfutils-libelf to libelf and obsolete old package names
* Tue Feb 28 2006 Stefano Cotta Ramusino <stefano.cotta@qilinux.it> 0.119-2qilnx
- added portability patch
* Mon Feb 27 2006 Stefano Cotta Ramusino <stefano.cotta@qilinux.it> 0.119-1qilnx
- update to version 0.119 by autospec
- fixed source URL
- fixed license
* Tue Jan 03 2006 Davide Madrisan <davide.madrisan@qilinux.it> 0.118-1qilnx
- package created by autospec