SHA256
1
0
forked from pool/elfutils

Accepting request 109477 from home:dimstar:gcc47

Fix build with gcc 4.7;update to 0.153

OBS-URL: https://build.opensuse.org/request/show/109477
OBS-URL: https://build.opensuse.org/package/show/Base:System/elfutils?expand=0&rev=36
This commit is contained in:
Tony Jones 2012-03-15 18:50:54 +00:00 committed by Git OBS Bridge
parent 7f85a55c36
commit 0ffa4541ff
8 changed files with 797 additions and 214 deletions

View File

@ -1,5 +1,5 @@
All patches need to have a patch description header similar to what is used in All patches need to have a patch description header similar to what is used in
SuSE kernel git tree. SUSE kernel git tree.
Patches added without this will be reverted. Patches added without this will be reverted.

View File

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

3
elfutils-0.153.tar.bz2 Normal file
View File

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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,26 @@
--- elfutils/src/addr2line.c
+++ elfutils/src/addr2line.c
@@ -455,10 +455,10 @@ handle_address (const char *string, Dwfl
bool parsed = false;
int i, j;
char *name = NULL;
- if (sscanf (string, "(%m[^)])%" PRIiMAX "%n", &name, &addr, &i) == 2
+ if (sscanf (string, "(%a[^)])%" PRIiMAX "%n", &name, &addr, &i) == 2
&& string[i] == '\0')
parsed = adjust_to_section (name, &addr, dwfl);
- switch (sscanf (string, "%m[^-+]%n%" PRIiMAX "%n", &name, &i, &addr, &j))
+ switch (sscanf (string, "%a[^-+]%n%" PRIiMAX "%n", &name, &i, &addr, &j))
{
default:
break;
--- elfutils/tests/line2addr.c
+++ elfutils/tests/line2addr.c
@@ -132,7 +132,7 @@ main (int argc, char *argv[])
{
struct args a = { .arg = argv[cnt] };
- switch (sscanf (a.arg, "%m[^:]:%d", &a.file, &a.line))
+ switch (sscanf (a.arg, "%a[^:]:%d", &a.file, &a.line))
{
default:
case 0:

View File

@ -1,13 +1,47 @@
From: Tony Jones <tonyj@suse.de> --- elfutils/libdwfl/ChangeLog
Subject: Elfutils robustify patch +++ elfutils/libdwfl/ChangeLog
Version: 0.152 @@ -41,6 +41,11 @@
References: https://fedorahosted.org/releases/e/l/elfutils/0.152/elfutils-robustify.patch * dwfl_module_getdwarf.c (open_elf): Clear errno before CBFAIL.
Upstream: yes Reported by Kurt Roeckx <kurt@roeckx.be>.
This patch contains functional/stability fixes that are regarded as generally +2011-03-23 Petr Machata <pmachata@redhat.com>
useful by the community but are not accepted by the elfutils maintainer (and +
are therefore not in the git repository). + * relocate.c (relocate_section): Use gelf_fsize instead of relying
+ on shdr->sh_entsize.
+
2011-02-11 Roland McGrath <roland@redhat.com>
* linux-kernel-modules.c (try_kernel_name): Try .gz, .bz2, .xz
--- elfutils/libdwfl/relocate.c
+++ elfutils/libdwfl/relocate.c
@@ -1,5 +1,5 @@
/* Relocate debug information.
- Copyright (C) 2005-2010 Red Hat, Inc.
+ Copyright (C) 2005-2011 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -478,7 +478,10 @@ relocate_section (Dwfl_Module *mod, Elf
}
}
- size_t nrels = shdr->sh_size / shdr->sh_entsize;
+ size_t sh_entsize
+ = gelf_fsize (relocated, shdr->sh_type == SHT_REL ? ELF_T_REL : ELF_T_RELA,
+ 1, EV_CURRENT);
+ size_t nrels = shdr->sh_size / sh_entsize;
size_t complete = 0;
if (shdr->sh_type == SHT_REL)
for (size_t relidx = 0; !result && relidx < nrels; ++relidx)
@@ -580,7 +583,7 @@ relocate_section (Dwfl_Module *mod, Elf
nrels = next;
}
- shdr->sh_size = reldata->d_size = nrels * shdr->sh_entsize;
+ shdr->sh_size = reldata->d_size = nrels * sh_entsize;
gelf_update_shdr (scn, shdr);
}
--- elfutils/libelf/ChangeLog --- elfutils/libelf/ChangeLog
+++ elfutils/libelf/ChangeLog +++ elfutils/libelf/ChangeLog
@@ -663,10 +663,53 @@ @@ -663,10 +663,53 @@
@ -875,7 +909,20 @@ are therefore not in the git repository).
#endif /* libelfP.h */ #endif /* libelfP.h */
--- elfutils/src/ChangeLog --- elfutils/src/ChangeLog
+++ elfutils/src/ChangeLog +++ elfutils/src/ChangeLog
@@ -1710,6 +1710,16 @@ @@ -228,6 +228,12 @@
* readelf.c (dwarf_attr_string): Grok DW_AT_GNU_odr_signature.
+2011-03-23 Petr Machata <pmachata@redhat.com>
+
+ * readelf.c (handle_dynamic, handle_relocs_rel)
+ (handle_relocs_rela, handle_versym, print_liblist):
+ Use gelf_fsize instead of relying on shdr->sh_entsize.
+
2011-02-11 Roland McGrath <roland@redhat.com>
* elfcmp.c (verbose): New variable.
@@ -1940,6 +1946,16 @@
object symbols or symbols with unknown type. object symbols or symbols with unknown type.
(check_rel): Likewise. (check_rel): Likewise.
@ -892,7 +939,7 @@ are therefore not in the git repository).
2005-06-08 Roland McGrath <roland@redhat.com> 2005-06-08 Roland McGrath <roland@redhat.com>
* readelf.c (print_ops): Add consts. * readelf.c (print_ops): Add consts.
@@ -1755,6 +1765,19 @@ @@ -1985,6 +2001,19 @@
* readelf.c (dwarf_tag_string): Add new tags. * readelf.c (dwarf_tag_string): Add new tags.
@ -958,7 +1005,7 @@ are therefore not in the git repository).
static void static void
check_elf_header (Ebl *ebl, GElf_Ehdr *ehdr, size_t size) check_elf_header (Ebl *ebl, GElf_Ehdr *ehdr, size_t size)
{ {
@@ -632,7 +640,8 @@ section [%2d] '%s': symbol table cannot @@ -632,7 +640,8 @@ section [%2d] '%s': symbol table cannot
} }
} }
@ -977,7 +1024,7 @@ are therefore not in the git repository).
{ {
sym = gelf_getsymshndx (data, xndxdata, cnt, &sym_mem, &xndx); sym = gelf_getsymshndx (data, xndxdata, cnt, &sym_mem, &xndx);
if (sym == NULL) if (sym == NULL)
@@ -690,7 +699,8 @@ section [%2d] '%s': symbol %zu: invalid @@ -690,7 +699,8 @@ section [%2d] '%s': symbol %zu: invalid
else else
{ {
name = elf_strptr (ebl->elf, shdr->sh_link, sym->st_name); name = elf_strptr (ebl->elf, shdr->sh_link, sym->st_name);
@ -1072,7 +1119,7 @@ are therefore not in the git repository).
{ {
GElf_Dyn dyn_mem; GElf_Dyn dyn_mem;
GElf_Dyn *dyn = gelf_getdyn (data, cnt, &dyn_mem); GElf_Dyn *dyn = gelf_getdyn (data, cnt, &dyn_mem);
@@ -1879,6 +1899,8 @@ section [%2d] '%s': entry size does not @@ -1879,6 +1899,8 @@ section [%2d] '%s': entry size does not
idx, section_name (ebl, idx)); idx, section_name (ebl, idx));
if (symshdr != NULL if (symshdr != NULL
@ -1175,7 +1222,7 @@ are therefore not in the git repository).
idx, section_name (ebl, idx), (long int) shdr->sh_size, idx, section_name (ebl, idx), (long int) shdr->sh_size,
(long int) ((4 + bitmask_words + nbuckets) * sizeof (Elf32_Word))); (long int) ((4 + bitmask_words + nbuckets) * sizeof (Elf32_Word)));
return; return;
@@ -2707,8 +2755,9 @@ section [%2d] '%s' refers in sh_link to @@ -2707,8 +2755,9 @@ section [%2d] '%s' refers in sh_link to
/* The number of elements in the version symbol table must be the /* The number of elements in the version symbol table must be the
same as the number of symbols. */ same as the number of symbols. */
@ -1189,7 +1236,7 @@ are therefore not in the git repository).
idx, section_name (ebl, idx), idx, section_name (ebl, idx),
--- elfutils/src/readelf.c --- elfutils/src/readelf.c
+++ elfutils/src/readelf.c +++ elfutils/src/readelf.c
@@ -1178,6 +1178,8 @@ handle_scngrp (Ebl *ebl, Elf_Scn *scn, G @@ -1191,6 +1191,8 @@ handle_scngrp (Ebl *ebl, Elf_Scn *scn, G
Elf32_Word *grpref = (Elf32_Word *) data->d_buf; Elf32_Word *grpref = (Elf32_Word *) data->d_buf;
GElf_Sym sym_mem; GElf_Sym sym_mem;
@ -1198,7 +1245,7 @@ are therefore not in the git repository).
printf ((grpref[0] & GRP_COMDAT) printf ((grpref[0] & GRP_COMDAT)
? ngettext ("\ ? ngettext ("\
\nCOMDAT section group [%2zu] '%s' with signature '%s' contains %zu entry:\n", \nCOMDAT section group [%2zu] '%s' with signature '%s' contains %zu entry:\n",
@@ -1190,8 +1192,8 @@ handle_scngrp (Ebl *ebl, Elf_Scn *scn, G @@ -1203,8 +1205,8 @@ handle_scngrp (Ebl *ebl, Elf_Scn *scn, G
data->d_size / sizeof (Elf32_Word) - 1), data->d_size / sizeof (Elf32_Word) - 1),
elf_ndxscn (scn), elf_ndxscn (scn),
elf_strptr (ebl->elf, shstrndx, shdr->sh_name), elf_strptr (ebl->elf, shstrndx, shdr->sh_name),
@ -1209,7 +1256,7 @@ are therefore not in the git repository).
?: gettext ("<INVALID SYMBOL>"), ?: gettext ("<INVALID SYMBOL>"),
data->d_size / sizeof (Elf32_Word) - 1); data->d_size / sizeof (Elf32_Word) - 1);
@@ -1342,7 +1344,8 @@ static void @@ -1355,10 +1357,12 @@ static void
handle_dynamic (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr) handle_dynamic (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr)
{ {
int class = gelf_getclass (ebl->elf); int class = gelf_getclass (ebl->elf);
@ -1219,10 +1266,16 @@ are therefore not in the git repository).
Elf_Data *data; Elf_Data *data;
size_t cnt; size_t cnt;
size_t shstrndx; size_t shstrndx;
@@ -1357,6 +1360,11 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn, + size_t sh_entsize;
/* Get the data of the section. */
data = elf_getdata (scn, NULL);
@@ -1370,21 +1374,26 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn,
error (EXIT_FAILURE, 0, error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index")); gettext ("cannot get section header string table index"));
+ sh_entsize = gelf_fsize (ebl->elf, ELF_T_DYN, 1, EV_CURRENT);
+
+ glink = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link), &glink_mem); + glink = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link), &glink_mem);
+ if (glink == NULL) + if (glink == NULL)
+ error (EXIT_FAILURE, 0, gettext ("invalid sh_link value in section %Zu"), + error (EXIT_FAILURE, 0, gettext ("invalid sh_link value in section %Zu"),
@ -1231,7 +1284,11 @@ are therefore not in the git repository).
printf (ngettext ("\ printf (ngettext ("\
\nDynamic segment contains %lu entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n", \nDynamic segment contains %lu entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n",
"\ "\
@@ -1366,9 +1374,7 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn, \nDynamic segment contains %lu entries:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n",
- shdr->sh_size / shdr->sh_entsize),
- (unsigned long int) (shdr->sh_size / shdr->sh_entsize),
+ shdr->sh_size / sh_entsize),
+ (unsigned long int) (shdr->sh_size / sh_entsize),
class == ELFCLASS32 ? 10 : 18, shdr->sh_addr, class == ELFCLASS32 ? 10 : 18, shdr->sh_addr,
shdr->sh_offset, shdr->sh_offset,
(int) shdr->sh_link, (int) shdr->sh_link,
@ -1241,8 +1298,32 @@ are therefore not in the git repository).
+ elf_strptr (ebl->elf, shstrndx, glink->sh_name)); + elf_strptr (ebl->elf, shstrndx, glink->sh_name));
fputs_unlocked (gettext (" Type Value\n"), stdout); fputs_unlocked (gettext (" Type Value\n"), stdout);
for (cnt = 0; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt) - for (cnt = 0; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt)
@@ -1951,6 +1957,13 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, G + for (cnt = 0; cnt < shdr->sh_size / sh_entsize; ++cnt)
{
GElf_Dyn dynmem;
GElf_Dyn *dyn = gelf_getdyn (data, cnt, &dynmem);
@@ -1533,7 +1542,8 @@ static void
handle_relocs_rel (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr)
{
int class = gelf_getclass (ebl->elf);
- int nentries = shdr->sh_size / shdr->sh_entsize;
+ size_t sh_entsize = gelf_fsize (ebl->elf, ELF_T_REL, 1, EV_CURRENT);
+ int nentries = shdr->sh_size / sh_entsize;
/* Get the data of the section. */
Elf_Data *data = elf_getdata (scn, NULL);
@@ -1719,7 +1729,8 @@ static void
handle_relocs_rela (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr)
{
int class = gelf_getclass (ebl->elf);
- int nentries = shdr->sh_size / shdr->sh_entsize;
+ size_t sh_entsize = gelf_fsize (ebl->elf, ELF_T_RELA, 1, EV_CURRENT);
+ int nentries = shdr->sh_size / sh_entsize;
/* Get the data of the section. */
Elf_Data *data = elf_getdata (scn, NULL);
@@ -1966,6 +1977,13 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, G
error (EXIT_FAILURE, 0, error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index")); gettext ("cannot get section header string table index"));
@ -1256,7 +1337,7 @@ are therefore not in the git repository).
/* Now we can compute the number of entries in the section. */ /* Now we can compute the number of entries in the section. */
unsigned int nsyms = data->d_size / (class == ELFCLASS32 unsigned int nsyms = data->d_size / (class == ELFCLASS32
? sizeof (Elf32_Sym) ? sizeof (Elf32_Sym)
@@ -1961,15 +1974,12 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, G @@ -1976,15 +1994,12 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, G
nsyms), nsyms),
(unsigned int) elf_ndxscn (scn), (unsigned int) elf_ndxscn (scn),
elf_strptr (ebl->elf, shstrndx, shdr->sh_name), nsyms); elf_strptr (ebl->elf, shstrndx, shdr->sh_name), nsyms);
@ -1273,7 +1354,7 @@ are therefore not in the git repository).
fputs_unlocked (class == ELFCLASS32 fputs_unlocked (class == ELFCLASS32
? gettext ("\ ? gettext ("\
@@ -2205,7 +2215,13 @@ handle_verneed (Ebl *ebl, Elf_Scn *scn, @@ -2220,7 +2235,13 @@ handle_verneed (Ebl *ebl, Elf_Scn *scn,
error (EXIT_FAILURE, 0, error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index")); gettext ("cannot get section header string table index"));
@ -1288,7 +1369,7 @@ are therefore not in the git repository).
printf (ngettext ("\ printf (ngettext ("\
\nVersion needs section [%2u] '%s' contains %d entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n", \nVersion needs section [%2u] '%s' contains %d entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n",
"\ "\
@@ -2216,9 +2232,7 @@ handle_verneed (Ebl *ebl, Elf_Scn *scn, @@ -2231,9 +2252,7 @@ handle_verneed (Ebl *ebl, Elf_Scn *scn,
class == ELFCLASS32 ? 10 : 18, shdr->sh_addr, class == ELFCLASS32 ? 10 : 18, shdr->sh_addr,
shdr->sh_offset, shdr->sh_offset,
(unsigned int) shdr->sh_link, (unsigned int) shdr->sh_link,
@ -1299,7 +1380,7 @@ are therefore not in the git repository).
unsigned int offset = 0; unsigned int offset = 0;
for (int cnt = shdr->sh_info; --cnt >= 0; ) for (int cnt = shdr->sh_info; --cnt >= 0; )
@@ -2271,8 +2285,14 @@ handle_verdef (Ebl *ebl, Elf_Scn *scn, G @@ -2286,8 +2305,14 @@ handle_verdef (Ebl *ebl, Elf_Scn *scn, G
error (EXIT_FAILURE, 0, error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index")); gettext ("cannot get section header string table index"));
@ -1315,7 +1396,7 @@ are therefore not in the git repository).
printf (ngettext ("\ printf (ngettext ("\
\nVersion definition section [%2u] '%s' contains %d entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n", \nVersion definition section [%2u] '%s' contains %d entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n",
"\ "\
@@ -2284,9 +2304,7 @@ handle_verdef (Ebl *ebl, Elf_Scn *scn, G @@ -2299,9 +2324,7 @@ handle_verdef (Ebl *ebl, Elf_Scn *scn, G
class == ELFCLASS32 ? 10 : 18, shdr->sh_addr, class == ELFCLASS32 ? 10 : 18, shdr->sh_addr,
shdr->sh_offset, shdr->sh_offset,
(unsigned int) shdr->sh_link, (unsigned int) shdr->sh_link,
@ -1326,13 +1407,14 @@ are therefore not in the git repository).
unsigned int offset = 0; unsigned int offset = 0;
for (int cnt = shdr->sh_info; --cnt >= 0; ) for (int cnt = shdr->sh_info; --cnt >= 0; )
@@ -2548,8 +2566,14 @@ handle_versym (Ebl *ebl, Elf_Scn *scn, G @@ -2563,25 +2586,30 @@ handle_versym (Ebl *ebl, Elf_Scn *scn, G
filename = NULL; filename = NULL;
} }
+ GElf_Shdr glink_mem; + GElf_Shdr glink_mem;
+ GElf_Shdr *glink = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link), + GElf_Shdr *glink = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link),
+ &glink_mem); + &glink_mem);
+ size_t sh_entsize = gelf_fsize (ebl->elf, ELF_T_HALF, 1, EV_CURRENT);
+ if (glink == NULL) + if (glink == NULL)
+ error (EXIT_FAILURE, 0, gettext ("invalid sh_link value in section %Zu"), + error (EXIT_FAILURE, 0, gettext ("invalid sh_link value in section %Zu"),
+ elf_ndxscn (scn)); + elf_ndxscn (scn));
@ -1342,7 +1424,13 @@ are therefore not in the git repository).
printf (ngettext ("\ printf (ngettext ("\
\nVersion symbols section [%2u] '%s' contains %d entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'", \nVersion symbols section [%2u] '%s' contains %d entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'",
"\ "\
@@ -2561,9 +2585,7 @@ handle_versym (Ebl *ebl, Elf_Scn *scn, G \nVersion symbols section [%2u] '%s' contains %d entries:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'",
- shdr->sh_size / shdr->sh_entsize),
+ shdr->sh_size / sh_entsize),
(unsigned int) elf_ndxscn (scn),
elf_strptr (ebl->elf, shstrndx, shdr->sh_name),
- (int) (shdr->sh_size / shdr->sh_entsize),
+ (int) (shdr->sh_size / sh_entsize),
class == ELFCLASS32 ? 10 : 18, shdr->sh_addr, class == ELFCLASS32 ? 10 : 18, shdr->sh_addr,
shdr->sh_offset, shdr->sh_offset,
(unsigned int) shdr->sh_link, (unsigned int) shdr->sh_link,
@ -1352,8 +1440,12 @@ are therefore not in the git repository).
+ elf_strptr (ebl->elf, shstrndx, glink->sh_name)); + elf_strptr (ebl->elf, shstrndx, glink->sh_name));
/* Now we can finally look at the actual contents of this section. */ /* Now we can finally look at the actual contents of this section. */
for (unsigned int cnt = 0; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt) - for (unsigned int cnt = 0; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt)
@@ -2615,7 +2637,17 @@ print_hash_info (Ebl *ebl, Elf_Scn *scn, + for (unsigned int cnt = 0; cnt < shdr->sh_size / sh_entsize; ++cnt)
{
if (cnt % 2 == 0)
printf ("\n %4d:", cnt);
@@ -2630,7 +2658,17 @@ print_hash_info (Ebl *ebl, Elf_Scn *scn,
for (Elf32_Word cnt = 0; cnt < nbucket; ++cnt) for (Elf32_Word cnt = 0; cnt < nbucket; ++cnt)
++counts[lengths[cnt]]; ++counts[lengths[cnt]];
@ -1372,7 +1464,7 @@ are therefore not in the git repository).
printf (ngettext ("\ printf (ngettext ("\
\nHistogram for bucket list length in section [%2u] '%s' (total of %d bucket):\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n", \nHistogram for bucket list length in section [%2u] '%s' (total of %d bucket):\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n",
"\ "\
@@ -2628,9 +2660,7 @@ print_hash_info (Ebl *ebl, Elf_Scn *scn, @@ -2643,9 +2681,7 @@ print_hash_info (Ebl *ebl, Elf_Scn *scn,
shdr->sh_addr, shdr->sh_addr,
shdr->sh_offset, shdr->sh_offset,
(unsigned int) shdr->sh_link, (unsigned int) shdr->sh_link,
@ -1383,7 +1475,17 @@ are therefore not in the git repository).
if (extrastr != NULL) if (extrastr != NULL)
fputs (extrastr, stdout); fputs (extrastr, stdout);
@@ -4486,6 +4516,16 @@ print_debug_aranges_section (Dwfl_Module @@ -2905,7 +2941,8 @@ print_liblist (Ebl *ebl)
if (shdr != NULL && shdr->sh_type == SHT_GNU_LIBLIST)
{
- int nentries = shdr->sh_size / shdr->sh_entsize;
+ size_t sh_entsize = gelf_fsize (ebl->elf, ELF_T_LIB, 1, EV_CURRENT);
+ int nentries = shdr->sh_size / sh_entsize;
printf (ngettext ("\
\nLibrary list section [%2zu] '%s' at offset %#0" PRIx64 " contains %d entry:\n",
"\
@@ -4646,6 +4683,16 @@ print_debug_aranges_section (Dwfl_Module
return; return;
} }
@ -1402,7 +1504,7 @@ are therefore not in the git repository).
"\ "\
--- elfutils/src/strip.c --- elfutils/src/strip.c
+++ elfutils/src/strip.c +++ elfutils/src/strip.c
@@ -555,6 +555,11 @@ handle_elf (int fd, Elf *elf, const char @@ -572,6 +572,11 @@ handle_elf (int fd, Elf *elf, const char
goto fail_close; goto fail_close;
} }
@ -1414,7 +1516,7 @@ are therefore not in the git repository).
/* Storage for section information. We leave room for two more /* Storage for section information. We leave room for two more
entries since we unconditionally create a section header string entries since we unconditionally create a section header string
table. Maybe some weird tool created an ELF file without one. table. Maybe some weird tool created an ELF file without one.
@@ -576,7 +581,7 @@ handle_elf (int fd, Elf *elf, const char @@ -593,7 +598,7 @@ handle_elf (int fd, Elf *elf, const char
{ {
/* This should always be true (i.e., there should not be any /* This should always be true (i.e., there should not be any
holes in the numbering). */ holes in the numbering). */
@ -1423,7 +1525,7 @@ are therefore not in the git repository).
shdr_info[cnt].scn = scn; shdr_info[cnt].scn = scn;
@@ -589,6 +594,7 @@ handle_elf (int fd, Elf *elf, const char @@ -606,6 +611,7 @@ handle_elf (int fd, Elf *elf, const char
shdr_info[cnt].shdr.sh_name); shdr_info[cnt].shdr.sh_name);
if (shdr_info[cnt].name == NULL) if (shdr_info[cnt].name == NULL)
{ {
@ -1431,7 +1533,7 @@ are therefore not in the git repository).
error (0, 0, gettext ("illformed file '%s'"), fname); error (0, 0, gettext ("illformed file '%s'"), fname);
goto fail_close; goto fail_close;
} }
@@ -598,6 +604,8 @@ handle_elf (int fd, Elf *elf, const char @@ -615,6 +621,8 @@ handle_elf (int fd, Elf *elf, const char
/* Remember the shdr.sh_link value. */ /* Remember the shdr.sh_link value. */
shdr_info[cnt].old_sh_link = shdr_info[cnt].shdr.sh_link; shdr_info[cnt].old_sh_link = shdr_info[cnt].shdr.sh_link;
@ -1440,7 +1542,7 @@ are therefore not in the git repository).
/* Sections in files other than relocatable object files which /* Sections in files other than relocatable object files which
are not loaded can be freely moved by us. In relocatable are not loaded can be freely moved by us. In relocatable
@@ -610,7 +618,7 @@ handle_elf (int fd, Elf *elf, const char @@ -627,7 +635,7 @@ handle_elf (int fd, Elf *elf, const char
appropriate reference. */ appropriate reference. */
if (unlikely (shdr_info[cnt].shdr.sh_type == SHT_SYMTAB_SHNDX)) if (unlikely (shdr_info[cnt].shdr.sh_type == SHT_SYMTAB_SHNDX))
{ {
@ -1449,7 +1551,7 @@ are therefore not in the git repository).
shdr_info[shdr_info[cnt].shdr.sh_link].symtab_idx = cnt; shdr_info[shdr_info[cnt].shdr.sh_link].symtab_idx = cnt;
} }
else if (unlikely (shdr_info[cnt].shdr.sh_type == SHT_GROUP)) else if (unlikely (shdr_info[cnt].shdr.sh_type == SHT_GROUP))
@@ -627,7 +635,12 @@ handle_elf (int fd, Elf *elf, const char @@ -644,7 +652,12 @@ handle_elf (int fd, Elf *elf, const char
for (inner = 1; for (inner = 1;
inner < shdr_info[cnt].data->d_size / sizeof (Elf32_Word); inner < shdr_info[cnt].data->d_size / sizeof (Elf32_Word);
++inner) ++inner)
@ -1462,7 +1564,7 @@ are therefore not in the git repository).
if (inner == 1 || (inner == 2 && (grpref[0] & GRP_COMDAT) == 0)) if (inner == 1 || (inner == 2 && (grpref[0] & GRP_COMDAT) == 0))
/* If the section group contains only one element and this /* If the section group contains only one element and this
@@ -638,7 +651,7 @@ handle_elf (int fd, Elf *elf, const char @@ -655,7 +668,7 @@ handle_elf (int fd, Elf *elf, const char
} }
else if (unlikely (shdr_info[cnt].shdr.sh_type == SHT_GNU_versym)) else if (unlikely (shdr_info[cnt].shdr.sh_type == SHT_GNU_versym))
{ {
@ -1471,7 +1573,7 @@ are therefore not in the git repository).
shdr_info[shdr_info[cnt].shdr.sh_link].version_idx = cnt; shdr_info[shdr_info[cnt].shdr.sh_link].version_idx = cnt;
} }
@@ -646,7 +659,7 @@ handle_elf (int fd, Elf *elf, const char @@ -663,7 +676,7 @@ handle_elf (int fd, Elf *elf, const char
discarded right away. */ discarded right away. */
if ((shdr_info[cnt].shdr.sh_flags & SHF_GROUP) != 0) if ((shdr_info[cnt].shdr.sh_flags & SHF_GROUP) != 0)
{ {
@ -1480,7 +1582,7 @@ are therefore not in the git repository).
if (shdr_info[shdr_info[cnt].group_idx].idx == 0) if (shdr_info[shdr_info[cnt].group_idx].idx == 0)
{ {
@@ -722,11 +735,15 @@ handle_elf (int fd, Elf *elf, const char @@ -739,10 +752,14 @@ handle_elf (int fd, Elf *elf, const char
{ {
/* If a relocation section is marked as being removed make /* If a relocation section is marked as being removed make
sure the section it is relocating is removed, too. */ sure the section it is relocating is removed, too. */
@ -1488,17 +1590,17 @@ are therefore not in the git repository).
+ if (shdr_info[cnt].shdr.sh_type == SHT_REL + if (shdr_info[cnt].shdr.sh_type == SHT_REL
|| shdr_info[cnt].shdr.sh_type == SHT_RELA) || shdr_info[cnt].shdr.sh_type == SHT_RELA)
- && shdr_info[shdr_info[cnt].shdr.sh_info].idx != 0) - && shdr_info[shdr_info[cnt].shdr.sh_info].idx != 0)
- shdr_info[cnt].idx = 1;
+ { + {
+ if (shdr_info[cnt].shdr.sh_info >= shnum) + if (shdr_info[cnt].shdr.sh_info >= shnum)
+ goto illformed; + goto illformed;
+ else if (shdr_info[shdr_info[cnt].shdr.sh_info].idx != 0) + else if (shdr_info[shdr_info[cnt].shdr.sh_info].idx != 0)
shdr_info[cnt].idx = 1; + shdr_info[cnt].idx = 1;
} + }
+ }
if (shdr_info[cnt].idx == 1) /* If a group section is marked as being removed make
{ sure all the sections it contains are being removed, too. */
@@ -753,7 +770,7 @@ handle_elf (int fd, Elf *elf, const char @@ -786,7 +803,7 @@ handle_elf (int fd, Elf *elf, const char
if (shdr_info[cnt].symtab_idx != 0 if (shdr_info[cnt].symtab_idx != 0
&& shdr_info[shdr_info[cnt].symtab_idx].data == NULL) && shdr_info[shdr_info[cnt].symtab_idx].data == NULL)
{ {
@ -1507,7 +1609,7 @@ are therefore not in the git repository).
shdr_info[shdr_info[cnt].symtab_idx].data shdr_info[shdr_info[cnt].symtab_idx].data
= elf_getdata (shdr_info[shdr_info[cnt].symtab_idx].scn, = elf_getdata (shdr_info[shdr_info[cnt].symtab_idx].scn,
@@ -793,6 +810,9 @@ handle_elf (int fd, Elf *elf, const char @@ -826,6 +843,9 @@ handle_elf (int fd, Elf *elf, const char
else if (scnidx == SHN_XINDEX) else if (scnidx == SHN_XINDEX)
scnidx = xndx; scnidx = xndx;
@ -1517,7 +1619,7 @@ are therefore not in the git repository).
if (shdr_info[scnidx].idx == 0) if (shdr_info[scnidx].idx == 0)
/* This symbol table has a real symbol in /* This symbol table has a real symbol in
a discarded section. So preserve the a discarded section. So preserve the
@@ -823,12 +843,16 @@ handle_elf (int fd, Elf *elf, const char @@ -856,12 +876,16 @@ handle_elf (int fd, Elf *elf, const char
} }
/* Handle references through sh_info. */ /* Handle references through sh_info. */
@ -1536,7 +1638,7 @@ are therefore not in the git repository).
/* Mark the section as investigated. */ /* Mark the section as investigated. */
shdr_info[cnt].idx = 2; shdr_info[cnt].idx = 2;
@@ -967,7 +991,7 @@ handle_elf (int fd, Elf *elf, const char @@ -1002,7 +1026,7 @@ handle_elf (int fd, Elf *elf, const char
error (EXIT_FAILURE, 0, gettext ("while generating output file: %s"), error (EXIT_FAILURE, 0, gettext ("while generating output file: %s"),
elf_errmsg (-1)); elf_errmsg (-1));
@ -1545,7 +1647,7 @@ are therefore not in the git repository).
/* Add this name to the section header string table. */ /* Add this name to the section header string table. */
shdr_info[cnt].se = ebl_strtabadd (shst, shdr_info[cnt].name, 0); shdr_info[cnt].se = ebl_strtabadd (shst, shdr_info[cnt].name, 0);
@@ -1004,7 +1028,7 @@ handle_elf (int fd, Elf *elf, const char @@ -1039,7 +1063,7 @@ handle_elf (int fd, Elf *elf, const char
error (EXIT_FAILURE, 0, error (EXIT_FAILURE, 0,
gettext ("while create section header section: %s"), gettext ("while create section header section: %s"),
elf_errmsg (-1)); elf_errmsg (-1));
@ -1554,7 +1656,7 @@ are therefore not in the git repository).
shdr_info[cnt].data = elf_newdata (shdr_info[cnt].newscn); shdr_info[cnt].data = elf_newdata (shdr_info[cnt].newscn);
if (shdr_info[cnt].data == NULL) if (shdr_info[cnt].data == NULL)
@@ -1060,7 +1084,7 @@ handle_elf (int fd, Elf *elf, const char @@ -1095,7 +1119,7 @@ handle_elf (int fd, Elf *elf, const char
error (EXIT_FAILURE, 0, error (EXIT_FAILURE, 0,
gettext ("while create section header section: %s"), gettext ("while create section header section: %s"),
elf_errmsg (-1)); elf_errmsg (-1));
@ -1563,7 +1665,7 @@ are therefore not in the git repository).
/* Finalize the string table and fill in the correct indices in the /* Finalize the string table and fill in the correct indices in the
section headers. */ section headers. */
@@ -1150,20 +1174,20 @@ handle_elf (int fd, Elf *elf, const char @@ -1185,20 +1209,20 @@ handle_elf (int fd, Elf *elf, const char
shndxdata = elf_getdata (shdr_info[shdr_info[cnt].symtab_idx].scn, shndxdata = elf_getdata (shdr_info[shdr_info[cnt].symtab_idx].scn,
NULL); NULL);
@ -1587,7 +1689,7 @@ are therefore not in the git repository).
>= shdr_info[cnt].data->d_size / elsize); >= shdr_info[cnt].data->d_size / elsize);
} }
@@ -1218,7 +1242,7 @@ handle_elf (int fd, Elf *elf, const char @@ -1253,7 +1277,7 @@ handle_elf (int fd, Elf *elf, const char
sec = shdr_info[sym->st_shndx].idx; sec = shdr_info[sym->st_shndx].idx;
else else
{ {
@ -1596,7 +1698,7 @@ are therefore not in the git repository).
sec = shdr_info[xshndx].idx; sec = shdr_info[xshndx].idx;
} }
@@ -1239,7 +1263,7 @@ handle_elf (int fd, Elf *elf, const char @@ -1274,7 +1298,7 @@ handle_elf (int fd, Elf *elf, const char
nxshndx = sec; nxshndx = sec;
} }
@ -1605,16 +1707,22 @@ are therefore not in the git repository).
if ((inner != destidx || nshndx != sym->st_shndx if ((inner != destidx || nshndx != sym->st_shndx
|| (shndxdata != NULL && nxshndx != xshndx)) || (shndxdata != NULL && nxshndx != xshndx))
@@ -1263,7 +1287,7 @@ handle_elf (int fd, Elf *elf, const char @@ -1301,9 +1325,11 @@ handle_elf (int fd, Elf *elf, const char
|| shdr_info[cnt].debug_data == NULL) {
/* This is a section symbol for a section which has size_t sidx = (sym->st_shndx != SHN_XINDEX
been removed. */ ? sym->st_shndx : xshndx);
- assert (GELF_ST_TYPE (sym->st_info) == STT_SECTION); - assert (GELF_ST_TYPE (sym->st_info) == STT_SECTION
+ elf_assert (GELF_ST_TYPE (sym->st_info) == STT_SECTION); - || (shdr_info[sidx].shdr.sh_type == SHT_GROUP
- && shdr_info[sidx].shdr.sh_info == inner));
+ elf_assert (GELF_ST_TYPE (sym->st_info) == STT_SECTION
+ || ((shdr_info[sidx].shdr.sh_type
+ == SHT_GROUP)
+ && (shdr_info[sidx].shdr.sh_info
+ == inner)));
}
} }
if (destidx != inner) @@ -1491,11 +1517,11 @@ handle_elf (int fd, Elf *elf, const char
@@ -1450,11 +1474,11 @@ handle_elf (int fd, Elf *elf, const char
{ {
GElf_Sym sym_mem; GElf_Sym sym_mem;
GElf_Sym *sym = gelf_getsym (symd, inner, &sym_mem); GElf_Sym *sym = gelf_getsym (symd, inner, &sym_mem);
@ -1628,16 +1736,18 @@ are therefore not in the git repository).
size_t hidx = elf_hash (name) % nbucket; size_t hidx = elf_hash (name) % nbucket;
if (bucket[hidx] == 0) if (bucket[hidx] == 0)
@@ -1473,7 +1497,7 @@ handle_elf (int fd, Elf *elf, const char @@ -1514,8 +1540,8 @@ handle_elf (int fd, Elf *elf, const char
else else
{ {
/* Alpha and S390 64-bit use 64-bit SHT_HASH entries. */ /* Alpha and S390 64-bit use 64-bit SHT_HASH entries. */
- assert (shdr_info[cnt].shdr.sh_entsize - assert (shdr_info[cnt].shdr.sh_entsize
- == sizeof (Elf64_Xword));
+ elf_assert (shdr_info[cnt].shdr.sh_entsize + elf_assert (shdr_info[cnt].shdr.sh_entsize
== sizeof (Elf64_Xword)); + == sizeof (Elf64_Xword));
Elf64_Xword *bucket = (Elf64_Xword *) hashd->d_buf; Elf64_Xword *bucket = (Elf64_Xword *) hashd->d_buf;
@@ -1504,11 +1528,11 @@ handle_elf (int fd, Elf *elf, const char
@@ -1545,11 +1571,11 @@ handle_elf (int fd, Elf *elf, const char
{ {
GElf_Sym sym_mem; GElf_Sym sym_mem;
GElf_Sym *sym = gelf_getsym (symd, inner, &sym_mem); GElf_Sym *sym = gelf_getsym (symd, inner, &sym_mem);

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Thu Mar 15 08:49:20 UTC 2012 - aj@suse.de
- Update to 0.153:
* Fix building with gcc 4.7
* New --disable-werror for portability.
* Support for .zdebug sections
* type_units and DW_AT_GNU_odr_signature support
* low level support DW_OP_GNU_entry_value and DW_TAG_GNU_call_site
- Revert scanf changes in portability patch since C99 gives %a a new
meaning.
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Dec 2 08:59:33 UTC 2011 - cfarrell@suse.com Fri Dec 2 08:59:33 UTC 2011 - cfarrell@suse.com

View File

@ -1,7 +1,7 @@
# #
# spec file for package elfutils # spec file for package elfutils
# #
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. # Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -15,9 +15,11 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/ # Please submit bugfixes or comments via http://bugs.opensuse.org/
# #
Name: elfutils Name: elfutils
License: GPL-2.0-with-osi-exception License: GPL-2.0-with-osi-exception
Version: 0.152 Version: 0.153
Release: 0 Release: 0
Summary: Higher-level library to access ELF Summary: Higher-level library to access ELF
Group: System/Libraries Group: System/Libraries
@ -32,6 +34,7 @@ Patch4: libebl-prototype-fix.diff
Patch5: elfutils-uninitialized.diff Patch5: elfutils-uninitialized.diff
Patch6: elfutils-0.137-dwarf-header-check-fix.diff Patch6: elfutils-0.137-dwarf-header-check-fix.diff
Patch7: elfutils-0.148-dont-crash.diff Patch7: elfutils-0.148-dont-crash.diff
Patch8: elfutils-revert-portability-scanf.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: automake BuildRequires: automake
BuildRequires: bison BuildRequires: bison
@ -142,6 +145,7 @@ to develop applications that require these.
%patch5 -p1 %patch5 -p1
%patch6 -p1 %patch6 -p1
%patch7 -p1 %patch7 -p1
%patch8 -p1 -R
%build %build
# Change DATE/TIME macros to use last change time of elfutils.changes # Change DATE/TIME macros to use last change time of elfutils.changes