Add 'readelf' to binutils.
This commit is contained in:
parent
e2a15d35a8
commit
764668738f
@ -90,6 +90,8 @@ rclex.l
|
||||
rcparse.y
|
||||
rdcoff.c
|
||||
rddbg.c
|
||||
readelf.c
|
||||
readelf.h
|
||||
resbin.c
|
||||
rescoff.c
|
||||
resrc.c
|
||||
@ -122,6 +124,34 @@ Things-to-lose:
|
||||
|
||||
Do-last:
|
||||
|
||||
v850e_files="readelf.c"
|
||||
if ( echo $* | grep keep\-v850e > /dev/null ) ; then
|
||||
for i in $v850e_files ; do
|
||||
if test ! -d $i && (grep sanitize-v850e $i > /dev/null) ; then
|
||||
if [ -n "${verbose}" ] ; then
|
||||
echo Keeping v850e stuff in $i
|
||||
fi
|
||||
fi
|
||||
done
|
||||
else
|
||||
for i in $v850e_files ; do
|
||||
if test -r $i && (grep sanitize-v850e $i > /dev/null) ; then
|
||||
if [ -n "${verbose}" ] ; then
|
||||
echo Removing traces of \"v850e\" from $i...
|
||||
fi
|
||||
cp $i new
|
||||
sed '/start\-sanitize\-v850e/,/end\-sanitize\-v850e/d' < $i > new
|
||||
if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
|
||||
if [ -n "${verbose}" ] ; then
|
||||
echo Caching $i in .Recover...
|
||||
fi
|
||||
mv $i .Recover
|
||||
fi
|
||||
mv new $i
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# This must come after all other sanitizations. Re-sanitize the .pot
|
||||
# file.
|
||||
if [ -n "${verbose}" ]; then
|
||||
|
@ -29,6 +29,8 @@ STRIP_PROG=strip-new
|
||||
|
||||
STRINGS_PROG=strings
|
||||
|
||||
READELF_PROG=readelf
|
||||
|
||||
# These should all be the same program too.
|
||||
SIZE_PROG=size
|
||||
NM_PROG=nm-new
|
||||
@ -49,9 +51,9 @@ SRCONV_PROG=srconv$(EXEEXT) sysdump$(EXEEXT) coffdump$(EXEEXT)
|
||||
man_MANS = ar.1 nm.1 objdump.1 ranlib.1 size.1 strings.1 strip.1 objcopy.1 \
|
||||
addr2line.1 nlmconv.1 $(DEMANGLER_PROG).1
|
||||
|
||||
PROGS = $(SIZE_PROG) $(OBJDUMP_PROG) $(NM_PROG) $(AR_PROG) $(STRINGS_PROG) $(STRIP_PROG) $(RANLIB_PROG) $(DEMANGLER_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ $(ADDR2LINE_PROG)
|
||||
PROGS = $(SIZE_PROG) $(OBJDUMP_PROG) $(NM_PROG) $(AR_PROG) $(STRINGS_PROG) $(STRIP_PROG) $(RANLIB_PROG) $(DEMANGLER_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ $(ADDR2LINE_PROG) $(READELF_PROG)
|
||||
|
||||
bin_PROGRAMS = $(SIZE_PROG) $(OBJDUMP_PROG) $(AR_PROG) $(STRINGS_PROG) $(RANLIB_PROG) $(DEMANGLER_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ $(ADDR2LINE_PROG)
|
||||
bin_PROGRAMS = $(SIZE_PROG) $(OBJDUMP_PROG) $(AR_PROG) $(STRINGS_PROG) $(RANLIB_PROG) $(DEMANGLER_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ $(ADDR2LINE_PROG) $(READELF_PROG)
|
||||
|
||||
## We need a special rule to install the programs which are built with -new
|
||||
noinst_PROGRAMS = $(NM_PROG) $(STRIP_PROG)
|
||||
@ -71,7 +73,7 @@ DEP = mkdep
|
||||
INCLUDES = -D_GNU_SOURCE -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) @HDEFINES@ -I$(srcdir)/../intl -I../intl -DLOCALEDIR="\"$(prefix)/share/locale\""
|
||||
|
||||
HFILES = arsup.h bucomm.h budbg.h coffgrok.h debug.h nlmconv.h dlltool.h \
|
||||
windres.h
|
||||
windres.h readelf.h
|
||||
|
||||
GENERATED_HFILES = arparse.h sysroff.h sysinfo.h defparse.h
|
||||
|
||||
@ -80,7 +82,7 @@ CFILES = addr2line.c ar.c arsup.c bucomm.c coffdump.c coffgrok.c debug.c \
|
||||
maybe-strip.c nlmconv.c nm.c not-ranlib.c not-strip.c \
|
||||
objcopy.c objdump.c prdbg.c rdcoff.c rddbg.c size.c srconv.c \
|
||||
stabs.c strings.c sysdump.c version.c wrstabs.c \
|
||||
windres.c resrc.c rescoff.c resbin.c
|
||||
windres.c resrc.c rescoff.c resbin.c readelf.c
|
||||
|
||||
GENERATED_CFILES = \
|
||||
underscore.c arparse.c arlex.c sysroff.c sysinfo.c syslex.c \
|
||||
@ -154,6 +156,9 @@ objcopy_SOURCES = objcopy.c not-strip.c $(WRITE_DEBUG_SRCS) $(BULIBS)
|
||||
|
||||
strings_SOURCES = strings.c $(BULIBS)
|
||||
|
||||
readelf_SOURCES = readelf.c version.c
|
||||
readelf_LDADD = $(INTLLIBS)
|
||||
|
||||
strip_new_SOURCES = objcopy.c is-strip.c $(WRITE_DEBUG_SRCS) $(BULIBS)
|
||||
|
||||
nm_new_SOURCES = nm.c $(BULIBS)
|
||||
@ -393,6 +398,9 @@ objdump.o: objdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/getopt.h $(INCDIR)/progress.h bucomm.h config.h \
|
||||
$(INCDIR)/fopen-same.h $(INCDIR)/dis-asm.h $(INCDIR)/libiberty.h \
|
||||
$(INCDIR)/demangle.h debug.h budbg.h $(INCDIR)/aout/aout64.h
|
||||
readelf.o: readelf.c $(INCDIR)/ansidecl.h ./readelf.h \
|
||||
$(INCDIR)/progress.h config.h $(INCDIR)/fopen-same.h ../bfd/bfd.h \
|
||||
$(INCDIR)/getopt.h $(INCDIR)/libiberty.h $(INCDIR)/elf/common.h
|
||||
prdbg.o: prdbg.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
|
||||
debug.h budbg.h
|
||||
|
@ -102,6 +102,8 @@ STRIP_PROG=strip-new
|
||||
|
||||
STRINGS_PROG=strings
|
||||
|
||||
READELF_PROG=readelf
|
||||
|
||||
# These should all be the same program too.
|
||||
SIZE_PROG=size
|
||||
NM_PROG=nm-new
|
||||
@ -122,9 +124,9 @@ SRCONV_PROG=srconv$(EXEEXT) sysdump$(EXEEXT) coffdump$(EXEEXT)
|
||||
man_MANS = ar.1 nm.1 objdump.1 ranlib.1 size.1 strings.1 strip.1 objcopy.1 \
|
||||
addr2line.1 nlmconv.1 $(DEMANGLER_PROG).1
|
||||
|
||||
PROGS = $(SIZE_PROG) $(OBJDUMP_PROG) $(NM_PROG) $(AR_PROG) $(STRINGS_PROG) $(STRIP_PROG) $(RANLIB_PROG) $(DEMANGLER_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ $(ADDR2LINE_PROG)
|
||||
PROGS = $(SIZE_PROG) $(OBJDUMP_PROG) $(NM_PROG) $(AR_PROG) $(STRINGS_PROG) $(STRIP_PROG) $(RANLIB_PROG) $(DEMANGLER_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ $(ADDR2LINE_PROG) $(READELF_PROG)
|
||||
|
||||
bin_PROGRAMS = $(SIZE_PROG) $(OBJDUMP_PROG) $(AR_PROG) $(STRINGS_PROG) $(RANLIB_PROG) $(DEMANGLER_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ $(ADDR2LINE_PROG)
|
||||
bin_PROGRAMS = $(SIZE_PROG) $(OBJDUMP_PROG) $(AR_PROG) $(STRINGS_PROG) $(RANLIB_PROG) $(DEMANGLER_PROG) $(OBJCOPY_PROG) @BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ $(ADDR2LINE_PROG) $(READELF_PROG)
|
||||
|
||||
noinst_PROGRAMS = $(NM_PROG) $(STRIP_PROG)
|
||||
|
||||
@ -143,7 +145,7 @@ DEP = mkdep
|
||||
INCLUDES = -D_GNU_SOURCE -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) @HDEFINES@ -I$(srcdir)/../intl -I../intl -DLOCALEDIR="\"$(prefix)/share/locale\""
|
||||
|
||||
HFILES = arsup.h bucomm.h budbg.h coffgrok.h debug.h nlmconv.h dlltool.h \
|
||||
windres.h
|
||||
windres.h readelf.h
|
||||
|
||||
GENERATED_HFILES = arparse.h sysroff.h sysinfo.h defparse.h
|
||||
|
||||
@ -152,7 +154,7 @@ CFILES = addr2line.c ar.c arsup.c bucomm.c coffdump.c coffgrok.c debug.c \
|
||||
maybe-strip.c nlmconv.c nm.c not-ranlib.c not-strip.c \
|
||||
objcopy.c objdump.c prdbg.c rdcoff.c rddbg.c size.c srconv.c \
|
||||
stabs.c strings.c sysdump.c version.c wrstabs.c \
|
||||
windres.c resrc.c rescoff.c resbin.c
|
||||
windres.c resrc.c rescoff.c resbin.c readelf.c
|
||||
|
||||
GENERATED_CFILES = \
|
||||
underscore.c arparse.c arlex.c sysroff.c sysinfo.c syslex.c \
|
||||
@ -204,6 +206,9 @@ objcopy_SOURCES = objcopy.c not-strip.c $(WRITE_DEBUG_SRCS) $(BULIBS)
|
||||
|
||||
strings_SOURCES = strings.c $(BULIBS)
|
||||
|
||||
readelf_SOURCES = readelf.c version.c
|
||||
readelf_LDADD = $(INTLLIBS)
|
||||
|
||||
strip_new_SOURCES = objcopy.c is-strip.c $(WRITE_DEBUG_SRCS) $(BULIBS)
|
||||
|
||||
nm_new_SOURCES = nm.c $(BULIBS)
|
||||
@ -254,7 +259,7 @@ CONFIG_CLEAN_FILES =
|
||||
bin_PROGRAMS = size$(EXEEXT) objdump$(EXEEXT) ar$(EXEEXT) \
|
||||
strings$(EXEEXT) ranlib$(EXEEXT) c++filt$(EXEEXT) objcopy$(EXEEXT) \
|
||||
@BUILD_NLMCONV@ @BUILD_SRCONV@ @BUILD_DLLTOOL@ @BUILD_WINDRES@ \
|
||||
addr2line$(EXEEXT)
|
||||
addr2line$(EXEEXT) readelf$(EXEEXT)
|
||||
noinst_PROGRAMS = nm-new$(EXEEXT) strip-new$(EXEEXT)
|
||||
PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
|
||||
|
||||
@ -321,6 +326,9 @@ addr2line_OBJECTS = addr2line.o bucomm.o version.o filemode.o
|
||||
addr2line_LDADD = $(LDADD)
|
||||
addr2line_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a
|
||||
addr2line_LDFLAGS =
|
||||
readelf_OBJECTS = readelf.o version.o
|
||||
readelf_DEPENDENCIES =
|
||||
readelf_LDFLAGS =
|
||||
nm_new_OBJECTS = nm.o bucomm.o version.o filemode.o
|
||||
nm_new_LDADD = $(LDADD)
|
||||
nm_new_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a
|
||||
@ -360,8 +368,8 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
SOURCES = $(nlmconv_SOURCES) $(srconv_SOURCES) $(sysdump_SOURCES) $(coffdump_SOURCES) $(dlltool_SOURCES) $(windres_SOURCES) $(size_SOURCES) $(objdump_SOURCES) $(ar_SOURCES) $(strings_SOURCES) $(ranlib_SOURCES) $(c__filt_SOURCES) $(objcopy_SOURCES) $(addr2line_SOURCES) $(nm_new_SOURCES) $(strip_new_SOURCES)
|
||||
OBJECTS = $(nlmconv_OBJECTS) $(srconv_OBJECTS) $(sysdump_OBJECTS) $(coffdump_OBJECTS) $(dlltool_OBJECTS) $(windres_OBJECTS) $(size_OBJECTS) $(objdump_OBJECTS) $(ar_OBJECTS) $(strings_OBJECTS) $(ranlib_OBJECTS) $(c__filt_OBJECTS) $(objcopy_OBJECTS) $(addr2line_OBJECTS) $(nm_new_OBJECTS) $(strip_new_OBJECTS)
|
||||
SOURCES = $(nlmconv_SOURCES) $(srconv_SOURCES) $(sysdump_SOURCES) $(coffdump_SOURCES) $(dlltool_SOURCES) $(windres_SOURCES) $(size_SOURCES) $(objdump_SOURCES) $(ar_SOURCES) $(strings_SOURCES) $(ranlib_SOURCES) $(c__filt_SOURCES) $(objcopy_SOURCES) $(addr2line_SOURCES) $(readelf_SOURCES) $(nm_new_SOURCES) $(strip_new_SOURCES)
|
||||
OBJECTS = $(nlmconv_OBJECTS) $(srconv_OBJECTS) $(sysdump_OBJECTS) $(coffdump_OBJECTS) $(dlltool_OBJECTS) $(windres_OBJECTS) $(size_OBJECTS) $(objdump_OBJECTS) $(ar_OBJECTS) $(strings_OBJECTS) $(ranlib_OBJECTS) $(c__filt_OBJECTS) $(objcopy_OBJECTS) $(addr2line_OBJECTS) $(readelf_OBJECTS) $(nm_new_OBJECTS) $(strip_new_OBJECTS)
|
||||
|
||||
all: all-recursive-am all-am
|
||||
|
||||
@ -531,6 +539,10 @@ addr2line$(EXEEXT): $(addr2line_OBJECTS) $(addr2line_DEPENDENCIES)
|
||||
@rm -f addr2line$(EXEEXT)
|
||||
$(LINK) $(addr2line_LDFLAGS) $(addr2line_OBJECTS) $(addr2line_LDADD) $(LIBS)
|
||||
|
||||
readelf$(EXEEXT): $(readelf_OBJECTS) $(readelf_DEPENDENCIES)
|
||||
@rm -f readelf$(EXEEXT)
|
||||
$(LINK) $(readelf_LDFLAGS) $(readelf_OBJECTS) $(readelf_LDADD) $(LIBS)
|
||||
|
||||
nm-new$(EXEEXT): $(nm_new_OBJECTS) $(nm_new_DEPENDENCIES)
|
||||
@rm -f nm-new$(EXEEXT)
|
||||
$(LINK) $(nm_new_LDFLAGS) $(nm_new_OBJECTS) $(nm_new_LDADD) $(LIBS)
|
||||
@ -1158,6 +1170,9 @@ objdump.o: objdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
$(INCDIR)/getopt.h $(INCDIR)/progress.h bucomm.h config.h \
|
||||
$(INCDIR)/fopen-same.h $(INCDIR)/dis-asm.h $(INCDIR)/libiberty.h \
|
||||
$(INCDIR)/demangle.h debug.h budbg.h $(INCDIR)/aout/aout64.h
|
||||
readelf.o: readelf.c $(INCDIR)/ansidecl.h ./readelf.h \
|
||||
$(INCDIR)/progress.h config.h $(INCDIR)/fopen-same.h ../bfd/bfd.h \
|
||||
$(INCDIR)/getopt.h $(INCDIR)/libiberty.h $(INCDIR)/elf/common.h
|
||||
prdbg.o: prdbg.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||
bucomm.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
|
||||
debug.h budbg.h
|
||||
|
@ -6,7 +6,7 @@
|
||||
@format
|
||||
START-INFO-DIR-ENTRY
|
||||
* Binutils: (binutils). The GNU binary utilities "ar", "objcopy",
|
||||
"objdump", "nm", "nlmconv", "size",
|
||||
"objdump", "nm", "nlmconv", "size", "readelf"
|
||||
"strings", "strip", "ranlib" and "dlltool".
|
||||
END-INFO-DIR-ENTRY
|
||||
@end format
|
||||
@ -39,7 +39,7 @@ into another language, under the above conditions for modified versions.
|
||||
@synindex ky cp
|
||||
@c
|
||||
@c This file documents the GNU binary utilities "ar", "ld", "objcopy",
|
||||
@c "objdump", "nm", "size", "strings", "strip", and "ranlib".
|
||||
@c "objdump", "nm", "size", "strings", "strip", "readelf" and "ranlib".
|
||||
@c
|
||||
@c Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
|
||||
@c
|
||||
@ -105,6 +105,9 @@ Display information from object files
|
||||
@item ranlib
|
||||
Generate index to archive contents
|
||||
|
||||
@item readelf
|
||||
Display the contents of ELF format files.
|
||||
|
||||
@item size
|
||||
List file section sizes and total size
|
||||
|
||||
@ -137,6 +140,7 @@ Create the files needed to build and use Dynamic Link Libraries
|
||||
* objcopy:: Copy and translate object files
|
||||
* objdump:: Display information from object files
|
||||
* ranlib:: Generate index to archive contents
|
||||
* readelf:: Display the contents of ELF format files.
|
||||
* size:: List section sizes and total size
|
||||
* strings:: List printable strings from files
|
||||
* strip:: Discard symbols
|
||||
@ -2262,6 +2266,106 @@ Displays dlltool's version number and then exits.
|
||||
|
||||
@end table
|
||||
|
||||
@node readelf
|
||||
@chapter readelf
|
||||
|
||||
@cindex ELF file information
|
||||
@kindex readelf
|
||||
|
||||
@smallexample
|
||||
readelf [ -a | --all ]
|
||||
[ -h | --file-header]
|
||||
[ -l | --program-headers | --segments]
|
||||
[ -S | --sections]
|
||||
[ -s | --symbols]
|
||||
[ -r | --relocs]
|
||||
[ -d | --dynamic]
|
||||
[ -V | --version-info]
|
||||
[ -D | --use-dynamic]
|
||||
[ -x <number> | --hex-dump=<number>]
|
||||
[ -v | --version]
|
||||
[ -H | --help]
|
||||
@var{elffile}@dots{}
|
||||
@end smallexample
|
||||
|
||||
@code{readelf} displays information about one or more ELF format object
|
||||
files. The options control what particular information to display.
|
||||
|
||||
@var{elffile}@dots{} are the object files to be examined. At the
|
||||
moment, @code{readelf} does not support examining archives, nor does it
|
||||
support examing 64 bit ELF files.
|
||||
|
||||
The long and short forms of options, shown here as alternatives, are
|
||||
equivalent. At least one option besides @samp{-v} or @samp{-H} must be
|
||||
given.
|
||||
|
||||
@table @code
|
||||
@item -a
|
||||
@itemx --all
|
||||
Equivalent to specifiying @samp{--file-header},
|
||||
@samp{--program-headers}, @samp{--sections}, @samp{--symbols},
|
||||
@samp{--relocs}, @samp{--dynamic} and @samp{--version-info}.
|
||||
|
||||
@item -h
|
||||
@itemx --file-header
|
||||
@cindex ELF file header information
|
||||
Displays the information contained in the ELF header at the start of the
|
||||
file.
|
||||
|
||||
@item -l
|
||||
@itemx --program-headers
|
||||
@itemx --segments
|
||||
@cindex ELF program header information
|
||||
@cindex ELF segment information
|
||||
Displays the information contained in the file's segment headers, if it
|
||||
has any.
|
||||
|
||||
@item -S
|
||||
@itemx --sections
|
||||
@cindex ELF section information
|
||||
Displays the information contained in the file's section headers, if it
|
||||
has any.
|
||||
|
||||
@item -s
|
||||
@itemx --symbols
|
||||
@cindex ELF symbol table information
|
||||
Displays the entries in symbol table section of the file, if it has one.
|
||||
|
||||
@item -r
|
||||
@itemx --relocs
|
||||
@cindex ELF reloc information
|
||||
Displays the contents of the file's relocation section, if it ha one.
|
||||
|
||||
@item -d
|
||||
@itemx --dynamic
|
||||
@cindex ELF dynamic section information
|
||||
Displays the contents of the file's dynamic section, if it has one.
|
||||
|
||||
@item -V
|
||||
@itemx --version-info
|
||||
@cindex ELF version sections informations
|
||||
Displays the contents of the version sections in the file, it they
|
||||
exist.
|
||||
|
||||
@item -D
|
||||
@itemx --use-dynamic
|
||||
When displaying symbols, this option makes @code{readelf} use the
|
||||
symblol table in the file's dynamic section, rather than the one in the
|
||||
symbols section.
|
||||
|
||||
@item -x <number>
|
||||
@itemx --hex-dump=<number>
|
||||
Displays the contents of the indicated section as a hexadecimal dump.
|
||||
|
||||
@item -v
|
||||
@itemx --version
|
||||
Display the version number of readelf.
|
||||
|
||||
@item -H
|
||||
@itemx --help
|
||||
Display the command line options understood by @code{readelf}.
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
@node Selecting The Target System
|
||||
|
2254
binutils/readelf.c
Normal file
2254
binutils/readelf.c
Normal file
File diff suppressed because it is too large
Load Diff
173
binutils/readelf.h
Normal file
173
binutils/readelf.h
Normal file
@ -0,0 +1,173 @@
|
||||
/* readelf.h -- This file contains structures similar to those found in
|
||||
include/elf/internal.h. These structures however, match the layout of
|
||||
the information in the file, rather than being optimised for internal
|
||||
storage.
|
||||
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Binutils.
|
||||
|
||||
This program 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 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _READELF_H
|
||||
#define _READELF_H
|
||||
|
||||
#include "bfd.h"
|
||||
#include "elf/common.h"
|
||||
|
||||
/* The type 'bfd_vma' is used in places where the 64 bit version of the
|
||||
structure has a 64 bit wide field, and the 32 bit version has a 32 bit wide
|
||||
field. It does not necessarily imply that the field contains an address. */
|
||||
|
||||
#define EI_NIDENT 16
|
||||
|
||||
/* The ELF file header. This appears at the start of every ELF file. */
|
||||
typedef struct
|
||||
{
|
||||
unsigned char e_ident [EI_NIDENT]; /* Magic number and other info */
|
||||
unsigned short e_type; /* Object file type */
|
||||
unsigned short e_machine; /* Architecture */
|
||||
unsigned long e_version; /* Object file version */
|
||||
bfd_vma e_entry; /* Entry point virtual address */
|
||||
bfd_vma e_phoff; /* Program header table file offset */
|
||||
bfd_vma e_shoff; /* Section header table file offset */
|
||||
unsigned long e_flags; /* Processor-specific flags */
|
||||
unsigned short e_ehsize; /* ELF header size in bytes */
|
||||
unsigned short e_phentsize; /* Program header table entry size */
|
||||
unsigned short e_phnum; /* Program header table entry count */
|
||||
unsigned short e_shentsize; /* Section header table entry size */
|
||||
unsigned short e_shnum; /* Section header table entry count */
|
||||
unsigned short e_shstrndx; /* Section header string table index */
|
||||
}
|
||||
Elf_Ehdr;
|
||||
|
||||
/* Program Segment Header. (Might be wrong for 64 bit ELF formats). */
|
||||
typedef struct
|
||||
{
|
||||
unsigned long p_type; /* Segment type */
|
||||
bfd_vma p_offset; /* Segment file offset */
|
||||
bfd_vma p_vaddr; /* Segment virtual address */
|
||||
bfd_vma p_paddr; /* Segment physical address */
|
||||
unsigned long p_filesz; /* Segment size in file */
|
||||
unsigned long p_memsz; /* Segment size in memory */
|
||||
unsigned long p_flags; /* Segment flags */
|
||||
unsigned long p_align; /* Segment alignment */
|
||||
}
|
||||
Elf_Phdr;
|
||||
|
||||
/* Section header. */
|
||||
typedef struct
|
||||
{
|
||||
unsigned long sh_name; /* Section name (string tbl index) */
|
||||
unsigned long sh_type; /* Section type */
|
||||
bfd_vma sh_flags; /* Section flags */
|
||||
bfd_vma sh_addr; /* Section virtual addr at execution */
|
||||
bfd_vma sh_offset; /* Section file offset */
|
||||
unsigned long sh_size; /* Section size in bytes */
|
||||
unsigned long sh_link; /* Link to another section */
|
||||
unsigned long sh_info; /* Additional section information */
|
||||
bfd_vma sh_addralign; /* Section alignment */
|
||||
bfd_vma sh_entsize; /* Entry size if section holds table */
|
||||
}
|
||||
Elf_Shdr;
|
||||
|
||||
/* Symbol table entry. (Might be incorrect for 64 bit ELF formats) */
|
||||
typedef struct
|
||||
{
|
||||
unsigned long st_name; /* Symbol name (string tbl index) */
|
||||
bfd_vma st_value; /* Symbol value */
|
||||
bfd_vma st_size; /* Symbol size */
|
||||
unsigned char st_info; /* Symbol type and binding */
|
||||
unsigned char st_other; /* No defined meaning, 0 */
|
||||
unsigned short st_shndx; /* Section index */
|
||||
}
|
||||
Elf_Sym;
|
||||
|
||||
/* Version definition sections. */
|
||||
typedef struct
|
||||
{
|
||||
unsigned short vd_version; /* Version number of structure. */
|
||||
unsigned short vd_flags; /* Flags (VER_FLG_*). */
|
||||
unsigned short vd_ndx; /* Version index. */
|
||||
unsigned short vd_cnt; /* Number of verdaux entries. */
|
||||
unsigned long vd_hash; /* Hash of name. */
|
||||
unsigned long vd_aux; /* Offset to verdaux entries. */
|
||||
unsigned long vd_next; /* Offset to next verdef. */
|
||||
}
|
||||
Elf_Verdef;
|
||||
|
||||
/* Auxialiary version information. */
|
||||
typedef struct
|
||||
{
|
||||
unsigned long vda_name; /* String table offset of name. */
|
||||
unsigned long vda_next; /* Offset to next verdaux. */
|
||||
}
|
||||
Elf_Verdaux;
|
||||
|
||||
/* Version dependency section. */
|
||||
typedef struct
|
||||
{
|
||||
unsigned short vn_version; /* Version number of structure. */
|
||||
unsigned short vn_cnt; /* Number of vernaux entries. */
|
||||
unsigned long vn_file; /* String table offset of library name. */
|
||||
unsigned long vn_aux; /* Offset to vernaux entries. */
|
||||
unsigned long vn_next; /* Offset to next verneed. */
|
||||
}
|
||||
Elf_Verneed;
|
||||
|
||||
/* Auxiliary needed version information. */
|
||||
typedef struct
|
||||
{
|
||||
unsigned long vna_hash; /* Hash of dependency name. */
|
||||
unsigned short vna_flags; /* Flags (VER_FLG_*). */
|
||||
unsigned short vna_other; /* Unused. */
|
||||
unsigned long vna_name; /* String table offset to version name. */
|
||||
unsigned long vna_next; /* Offset to next vernaux. */
|
||||
}
|
||||
Elf_Vernaux;
|
||||
|
||||
/* Relocation table entry without addend. */
|
||||
typedef struct
|
||||
{
|
||||
bfd_vma r_offset; /* Location at which to apply the action */
|
||||
bfd_vma r_info; /* index and type of relocation */
|
||||
}
|
||||
Elf_Rel;
|
||||
|
||||
/* Relocation table entry with addend. */
|
||||
typedef struct
|
||||
{
|
||||
bfd_vma r_offset; /* Location at which to apply the action */
|
||||
bfd_vma r_info; /* Index and Type of relocation */
|
||||
bfd_signed_vma r_addend; /* Constant addend used to compute value */
|
||||
}
|
||||
Elf_Rela;
|
||||
|
||||
/* Dynamic section entry. */
|
||||
typedef struct
|
||||
{
|
||||
signed long d_tag; /* Dynamic entry type */
|
||||
union
|
||||
{
|
||||
bfd_vma d_val; /* Integer value */
|
||||
bfd_vma d_ptr; /* Address value */
|
||||
} d_un;
|
||||
}
|
||||
Elf_Dyn;
|
||||
|
||||
|
||||
#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) /* Reverse order! */
|
||||
|
||||
#endif /* _READELF_H */
|
Loading…
Reference in New Issue
Block a user