Update to 0.153.

This commit is contained in:
Mark J. Wielaard 2012-02-23 13:24:19 +01:00
parent 8641676d0d
commit 22346cb747
5 changed files with 743 additions and 187 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
/elfutils-0.152.tar.bz2 /elfutils-0.152.tar.bz2
/elfutils-0.153.tar.bz2

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,47 @@
--- elfutils/libdwfl/ChangeLog
+++ elfutils/libdwfl/ChangeLog
@@ -41,6 +41,11 @@
* dwfl_module_getdwarf.c (open_elf): Clear errno before CBFAIL.
Reported by Kurt Roeckx <kurt@roeckx.be>.
+2011-03-23 Petr Machata <pmachata@redhat.com>
+
+ * 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 @@
@ -865,7 +909,20 @@
#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.
@ -882,7 +939,7 @@
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.
@ -948,7 +1005,7 @@
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
} }
} }
@ -967,7 +1024,7 @@
{ {
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);
@ -1062,7 +1119,7 @@
{ {
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
@ -1165,7 +1222,7 @@
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. */
@ -1179,7 +1236,7 @@
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;
@ -1188,7 +1245,7 @@
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),
@ -1199,7 +1256,7 @@
?: 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);
@ -1209,10 +1266,16 @@
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"),
@ -1221,7 +1284,11 @@
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,
@ -1231,8 +1298,32 @@
+ 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"));
@ -1246,7 +1337,7 @@
/* 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);
@ -1263,7 +1354,7 @@
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"));
@ -1278,7 +1369,7 @@
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,
@ -1289,7 +1380,7 @@
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"));
@ -1305,7 +1396,7 @@
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,
@ -1316,13 +1407,14 @@
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));
@ -1332,7 +1424,13 @@
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,
@ -1342,8 +1440,12 @@
+ 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]];
@ -1362,7 +1464,7 @@
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,
@ -1373,7 +1475,17 @@
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;
} }
@ -1392,7 +1504,7 @@
"\ "\
--- 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;
} }
@ -1404,7 +1516,7 @@
/* 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). */
@ -1413,7 +1525,7 @@
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)
{ {
@ -1421,7 +1533,7 @@
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;
@ -1430,7 +1542,7 @@
/* 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))
{ {
@ -1439,7 +1551,7 @@
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)
@ -1452,7 +1564,7 @@
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))
{ {
@ -1461,7 +1573,7 @@
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)
{ {
@ -1470,7 +1582,7 @@
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. */
@ -1478,17 +1590,17 @@
+ 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)
{ {
@ -1497,7 +1609,7 @@
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;
@ -1507,7 +1619,7 @@
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. */
@ -1526,7 +1638,7 @@
/* 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));
@ -1535,7 +1647,7 @@
/* 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));
@ -1544,7 +1656,7 @@
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));
@ -1553,7 +1665,7 @@
/* 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);
@ -1577,7 +1689,7 @@
>= 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
{ {
@ -1586,7 +1698,7 @@
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;
} }
@ -1595,16 +1707,22 @@
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);
@ -1618,16 +1736,18 @@
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,7 +1,7 @@
Name: elfutils Name: elfutils
Summary: A collection of utilities and DSOs to handle compiled objects Summary: A collection of utilities and DSOs to handle compiled objects
Version: 0.152 Version: 0.153
%global baserelease 3 %global baserelease 1
URL: https://fedorahosted.org/elfutils/ URL: https://fedorahosted.org/elfutils/
%global source_url http://fedorahosted.org/releases/e/l/elfutils/%{version}/ %global source_url http://fedorahosted.org/releases/e/l/elfutils/%{version}/
License: GPLv2 with exceptions License: GPLv2 with exceptions
@ -218,9 +218,12 @@ RPM_OPT_FLAGS=${RPM_OPT_FLAGS/-Wall/}
# Some older glibc headers can run afoul of -Werror all by themselves. # Some older glibc headers can run afoul of -Werror all by themselves.
# Disabling the fancy inlines avoids those problems. # Disabling the fancy inlines avoids those problems.
RPM_OPT_FLAGS="$RPM_OPT_FLAGS -D__NO_INLINE__" RPM_OPT_FLAGS="$RPM_OPT_FLAGS -D__NO_INLINE__"
COMPAT_CONFIG_FLAGS="--disable-werror"
%else
COMPAT_CONFIG_FLAGS=""
%endif %endif
%configure CFLAGS="$RPM_OPT_FLAGS -fexceptions" || { %configure $COMPAT_CONFIG_FLAGS CFLAGS="$RPM_OPT_FLAGS -fexceptions" || {
cat config.log cat config.log
exit 2 exit 2
} }
@ -318,6 +321,15 @@ rm -rf ${RPM_BUILD_ROOT}
%{_libdir}/libelf.a %{_libdir}/libelf.a
%changelog %changelog
* Thu Feb 23 2012 Mark Wielaard <mjw@redhat.com> - 0.153-1
- Update to 0.153
- New --disable-werror for portability.
- Support for .zdebug sections (#679777)
- type_units and DW_AT_GNU_odr_signature support (#679815)
- low level support DW_OP_GNU_entry_value and DW_TAG_GNU_call_site (#688090)
- FTBFS on rawhide with gcc 4.7 (#783506)
- Remove gcc-4.7 patch
* Fri Jan 20 2012 Mark Wielaard <mjw@redhat.com> - 0.152-3 * Fri Jan 20 2012 Mark Wielaard <mjw@redhat.com> - 0.152-3
- Fixes for gcc-4.7 based on upstream commit 32899a (#783506). - Fixes for gcc-4.7 based on upstream commit 32899a (#783506).

View File

@ -1 +1 @@
39739ed58a0fa1862eff8735f111fe5c elfutils-0.152.tar.bz2 289a146182bc29f0236eaa15d8ebdf98 elfutils-0.153.tar.bz2