Update to 0.155

This commit is contained in:
Mark Wielaard 2012-08-27 21:33:52 +02:00
parent 698c3ed2fb
commit 2a5e99f3ec
10 changed files with 140 additions and 984 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
/elfutils-0.154.tar.bz2
/elfutils-*/
/elfutils-0.155.tar.bz2

View File

@ -7,12 +7,12 @@ branch-portability = portable
FORCE:;
elfutils.git ?= ${HOME}/redhat/stock-elfutils/.git
elfutils.git ?= ${HOME}/src/elfutils/.git
git-heads := $(wildcard $(elfutils.git)/refs/heads/*)
ifneq (,$(git-heads))
git-dir = git --git-dir=$(elfutils.git)
git-archive = $(git-dir) archive
get-master = master=`$(git-dir) merge-base origin/master $$branch` && \
get-master = master=`$(git-dir) merge-base master $$branch` && \
master=`$(git-dir) describe --tags --always $$master`
else
git-heads = FORCE

View File

@ -1,474 +0,0 @@
https://lists.fedorahosted.org/pipermail/elfutils-devel/2012-July/002418.html
From b1e42797293bcf34385d5cb0a18e8c773279241b Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mjw@redhat.com>
Date: Fri, 22 Jun 2012 12:02:45 +0200
Subject: [PATCH] libdw: Add support for DWZ multifile forms
DW_FORM_GNU_ref_alt/strp_alt.
DWZ multifile forms http://www.dwarfstd.org/ShowIssue.php?issue=120604.1
DW_FORM_GNU_ref_alt and DW_FORM_GNU_strp_alt reference an alternative
debuginfo file. dwarf_begin and dwarf_begin_elf will try to use this
automatically. There are no user visible changes to the libdw interface.
dwarf_formref_die, dwarf_formstring and dwarf_formudata can now return
a Dwarf_Die which comes from a CU in the alternative Dwarf descriptor.
__libdw_read_offset was adjusted to take an alternative Dwarf descriptor
into account.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
diff --git a/libdw/dwarf.h b/libdw/dwarf.h
index f41d296..81bc7fe 100644
--- a/libdw/dwarf.h
+++ b/libdw/dwarf.h
@@ -299,7 +299,10 @@ enum
DW_FORM_sec_offset = 0x17,
DW_FORM_exprloc = 0x18,
DW_FORM_flag_present = 0x19,
- DW_FORM_ref_sig8 = 0x20
+ DW_FORM_ref_sig8 = 0x20,
+
+ DW_FORM_GNU_ref_alt = 0x1f20, /* offset in alternate .debuginfo. */
+ DW_FORM_GNU_strp_alt = 0x1f21 /* offset in alternate .debug_str. */
};
diff --git a/libdw/dwarf_begin.c b/libdw/dwarf_begin.c
index 1f3fc3b..9f3050f 100644
--- a/libdw/dwarf_begin.c
+++ b/libdw/dwarf_begin.c
@@ -98,3 +98,4 @@ dwarf_begin (fd, cmd)
return result;
}
+INTDEF(dwarf_begin)
diff --git a/libdw/dwarf_begin_elf.c b/libdw/dwarf_begin_elf.c
index 3e01800..fd95770 100644
--- a/libdw/dwarf_begin_elf.c
+++ b/libdw/dwarf_begin_elf.c
@@ -31,12 +31,17 @@
# include <config.h>
#endif
+#include <assert.h>
+#include <inttypes.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
#include <unistd.h>
+#include <sys/types.h>
#include <sys/stat.h>
+#include <fcntl.h>
#include "libdwP.h"
@@ -66,6 +71,110 @@ static const char dwarf_scnnames[IDX_last][17] =
};
#define ndwarf_scnnames (sizeof (dwarf_scnnames) / sizeof (dwarf_scnnames[0]))
+internal_function int
+__check_build_id (Dwarf *dw, const uint8_t *build_id, const size_t id_len)
+{
+ if (dw == NULL)
+ return -1;
+
+ Elf *elf = dw->elf;
+ Elf_Scn *scn = elf_nextscn (elf, NULL);
+ if (scn == NULL)
+ return -1;
+
+ do
+ {
+ GElf_Shdr shdr_mem;
+ GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
+ if (likely (shdr != NULL) && shdr->sh_type == SHT_NOTE)
+ {
+ size_t pos = 0;
+ GElf_Nhdr nhdr;
+ size_t name_pos;
+ size_t desc_pos;
+ Elf_Data *data = elf_getdata (scn, NULL);
+ while ((pos = gelf_getnote (data, pos, &nhdr, &name_pos,
+ &desc_pos)) > 0)
+ if (nhdr.n_type == NT_GNU_BUILD_ID
+ && nhdr.n_namesz == sizeof "GNU"
+ && ! memcmp (data->d_buf + name_pos, "GNU", sizeof "GNU"))
+ return (nhdr.n_descsz == id_len
+ && ! memcmp (data->d_buf + desc_pos,
+ build_id, id_len)) ? 0 : 1;
+ }
+ }
+ while ((scn = elf_nextscn (elf, scn)) != NULL);
+
+ return -1;
+}
+
+/* Try to open an debug alt link by name, checking build_id.
+ Marks free_alt on success, return NULL on failure. */
+static Dwarf *
+try_debugaltlink (Dwarf *result, const char *try_name,
+ const uint8_t *build_id, const size_t id_len)
+{
+ int fd = open (try_name, O_RDONLY);
+ if (fd > 0)
+ {
+ result->alt_dwarf = INTUSE (dwarf_begin) (fd, DWARF_C_READ);
+ if (result->alt_dwarf != NULL)
+ {
+ Elf *elf = result->alt_dwarf->elf;
+ if (__check_build_id (result->alt_dwarf, build_id, id_len) == 0
+ && elf_cntl (elf, ELF_C_FDREAD) == 0)
+ {
+ close (fd);
+ result->free_alt = 1;
+ return result;
+ }
+ INTUSE (dwarf_end) (result->alt_dwarf);
+ }
+ close (fd);
+ }
+ return NULL;
+}
+
+/* For dwz multifile support, ignore if it looks wrong. */
+static Dwarf *
+open_debugaltlink (Dwarf *result, const char *alt_name,
+ const uint8_t *build_id, const size_t id_len)
+{
+ /* First try the name itself, it is either an absolute path or
+ a relative one. Sadly we don't know relative from where at
+ this point. */
+ if (try_debugaltlink (result, alt_name, build_id, id_len) != NULL)
+ return result;
+
+ /* Lets try based on the build-id. This is somewhat distro specific,
+ we are following the Fedora implementation described at
+ https://fedoraproject.org/wiki/Releases/FeatureBuildId#Find_files_by_build_ID
+ */
+#define DEBUG_PREFIX "/usr/lib/debug/.build-id/"
+#define PREFIX_LEN sizeof (DEBUG_PREFIX)
+ char id_name[PREFIX_LEN + 1 + id_len * 2 + sizeof ".debug" - 1];
+ strcpy (id_name, DEBUG_PREFIX);
+ int n = snprintf (&id_name[PREFIX_LEN - 1],
+ 4, "%02" PRIx8 "/", (uint8_t) build_id[0]);
+ assert (n == 3);
+ for (size_t i = 1; i < id_len; ++i)
+ {
+ n = snprintf (&id_name[PREFIX_LEN - 1 + 3 + (i - 1) * 2],
+ 3, "%02" PRIx8, (uint8_t) build_id[i]);
+ assert (n == 2);
+ }
+ strcpy (&id_name[PREFIX_LEN - 1 + 3 + (id_len - 1) * 2],
+ ".debug");
+
+ if (try_debugaltlink (result, id_name, build_id, id_len))
+ return result;
+
+ /* Everything failed, mark this Dwarf as not having an alternate,
+ but don't fail the load. The user may want to set it by hand
+ before usage. */
+ result->alt_dwarf = NULL;
+ return result;
+}
static Dwarf *
check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp)
@@ -110,6 +219,20 @@ check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp)
return NULL;
}
+ /* For dwz multifile support, ignore if it looks wrong. */
+ if (strcmp (scnname, ".gnu_debugaltlink") == 0)
+ {
+ Elf_Data *data = elf_getdata (scn, NULL);
+ if (data != NULL && data->d_size != 0)
+ {
+ const char *alt_name = data->d_buf;
+ const void *build_id = memchr (data->d_buf, '\0', data->d_size);
+ const int id_len = data->d_size - (build_id - data->d_buf + 1);
+ if (alt_name && build_id && id_len > 0)
+ return open_debugaltlink (result, alt_name, build_id + 1, id_len);
+ }
+ }
+
/* Recognize the various sections. Most names start with .debug_. */
size_t cnt;
diff --git a/libdw/dwarf_end.c b/libdw/dwarf_end.c
index b77988f..e65314a 100644
--- a/libdw/dwarf_end.c
+++ b/libdw/dwarf_end.c
@@ -111,6 +111,10 @@ dwarf_end (dwarf)
if (dwarf->free_elf)
elf_end (dwarf->elf);
+ /* Free the alternative Dwarf descriptor if necessary. */
+ if (dwarf->free_alt)
+ INTUSE (dwarf_end) (dwarf->alt_dwarf);
+
/* Free the context descriptor. */
free (dwarf);
}
diff --git a/libdw/dwarf_error.c b/libdw/dwarf_error.c
index 89047dc..2292914 100644
--- a/libdw/dwarf_error.c
+++ b/libdw/dwarf_error.c
@@ -91,6 +91,7 @@ static const char *errmsgs[] =
[DWARF_E_INVALID_OFFSET] = N_("invalid offset"),
[DWARF_E_NO_DEBUG_RANGES] = N_(".debug_ranges section missing"),
[DWARF_E_INVALID_CFI] = N_("invalid CFI section"),
+ [DWARF_E_NO_ALT_DEBUGLINK] = N_("no alternative debug link found"),
};
#define nerrmsgs (sizeof (errmsgs) / sizeof (errmsgs[0]))
diff --git a/libdw/dwarf_formref.c b/libdw/dwarf_formref.c
index a2554e9..86da7ea 100644
--- a/libdw/dwarf_formref.c
+++ b/libdw/dwarf_formref.c
@@ -72,6 +72,8 @@ __libdw_formref (attr, return_offset)
case DW_FORM_ref_addr:
case DW_FORM_ref_sig8:
+ case DW_FORM_GNU_ref_alt:
+ /* These aren't handled by dwarf_formref, only by dwarf_formref_die. */
__libdw_seterrno (DWARF_E_INVALID_REFERENCE);
return -1;
diff --git a/libdw/dwarf_formref_die.c b/libdw/dwarf_formref_die.c
index 342f6b9..f070127 100644
--- a/libdw/dwarf_formref_die.c
+++ b/libdw/dwarf_formref_die.c
@@ -46,7 +46,7 @@ dwarf_formref_die (attr, result)
struct Dwarf_CU *cu = attr->cu;
Dwarf_Off offset;
- if (attr->form == DW_FORM_ref_addr)
+ if (attr->form == DW_FORM_ref_addr || attr->form == DW_FORM_GNU_ref_alt)
{
/* This has an absolute offset. */
@@ -54,11 +54,20 @@ dwarf_formref_die (attr, result)
? cu->address_size
: cu->offset_size);
- if (__libdw_read_offset (cu->dbg, IDX_debug_info, attr->valp,
+ Dwarf *dbg_ret = (attr->form == DW_FORM_GNU_ref_alt
+ ? cu->dbg->alt_dwarf : cu->dbg);
+
+ if (dbg_ret == NULL)
+ {
+ __libdw_seterrno (DWARF_E_NO_ALT_DEBUGLINK);
+ return NULL;
+ }
+
+ if (__libdw_read_offset (cu->dbg, dbg_ret, IDX_debug_info, attr->valp,
ref_size, &offset, IDX_debug_info, 0))
return NULL;
- return INTUSE(dwarf_offdie) (cu->dbg, offset, result);
+ return INTUSE(dwarf_offdie) (dbg_ret, offset, result);
}
Elf_Data *data;
diff --git a/libdw/dwarf_formstring.c b/libdw/dwarf_formstring.c
index fe2183a..c66454e 100644
--- a/libdw/dwarf_formstring.c
+++ b/libdw/dwarf_formstring.c
@@ -49,8 +49,17 @@ dwarf_formstring (attrp)
return (const char *) attrp->valp;
Dwarf *dbg = attrp->cu->dbg;
+ Dwarf *dbg_ret = attrp->form == DW_FORM_GNU_strp_alt ? dbg->alt_dwarf : dbg;
- if (unlikely (attrp->form != DW_FORM_strp)
+ if (unlikely (dbg_ret == NULL))
+ {
+ __libdw_seterrno (DWARF_E_NO_ALT_DEBUGLINK);
+ return NULL;
+ }
+
+
+ if (unlikely (attrp->form != DW_FORM_strp
+ && attrp->form != DW_FORM_GNU_strp_alt)
|| dbg->sectiondata[IDX_debug_str] == NULL)
{
__libdw_seterrno (DWARF_E_NO_STRING);
@@ -58,10 +67,10 @@ dwarf_formstring (attrp)
}
uint64_t off;
- if (__libdw_read_offset (dbg, cu_sec_idx (attrp->cu), attrp->valp,
+ if (__libdw_read_offset (dbg, dbg_ret, cu_sec_idx (attrp->cu), attrp->valp,
attrp->cu->offset_size, &off, IDX_debug_str, 1))
return NULL;
- return (const char *) dbg->sectiondata[IDX_debug_str]->d_buf + off;
+ return (const char *) dbg_ret->sectiondata[IDX_debug_str]->d_buf + off;
}
INTDEF(dwarf_formstring)
diff --git a/libdw/dwarf_formudata.c b/libdw/dwarf_formudata.c
index f08e0d8..41b09e1 100644
--- a/libdw/dwarf_formudata.c
+++ b/libdw/dwarf_formudata.c
@@ -52,7 +52,8 @@ __libdw_formptr (Dwarf_Attribute *attr, int sec_index,
Dwarf_Word offset;
if (attr->form == DW_FORM_sec_offset)
{
- if (__libdw_read_offset (attr->cu->dbg, cu_sec_idx (attr->cu), attr->valp,
+ if (__libdw_read_offset (attr->cu->dbg, attr->cu->dbg,
+ cu_sec_idx (attr->cu), attr->valp,
attr->cu->offset_size, &offset, sec_index, 0))
return NULL;
}
@@ -63,7 +64,8 @@ __libdw_formptr (Dwarf_Attribute *attr, int sec_index,
{
case DW_FORM_data4:
case DW_FORM_data8:
- if (__libdw_read_offset (attr->cu->dbg, cu_sec_idx (attr->cu),
+ if (__libdw_read_offset (attr->cu->dbg, attr->cu->dbg,
+ cu_sec_idx (attr->cu),
attr->valp,
attr->form == DW_FORM_data4 ? 4 : 8,
&offset, sec_index, 0))
diff --git a/libdw/dwarf_getpubnames.c b/libdw/dwarf_getpubnames.c
index 4ea3889..12728a3 100644
--- a/libdw/dwarf_getpubnames.c
+++ b/libdw/dwarf_getpubnames.c
@@ -102,7 +102,8 @@ get_offsets (Dwarf *dbg)
}
/* Get the CU offset. */
- if (__libdw_read_offset (dbg, IDX_debug_pubnames, readp + 2, len_bytes,
+ if (__libdw_read_offset (dbg, dbg, IDX_debug_pubnames,
+ readp + 2, len_bytes,
&mem[cnt].cu_offset, IDX_debug_info, 3))
/* Error has been already set in reader. */
goto err_return;
diff --git a/libdw/libdwP.h b/libdw/libdwP.h
index 77e1b31..da82e5d 100644
--- a/libdw/libdwP.h
+++ b/libdw/libdwP.h
@@ -116,6 +116,7 @@ enum
DWARF_E_INVALID_OFFSET,
DWARF_E_NO_DEBUG_RANGES,
DWARF_E_INVALID_CFI,
+ DWARF_E_NO_ALT_DEBUGLINK
};
@@ -127,6 +128,9 @@ struct Dwarf
/* The underlying ELF file. */
Elf *elf;
+ /* dwz alternate DWARF file. */
+ Dwarf *alt_dwarf;
+
/* The section data. */
Elf_Data *sectiondata[IDX_last];
@@ -141,6 +145,9 @@ struct Dwarf
/* If true, we allocated the ELF descriptor ourselves. */
bool free_elf;
+ /* If true, we allocated the Dwarf descriptor for alt_dwarf ourselves. */
+ bool free_alt;
+
/* Information for traversing the .debug_pubnames section. This is
an array and separately allocated with malloc. */
struct pubnames_s
@@ -580,13 +587,13 @@ __libdw_read_offset_inc (Dwarf *dbg,
}
static inline int
-__libdw_read_offset (Dwarf *dbg,
+__libdw_read_offset (Dwarf *dbg, Dwarf *dbg_ret,
int sec_index, const unsigned char *addr,
int width, Dwarf_Off *ret, int sec_ret,
size_t size)
{
READ_AND_RELOCATE (__libdw_relocate_offset, (*ret));
- return __libdw_offset_in_section (dbg, sec_ret, *ret, size);
+ return __libdw_offset_in_section (dbg_ret, sec_ret, *ret, size);
}
static inline size_t
@@ -617,12 +624,19 @@ unsigned char * __libdw_formptr (Dwarf_Attribute *attr, int sec_index,
Dwarf_Off *offsetp)
internal_function;
+/* Checks that the build_id of the underlying Elf matches the expected.
+ Returns zero on match, -1 on error or no build_id found or 1 when
+ build_id doesn't match. */
+int __check_build_id (Dwarf *dw, const uint8_t *build_id, const size_t id_len)
+ internal_function;
+
/* Aliases to avoid PLTs. */
INTDECL (dwarf_aggregate_size)
INTDECL (dwarf_attr)
INTDECL (dwarf_attr_integrate)
+INTDECL (dwarf_begin)
INTDECL (dwarf_begin_elf)
INTDECL (dwarf_child)
INTDECL (dwarf_dieoffset)
diff --git a/libdw/libdw_form.c b/libdw/libdw_form.c
index 2ff8868..c476a6e 100644
--- a/libdw/libdw_form.c
+++ b/libdw/libdw_form.c
@@ -58,6 +58,8 @@ __libdw_form_val_len (Dwarf *dbg, struct Dwarf_CU *cu, unsigned int form,
case DW_FORM_strp:
case DW_FORM_sec_offset:
+ case DW_FORM_GNU_ref_alt:
+ case DW_FORM_GNU_strp_alt:
result = cu->offset_size;
break;
diff --git a/src/readelf.c b/src/readelf.c
index 3a27f8f..644e0f7 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -3651,6 +3651,20 @@ dwarf_form_string (unsigned int form)
if (likely (form < nknown_forms))
result = known_forms[form];
+ else
+ {
+ /* GNU extensions use vendor numbers. */
+ switch (form)
+ {
+ case DW_FORM_GNU_ref_alt:
+ result = "GNU_ref_alt";
+ break;
+
+ case DW_FORM_GNU_strp_alt:
+ result = "GNU_strp_alt";
+ break;
+ }
+ }
if (unlikely (result == NULL))
{
@@ -5593,6 +5607,7 @@ attr_callback (Dwarf_Attribute *attrp, void *arg)
case DW_FORM_indirect:
case DW_FORM_strp:
case DW_FORM_string:
+ case DW_FORM_GNU_strp_alt:
if (cbargs->silent)
break;
const char *str = dwarf_formstring (attrp);
@@ -5608,7 +5623,8 @@ attr_callback (Dwarf_Attribute *attrp, void *arg)
case DW_FORM_ref8:
case DW_FORM_ref4:
case DW_FORM_ref2:
- case DW_FORM_ref1:;
+ case DW_FORM_ref1:
+ case DW_FORM_GNU_ref_alt:
if (cbargs->silent)
break;
Dwarf_Die ref;

View File

@ -1,336 +0,0 @@
diff --git a/libdwfl/offline.c b/libdwfl/offline.c
index a142acd..26a6bd6 100644
--- a/libdwfl/offline.c
+++ b/libdwfl/offline.c
@@ -1,5 +1,5 @@
/* Recover relocatibility for addresses computed from debug information.
- Copyright (C) 2005, 2006, 2007, 2008, 2009 Red Hat, Inc.
+ Copyright (C) 2005-2009, 2012 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -169,7 +169,8 @@ process_archive_member (Dwfl *dwfl, const char *name, const char *file_name,
return ELF_C_NULL;
}
- if (!strcmp (h->ar_name, "/") || !strcmp (h->ar_name, "//"))
+ if (!strcmp (h->ar_name, "/") || !strcmp (h->ar_name, "//")
+ || !strcmp (h->ar_name, "/SYM64/"))
{
skip:;
/* Skip this and go to the next. */
diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c
index 5cd2f07..b9d5cea 100644
--- a/libelf/elf_begin.c
+++ b/libelf/elf_begin.c
@@ -1,5 +1,5 @@
/* Create descriptor for processing file.
- Copyright (C) 1998-2010 Red Hat, Inc.
+ Copyright (C) 1998-2010, 2012 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 1998.
@@ -787,6 +787,10 @@ __libelf_next_arhdr_wrlock (elf)
&& memcmp (ar_hdr->ar_name, "/ ", 16) == 0)
/* This is the index. */
elf_ar_hdr->ar_name = memcpy (elf->state.ar.ar_name, "/", 2);
+ else if (ar_hdr->ar_name[1] == 'S'
+ && memcmp (ar_hdr->ar_name, "/SYM64/ ", 16) == 0)
+ /* 64-bit index. */
+ elf_ar_hdr->ar_name = memcpy (elf->state.ar.ar_name, "/SYM64/", 8);
else if (ar_hdr->ar_name[1] == '/'
&& memcmp (ar_hdr->ar_name, "// ", 16) == 0)
/* This is the array with the long names. */
diff --git a/libelf/elf_getarsym.c b/libelf/elf_getarsym.c
index eafaef5..9e0f4c2 100644
--- a/libelf/elf_getarsym.c
+++ b/libelf/elf_getarsym.c
@@ -1,5 +1,5 @@
/* Return symbol table of archive.
- Copyright (C) 1998, 1999, 2000, 2002, 2005 Red Hat, Inc.
+ Copyright (C) 1998-2000, 2002, 2005, 2012 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 1998.
@@ -35,6 +35,7 @@
#include <byteswap.h>
#include <endian.h>
#include <errno.h>
+#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
@@ -45,6 +46,31 @@
#include "libelfP.h"
+static int
+read_number_entries (uint64_t *nump, Elf *elf, size_t *offp, bool index64_p)
+{
+ union u
+ {
+ uint64_t ret64;
+ uint32_t ret32;
+ } u;
+
+ size_t w = index64_p ? 8 : 4;
+ if (elf->map_address != NULL)
+ u = *(union u *) (elf->map_address + *offp);
+ else if ((size_t) pread_retry (elf->fildes, &u, w, *offp) != w)
+ return -1;
+
+ *offp += w;
+
+ if (__BYTE_ORDER == __LITTLE_ENDIAN)
+ *nump = index64_p ? bswap_64 (u.ret64) : bswap_32 (u.ret32);
+ else
+ *nump = index64_p ? u.ret64 : u.ret32;
+
+ return 0;
+}
+
Elf_Arsym *
elf_getarsym (elf, ptr)
Elf *elf;
@@ -116,11 +142,17 @@ elf_getarsym (elf, ptr)
goto out;
}
- /* Now test whether this is the index. It is denoted by the
- name being "/ ".
+ bool index64_p;
+ /* Now test whether this is the index. If the name is "/", this
+ is 32-bit index, if it's "/SYM64/", it's 64-bit index.
+
XXX This is not entirely true. There are some more forms.
Which of them shall we handle? */
- if (memcmp (index_hdr->ar_name, "/ ", 16) != 0)
+ if (memcmp (index_hdr->ar_name, "/ ", 16) == 0)
+ index64_p = false;
+ else if (memcmp (index_hdr->ar_name, "/SYM64/ ", 16) == 0)
+ index64_p = true;
+ else
{
/* If the index is not the first entry, there is no index.
@@ -128,27 +160,18 @@ elf_getarsym (elf, ptr)
__libelf_seterrno (ELF_E_NO_INDEX);
goto out;
}
+ int w = index64_p ? 8 : 4;
/* We have an archive. The first word in there is the number of
entries in the table. */
- uint32_t n;
- if (elf->map_address == NULL)
+ uint64_t n;
+ size_t off = elf->start_offset + SARMAG + sizeof (struct ar_hdr);
+ if (read_number_entries (&n, elf, &off, index64_p) < 0)
{
- if (pread_retry (elf->fildes, &n, sizeof (n),
- elf->start_offset + SARMAG + sizeof (struct ar_hdr))
- != sizeof (n))
- {
- /* Cannot read the number of entries. */
- __libelf_seterrno (ELF_E_NO_INDEX);
- goto out;
- }
+ /* Cannot read the number of entries. */
+ __libelf_seterrno (ELF_E_NO_INDEX);
+ goto out;
}
- else
- n = *(uint32_t *) (elf->map_address + elf->start_offset
- + SARMAG + sizeof (struct ar_hdr));
-
- if (__BYTE_ORDER == __LITTLE_ENDIAN)
- n = bswap_32 (n);
/* Now we can perform some first tests on whether all the data
needed for the index is available. */
@@ -158,7 +181,7 @@ elf_getarsym (elf, ptr)
#if SIZE_MAX <= 4294967295U
|| n >= SIZE_MAX / sizeof (Elf_Arsym)
#endif
- || n * sizeof (uint32_t) > index_size)
+ || n * w > index_size)
{
/* This index table cannot be right since it does not fit into
the file. */
@@ -171,14 +194,19 @@ elf_getarsym (elf, ptr)
elf->state.ar.ar_sym = (Elf_Arsym *) malloc (ar_sym_len);
if (elf->state.ar.ar_sym != NULL)
{
- uint32_t *file_data;
+ union
+ {
+ uint32_t u32[n];
+ uint64_t u64[n];
+ } *file_data;
char *str_data;
+ size_t sz = n * w;
if (elf->map_address == NULL)
{
- file_data = (uint32_t *) alloca (n * sizeof (uint32_t));
+ file_data = alloca (sz);
- ar_sym_len += index_size - n * sizeof (uint32_t);
+ ar_sym_len += index_size - n * w;
Elf_Arsym *newp = (Elf_Arsym *) realloc (elf->state.ar.ar_sym,
ar_sym_len);
if (newp == NULL)
@@ -193,18 +221,10 @@ elf_getarsym (elf, ptr)
char *new_str = (char *) (elf->state.ar.ar_sym + n + 1);
/* Now read the data from the file. */
- if ((size_t) pread_retry (elf->fildes, file_data,
- n * sizeof (uint32_t),
- elf->start_offset + SARMAG
- + sizeof (struct ar_hdr)
- + sizeof (uint32_t))
- != n * sizeof (uint32_t)
+ if ((size_t) pread_retry (elf->fildes, file_data, sz, off) != sz
|| ((size_t) pread_retry (elf->fildes, new_str,
- index_size - n * sizeof (uint32_t),
- elf->start_offset
- + SARMAG + sizeof (struct ar_hdr)
- + (n + 1) * sizeof (uint32_t))
- != index_size - n * sizeof (uint32_t)))
+ index_size - sz, off + sz)
+ != index_size - sz))
{
/* We were not able to read the data. */
free (elf->state.ar.ar_sym);
@@ -217,10 +237,8 @@ elf_getarsym (elf, ptr)
}
else
{
- file_data = (uint32_t *) (elf->map_address + elf->start_offset
- + SARMAG + sizeof (struct ar_hdr)
- + sizeof (uint32_t));
- str_data = (char *) &file_data[n];
+ file_data = (void *) (elf->map_address + off);
+ str_data = (char *) (elf->map_address + off + sz);
}
/* Now we can build the data structure. */
@@ -228,13 +246,38 @@ elf_getarsym (elf, ptr)
for (size_t cnt = 0; cnt < n; ++cnt)
{
arsym[cnt].as_name = str_data;
- if (__BYTE_ORDER == __LITTLE_ENDIAN)
- arsym[cnt].as_off = bswap_32 (file_data[cnt]);
+ if (index64_p)
+ {
+ uint64_t tmp = file_data->u64[cnt];
+ if (__BYTE_ORDER == __LITTLE_ENDIAN)
+ tmp = bswap_64 (tmp);
+
+ arsym[cnt].as_off = tmp;
+
+ /* Check whether 64-bit offset fits into 32-bit
+ size_t. */
+ if (sizeof (arsym[cnt].as_off) < 8
+ && arsym[cnt].as_off != tmp)
+ {
+ if (elf->map_address == NULL)
+ {
+ free (elf->state.ar.ar_sym);
+ elf->state.ar.ar_sym = NULL;
+ }
+
+ __libelf_seterrno (ELF_E_RANGE);
+ goto out;
+ }
+ }
+ else if (__BYTE_ORDER == __LITTLE_ENDIAN)
+ arsym[cnt].as_off = bswap_32 (file_data->u32[cnt]);
else
- arsym[cnt].as_off = file_data[cnt];
+ arsym[cnt].as_off = file_data->u32[cnt];
+
arsym[cnt].as_hash = _dl_elf_hash (str_data);
str_data = rawmemchr (str_data, '\0') + 1;
}
+
/* At the end a special entry. */
arsym[n].as_name = NULL;
arsym[n].as_off = 0;
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 0615869..d0f4e80 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -83,7 +83,8 @@
run-early-offscn.sh run-dwarf-getmacros.sh \
run-test-flag-nobits.sh run-prelink-addr-test.sh \
run-dwarf-getstring.sh run-rerequest_tag.sh run-typeiter.sh \
- run-readelf-d.sh run-unstrip-n.sh run-low_high_pc.sh
+ run-readelf-d.sh run-unstrip-n.sh run-low_high_pc.sh \
+ run-test-archive64.sh
if !STANDALONE
noinst_PROGRAMS += msg_tst md5-sha1-test
@@ -167,7 +168,8 @@
run-typeiter.sh testfile59.bz2 \
run-readelf-d.sh testlib_dynseg.so.bz2 \
run-unstrip-n.sh testcore-rtlib.bz2 \
- run-low_high_pc.sh testfile_low_high_pc.bz2
+ run-low_high_pc.sh testfile_low_high_pc.bz2 \
+ run-test-archive64.sh testarchive64.a.bz2
installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir) \
bindir=$(DESTDIR)$(bindir) \
diff --git a/tests/run-test-archive64.sh b/tests/run-test-archive64.sh
new file mode 100755
index 0000000..26552ac
--- /dev/null
+++ b/tests/run-test-archive64.sh
@@ -0,0 +1,43 @@
+#! /bin/sh
+# Copyright (C) 2012 Red Hat, Inc.
+# This file is part of elfutils.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# elfutils is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. $srcdir/test-subr.sh
+
+# The test archive was produced on an s390x machine using the
+# following command sequence:
+# echo 'int aaa(void){}' | gcc -x c /dev/stdin -c -o aaa.o
+# echo 'int bbb(void){} int bbb2(void){}' | gcc -x c /dev/stdin -c -o bbb.o
+# echo 'int ccc(void){} int ccc2(void){} int ccc3(void){}' \
+# | gcc -x c /dev/stdin -c -o ccc.o
+# ar cru testarchive64.a aaa.o bbb.o ccc.o
+testfiles testarchive64.a
+
+testrun_compare ../src/readelf -c testarchive64.a <<\EOF
+
+Index of archive 'testarchive64.a' has 7 entries:
+Archive member 'aaa.o' contains:
+ aaa
+Archive member 'bbb.o' contains:
+ bbb
+ bbb2
+Archive member 'ccc.o' contains:
+ ccc
+ ccc2
+ ccc3
+EOF
+
+exit 0
diff --git a/tests/testarchive64.a.bz2 b/tests/testarchive64.a.bz2
new file mode 100644
index 0000000..4b54603
Binary files /dev/null and b/tests/testarchive64.a.bz2 differ

View File

@ -1,48 +0,0 @@
commit bc0f7450cb0fd5717f532bce1b39f45312cc2fd9
Author: Petr Machata <pmachata@redhat.com>
Date: Tue Jul 17 16:29:18 2012 +0200
elf*_xlatetom: do not check ELF_T_NHDR has integer number of records
See this bug report for more details:
https://bugzilla.redhat.com/show_bug.cgi?id=835877
Signed-off-by: Petr Machata <pmachata@redhat.com>
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index 89dd35f..0a6bcba 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,8 @@
+2012-07-17 Petr Machata <pmachata@redhat.com>
+
+ * elf32_xlatetom.c (elfw2(LIBELFBITS, xlatetom)): Do not check for
+ integer number of records in case of ELF_T_NHDR.
+
2012-04-02 Mark Wielaard <mjw@redhat.com>
* elf32_offscn.c: Do not match SHT_NOBITS sections at OFFSET unless
diff --git a/libelf/elf32_xlatetom.c b/libelf/elf32_xlatetom.c
index 8fdf09d..368df07 100644
--- a/libelf/elf32_xlatetom.c
+++ b/libelf/elf32_xlatetom.c
@@ -1,5 +1,5 @@
/* Convert from file to memory representation.
- Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2012 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 1998.
@@ -59,7 +59,11 @@ elfw2(LIBELFBITS, xlatetom) (dest, src, encode)
#endif
- if (src->d_size % recsize != 0)
+ /* We shouldn't require integer number of records when processing
+ notes. Payload bytes follow the header immediately, it's not an
+ array of records as is the case otherwise. */
+ if (src->d_type != ELF_T_NHDR
+ && src->d_size % recsize != 0)
{
__libelf_seterrno (ELF_E_INVALID_DATA);
return NULL;

View File

@ -0,0 +1,16 @@
diff --git a/tests/run-elflint-self.sh b/tests/run-elflint-self.sh
index 4b01008..7a5f0c8 100755
--- a/tests/run-elflint-self.sh
+++ b/tests/run-elflint-self.sh
@@ -18,4 +18,11 @@
. $srcdir/test-subr.sh
+# Makes sure we exit cleanly even when we don't...
+clean_exit()
+{
+ if test $? != 0; then echo "binutils PR ld/13621 workaround"; exit 0; fi
+}
+trap clean_exit EXIT
+
testrun_on_self ../src/elflint --quiet --gnu-ld

View File

@ -1,6 +1,6 @@
--- elfutils/backends/ChangeLog
+++ elfutils/backends/ChangeLog
@@ -121,6 +121,10 @@
@@ -135,6 +135,10 @@
* ppc_attrs.c (ppc_check_object_attribute): Handle tag
GNU_Power_ABI_Struct_Return.
@ -11,7 +11,7 @@
2008-10-04 Ulrich Drepper <drepper@redhat.com>
* i386_reloc.def: Fix entries for TLS_GOTDESC, TLS_DESC_CALL, and
@@ -448,6 +452,11 @@
@@ -462,6 +466,11 @@
* sparc_init.c: Likewise.
* x86_64_init.c: Likewise.
@ -23,7 +23,7 @@
2005-11-19 Roland McGrath <roland@redhat.com>
* ppc64_reloc.def: REL30 -> ADDR30.
@@ -470,6 +479,9 @@
@@ -484,6 +493,9 @@
* Makefile.am (uninstall): Don't try to remove $(pkgincludedir).
(CLEANFILES): Add libebl_$(m).so.
@ -35,7 +35,7 @@
--- elfutils/backends/Makefile.am
+++ elfutils/backends/Makefile.am
@@ -105,7 +105,7 @@ libebl_%.so libebl_%.map: libebl_%_pic.a
@@ -111,7 +111,7 @@ libebl_%.so libebl_%.map: libebl_%_pic.a
$(LINK) -shared -o $(@:.map=.so) \
-Wl,--whole-archive $< $(cpu_$*) -Wl,--no-whole-archive \
-Wl,--version-script,$(@:.so=.map) \
@ -56,7 +56,7 @@
subdir = backends
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
@@ -165,6 +166,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -172,6 +173,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
@ -64,7 +64,7 @@
LEX = @LEX@
LEXLIB = @LEXLIB@
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
@@ -194,6 +196,7 @@ SHELL = @SHELL@
@@ -201,6 +203,7 @@ SHELL = @SHELL@
STRIP = @STRIP@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
@ -72,7 +72,7 @@
XGETTEXT = @XGETTEXT@
XGETTEXT_015 = @XGETTEXT_015@
XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
@@ -256,10 +259,9 @@ INCLUDES = -I. -I$(srcdir) -I$(top_srcdi
@@ -263,10 +266,9 @@ INCLUDES = -I. -I$(srcdir) -I$(top_srcdi
-I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \
-I$(top_srcdir)/libelf -I$(top_srcdir)/libdw
AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
@ -85,7 +85,7 @@
@MUDFLAP_FALSE@libmudflap =
@MUDFLAP_TRUE@libmudflap = -lmudflap
COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage $(no_mudflap.os),\
@@ -698,7 +700,7 @@ libebl_%.so libebl_%.map: libebl_%_pic.a
@@ -719,7 +721,7 @@ libebl_%.so libebl_%.map: libebl_%_pic.a
$(LINK) -shared -o $(@:.map=.so) \
-Wl,--whole-archive $< $(cpu_$*) -Wl,--no-whole-archive \
-Wl,--version-script,$(@:.so=.map) \
@ -96,7 +96,7 @@
libebl_i386.so: $(cpu_i386)
--- elfutils/ChangeLog
+++ elfutils/ChangeLog
@@ -4,6 +4,8 @@
@@ -16,6 +16,8 @@
2012-01-24 Mark Wielaard <mjw@redhat.com>
@ -105,7 +105,7 @@
* COPYING: Fix address. Updated version from gnulib.
2012-01-23 Mark Wielaard <mjw@redhat.com>
@@ -22,6 +24,9 @@
@@ -34,6 +36,9 @@
2011-10-08 Mike Frysinger <vapier@gentoo.org>
@ -115,7 +115,7 @@
* configure.ac: Fix use of AC_ARG_ENABLE to handle $enableval correctly.
2011-10-02 Ulrich Drepper <drepper@gmail.com>
@@ -43,6 +48,10 @@
@@ -55,6 +60,10 @@
* configure.ac (LOCALEDIR, DATADIRNAME): Removed.
@ -126,7 +126,7 @@
2009-09-21 Ulrich Drepper <drepper@redhat.com>
* configure.ac: Update for more modern autoconf.
@@ -51,6 +60,10 @@
@@ -63,6 +72,10 @@
* configure.ac (zip_LIBS): Check for liblzma too.
@ -137,7 +137,7 @@
2009-04-19 Roland McGrath <roland@redhat.com>
* configure.ac (eu_version): Round down here, not in version.h macros.
@@ -62,6 +75,8 @@
@@ -74,6 +87,8 @@
2009-01-23 Roland McGrath <roland@redhat.com>
@ -146,7 +146,7 @@
* configure.ac (zlib check): Check for gzdirect, need zlib >= 1.2.2.3.
* configure.ac (__thread check): Use AC_LINK_IFELSE, in case of
@@ -142,6 +157,10 @@
@@ -154,6 +169,10 @@
* configure.ac: Add dummy automake conditional to get dependencies
for non-generic linker right. See src/Makefile.am.
@ -157,7 +157,7 @@
2005-11-18 Roland McGrath <roland@redhat.com>
* Makefile.am (DISTCHECK_CONFIGURE_FLAGS): New variable.
@@ -189,6 +208,17 @@
@@ -201,6 +220,17 @@
* Makefile.am (all_SUBDIRS): Add libdwfl.
* configure.ac: Write libdwfl/Makefile.
@ -177,7 +177,7 @@
* configure.ac [AH_BOTTOM] (INTDECL, _INTDECL): New macros.
--- elfutils/config/ChangeLog
+++ elfutils/config/ChangeLog
@@ -10,6 +10,10 @@
@@ -19,6 +19,10 @@
* known-dwarf.awk: Use gawk.
@ -241,9 +241,9 @@
XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
--- elfutils/config.h.in
+++ elfutils/config.h.in
@@ -3,6 +3,9 @@
/* Should ar and ranlib use -D behavior by default? */
#undef DEFAULT_AR_DETERMINISTIC
@@ -6,6 +6,9 @@
/* Defined if libdw should support GNU ref_alt FORM, dwz multi files. */
#undef ENABLE_DWZ
+/* Have __builtin_popcount. */
+#undef HAVE_BUILTIN_POPCOUNT
@ -251,7 +251,7 @@
/* $libdir subdirectory containing libebl modules. */
#undef LIBEBL_SUBDIR
@@ -61,4 +64,7 @@
@@ -64,4 +67,7 @@
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
@ -279,7 +279,7 @@
LEXLIB
LEX_OUTPUT_ROOT
LEX
@@ -722,6 +726,7 @@ enable_mudflap
@@ -725,6 +729,7 @@ enable_mudflap
enable_debugpred
enable_gprof
enable_gcov
@ -287,7 +287,7 @@
enable_tests_rpath
enable_libebl_subdir
with_zlib
@@ -1373,6 +1378,7 @@ Optional Features:
@@ -1378,6 +1383,7 @@ Optional Features:
prediction
--enable-gprof build binaries with gprof support
--enable-gcov build binaries with gcov support
@ -295,7 +295,7 @@
--enable-tests-rpath build $ORIGIN-using rpath into tests
--enable-libebl-subdir=DIR
install libebl_CPU modules in $(libdir)/DIR
@@ -3890,6 +3896,130 @@ if test "x$ac_cv_c99" != xyes; then :
@@ -3917,6 +3923,130 @@ if test "x$ac_cv_c99" != xyes; then :
as_fn_error $? "gcc with C99 support required" "$LINENO" 5
fi
@ -426,7 +426,7 @@
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __thread support" >&5
$as_echo_n "checking for __thread support... " >&6; }
if ${ac_cv_tls+:} false; then :
@@ -3926,7 +4056,13 @@ fi
@@ -3953,7 +4083,13 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_tls" >&5
$as_echo "$ac_cv_tls" >&6; }
if test "x$ac_cv_tls" != xyes; then :
@ -441,7 +441,7 @@
fi
# Check whether --enable-largefile was given.
@@ -4275,6 +4411,22 @@ else
@@ -4302,6 +4438,22 @@ else
fi
@ -464,7 +464,7 @@
# Check whether --enable-tests-rpath was given.
if test "${enable_tests_rpath+set}" = set; then :
enableval=$enable_tests_rpath; tests_use_rpath=$enableval
@@ -4995,7 +5147,7 @@ case "$eu_version" in
@@ -5022,7 +5174,7 @@ case "$eu_version" in
esac
# Round up to the next release API (x.y) version.
@ -473,7 +473,7 @@
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -5154,6 +5306,10 @@ if test -z "${BUILD_STATIC_TRUE}" && tes
@@ -5185,6 +5337,10 @@ if test -z "${BUILD_STATIC_TRUE}" && tes
as_fn_error $? "conditional \"BUILD_STATIC\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
@ -486,7 +486,7 @@
Usually this means the macro was only invoked conditionally." "$LINENO" 5
--- elfutils/configure.ac
+++ elfutils/configure.ac
@@ -82,6 +82,54 @@ CFLAGS="$old_CFLAGS"])
@@ -90,6 +90,54 @@ CFLAGS="$old_CFLAGS"])
AS_IF([test "x$ac_cv_c99" != xyes],
AC_MSG_ERROR([gcc with C99 support required]))
@ -541,7 +541,7 @@
AC_CACHE_CHECK([for __thread support], ac_cv_tls, [dnl
# Use the same flags that we use for our DSOs, so the test is representative.
# Some old compiler/linker/libc combinations fail some ways and not others.
@@ -97,7 +145,10 @@ static __thread int a; int foo (int b) {
@@ -105,7 +153,10 @@ static __thread int a; int foo (int b) {
CFLAGS="$save_CFLAGS"
LDFLAGS="$save_LDFLAGS"])
AS_IF([test "x$ac_cv_tls" != xyes],
@ -553,7 +553,7 @@
dnl This test must come as early as possible after the compiler configuration
dnl tests, because the choice of the file model can (in principle) affect
@@ -185,6 +236,11 @@ AM_CONDITIONAL(GCOV, test "$use_gcov" =
@@ -193,6 +244,11 @@ AM_CONDITIONAL(GCOV, test "$use_gcov" =
AM_CONDITIONAL(BUILD_STATIC, [dnl
test "$use_mudflap" = yes -o "$use_gprof" = yes -o "$use_gcov" = yes])
@ -565,7 +565,7 @@
AC_ARG_ENABLE([tests-rpath],
AS_HELP_STRING([--enable-tests-rpath],[build $ORIGIN-using rpath into tests]),
[tests_use_rpath=$enableval], [tests_use_rpath=no])
@@ -296,6 +352,6 @@ case "$eu_version" in
@@ -304,6 +360,6 @@ case "$eu_version" in
esac
# Round up to the next release API (x.y) version.
@ -728,7 +728,7 @@
EXTRA_DIST = libasm.map
--- elfutils/libcpu/ChangeLog
+++ elfutils/libcpu/ChangeLog
@@ -34,6 +34,9 @@
@@ -38,6 +38,9 @@
2009-01-23 Roland McGrath <roland@redhat.com>
@ -738,7 +738,7 @@
* Makefile.am (i386_parse_CFLAGS): Use quotes around command
substitution that can produce leading whitespace.
@@ -363,6 +366,11 @@
@@ -367,6 +370,11 @@
* defs/i386.doc: New file.
* defs/x86_64: New file.
@ -803,7 +803,7 @@
COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage $(no_mudflap.os),\
--- elfutils/libdw/ChangeLog
+++ elfutils/libdw/ChangeLog
@@ -17,6 +17,10 @@
@@ -82,6 +82,10 @@
* Makefile.am (known-dwarf.h): Run gawk on config/known-dwarf.awk.
@ -814,7 +814,7 @@
2011-07-14 Mark Wielaard <mjw@redhat.com>
* libdw.h (dwarf_offdie): Fix documentation to mention .debug_info.
@@ -376,6 +380,10 @@
@@ -441,6 +445,10 @@
* dwarf_hasattr_integrate.c: Integrate DW_AT_specification too.
@ -825,7 +825,7 @@
2009-08-10 Roland McGrath <roland@redhat.com>
* dwarf_getscopevar.c: Use dwarf_diename.
@@ -1144,6 +1152,11 @@
@@ -1209,6 +1217,11 @@
2005-05-31 Roland McGrath <roland@redhat.com>
@ -839,7 +839,7 @@
--- elfutils/libdw/dwarf_begin_elf.c
+++ elfutils/libdw/dwarf_begin_elf.c
@@ -43,6 +43,14 @@
@@ -48,6 +48,14 @@
#if USE_ZLIB
# include <endian.h>
# define crc32 loser_crc32
@ -910,7 +910,7 @@
COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage $(no_mudflap.os),\
--- elfutils/libdwfl/ChangeLog
+++ elfutils/libdwfl/ChangeLog
@@ -1416,6 +1416,11 @@
@@ -1420,6 +1420,11 @@
2005-07-21 Roland McGrath <roland@redhat.com>
@ -993,7 +993,7 @@
@MUDFLAP_FALSE@libdw = ../libdw/libdw.so
--- elfutils/libebl/ChangeLog
+++ elfutils/libebl/ChangeLog
@@ -650,6 +650,11 @@
@@ -658,6 +658,11 @@
* Makefile.am (libebl_*_so_SOURCES): Set to $(*_SRCS) so dependency
tracking works right.
@ -1048,7 +1048,7 @@
COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage $(no_mudflap.os),\
--- elfutils/libelf/ChangeLog
+++ elfutils/libelf/ChangeLog
@@ -7,6 +7,11 @@
@@ -34,6 +34,11 @@
* elf-knowledge.h (SECTION_STRIP_P): Remove < SHT_NUM check.
@ -1060,7 +1060,7 @@
2011-02-26 Mark Wielaard <mjw@redhat.com>
* elf_end.c (elf_end): Call rwlock_unlock before rwlock_fini.
@@ -684,6 +689,11 @@
@@ -711,6 +716,11 @@
* elf.h: Update from glibc.
@ -1221,7 +1221,7 @@
break;
--- elfutils/src/ChangeLog
+++ elfutils/src/ChangeLog
@@ -519,8 +519,16 @@
@@ -606,8 +606,16 @@
* readelf.c (attr_callback): Use print_block only when we don't use
print_ops.
@ -1238,7 +1238,7 @@
* ar.c (do_oper_extract): Use pathconf instead of statfs.
2009-08-01 Ulrich Drepper <drepper@redhat.com>
@@ -684,6 +692,8 @@
@@ -771,6 +779,8 @@
* readelf.c (print_debug_frame_section): Use t instead of j formats
for ptrdiff_t OFFSET.
@ -1247,7 +1247,7 @@
2009-01-21 Ulrich Drepper <drepper@redhat.com>
* elflint.c (check_program_header): Fix typo in .eh_frame_hdr section
@@ -867,6 +877,11 @@
@@ -954,6 +964,11 @@
that matches its PT_LOAD's p_flags &~ PF_W. On sparc, PF_X really
is valid in RELRO.
@ -1259,7 +1259,7 @@
2008-02-29 Roland McGrath <roland@redhat.com>
* readelf.c (print_attributes): Add a cast.
@@ -1118,6 +1133,8 @@
@@ -1205,6 +1220,8 @@
* readelf.c (hex_dump): Fix rounding error in whitespace calculation.
@ -1268,7 +1268,7 @@
2007-10-15 Roland McGrath <roland@redhat.com>
* make-debug-archive.in: New file.
@@ -1557,6 +1574,10 @@
@@ -1644,6 +1661,10 @@
* elflint.c (valid_e_machine): Add EM_ALPHA.
Reported by Christian Aichinger <Greek0@gmx.net>.
@ -1279,7 +1279,7 @@
2006-08-08 Ulrich Drepper <drepper@redhat.com>
* elflint.c (check_dynamic): Don't require DT_HASH for DT_SYMTAB.
@@ -1633,6 +1654,10 @@
@@ -1720,6 +1741,10 @@
* Makefile.am: Add hacks to create dependency files for non-generic
linker.
@ -1290,7 +1290,7 @@
2006-06-12 Ulrich Drepper <drepper@redhat.com>
* ldgeneric.c (ld_generic_generate_sections): Don't create .interp
@@ -1981,6 +2006,11 @@
@@ -2068,6 +2093,11 @@
* readelf.c (print_debug_loc_section): Fix indentation for larger
address size.
@ -1440,7 +1440,7 @@
findtextrel_LDADD = $(libdw) $(libelf) $(libmudflap)
--- elfutils/src/readelf.c
+++ elfutils/src/readelf.c
@@ -4429,10 +4429,11 @@ struct listptr
@@ -3949,10 +3949,11 @@ struct listptr
#define listptr_offset_size(p) ((p)->dwarf64 ? 8 : 4)
#define listptr_address_size(p) ((p)->addr64 ? 8 : 4)
@ -1454,7 +1454,7 @@
struct listptr *p1 = (void *) a;
struct listptr *p2 = (void *) b;
@@ -4513,8 +4514,11 @@ static void
@@ -4033,8 +4034,11 @@ static void
sort_listptr (struct listptr_table *table, const char *name)
{
if (table->n > 0)
@ -1468,7 +1468,7 @@
}
static bool
@@ -8478,7 +8482,7 @@ dump_archive_index (Elf *elf, const char
@@ -8442,7 +8446,7 @@ dump_archive_index (Elf *elf, const char
if (unlikely (elf_rand (elf, as_off) == 0)
|| unlikely ((subelf = elf_begin (-1, ELF_C_READ_MMAP, elf))
== NULL))
@ -1570,7 +1570,7 @@
cannot set access and modification date of '%s'"), fname);
--- elfutils/tests/ChangeLog
+++ elfutils/tests/ChangeLog
@@ -333,6 +333,8 @@
@@ -439,6 +439,8 @@
2008-01-21 Roland McGrath <roland@redhat.com>
@ -1579,7 +1579,7 @@
* testfile45.S.bz2: Add tests for cltq, cqto.
* testfile45.expect.bz2: Adjust.
@@ -1041,6 +1043,11 @@
@@ -1147,6 +1149,11 @@
* Makefile.am (TESTS): Add run-elflint-test.sh.
(EXTRA_DIST): Add run-elflint-test.sh and testfile18.bz2.
@ -1604,7 +1604,7 @@
case 0:
--- elfutils/tests/Makefile.in
+++ elfutils/tests/Makefile.in
@@ -36,14 +36,15 @@ build_triplet = @build@
@@ -35,14 +35,15 @@ build_triplet = @build@
host_triplet = @host@
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/config/eu.am ChangeLog
@ -1621,23 +1621,27 @@
-@TESTS_RPATH_TRUE@am__append_4 = -Wl,-rpath,$(BUILD_RPATH)
+@STANDALONE_FALSE@am__append_4 = -Wl,-rpath-link,../libasm:../libdw:../libelf
+@TESTS_RPATH_TRUE@am__append_5 = -Wl,-rpath,$(BUILD_RPATH)
noinst_PROGRAMS = arextract$(EXEEXT) arsymtest$(EXEEXT) \
check_PROGRAMS = arextract$(EXEEXT) arsymtest$(EXEEXT) \
newfile$(EXEEXT) saridx$(EXEEXT) scnnames$(EXEEXT) \
sectiondump$(EXEEXT) showptable$(EXEEXT) update1$(EXEEXT) \
@@ -89,10 +90,10 @@ TESTS = run-arextract.sh run-arsymtest.s
run-rerequest_tag.sh run-typeiter.sh run-readelf-d.sh \
run-unstrip-n.sh run-low_high_pc.sh $(am__EXEEXT_1) \
$(am__EXEEXT_3)
@@ -92,12 +93,12 @@ TESTS = run-arextract.sh run-arsymtest.s
run-readelf-gdb_index.sh run-unstrip-n.sh run-low_high_pc.sh \
run-macro-test.sh run-elf_cntl_gelf_getshdr.sh \
run-test-archive64.sh $(am__EXEEXT_1) $(am__EXEEXT_3) \
- $(am__append_9)
-@STANDALONE_FALSE@am__append_5 = msg_tst md5-sha1-test
+ $(am__append_10)
@STANDALONE_FALSE@am__append_6 = msg_tst md5-sha1-test
-@HAVE_LIBASM_TRUE@am__append_7 = $(asm_TESTS)
+@STANDALONE_FALSE@am__append_7 = msg_tst md5-sha1-test
@HAVE_LIBASM_TRUE@am__append_8 = $(asm_TESTS)
-@ENABLE_DWZ_TRUE@am__append_9 = run-readelf-dwz-multi.sh
+@HAVE_LIBASM_TRUE@am__append_9 = $(asm_TESTS)
+@ENABLE_DWZ_TRUE@am__append_10 = run-readelf-dwz-multi.sh
subdir = tests
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
@@ -403,6 +404,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -412,6 +413,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
@ -1645,7 +1649,7 @@
LEX = @LEX@
LEXLIB = @LEXLIB@
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
@@ -432,6 +434,7 @@ SHELL = @SHELL@
@@ -441,6 +443,7 @@ SHELL = @SHELL@
STRIP = @STRIP@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
@ -1653,7 +1657,7 @@
XGETTEXT = @XGETTEXT@
XGETTEXT_015 = @XGETTEXT_015@
XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
@@ -490,12 +493,11 @@ top_build_prefix = @top_build_prefix@
@@ -499,12 +502,11 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
zip_LIBS = @zip_LIBS@
@ -1669,7 +1673,7 @@
@MUDFLAP_FALSE@libmudflap =
@MUDFLAP_TRUE@libmudflap = -lmudflap
COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage $(no_mudflap.os),\
@@ -505,7 +507,7 @@ CLEANFILES = *.gcno *.gcda
@@ -514,7 +516,7 @@ CLEANFILES = *.gcno *.gcda
textrel_check = if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
@MUDFLAP_FALSE@BUILD_RPATH = \$$ORIGIN/../libasm:\$$ORIGIN/../libdw:\$$ORIGIN/../backends:\$$ORIGIN/../libelf
@MUDFLAP_TRUE@BUILD_RPATH = \$$ORIGIN/../backends

View File

@ -1,6 +1,6 @@
--- elfutils/libdwfl/ChangeLog
+++ elfutils/libdwfl/ChangeLog
@@ -48,6 +48,11 @@
@@ -52,6 +52,11 @@
* dwfl_module_getdwarf.c (open_elf): Clear errno before CBFAIL.
Reported by Kurt Roeckx <kurt@roeckx.be>.
@ -44,7 +44,7 @@
--- elfutils/libelf/ChangeLog
+++ elfutils/libelf/ChangeLog
@@ -676,10 +676,53 @@
@@ -703,10 +703,53 @@
If section content hasn't been read yet, do it before looking for the
block size. If no section data present, infer size of section header.
@ -119,13 +119,6 @@
+ elf->start_offset + ehdr->e_phoff);
--- elfutils/libelf/elf32_getshdr.c
+++ elfutils/libelf/elf32_getshdr.c
@@ -1,5 +1,5 @@
/* Return section header.
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005, 2007, 2009 Red Hat, Inc.
+ Copyright (C) 1998-2009 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 1998.
@@ -60,7 +60,8 @@ load_shdr_wrlock (Elf_Scn *scn)
goto out;
@ -260,14 +253,14 @@
--- elfutils/libelf/elf_getarsym.c
+++ elfutils/libelf/elf_getarsym.c
@@ -158,6 +158,9 @@ elf_getarsym (elf, ptr)
@@ -181,6 +181,9 @@ elf_getarsym (elf, ptr)
size_t index_size = atol (tmpbuf);
if (SARMAG + sizeof (struct ar_hdr) + index_size > elf->maximum_size
+#if SIZE_MAX <= 4294967295U
+ || n >= SIZE_MAX / sizeof (Elf_Arsym)
+#endif
|| n * sizeof (uint32_t) > index_size)
|| n * w > index_size)
{
/* This index table cannot be right since it does not fit into
--- elfutils/libelf/elf_getshdrstrndx.c
@ -909,7 +902,7 @@
#endif /* libelfP.h */
--- elfutils/src/ChangeLog
+++ elfutils/src/ChangeLog
@@ -257,6 +257,12 @@
@@ -344,6 +344,12 @@
* readelf.c (dwarf_attr_string): Grok DW_AT_GNU_odr_signature.
@ -922,7 +915,7 @@
2011-02-11 Roland McGrath <roland@redhat.com>
* elfcmp.c (verbose): New variable.
@@ -1969,6 +1975,16 @@
@@ -2056,6 +2062,16 @@
object symbols or symbols with unknown type.
(check_rel): Likewise.
@ -939,7 +932,7 @@
2005-06-08 Roland McGrath <roland@redhat.com>
* readelf.c (print_ops): Add consts.
@@ -2014,6 +2030,19 @@
@@ -2101,6 +2117,19 @@
* readelf.c (dwarf_tag_string): Add new tags.
@ -993,7 +986,7 @@
}
@@ -336,11 +349,6 @@ static const int valid_e_machine[] =
@@ -337,11 +350,6 @@ static const int valid_e_machine[] =
(sizeof (valid_e_machine) / sizeof (valid_e_machine[0]))
@ -1005,7 +998,7 @@
static void
check_elf_header (Ebl *ebl, GElf_Ehdr *ehdr, size_t size)
{
@@ -624,7 +632,8 @@ section [%2d] '%s': symbol table cannot
@@ -625,7 +633,8 @@ section [%2d] '%s': symbol table cannot
}
}
@ -1015,7 +1008,7 @@
ERROR (gettext ("\
section [%2u] '%s': entry size is does not match ElfXX_Sym\n"),
idx, section_name (ebl, idx));
@@ -662,7 +671,7 @@ section [%2d] '%s': XINDEX for zeroth en
@@ -663,7 +672,7 @@ section [%2d] '%s': XINDEX for zeroth en
xndxscnidx, section_name (ebl, xndxscnidx));
}
@ -1024,7 +1017,7 @@
{
sym = gelf_getsymshndx (data, xndxdata, cnt, &sym_mem, &xndx);
if (sym == NULL)
@@ -682,7 +691,8 @@ section [%2d] '%s': symbol %zu: invalid
@@ -683,7 +692,8 @@ section [%2d] '%s': symbol %zu: invalid
else
{
name = elf_strptr (ebl->elf, shdr->sh_link, sym->st_name);
@ -1034,7 +1027,7 @@
}
if (sym->st_shndx == SHN_XINDEX)
@@ -1031,9 +1041,11 @@ is_rel_dyn (Ebl *ebl, const GElf_Ehdr *e
@@ -1032,9 +1042,11 @@ is_rel_dyn (Ebl *ebl, const GElf_Ehdr *e
{
GElf_Shdr rcshdr_mem;
const GElf_Shdr *rcshdr = gelf_getshdr (scn, &rcshdr_mem);
@ -1048,7 +1041,7 @@
{
/* Found the dynamic section. Look through it. */
Elf_Data *d = elf_getdata (scn, NULL);
@@ -1043,7 +1055,9 @@ is_rel_dyn (Ebl *ebl, const GElf_Ehdr *e
@@ -1044,7 +1056,9 @@ is_rel_dyn (Ebl *ebl, const GElf_Ehdr *e
{
GElf_Dyn dyn_mem;
GElf_Dyn *dyn = gelf_getdyn (d, cnt, &dyn_mem);
@ -1059,7 +1052,7 @@
if (dyn->d_tag == DT_RELCOUNT)
{
@@ -1057,7 +1071,9 @@ section [%2d] '%s': DT_RELCOUNT used for
@@ -1058,7 +1072,9 @@ section [%2d] '%s': DT_RELCOUNT used for
/* Does the number specified number of relative
relocations exceed the total number of
relocations? */
@ -1070,7 +1063,7 @@
ERROR (gettext ("\
section [%2d] '%s': DT_RELCOUNT value %d too high for this section\n"),
idx, section_name (ebl, idx),
@@ -1217,7 +1233,8 @@ section [%2d] '%s': no relocations for m
@@ -1218,7 +1234,8 @@ section [%2d] '%s': no relocations for m
}
}
@ -1080,7 +1073,7 @@
ERROR (gettext (reltype == ELF_T_RELA ? "\
section [%2d] '%s': section entry size does not match ElfXX_Rela\n" : "\
section [%2d] '%s': section entry size does not match ElfXX_Rel\n"),
@@ -1440,7 +1457,8 @@ check_rela (Ebl *ebl, GElf_Ehdr *ehdr, G
@@ -1441,7 +1458,8 @@ check_rela (Ebl *ebl, GElf_Ehdr *ehdr, G
Elf_Data *symdata = elf_getdata (symscn, NULL);
enum load_state state = state_undecided;
@ -1090,7 +1083,7 @@
{
GElf_Rela rela_mem;
GElf_Rela *rela = gelf_getrela (data, cnt, &rela_mem);
@@ -1490,7 +1508,8 @@ check_rel (Ebl *ebl, GElf_Ehdr *ehdr, GE
@@ -1491,7 +1509,8 @@ check_rel (Ebl *ebl, GElf_Ehdr *ehdr, GE
Elf_Data *symdata = elf_getdata (symscn, NULL);
enum load_state state = state_undecided;
@ -1100,7 +1093,7 @@
{
GElf_Rel rel_mem;
GElf_Rel *rel = gelf_getrel (data, cnt, &rel_mem);
@@ -1589,7 +1608,8 @@ section [%2d] '%s': referenced as string
@@ -1590,7 +1609,8 @@ section [%2d] '%s': referenced as string
shdr->sh_link, section_name (ebl, shdr->sh_link),
idx, section_name (ebl, idx));
@ -1110,7 +1103,7 @@
ERROR (gettext ("\
section [%2d] '%s': section entry size does not match ElfXX_Dyn\n"),
idx, section_name (ebl, idx));
@@ -1599,7 +1619,7 @@ section [%2d] '%s': section entry size d
@@ -1600,7 +1620,7 @@ section [%2d] '%s': section entry size d
idx, section_name (ebl, idx));
bool non_null_warned = false;
@ -1119,7 +1112,7 @@
{
GElf_Dyn dyn_mem;
GElf_Dyn *dyn = gelf_getdyn (data, cnt, &dyn_mem);
@@ -1871,6 +1891,8 @@ section [%2d] '%s': entry size does not
@@ -1872,6 +1892,8 @@ section [%2d] '%s': entry size does not
idx, section_name (ebl, idx));
if (symshdr != NULL
@ -1128,7 +1121,7 @@
&& (shdr->sh_size / shdr->sh_entsize
< symshdr->sh_size / symshdr->sh_entsize))
ERROR (gettext ("\
@@ -1897,6 +1919,12 @@ section [%2d] '%s': extended section ind
@@ -1898,6 +1920,12 @@ section [%2d] '%s': extended section ind
}
Elf_Data *data = elf_getdata (elf_getscn (ebl->elf, idx), NULL);
@ -1141,7 +1134,7 @@
if (*((Elf32_Word *) data->d_buf) != 0)
ERROR (gettext ("symbol 0 should have zero extended section index\n"));
@@ -1939,7 +1967,7 @@ section [%2d] '%s': hash table section i
@@ -1940,7 +1968,7 @@ section [%2d] '%s': hash table section i
size_t maxidx = nchain;
@ -1150,7 +1143,7 @@
{
size_t symsize = symshdr->sh_size / symshdr->sh_entsize;
@@ -1950,18 +1978,28 @@ section [%2d] '%s': hash table section i
@@ -1951,18 +1979,28 @@ section [%2d] '%s': hash table section i
maxidx = symsize;
}
@ -1181,7 +1174,7 @@
}
@@ -1991,18 +2029,28 @@ section [%2d] '%s': hash table section i
@@ -1992,18 +2030,28 @@ section [%2d] '%s': hash table section i
maxidx = symsize;
}
@ -1213,7 +1206,7 @@
}
@@ -2027,7 +2075,7 @@ section [%2d] '%s': bitmask size not pow
@@ -2028,7 +2076,7 @@ section [%2d] '%s': bitmask size not pow
if (shdr->sh_size < (4 + bitmask_words + nbuckets) * sizeof (Elf32_Word))
{
ERROR (gettext ("\
@ -1222,7 +1215,7 @@
idx, section_name (ebl, idx), (long int) shdr->sh_size,
(long int) ((4 + bitmask_words + nbuckets) * sizeof (Elf32_Word)));
return;
@@ -2699,8 +2747,9 @@ section [%2d] '%s' refers in sh_link to
@@ -2700,8 +2748,9 @@ section [%2d] '%s' refers in sh_link to
/* The number of elements in the version symbol table must be the
same as the number of symbols. */
@ -1236,7 +1229,7 @@
idx, section_name (ebl, idx),
--- elfutils/src/readelf.c
+++ elfutils/src/readelf.c
@@ -1183,6 +1183,8 @@ handle_scngrp (Ebl *ebl, Elf_Scn *scn, G
@@ -1189,6 +1189,8 @@ handle_scngrp (Ebl *ebl, Elf_Scn *scn, G
Elf32_Word *grpref = (Elf32_Word *) data->d_buf;
GElf_Sym sym_mem;
@ -1245,7 +1238,7 @@
printf ((grpref[0] & GRP_COMDAT)
? ngettext ("\
\nCOMDAT section group [%2zu] '%s' with signature '%s' contains %zu entry:\n",
@@ -1195,8 +1197,8 @@ handle_scngrp (Ebl *ebl, Elf_Scn *scn, G
@@ -1201,8 +1203,8 @@ handle_scngrp (Ebl *ebl, Elf_Scn *scn, G
data->d_size / sizeof (Elf32_Word) - 1),
elf_ndxscn (scn),
elf_strptr (ebl->elf, shstrndx, shdr->sh_name),
@ -1256,7 +1249,7 @@
?: gettext ("<INVALID SYMBOL>"),
data->d_size / sizeof (Elf32_Word) - 1);
@@ -1347,10 +1349,12 @@ static void
@@ -1353,10 +1355,12 @@ static void
handle_dynamic (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr)
{
int class = gelf_getclass (ebl->elf);
@ -1270,7 +1263,7 @@
/* Get the data of the section. */
data = elf_getdata (scn, NULL);
@@ -1362,21 +1366,26 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn,
@@ -1368,21 +1372,26 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn,
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
@ -1303,7 +1296,7 @@
{
GElf_Dyn dynmem;
GElf_Dyn *dyn = gelf_getdyn (data, cnt, &dynmem);
@@ -1525,7 +1534,8 @@ static void
@@ -1531,7 +1540,8 @@ static void
handle_relocs_rel (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr)
{
int class = gelf_getclass (ebl->elf);
@ -1313,7 +1306,7 @@
/* Get the data of the section. */
Elf_Data *data = elf_getdata (scn, NULL);
@@ -1711,7 +1721,8 @@ static void
@@ -1717,7 +1727,8 @@ static void
handle_relocs_rela (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr)
{
int class = gelf_getclass (ebl->elf);
@ -1323,7 +1316,7 @@
/* Get the data of the section. */
Elf_Data *data = elf_getdata (scn, NULL);
@@ -1958,6 +1969,13 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, G
@@ -1964,6 +1975,13 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, G
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
@ -1337,7 +1330,7 @@
/* Now we can compute the number of entries in the section. */
unsigned int nsyms = data->d_size / (class == ELFCLASS32
? sizeof (Elf32_Sym)
@@ -1968,15 +1986,12 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, G
@@ -1974,15 +1992,12 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, G
nsyms),
(unsigned int) elf_ndxscn (scn),
elf_strptr (ebl->elf, shstrndx, shdr->sh_name), nsyms);
@ -1354,7 +1347,7 @@
fputs_unlocked (class == ELFCLASS32
? gettext ("\
@@ -2212,7 +2227,13 @@ handle_verneed (Ebl *ebl, Elf_Scn *scn,
@@ -2218,7 +2233,13 @@ handle_verneed (Ebl *ebl, Elf_Scn *scn,
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
@ -1369,7 +1362,7 @@
printf (ngettext ("\
\nVersion needs section [%2u] '%s' contains %d entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n",
"\
@@ -2223,9 +2244,7 @@ handle_verneed (Ebl *ebl, Elf_Scn *scn,
@@ -2229,9 +2250,7 @@ handle_verneed (Ebl *ebl, Elf_Scn *scn,
class == ELFCLASS32 ? 10 : 18, shdr->sh_addr,
shdr->sh_offset,
(unsigned int) shdr->sh_link,
@ -1380,7 +1373,7 @@
unsigned int offset = 0;
for (int cnt = shdr->sh_info; --cnt >= 0; )
@@ -2278,8 +2297,14 @@ handle_verdef (Ebl *ebl, Elf_Scn *scn, G
@@ -2284,8 +2303,14 @@ handle_verdef (Ebl *ebl, Elf_Scn *scn, G
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
@ -1396,7 +1389,7 @@
printf (ngettext ("\
\nVersion definition section [%2u] '%s' contains %d entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n",
"\
@@ -2291,9 +2316,7 @@ handle_verdef (Ebl *ebl, Elf_Scn *scn, G
@@ -2297,9 +2322,7 @@ handle_verdef (Ebl *ebl, Elf_Scn *scn, G
class == ELFCLASS32 ? 10 : 18, shdr->sh_addr,
shdr->sh_offset,
(unsigned int) shdr->sh_link,
@ -1407,7 +1400,7 @@
unsigned int offset = 0;
for (int cnt = shdr->sh_info; --cnt >= 0; )
@@ -2555,25 +2578,30 @@ handle_versym (Ebl *ebl, Elf_Scn *scn, G
@@ -2561,25 +2584,30 @@ handle_versym (Ebl *ebl, Elf_Scn *scn, G
filename = NULL;
}
@ -1445,7 +1438,7 @@
{
if (cnt % 2 == 0)
printf ("\n %4d:", cnt);
@@ -2622,7 +2650,17 @@ print_hash_info (Ebl *ebl, Elf_Scn *scn,
@@ -2628,7 +2656,17 @@ print_hash_info (Ebl *ebl, Elf_Scn *scn,
for (Elf32_Word cnt = 0; cnt < nbucket; ++cnt)
++counts[lengths[cnt]];
@ -1464,7 +1457,7 @@
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",
"\
@@ -2635,9 +2673,7 @@ print_hash_info (Ebl *ebl, Elf_Scn *scn,
@@ -2641,9 +2679,7 @@ print_hash_info (Ebl *ebl, Elf_Scn *scn,
shdr->sh_addr,
shdr->sh_offset,
(unsigned int) shdr->sh_link,
@ -1475,7 +1468,7 @@
if (extrastr != NULL)
fputs (extrastr, stdout);
@@ -2897,7 +2933,8 @@ print_liblist (Ebl *ebl)
@@ -2903,7 +2939,8 @@ print_liblist (Ebl *ebl)
if (shdr != NULL && shdr->sh_type == SHT_GNU_LIBLIST)
{
@ -1485,7 +1478,7 @@
printf (ngettext ("\
\nLibrary list section [%2zu] '%s' at offset %#0" PRIx64 " contains %d entry:\n",
"\
@@ -4644,6 +4681,16 @@ print_debug_aranges_section (Dwfl_Module
@@ -4164,6 +4201,16 @@ print_debug_aranges_section (Dwfl_Module
return;
}

View File

@ -1,7 +1,7 @@
Name: elfutils
Summary: A collection of utilities and DSOs to handle compiled objects
Version: 0.154
%global baserelease 4
Version: 0.155
%global baserelease 1
URL: https://fedorahosted.org/elfutils/
%global source_url http://fedorahosted.org/releases/e/l/elfutils/%{version}/
License: GPLv3+ and (GPLv2+ or LGPLv3+)
@ -45,10 +45,7 @@ Group: Development/Tools
Source: %{?source_url}%{name}-%{version}.tar.bz2
Patch1: %{?source_url}elfutils-robustify.patch
Patch2: %{?source_url}elfutils-portability.patch
Patch3: elfutils-0.154-binutils-pr-ld-13621.patch
Patch4: elfutils-0.154-xlatetom-835877.patch
Patch5: elfutils-0.154-dwz.patch
Patch6: elfutils-0.154-sym64.patch
Patch3: elfutils-0.155-binutils-pr-ld-13621.patch
%if !%{compat}
Release: %{baserelease}%{?dist}
@ -214,9 +211,6 @@ sed -i.scanf-m -e 's/%m/%a/g' src/addr2line.c tests/line2addr.c
%endif
%patch3 -p1 -b .binutils-pr-ld-13621
%patch4 -p1 -b .xlatetom-835877
%patch5 -p1 -b .dwz
%patch6 -p1 -b .sym64
find . -name \*.sh ! -perm -0100 -print | xargs chmod +x
@ -235,7 +229,7 @@ COMPAT_CONFIG_FLAGS="--disable-werror"
COMPAT_CONFIG_FLAGS=""
%endif
%configure $COMPAT_CONFIG_FLAGS CFLAGS="$RPM_OPT_FLAGS -fexceptions" || {
%configure --enable-dwz $COMPAT_CONFIG_FLAGS CFLAGS="$RPM_OPT_FLAGS -fexceptions" || {
cat config.log
exit 2
}
@ -333,6 +327,12 @@ rm -rf ${RPM_BUILD_ROOT}
%{_libdir}/libelf.a
%changelog
* Mon Aug 27 2012 Mark Wielaard <mjw@redhat.com> - 0.155-1
- Update to 0.155.
- #844270 - eu-nm invalid %N$ use detected.
- #847454 - Ukrainian translation update.
- Removed local ar 64-bit symbol patch, dwz support patch and xlatetom fix.
* Tue Aug 14 2012 Petr Machata <pmachata@redhat.com> - 0.154-4
- Add support for archives with 64-bit symbol tables (#843019)

View File

@ -1 +1 @@
e5b26ceaee67db40e742f13052087354 elfutils-0.154.tar.bz2
163a5712b86f6bdfebdf233cc6e2192d elfutils-0.155.tar.bz2