Resolve conflicts.

CVS patchset: 6868
CVS date: 2003/05/20 14:02:12
This commit is contained in:
jbj 2003-05-20 14:02:12 +00:00
parent fea55d4139
commit 8d73a1c5eb
28 changed files with 194 additions and 150 deletions

View File

@ -13,8 +13,8 @@ dnl License version 1.0 from http://www.opensource.org/licenses/osl.php or
dnl by writing the Open Source Initiative c/o Lawrence Rosen, Esq.,
dnl 3001 King Ranch Road, Ukiah, CA 95482.
dnl
AC_INIT([elfutils],[0.76],[drepper@redhat.com],[elfutils])
AM_INIT_AUTOMAKE([gnits 1.6.3 dist-bzip2])
AC_INIT([elfutils],[0.78],[drepper@redhat.com],[elfutils])
AM_INIT_AUTOMAKE([gnits 1.7 dist-bzip2])
AC_COPYRIGHT([Copyright (C) 1996-2002, 2003 Red Hat, Inc.])
AC_CONFIG_SRCDIR([src/readelf.c])
AM_CONFIG_HEADER([config.h])

View File

@ -244,7 +244,7 @@ cannot create extended section index table: %s"),
/* Store the real section index in the extended setion
index table. */
assert (ptr < ctx->nsymbol_tab + 1);
assert ((size_t) ptr < ctx->nsymbol_tab + 1);
xshndx[ptr] = ndx;
/* And signal that this happened. */

View File

@ -1,7 +1,7 @@
## Process this file with automake to create Makefile.in
## Configure input file for elfutils.
##
## Copyright (C) 2002 Red Hat, Inc.
## Copyright (C) 2002, 2003 Red Hat, Inc.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License version 2 as
@ -19,6 +19,7 @@
DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H
AM_CFLAGS = -Wall -Wshadow # -Werror
INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I.. -I$(srcdir)/../lib
VERSION = 1
LINT = splint
@ -31,8 +32,14 @@ noinst_PROGRAMS = $(noinst_LIBRARIES:_pic.a=.so)
#euinclude_HEADERS = libdw.h
libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_get_elf.c \
dwarf_get_pubnames.c \
dwarf_error.c
dwarf_get_pubnames.c dwarf_get_abbrev.c dwarf_tag.c \
dwarf_error.c dwarf_nextcu.c dwarf_diename.c dwarf_offdie.c \
dwarf_attr.c dwarf_formstring.c dwarf_abbrev_hash.c \
dwarf_child.c dwarf_has_children.c dwarf_formaddr.c \
dwarf_formudata.c dwarf_formsdata.c dwarf_lowpc.c \
dwarf_highpc.c dwarf_formref.c dwarf_siblingof.c \
libdw_findcu.c libdw_form.c libdw_alloc.c
libdw_pic_a_SOURCES =
am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os)
@ -41,7 +48,7 @@ libdw_so_SOURCES =
libdw.so: libdw_pic.a $(srcdir)/libdw.map
$(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
-Wl,--version-script,$(srcdir)/libdw.map,--no-undefined \
-Wl,--soname,$@.$(VERSION) \
-Wl,--soname,$@.$(VERSION),-z,defs \
../libelf/libelf.so
ln -fs $@ $@.$(VERSION)
@ -66,7 +73,7 @@ uninstall: uninstall-am
# rm -f $(DESTDIR)$(libdir)/libdw.so
# rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils
noinst_HEADERS = libdwP.h memory-access.h \
noinst_HEADERS = libdwP.h memory-access.h dwarf_abbrev_hash.h \
dwarf.h libdw.h
EXTRA_DIST = libdw.map

View File

@ -1,5 +1,5 @@
/* Create descriptor from ELF descriptor for processing file.
Copyright (C) 2002 Red Hat, Inc.
Copyright (C) 2002, 2003 Red Hat, Inc.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
This program is free software; you can redistribute it and/or modify
@ -23,6 +23,7 @@
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include "libdwP.h"
@ -55,7 +56,7 @@ check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp)
GElf_Shdr shdr_mem;
GElf_Shdr *shdr;
const char *scnname;
int cnt;
size_t cnt;
/* Get the section header data. */
shdr = gelf_getshdr (scn, &shdr_mem);
@ -83,7 +84,7 @@ check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp)
{
/* The section name must be valid. Otherwise is the ELF file
invalid. */
__libdwarf_seterrno (DWARF_E_INVALID_ELF);
__libdw_seterrno (DWARF_E_INVALID_ELF);
free (result);
return;
}
@ -122,7 +123,7 @@ valid_p (Dwarf *result)
is correct. */
if (unlikely (result->sectiondata[IDX_debug_info] == NULL))
{
__libdwarf_seterrno (DWARF_E_NO_DWARF);
__libdw_seterrno (DWARF_E_NO_DWARF);
result = NULL;
}
@ -168,7 +169,7 @@ scngrp_read (Dwarf *result, Elf *elf, GElf_Ehdr *ehdr, Dwarf_Cmd cmd,
{
/* A section group refers to a non-existing section. Should
never happen. */
__libdwarf_seterrno (DWARF_E_INVALID_ELF);
__libdw_seterrno (DWARF_E_INVALID_ELF);
free (result);
return NULL;
}
@ -196,19 +197,22 @@ dwarf_begin_elf (elf, cmd, scngrp)
if (ehdr == NULL)
{
if (elf_kind (elf) != ELF_K_ELF)
__libdwarf_seterrno (DWARF_E_NOELF);
__libdw_seterrno (DWARF_E_NOELF);
else
__libdwarf_seterrno (DWARF_E_GETEHDR_ERROR);
__libdw_seterrno (DWARF_E_GETEHDR_ERROR);
return NULL;
}
/* Default memory allocation size. */
size_t mem_default_size = sysconf (_SC_PAGESIZE) - 4 * sizeof (void *);
/* Allocate the data structure. */
result = (Dwarf *) calloc (1, sizeof (Dwarf));
result = (Dwarf *) calloc (1, sizeof (Dwarf) + mem_default_size);
if (result == NULL)
{
__libdwarf_seterrno (DWARF_E_NOMEM);
__libdw_seterrno (DWARF_E_NOMEM);
return NULL;
}
@ -219,6 +223,15 @@ dwarf_begin_elf (elf, cmd, scngrp)
result->elf = elf;
/* Initialize the memory handling. */
result->mem_default_size = mem_default_size;
result->oom_handler = __libdw_oom;
result->mem_tail = (struct libdw_memblock *) (result + 1);
result->mem_tail->size = (result->mem_default_size
- offsetof (struct libdw_memblock, mem));
result->mem_tail->remaining = result->mem_tail->size;
result->mem_tail->next = result->mem_tail->prev = NULL;
if (cmd == DWARF_C_READ || cmd == DWARF_C_RDWR)
{
@ -234,12 +247,12 @@ dwarf_begin_elf (elf, cmd, scngrp)
}
else if (cmd == DWARF_C_WRITE)
{
__libdwarf_seterrno (DWARF_E_UNIMPL);
__libdw_seterrno (DWARF_E_UNIMPL);
free (result);
return NULL;
}
__libdwarf_seterrno (DWARF_E_INVALID_CMD);
__libdw_seterrno (DWARF_E_INVALID_CMD);
free (result);
return NULL;
}

View File

@ -1,5 +1,5 @@
/* Get public symbol information.
Copyright (C) 2002 Red Hat, Inc.
Copyright (C) 2002, 2003 Red Hat, Inc.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
This program is free software; you can redistribute it and/or modify
@ -53,7 +53,7 @@ get_offsets (Dwarf *dbg)
newmem = (struct pubnames_s *) realloc (mem, allocated * entsize);
if (newmem == NULL)
{
__libdwarf_seterrno (DWARF_E_NOMEM);
__libdw_seterrno (DWARF_E_NOMEM);
err_return:
free (mem);
return -1;
@ -83,7 +83,7 @@ get_offsets (Dwarf *dbg)
version = read_2ubyte_unaligned (dbg, readp);
if (version != 2)
{
__libdwarf_seterrno (DWARF_E_INVALID_VERSION);
__libdw_seterrno (DWARF_E_INVALID_VERSION);
goto err_return;
}
@ -113,7 +113,7 @@ get_offsets (Dwarf *dbg)
if (mem == NULL)
{
__libdwarf_seterrno (DWARF_E_NO_ENTRY);
__libdw_seterrno (DWARF_E_NO_ENTRY);
return -1;
}

View File

@ -74,7 +74,7 @@ libdwarf_so_SOURCES =
libdwarf.so: libdwarf_pic.a libdwarf.map
$(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
-Wl,--version-script,$(srcdir)/libdwarf.map,--no-undefined \
-Wl,--soname,$@.$(VERSION) \
-Wl,--soname,$@.$(VERSION),-z,defs \
../libelf/libelf.so
ln -fs $@ $@.$(VERSION)

View File

@ -122,7 +122,7 @@ dwarf_elf_init (elf, access, errhand, errarg, dbg, error)
GElf_Shdr shdr_mem;
GElf_Shdr *shdr;
const char *scnname;
int cnt;
size_t cnt;
Elf_Data *data;
/* Get the section header data. */

View File

@ -277,7 +277,7 @@ dwarf_get_fde_list_eh (dbg, cie_data, cie_element_count, fde_data,
a direct offset in the section it is a offset from the
location of the FDE'S CIE ID value itself to the CIE entry. */
if (cie->cie->offset
== (cie_id_ptr - cie_id
== (size_t) (cie_id_ptr - cie_id
- (Dwarf_Small *) dbg->sections[IDX_eh_frame].addr))
{
new_fde->fde->cie = cie->cie;
@ -337,7 +337,7 @@ dwarf_get_fde_list_eh (dbg, cie_data, cie_element_count, fde_data,
do
{
if (cielist->cie->offset
== (fdelist->cie_id_ptr - fdelist->fde->offset
== (size_t) (fdelist->cie_id_ptr - fdelist->fde->offset
- (Dwarf_Small *) dbg->sections[IDX_eh_frame].addr))
{
fdelist->fde->cie = cielist->cie;

View File

@ -188,6 +188,9 @@ dwarf_srcfiles (die, srcfiles, srcfilecount, error)
int length;
int res;
/* For now we haven't found anything. */
*srcfilecount = 0;
/* The die must be for a compilation unit. */
if (die->abbrev->tag != DW_TAG_compile_unit)
{

View File

@ -58,7 +58,7 @@ libebl_so_SOURCES =
libebl.so: libebl_pic.a libebl.map
$(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
-Wl,--version-script,$(srcdir)/libebl.map,--no-undefined \
-Wl,--soname,$@.$(VERSION) \
-Wl,--soname,$@.$(VERSION),-z,defs \
../libelf/libelf.so -ldl
ln -fs $@ $@.$(VERSION)
@ -70,7 +70,8 @@ am_libebl_i386_pic_a_OBJECTS = $(i386_SRCS:.c=.os)
libebl_i386_so_SOURCES =
libebl_i386.so: libebl_i386_pic.a libebl_i386.map
$(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
-Wl,--version-script,$(srcdir)/libebl_i386.map,--no-undefined
-Wl,--version-script,$(srcdir)/libebl_i386.map,--no-undefined \
-Wl,-z,defs
sh_SRCS = sh_init.c sh_destr.c sh_symbol.c
@ -80,7 +81,8 @@ am_libebl_sh_pic_a_OBJECTS = $(sh_SRCS:.c=.os)
libebl_sh_so_SOURCES =
libebl_sh.so: libebl_sh_pic.a libebl_sh.map
$(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
-Wl,--version-script,$(srcdir)/libebl_sh.map,--no-undefined
-Wl,--version-script,$(srcdir)/libebl_sh.map,--no-undefined \
-Wl,-z,defs
mips_SRCS = mips_init.c mips_destr.c mips_symbol.c
@ -90,7 +92,8 @@ am_libebl_mips_pic_a_OBJECTS = $(mips_SRCS:.c=.os)
libebl_mips_so_SOURCES =
libebl_mips.so: libebl_mips_pic.a libebl_mips.map
$(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
-Wl,--version-script,$(srcdir)/libebl_mips.map,--no-undefined
-Wl,--version-script,$(srcdir)/libebl_mips.map,--no-undefined \
-Wl,-z,defs
x86_64_SRCS = x86_64_init.c x86_64_destr.c x86_64_symbol.c
@ -100,7 +103,8 @@ am_libebl_x86_64_pic_a_OBJECTS = $(x86_64_SRCS:.c=.os)
libebl_x86_64_so_SOURCES =
libebl_x86_64.so: libebl_x86_64_pic.a libebl_x86_64.map
$(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
-Wl,--version-script,$(srcdir)/libebl_x86_64.map,--no-undefined
-Wl,--version-script,$(srcdir)/libebl_x86_64.map,--no-undefined \
-Wl,-z,defs
ia64_SRCS = ia64_init.c ia64_destr.c ia64_symbol.c
@ -110,7 +114,8 @@ am_libebl_ia64_pic_a_OBJECTS = $(ia64_SRCS:.c=.os)
libebl_ia64_so_SOURCES =
libebl_ia64.so: libebl_ia64_pic.a libebl_ia64.map
$(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
-Wl,--version-script,$(srcdir)/libebl_ia64.map,--no-undefined
-Wl,--version-script,$(srcdir)/libebl_ia64.map,--no-undefined \
-Wl,-z,defs
alpha_SRCS = alpha_init.c alpha_destr.c alpha_symbol.c
@ -120,7 +125,8 @@ am_libebl_alpha_pic_a_OBJECTS = $(alpha_SRCS:.c=.os)
libebl_alpha_so_SOURCES =
libebl_alpha.so: libebl_alpha_pic.a libebl_alpha.map
$(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
-Wl,--version-script,$(srcdir)/libebl_alpha.map,--no-undefined
-Wl,--version-script,$(srcdir)/libebl_alpha.map,--no-undefined \
-Wl,-z,defs
arm_SRCS = arm_init.c arm_destr.c arm_symbol.c
@ -130,7 +136,8 @@ am_libebl_arm_pic_a_OBJECTS = $(arm_SRCS:.c=.os)
libebl_arm_so_SOURCES =
libebl_arm.so: libebl_arm_pic.a libebl_arm.map
$(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
-Wl,--version-script,$(srcdir)/libebl_arm.map,--no-undefined
-Wl,--version-script,$(srcdir)/libebl_arm.map,--no-undefined \
-Wl,-z,defs
sparc_SRCS = sparc_init.c sparc_destr.c sparc_symbol.c
@ -140,7 +147,8 @@ am_libebl_sparc_pic_a_OBJECTS = $(sparc_SRCS:.c=.os)
libebl_sparc_so_SOURCES =
libebl_sparc.so: libebl_sparc_pic.a libebl_sparc.map
$(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
-Wl,--version-script,$(srcdir)/libebl_sparc.map,--no-undefined
-Wl,--version-script,$(srcdir)/libebl_sparc.map,--no-undefined \
-Wl,-z,defs
%.os: %.c %.o

View File

@ -159,7 +159,7 @@ openbackend (elf, emulation, machine)
GElf_Half machine;
{
Ebl *result;
int cnt;
size_t cnt;
/* First allocate the data structure for the result. We do this
here since this assures that the structure is always large

View File

@ -54,7 +54,7 @@ ebl_section_type_name (ebl, section, buf, len)
};
/* Handle standard names. */
if (section < sizeof (knowntypes) / sizeof (knowntypes[0])
if ((size_t) section < sizeof (knowntypes) / sizeof (knowntypes[0])
&& knowntypes[section] != NULL)
res = knowntypes[section];
/* The symbol versioning/Sun extensions. */
@ -80,7 +80,8 @@ ebl_section_type_name (ebl, section, buf, len)
/* Handle processor-specific section names. */
else if (section >= SHT_LOPROC && section <= SHT_HIPROC)
snprintf (buf, len, "SHT_LOPROC+%x", section - SHT_LOPROC);
else if (section >= SHT_LOUSER && section <= SHT_HIUSER)
else if ((unsigned int) section >= SHT_LOUSER
&& (unsigned int) section <= SHT_HIUSER)
snprintf (buf, len, "SHT_LOUSER+%x", section - SHT_LOUSER);
else
snprintf (buf, len, "%s: %d", gettext ("<unknown>"), section);

View File

@ -75,7 +75,7 @@ libelf_so_SOURCES =
libelf.so: libelf_pic.a libelf.map
$(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
-Wl,--version-script,$(srcdir)/libelf.map,--no-undefined \
-Wl,--soname,$@.$(VERSION)
-Wl,--soname,$@.$(VERSION),-z-defs
ln -fs $@ $@.$(VERSION)
%.os: %.c %.o

View File

@ -139,7 +139,8 @@ elfw2(LIBELFBITS,getphdr) (Elf *elf)
elf->state.ELFW(elf,LIBELFBITS).phdr_flags |= ELF_F_MALLOCED;
/* Read the header. */
if (pread (elf->fildes, elf->state.ELFW(elf,LIBELFBITS).phdr, size,
if ((size_t) pread (elf->fildes,
elf->state.ELFW(elf,LIBELFBITS).phdr, size,
(elf->start_offset + ehdr->e_phoff)) != size)
{
/* Severe problems. We cannot read the data. */

View File

@ -124,7 +124,8 @@ elfw2(LIBELFBITS,getshdr) (Elf_Scn *scn)
else if (elf->fildes != -1)
{
/* Read the header. */
if (pread (elf->fildes, elf->state.ELFW(elf,LIBELFBITS).shdr, size,
if ((size_t) pread (elf->fildes,
elf->state.ELFW(elf,LIBELFBITS).shdr, size,
elf->start_offset + ehdr->e_shoff) != size)
{
/* Severe problems. We cannot read the data. */

View File

@ -65,7 +65,7 @@ sort_sections (Elf_Scn **scns, Elf_ScnList *list)
Elf_Scn **scnp = scns;
do
{
int cnt;
size_t cnt;
for (cnt = 0; cnt < list->cnt; ++cnt)
*scnp++ = &list->data[cnt];
@ -327,7 +327,7 @@ fill (int fd, off_t pos, size_t len, char *fillbuf, size_t *filledp)
/* This many bytes we want to write in this round. */
size_t n = MIN (filled, len);
if (unlikely (pwrite (fd, fillbuf, n, pos) != n))
if (unlikely ((size_t) pwrite (fd, fillbuf, n, pos) != n))
{
__libelf_seterrno (ELF_E_WRITE_ERROR);
return 1;
@ -444,9 +444,9 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum)
}
/* Write out the ELF header. */
if (unlikely (pwrite (elf->fildes, out_phdr,
sizeof (ElfW2(LIBELFBITS,Phdr)) * ehdr->e_phnum,
ehdr->e_phoff)
if (unlikely ((size_t) pwrite (elf->fildes, out_phdr,
sizeof (ElfW2(LIBELFBITS,Phdr))
* ehdr->e_phnum, ehdr->e_phoff)
!= sizeof (ElfW2(LIBELFBITS,Phdr)) * ehdr->e_phnum))
{
__libelf_seterrno (ELF_E_WRITE_ERROR);
@ -550,8 +550,9 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum)
(*fctp) (buf, dl->data.d.d_buf, dl->data.d.d_size, 1);
}
if (unlikely (pwrite (elf->fildes, buf,
dl->data.d.d_size, last_offset)
if (unlikely ((size_t) pwrite (elf->fildes, buf,
dl->data.d.d_size,
last_offset)
!= dl->data.d.d_size))
{
if (buf != dl->data.d.d_buf && buf != tmpbuf)
@ -590,9 +591,9 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum)
/* Write out the section header table. */
if (shdr_flags & ELF_F_DIRTY
&& unlikely (pwrite (elf->fildes, shdr_data,
sizeof (ElfW2(LIBELFBITS,Shdr)) * shnum,
shdr_offset)
&& unlikely ((size_t) pwrite (elf->fildes, shdr_data,
sizeof (ElfW2(LIBELFBITS,Shdr))
* shnum, shdr_offset)
!= sizeof (ElfW2(LIBELFBITS,Shdr)) * shnum))
{
__libelf_seterrno (ELF_E_WRITE_ERROR);

View File

@ -126,7 +126,7 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf, int *change_bop, size_t shnum)
{
/* The user is supposed to fill out e_phoff. Use it and
e_phnum to determine the maximum extend. */
size = MAX (size,
size = MAX ((size_t) size,
ehdr->e_phoff
+ elf_typesize (LIBELFBITS, ELF_T_PHDR, ehdr->e_phnum));
}
@ -164,7 +164,7 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf, int *change_bop, size_t shnum)
do
{
int cnt;
size_t cnt;
for (cnt = first == true; cnt < list->cnt; ++cnt)
{
@ -252,7 +252,8 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf, int *change_bop, size_t shnum)
/* The user specified the offset and the size.
All we have to do is check whether this block
fits in the size specified for the section. */
if (unlikely (dl->data.d.d_off + dl->data.d.d_size
if (unlikely ((GElf_Word) (dl->data.d.d_off
+ dl->data.d.d_size)
> shdr->sh_size))
{
__libelf_seterrno (ELF_E_SECTION_TOO_SMALL);
@ -278,7 +279,7 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf, int *change_bop, size_t shnum)
if (elf->flags & ELF_F_LAYOUT)
{
size = MAX (size,
size = MAX ((GElf_Word) size,
shdr->sh_offset
+ (shdr->sh_type != SHT_NOBITS
? shdr->sh_size : 0));
@ -302,10 +303,12 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf, int *change_bop, size_t shnum)
scn->shdr_flags);
size = (size + sh_align - 1) & ~(sh_align - 1);
update_if_changed (shdr->sh_offset, size, changed);
update_if_changed (shdr->sh_offset, (GElf_Word) size,
changed);
/* See whether the section size is correct. */
update_if_changed (shdr->sh_size, offset, changed);
update_if_changed (shdr->sh_size, (GElf_Word) offset,
changed);
if (shdr->sh_type != SHT_NOBITS)
size += offset;
@ -335,9 +338,9 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf, int *change_bop, size_t shnum)
{
/* The user is supposed to fill out e_phoff. Use it and
e_phnum to determine the maximum extend. */
size = MAX (size, (ehdr->e_shoff
+ (elf_typesize (LIBELFBITS, ELF_T_SHDR,
shnum))));
size = MAX ((GElf_Word) size,
(ehdr->e_shoff
+ (elf_typesize (LIBELFBITS, ELF_T_SHDR, shnum))));
}
else
{
@ -349,7 +352,7 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf, int *change_bop, size_t shnum)
#define SHDR_ALIGN sizeof (ElfW2(LIBELFBITS,Off))
size = (size + SHDR_ALIGN - 1) & ~(SHDR_ALIGN - 1);
update_if_changed (ehdr->e_shoff, size, elf->flags);
update_if_changed (ehdr->e_shoff, (GElf_Word) size, elf->flags);
update_if_changed (ehdr->e_shentsize,
elf_typesize (LIBELFBITS, ELF_T_SHDR, 1),
ehdr_flags);

View File

@ -84,7 +84,7 @@ get_shnum (/*@null@*/ void *map_address, unsigned char *e_ident, int fildes,
ehdr.p = alloca (len);
/* Fill it. */
if (pread (fildes, ehdr.p, len, offset) != len)
if ((size_t) pread (fildes, ehdr.p, len, offset) != len)
/* Failed reading. */
return (size_t) -1l;
@ -624,8 +624,9 @@ read_long_names (Elf *elf)
len);
else
{
if (pread (elf->fildes, newp, len,
elf->start_offset + offset + sizeof (struct ar_hdr))
if ((size_t) pread (elf->fildes, newp, len,
elf->start_offset + offset
+ sizeof (struct ar_hdr))
!= len)
{
/* We were not able to read all data. */

View File

@ -184,11 +184,11 @@ elf_getarsym (Elf *elf, size_t *ptr)
new_str = (char *) (elf->state.ar.ar_sym + n + 1);
/* Now read the data from the file. */
if (pread (elf->fildes, file_data, n * sizeof (uint32_t),
elf->start_offset
if ((size_t) pread (elf->fildes, file_data,
n * sizeof (uint32_t), elf->start_offset
+ SARMAG + sizeof (struct ar_hdr)
+ sizeof (uint32_t)) != n * sizeof (uint32_t)
|| (pread (elf->fildes, new_str,
|| ((size_t) pread (elf->fildes, new_str,
index_size - n * sizeof (uint32_t),
elf->start_offset
+ SARMAG + sizeof (struct ar_hdr)

View File

@ -268,7 +268,7 @@ __libelf_set_rawdata (Elf_Scn *scn)
return 1;
}
if (pread (elf->fildes, scn->rawdata.d.d_buf, size,
if ((size_t) pread (elf->fildes, scn->rawdata.d.d_buf, size,
elf->start_offset + offset) != size)
{
/* Cannot read the data. */

View File

@ -76,7 +76,7 @@ __libelf_readall (Elf *elf)
if (mem != NULL)
{
/* Read the file content. */
if (pread (elf->fildes, mem, elf->maximum_size,
if ((size_t) pread (elf->fildes, mem, elf->maximum_size,
elf->start_offset) != elf->maximum_size)
{
/* Something went wrong. */

View File

@ -54,7 +54,8 @@ gelf_rawchunk (Elf *elf, GElf_Off offset, GElf_Word size)
__libelf_seterrno (ELF_E_NOMEM);
else
/* Read the file content. */
if (pread (elf->fildes, result, size, elf->start_offset + offset) != size)
if ((size_t) pread (elf->fildes, result, size, elf->start_offset + offset)
!= size)
{
/* Something went wrong. */
__libelf_seterrno (ELF_E_READ_ERROR);

View File

@ -781,7 +781,7 @@ msgstr ""
msgid " %#06x: Parent %d: %s\n"
msgstr ""
#: src/readelf.c:2241
#: src/readelf.c:2242
#, c-format
msgid ""
"\n"
@ -794,20 +794,20 @@ msgid_plural ""
msgstr[0] ""
msgstr[1] ""
#: src/readelf.c:2273
#: src/readelf.c:2274
msgid " 0 *local* "
msgstr ""
#: src/readelf.c:2278
#: src/readelf.c:2279
msgid " 1 *global* "
msgstr ""
#: src/readelf.c:2334
#: src/readelf.c:2335
#, c-format
msgid "cannot get data for section %d: %s"
msgstr ""
#: src/readelf.c:2344
#: src/readelf.c:2345
#, c-format
msgid ""
"\n"
@ -822,49 +822,49 @@ msgid_plural ""
msgstr[0] ""
msgstr[1] ""
#: src/readelf.c:2389
#: src/readelf.c:2390
#, c-format
msgid " Length Number % of total Coverage"
msgstr ""
#: src/readelf.c:2390
#: src/readelf.c:2391
#, c-format
msgid " 0 %6<PRIu32> %5.1f%%\n"
msgstr ""
#: src/readelf.c:2396
#: src/readelf.c:2397
#, c-format
msgid "%7d %6<PRIu32> %5.1f%% %5.1f%%\n"
msgstr ""
#: src/readelf.c:2410
#: src/readelf.c:2411
#, c-format
msgid ""
" Average number of tests: successful lookup: %f\n"
" unsuccessful lookup: %f\n"
msgstr ""
#: src/readelf.c:2507
#: src/readelf.c:2508
#, c-format
msgid "unknown tag %hx"
msgstr ""
#: src/readelf.c:2509
#: src/readelf.c:2510
#, c-format
msgid "unknown user tag %hx"
msgstr ""
#: src/readelf.c:2692
#: src/readelf.c:2693
#, c-format
msgid "unknown attribute %hx"
msgstr ""
#: src/readelf.c:2695
#: src/readelf.c:2696
#, c-format
msgid "unknown user attribute %hx"
msgstr ""
#: src/readelf.c:2741
#: src/readelf.c:2742
#, c-format
msgid "unknown form %<PRIx64>"
msgstr ""
@ -1128,12 +1128,12 @@ msgstr ""
msgid "while closing `%s'"
msgstr ""
#: src/size.c:444 src/size.c:583
#: src/size.c:442 src/size.c:584
#, c-format
msgid " (ex %s)"
msgstr ""
#: src/size.c:608
#: src/size.c:609
msgid "(TOTALS)\n"
msgstr ""
@ -1776,12 +1776,20 @@ msgstr ""
msgid "cannot change access mode of output file"
msgstr ""
#: src/ldgeneric.c:5789
#: src/ldgeneric.c:5785
msgid "cannot stat output file"
msgstr ""
#: src/ldgeneric.c:5791
msgid "cannot rename output file"
msgstr ""
#: src/ldgeneric.c:5837 src/ldgeneric.c:5848 src/ldgeneric.c:5859
#: src/ldgeneric.c:5877 src/ldgeneric.c:5890 src/ldgeneric.c:5902
#: src/ldgeneric.c:5801
msgid "WARNING: temporary output overwritten before linking finished"
msgstr ""
#: src/ldgeneric.c:5854 src/ldgeneric.c:5865 src/ldgeneric.c:5876
#: src/ldgeneric.c:5894 src/ldgeneric.c:5907 src/ldgeneric.c:5919
#, c-format
msgid "no machine specific '%s' implementation"
msgstr ""
@ -2013,7 +2021,7 @@ msgstr ""
#: src/elflint.c:706
#, c-format
msgid "section [%2d] '%s': symbol %d: unknow symbol binding"
msgid "section [%2d] '%s': symbol %d: unknown symbol binding"
msgstr ""
#: src/elflint.c:718

View File

@ -141,7 +141,7 @@ main (int argc, char *argv[])
elf_errmsg (-1));
else
{
int prev_error_message_count = error_message_count;
unsigned int prev_error_message_count = error_message_count;
struct stat64 st;
if (fstat64 (fd, &st) != 0)
@ -324,14 +324,14 @@ static const int valid_e_machine[] =
/* Number of sections. */
static int shnum;
static unsigned int shnum;
static void
check_elf_header (Ebl *ebl, GElf_Ehdr *ehdr, size_t size)
{
char buf[512];
int cnt;
size_t cnt;
/* Check e_ident field. */
if (ehdr->e_ident[EI_MAG0] != ELFMAG0)
@ -506,7 +506,7 @@ check_scn_group (Ebl *ebl, GElf_Ehdr *ehdr, int idx)
{
/* No reference so far. Search following sections, maybe the
order is wrong. */
int cnt;
size_t cnt;
for (cnt = idx + 1; cnt < shnum; ++cnt)
{
@ -515,7 +515,7 @@ check_scn_group (Ebl *ebl, GElf_Ehdr *ehdr, int idx)
GElf_Shdr *shdr;
Elf_Data *data;
Elf32_Word *grpdata;
int inner;
size_t inner;
scn = elf_getscn (ebl->elf, cnt);
shdr = gelf_getshdr (scn, &shdr_mem);
@ -535,7 +535,7 @@ check_scn_group (Ebl *ebl, GElf_Ehdr *ehdr, int idx)
grpdata = (Elf32_Word *) data->d_buf;
for (inner = 1; inner < data->d_size / sizeof (Elf32_Word); ++inner)
if (grpdata[inner] == idx)
if (grpdata[inner] == (Elf32_Word) idx)
goto out;
}
@ -562,7 +562,7 @@ check_symtab (Ebl *ebl, GElf_Ehdr *ehdr, int idx)
Elf_Data *data;
GElf_Shdr strshdr_mem;
GElf_Shdr *strshdr;
int cnt;
size_t cnt;
GElf_Shdr xndxshdr_mem;
GElf_Shdr *xndxshdr = NULL;
Elf_Data *xndxdata = NULL;
@ -592,7 +592,7 @@ check_symtab (Ebl *ebl, GElf_Ehdr *ehdr, int idx)
/* Search for an extended section index table section. */
for (cnt = 1; cnt < shnum; ++cnt)
if (cnt != idx)
if (cnt != (size_t) idx)
{
Elf_Scn *xndxscn = elf_getscn (ebl->elf, cnt);
xndxshdr = gelf_getshdr (xndxscn, &xndxshdr_mem);
@ -603,7 +603,7 @@ check_symtab (Ebl *ebl, GElf_Ehdr *ehdr, int idx)
continue;
if (xndxshdr->sh_type == SHT_SYMTAB_SHNDX
&& xndxshdr->sh_link == idx)
&& xndxshdr->sh_link == (GElf_Word) idx)
break;
}
if (cnt == shnum)
@ -704,7 +704,7 @@ section [%2d] '%s': symbol %d: invalid section index"),
if (GELF_ST_BIND (sym->st_info) >= STB_NUM)
error (0, 0, gettext ("\
section [%2d] '%s': symbol %d: unknow symbol binding"),
section [%2d] '%s': symbol %d: unknown symbol binding"),
idx, section_name (ebl, ehdr, idx), cnt);
if (xndx > 0 && xndx < shnum)
@ -758,7 +758,7 @@ check_rela (Ebl *ebl, GElf_Ehdr *ehdr, int idx)
GElf_Shdr *symshdr;
GElf_Shdr destshdr_mem;
GElf_Shdr *destshdr = NULL;
int cnt;
size_t cnt;
scn = elf_getscn (ebl->elf, idx);
shdr = gelf_getshdr (scn, &shdr_mem);
@ -844,7 +844,7 @@ check_rel (Ebl *ebl, GElf_Ehdr *ehdr, int idx)
GElf_Shdr *symshdr;
GElf_Shdr destshdr_mem;
GElf_Shdr *destshdr = NULL;
int cnt;
size_t cnt;
scn = elf_getscn (ebl->elf, idx);
shdr = gelf_getshdr (scn, &shdr_mem);
@ -933,7 +933,7 @@ check_dynamic (Ebl *ebl, GElf_Ehdr *ehdr, int idx)
Elf_Data *data;
GElf_Shdr strshdr_mem;
GElf_Shdr *strshdr;
int cnt;
size_t cnt;
static const bool dependencies[DT_NUM][DT_NUM] =
{
[DT_NEEDED] = { [DT_STRTAB] = true },
@ -1130,7 +1130,7 @@ check_symtab_shndx (Ebl *ebl, GElf_Ehdr *ehdr, int idx)
GElf_Shdr symshdr_mem;
GElf_Shdr *symshdr;
Elf_Scn *symscn;
int cnt;
size_t cnt;
Elf_Data *data;
Elf_Data *symdata;
@ -1269,7 +1269,7 @@ section [%2d] '%s': hash table section is too small (is %ld, expected %ld)"),
if (symshdr != NULL)
{
size_t symsize = symshdr->sh_size / symshdr->sh_entsize;
int cnt;
size_t cnt;
if (nchain < symshdr->sh_size / symshdr->sh_entsize)
error (0, 0,
@ -1445,10 +1445,10 @@ static const struct
{
const char *name;
size_t namelen;
int type;
GElf_Word type;
enum { unused, exact, atleast } attrflag;
int attr;
int attr2;
GElf_Word attr;
GElf_Word attr2;
} special_sections[] =
{
/* See figure 4-14 in the gABI. */
@ -1547,7 +1547,7 @@ check_sections (Ebl *ebl, GElf_Ehdr *ehdr)
{
GElf_Shdr shdr_mem;
GElf_Shdr *shdr;
int cnt;
size_t cnt;
bool dot_interp_section = false;
/* Allocate array to count references in section groups. */

View File

@ -156,7 +156,7 @@ static bool print_armap;
static bool reverse_sort;
/* Type of the section we are printing. */
static int symsec_type = SHT_SYMTAB;
static GElf_Word symsec_type = SHT_SYMTAB;
/* Sorting selection. */
static enum
@ -616,7 +616,7 @@ get_local_names (Ebl *ebl, Dwarf_Debug dbg)
&& (dwarf_attr (die, DW_AT_decl_file, &file, &err)
== DW_DLV_OK)
&& dwarf_formudata (file, &fileidx, &err) == DW_DLV_OK
&& fileidx > 0 && fileidx <= nfiles
&& fileidx > 0 && fileidx <= (Dwarf_Unsigned) nfiles
&& (dwarf_attr (die, DW_AT_decl_line, &line, &err)
== DW_DLV_OK)
&& dwarf_formudata (line, &lineno, &err) == DW_DLV_OK
@ -1141,7 +1141,7 @@ show_symbols (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, Elf_Scn *xndxscn,
size_t nentries;
size_t cnt;
GElf_SymX *sym_mem;
int longest_name = 4;
size_t longest_name = 4;
int sort_by_name (const void *p1, const void *p2)
{
@ -1192,7 +1192,7 @@ show_symbols (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, Elf_Scn *xndxscn,
/* Allocate the memory.
XXX We can here a dirty trick. Since GElf_Sym == Elf64_Sym we
XXX We can use a dirty trick here. Since GElf_Sym == Elf64_Sym we
can use the data memory instead of copying again if what we read
is a 64 bit file. */
if (nentries * sizeof (GElf_SymX) < MAX_STACK_ALLOC)

View File

@ -1045,7 +1045,7 @@ handle_dynamic (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr)
int class = gelf_getclass (ebl->elf);
GElf_Shdr glink;
Elf_Data *data;
int cnt;
size_t cnt;
size_t shstrndx;
/* Get the data of the section. */
@ -1539,7 +1539,7 @@ print_symtab (Ebl *ebl, GElf_Ehdr *ehdr, int type)
GElf_Shdr shdr_mem;
GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
if (shdr != NULL && shdr->sh_type == type)
if (shdr != NULL && shdr->sh_type == (GElf_Word) type)
handle_symtab (ebl, ehdr, scn, shdr);
}
}
@ -2080,7 +2080,7 @@ handle_versym (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr)
if (def == NULL)
break;
nvername = MAX (nvername, def->vd_ndx & 0x7fff);
nvername = MAX (nvername, (size_t) (def->vd_ndx & 0x7fff));
offset += def->vd_next;
}
@ -2123,7 +2123,8 @@ handle_versym (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr)
if (aux == NULL)
break;
nvername = MAX (nvername, aux->vna_other & 0x7fff);
nvername = MAX (nvername,
(size_t) (aux->vna_other & 0x7fff));
auxoffset += aux->vna_next;
}
@ -3265,7 +3266,7 @@ print_debug_info_section (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn,
Dwarf_Unsigned nextcu;
int ret;
Dwarf_Off cu_offset;
int level;
size_t level;
printf (gettext ("\
\nDWARF section '%s' at offset %#" PRIx64 ":\n [Offset]\n"),

View File

@ -1,7 +1,7 @@
## Process this file with automake to create Makefile.in
## Configure input file for elfutils.
##
## Copyright (C) 1996-2001, 2002 Red Hat, Inc.
## Copyright (C) 1996-2002, 2003 Red Hat, Inc.
##
## This program is Open Source software; you can redistribute it and/or
## modify it under the terms of the Open Software License version 1.0 as
@ -15,6 +15,7 @@
##
DEFS = -DHAVE_CONFIG_H -D_GNU_SOURCE
AM_CFLAGS = -Wall # -Werror
AM_LDFLAGS = -Wl,-rpath,\$$ORIGIN/../libasm:\$$ORIGIN/../libdwarf:\$$ORIGIN/../libdw:\$$ORIGIN/../libebl:\$$ORIGIN/../libelf
INCLUDES = -I$(top_srcdir)/libasm -I$(top_srcdir)/libdwarf \
-I$(top_srcdir)/libdw \
-I$(top_srcdir)/libebl -I$(top_srcdir)/libelf \
@ -37,7 +38,8 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
run-show-ciefde.sh run-show-abbrev.sh hash asm-tst1 asm-tst2 \
asm-tst3 asm-tst4 asm-tst5 asm-tst6 asm-tst7 asm-tst8 asm-tst9 \
msg_tst newscn run-strip-test.sh run-strip-test2.sh \
run-get-pubnames2.sh run-ecp-test.sh run-ecp-test2.sh
run-ecp-test.sh run-ecp-test2.sh \
run-get-pubnames2.sh
EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-firstdie.sh \
run-show-dies.sh run-show-tags.sh run-show-die-info1.sh \
@ -50,8 +52,6 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-firstdie.sh \
testfile6.bz2 testfile7.bz2 testfile8.bz2 testfile9.bz2 \
testfile10
TESTS_ENVIRONMENT = LD_LIBRARY_PATH="../libelf:../libebl:../libasm:../libdwarf:../libdw$${LD_LIBRARY_PATH:+:}$$LD_LIBRARY_PATH"
arextract_LDADD = ../libelf/libelf.so
arsymtest_LDADD = ../libelf/libelf.so
newfile_LDADD = ../libelf/libelf.so

View File

@ -23,12 +23,14 @@ static int globcnt;
static int
callback (Dwarf *dbg, Dwarf_Global *gl, void *arg)
{
int result = DWARF_CB_OK;
const char *diename;
Dwarf_Die die;
printf (" [%2d] \"%s\", die: %llu, cu: %llu\n",
globcnt++, gl->name, (unsigned long long int) gl->die_offset,
(unsigned long long int) gl->cu_offset);
#if 0
{
Dwarf_Die cu_die;
const char *cuname;
const char *diename;
@ -37,28 +39,21 @@ callback (Dwarf *dbg, Dwarf_Global *gl, void *arg)
|| (cuname = dwarf_diename (&cu_die)) == NULL)
{
puts ("failed to get CU die");
result = 1;
result = DWARF_CB_ABORT;
}
else
{
printf ("CU name: \"%s\"\n", cuname);
dwarf_dealloc (dbg, cuname, DW_DLA_STRING);
}
if (dwarf_offdie (dbg, gl->die_offset, &die) == NULL
|| (diename = dwarf_diename (&die)) == NULL)
{
puts ("failed to get object die");
result = 1;
result = DWARF_CB_ABORT;
}
else
{
printf ("object name: \"%s\"\n", diename);
dwarf_dealloc (dbg, diename, DW_DLA_STRING);
}
}
#endif
return DWARF_CB_OK;
return result;
}