diff options
author | jbj <devnull@localhost> | 2002-10-22 22:52:08 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2002-10-22 22:52:08 +0000 |
commit | 75ccbf4900b1dea10363e774337c522e45d01d2b (patch) | |
tree | 29279cd54876089cddfeae3ab35ad08e1aa4b11d /elfutils | |
parent | f4890ceb80399e9400b801b7b7474be18ed38cd4 (diff) | |
download | librpm-tizen-75ccbf4900b1dea10363e774337c522e45d01d2b.tar.gz librpm-tizen-75ccbf4900b1dea10363e774337c522e45d01d2b.tar.bz2 librpm-tizen-75ccbf4900b1dea10363e774337c522e45d01d2b.zip |
Initial revision
CVS patchset: 5798
CVS date: 2002/10/22 22:52:08
Diffstat (limited to 'elfutils')
29 files changed, 2386 insertions, 0 deletions
diff --git a/elfutils/GPG-KEY b/elfutils/GPG-KEY new file mode 100644 index 000000000..330e1fbe7 --- /dev/null +++ b/elfutils/GPG-KEY @@ -0,0 +1,32 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.0.7 (GNU/Linux) + +mQGiBDuFth0RBACPcHEkyqJE26wTXuuuCxpqJjxlBnNFkJGkWUoeu89QjzWgzXy/ +EA8+ptNBgCTPKnLEqhkRUyxAT/Uz+t+xbKqUtL54IzYfxO4NQsN/VVM0uppNfIJb +MWvAjvpp2HCkd/32i693rlH+G9dvG8K57by3PBRHBgH2L8Q7t/QvA2AWpwCgzokX +DDUiitysGn4rWO0rBBoR6OED/3ehpcHtbGixNoubRZAxpw99VTKs/I76OkrQzqcm ++w+zwZeihJXC88yAHA77/LBB3YKaX3G4CmDQUbeRJ9zPlETTLmRMcF61dQdq/3qV +Biq1sm6ctZ4uEpm8HnysKMT+VY4Xmj9LLzF2BdING9frcX9rk8Vk25iCLBronS0M +IU3WA/sEvlUFlfbyCBRBoq+Rlr9u05fnHc7CLMKI7EIS1T1dLPxH1ivuUhyYNGAM +RhCivBbT2Z0t/R4ksu3VdnPGkCyAAdWNSafSGqCYUzQH0u5Z8HK6c2iXrIX3Ipk5 +DhQOQ6k1tyYzuQw3cCf7RYRJ9/iup8RlscVt2kmGnSucqpxJCbQjVWxyaWNoIERy +ZXBwZXIgPGRyZXBwZXJAcmVkaGF0LmNvbT6IVwQTEQIAFwUCO4W2HQULBwoDBAMV +AwIDFgIBAheAAAoJENoowjp5/0R0SqUAoL5HBbaRWR19vjldUeJvYCG2AR94AKDL +nmVEaykaZWyyNg0OTuxLe1boa4hGBBARAgAGBQI8iQDvAAoJEFWW3Qzpv2U97wgA +n1RVl6FbIHVVmT224nOp5b98OZVnAJ9ehXzM60RbmGi3kJNS30II+SGft4hGBBMR +AgAGBQI9Tvt0AAoJEP3S3qzTM8uhUy0AoNqATBj2usEtJduGHukKZ9mQaycFAJ9y +lq0MmZJwMZ3699e6rgMiHAMAVbkCDQQ7hbZPEAgAzuFAPq1sYUtpJClwX7+pdz1K +dIgbxDKoSHh2rSRx24HLYY/xg9ps6fZF21/SBialKaB8BFnIeh8S9LXUtWt9aUeC +klnnQwPbR0BGRcZAS7+nHZ9agiMd4CRe4RWFmS6KhIeUsDa70+8XhIm/C+Ogd7ag +kBw7ykTb/jWHMyvcP9iY0QtmIatfVTDJUm7Rm5TtM1mDCml/gWIQJ5ezr9gv2NUG +3kpNYwP+G9o4BLyTOHamix/0YHI/HiZSYiwq40ao0zROd/yXY6/a3mitN96AidJL +5I5tbqnrFy6LmRvWmyOxWkJD/bF31rrO5PfVUgcVpUxbtW44PtVilhLuh+qjTwAD +BQf+NTHwjUw1j+PZs/y5XnPw0x0ZdYGEl0I7NqtMgCxI4ZHT9jaLcLXARb3UVEuc +1LuJ1tAA1ss1c1NLK3Lg+uZzeKMRffRYEUg0Emer8QGWr1uSOxDHcAzuRZX3PYNX +cEGEyEm443DDnXr/4b8zYK6O+sy1Ld+SVxxp6jwtk0LyT7okgD0E1dDUzX+qxpsV +ujbzdH4bdqocKouMNMT+BHeobNZpR4Tyz5+pwW+rw1+XZebyBUkIPXOoWPZpUTDG +fZ+om9xfg0JOcKZIZ0X91dLQp5x99aCmzwWeWy9LFPTAf9pYky8wXzteEotE/Tkm +DeA1caPC9IEK9BBrrS9TeubrEIhGBBgRAgAGBQI7hbZPAAoJENoowjp5/0R0Z38A +mgM4FAquwltH0ooTdAmBMoCfKb4/AJ9ufAh4Rl9sFaCie/j8jdo02bcV1A== +=Yeua +-----END PGP PUBLIC KEY BLOCK----- diff --git a/elfutils/NOTES b/elfutils/NOTES new file mode 100644 index 000000000..4f06b8d2d --- /dev/null +++ b/elfutils/NOTES @@ -0,0 +1,73 @@ +- old GNU ld's behavior wrt DSOs seems to be severely broken. + + y.o reference foo() + y1.o defines foo(), references bar() + y2.o defines bar() + libbar.so defines bar() + + Running + + gcc -o y y.o -lbar y1.o y2.o + + uses the bar() definition from libbar.so and does not mention the definition + in y2.o at all (no duplicate symbol message). Correct is to use the + definition in y2.o. + + + y.o reference foo() + y1.o defines foo(), references bar() + y2.o in liby2.a defines bar() + libbar.so defines bar() + + Running + + gcc -o y y.o -lbar y1.o -ly3 + + has to use the definition in -lbar and not pull the definition from liby3.a. + + +- the old linker follows DT_NEEDED entries and adds the objects referenced + this way which define a symbol which is needed as a DT_NEEDED to the + generated binary. This is wrong since the DT_NEEDED changes the search + path in the object (which is breadth first). + + +- the old linker supported extern "C++", extern "java" in version scripts. + I believe this implementation is severly broken and needs a redesign + (how do wildcards work with these languages*?). Therefore it is left + out for now. + + +- what should happen if two sections in different files with the same + name have different types and/or the flags are different + + +- section names in input files are mostly irrelevant. Exceptions: + + .comment/SHT_PROGBITS in strip, ld + + .debug \ + .line | + .debug_srcinfo | + .debug_sfnames | + .debug_aranges | + .debug_pubnames | + .debug_info | + .debug_abbrev | + .debug_line | + .debug_abbrev > DWARF sections in ld + .debug_line | + .debug_frame | + .debug_str | + .debug_loc | + .debug_macinfo | + .debug_weaknames | + .debug_funcnames | + .debug_typenames | + .debug_varnames / + + Sections created in output files follow the naming of special section + from the gABI. + + In no place is a section solely indentified by its name. Internal + references always use the section index. diff --git a/elfutils/configure.ac b/elfutils/configure.ac new file mode 100644 index 000000000..6a99c5784 --- /dev/null +++ b/elfutils/configure.ac @@ -0,0 +1,158 @@ +dnl Process this file with autoconf to produce a configure script. -*-m4-*- +dnl Configure input file for elfutils. +dnl +dnl Copyright (C) 1996-2001, 2002 Red Hat, Inc. +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License version 2 as +dnl published by the Free Software Foundation. +dnl +dnl his program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software Foundation, +dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +dnl +AC_INIT([elfutils],[0.51],[drepper@redhat.com],[elfutils]) +AM_INIT_AUTOMAKE([gnits 1.7 dist-bzip2]) +AC_COPYRIGHT([Copyright (C) 1996-2001, 2002 Red Hat, Inc.]) +AC_CONFIG_SRCDIR([src/readelf.c]) +AC_CONFIG_HEADERS([config.h]) +AC_PREREQ(2.54) dnl Minimum Autoconf version required. +AC_CANONICAL_HOST + +ALL_LINGUAS= + +AC_PROG_CC +AC_PROG_CPP +AC_PROG_GCC_TRADITIONAL +AM_GNU_GETTEXT([external]) +AC_LIBLTDL_CONVENIENCE +AC_SUBST(INCLTDL) +AC_SUBST(LIBLTDL) +AC_LIBTOOL_DLOPEN +AM_PROG_LIBTOOL +AC_CONFIG_SUBDIRS(libltdl) +AC_PROG_YACC +AM_PROG_LEX + +LOCALEDIR=$datadir +AC_SUBST(LOCALEDIR) +AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR") +AH_TEMPLATE([LOCALEDIR], [Directory to place translation files in.]) + +AH_BOTTOM([ +/* Eventually we will allow multi-threaded applications to use the + libraries. Therefore we will add the necessary locking although + the macros used expand to nothing for now. */ +#define lock_lock(lock) +#define rwlock_define(class,name) class int name +#define rwlock_init(lock) +#define rwlock_fini(lock) +#define rwlock_rdlock(lock) +#define rwlock_wrlock(lock) +#define rwlock_unlock(lock) +#define tls_key_t void * +#define key_create(keyp, freefct) ((void) (keyp), (void) (freefct), 1) +#define getspecific(key) key +#define setspecific(key,val) key = val +#define once_define(class,name) class int name +#define once_execute(name,fct) \ + do { \ + if (name == 0) \ + fct (); \ + name = 1; \ + } while (0) + +/* gettext helper macro. */ +#define N_(Str) Str + +/* Compiler-specific definitions. */ +#define strong_alias(name, aliasname) \ + extern __typeof (name) aliasname __attribute__ ((alias (#name))); + +#ifdef __i386__ +# define internal_function \ + __attribute__ ((regparm (3), stdcall, visibility ("internal"))) +# define internal_strong_alias(name, aliasname) \ + extern __typeof (name) aliasname __attribute__ ((alias (#name), stdcall, visibility ("internal"))); +#else +# define internal_function \ + __attribute__ ((visibility ("internal"))) +# define internal_strong_alias(name, aliasname) \ + extern __typeof (name) aliasname __attribute__ ((alias (#name), visibility ("hiden"))); +#endif + +#define attribute_hidden \ + __attribute__ ((visibility ("hidden"))) + +/* Define ALLOW_UNALIGNED if the architecture allows operations on + unaligned memory locations. */ +#if defined __i386__ || defined __alpha__ || defined __x86_64__ || defined __ia64__ +# define ALLOW_UNALIGNED 1 +#else +# define ALLOW_UNALIGNED 0 +#endif + +#ifdef __GNUC__ +# define unlikely(expr) __builtin_expect (expr, 0) +# define likely(expr) __builtin_expect (expr, 1) +#else +# define unlikely(expr) (expr) +# define likely(expr) (expr) +#endif + +#if __STDC_VERSION__ >= 199901L +# define flexarr_size /* empty */ +#else +# define flexarr_size 0 +#endif + +/* Calling conventions. */ +#ifdef __i386__ +# define CALLING_CONVENTION regparm (3), stdcall +# define AND_CALLING_CONVENTION , regparm (3), stdcall +#else +# define CALLING_CONVENTION +# define AND_CALLING_CONVENTION +#endif + +/* Avoid PLT entries. */ +#if defined __PIC__ && defined __GNUC__ +# define INTUSE(name) _INTUSE(name) +# define _INTUSE(name) __##name##_internal +# define INTDEF(name) _INTDEF(name) +# define _INTDEF(name) \ + extern __typeof__ (name) __##name##_internal __attribute__ ((alias (#name))); +#else +# define INTUSE(name) name +# define INTDEF(name) /* empty */ +#endif +]) + +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 +dnl whether functions and headers are available, whether they work, etc. +AC_SYS_LARGEFILE + +AC_CONFIG_FILES([Makefile + elfutils.spec + m4/Makefile + doc/Makefile + lib/Makefile + libelf/Makefile + libebl/Makefile + libdwarf/Makefile + libcpu/Makefile + libasm/Makefile + src/Makefile + libelf-po/Makefile.in + libebl-po/Makefile.in + libdwarf-po/Makefile.in + libasm-po/Makefile.in + po/Makefile.in + tests/Makefile]) +AC_OUTPUT diff --git a/elfutils/doc/elfutils.sgml b/elfutils/doc/elfutils.sgml new file mode 100644 index 000000000..7ef84a8d9 --- /dev/null +++ b/elfutils/doc/elfutils.sgml @@ -0,0 +1,412 @@ +<!doctype book PUBLIC "-//OASIS//DTD DocBook V4.1//EN"[ +<!ENTITY package "<filename>new-bu</filename>"> +]> + +<book> + <title>New Binutils User's and Reference Manual</title> + + <chapter> + <title><filename>libelf</filename> <acronym>ABI</acronym></title> + + <simpara>The <acronym>ABI</acronym> of the + <filename>libelf</filename> implemented in the &package; package + is following that of Sun's implementation which in turn in derived + from the original SysVr4 implementation. There are some + extensions over Sun's versions, though, which makes it impossible + to replace this implementation with Sun's.</simpara> + + <beginpage> + + <refentry xreflabel="Elf_Data" id="ElfUData"> + <refnamediv> + <refname>Elf_Data</refname> + <refpurpose>Descriptor for Data Buffer</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <synopsis> +#include <libelf.h> +</synopsis> + </refsynopsisdiv> + + <refsect1> + <title>Description</title> + + <simpara>The <structname>Elf_Data</structname> structure is as + a descriptor for a data buffer associated with a section. + Every data buffer is associated with a specific section (see + <!-- xref --><structname>Elf_Scn</structname>).</simpara> + + <simpara>A data buffer is created when reading a file. In + this case only a single buffer is present in the section. The + user can add as many sections as wanted to a section and they + can be retrieved using the <function>elf_getdata</function> + and <function>elf_rawdata</function> functions.<!-- xref + --></simpara> + + <simpara>The <structname>Elf_Data</structname> structure + contains the following members:</simpara> + + <programlisting> + void *d_buf + Elf_Type d_type + size_t d_size + off_t d_off + size_t d_align + unsigned int d_version +</programlisting> + + <simpara>All these members can be modified directly by the + user. They can be used to resize a section, to change its + content or type, and many things more. This is also true for + the data read from a file. The meaning of the members is as + follows:</simpara> + + <variablelist> + <varlistentry> + <term><structfield>d_buf</structfield></term> + <listitem> + <simpara>The <structfield>d_buf</structfield> member is + the pointer to the buffer with the actual data. When + the ELF file was read from a file the first and only + data buffer of a section is allocated by the + <filename>libelf</filename> library. The user should + not try to resize or free this buffer. When the user + adds a new data buffer to a section the associated + memory block is normally allocated by the user. It is + important that the buffer must have a lifetime at least + until the ELF file is closed entirely (important when + the buffer is allocated on the stack). If the buffer is + not allocated on the stack it is the user's + responsibility to free the buffer after it is not used + anymore. The <structfield>d_buf</structfield> member + can contain a null pointer if the data buffer is + empty.</simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term><structfield>d_type</structfield></term> + <listitem> + <simpara>The <structfield>d_type</structfield> + determines how the data of the buffer is interpreted. + This type is determined from the section type and must + be the same for all data buffers for a section. See + <!-- xref --><type>Elf_Type</type> for more information. + The <function><link linkend="elfUgetdata" + endterm="elfUgetdata.refname"></link></function> + function uses this information to convert the data of + the buffer between the external form and the form + represented to the user and back if necessary.</simpara> + </listitem> + </varlistentry> + </variablelist> + </refsect1> + </refentry> + + <beginpage> + + <refentry id="elfUgetdata"> + <refnamediv> + <refname id="elfUgetdata.refname">elf_getdata</refname> + <refpurpose>Get washed data of section</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <funcsynopsis> + <funcsynopsisinfo> +#include <libelf.h> +</funcsynopsisinfo> + <funcprototype> + <funcdef>Elf_Data *<function>elf_getdata</function></funcdef> + <paramdef>Elf_Scn *<parameter>scn</parameter></paramdef> + <paramdef>Elf_Data *<parameter>data</parameter></paramdef> + </funcprototype> + </funcsynopsis> + </refsynopsisdiv> + + <refsect1> + <title>Description</title> + + <simpara>The <function>elf_getdata</function> function allows + to retriece the data buffers of the section + <parameter>scn</parameter>. There can be more than one buffer + if the user explicitly added them. When a file is read the + <filename>libelf</filename> library creates exactly one data + buffer.</simpara> + + <simpara>The first buffer in the list can be obtained by + passing a null pointer in the parameter + <parameter>data</parameter>. To get the next data buffer the + previously returned value must be passed in the + <parameter>data</parameter> parameter. If there is no more + buffer left in the list a null pointer is returned.</simpara> + + <simpara>If the <parameter>data</parameter> parameter is not a + null pointer it must be a descriptor with for a buffer + associated with the section <parameter>scn</parameter>. If + this is not the case a null pointer is returned. To + facilitate error handling <function>elf_getdata</function> + also returns a null pointer if the <parameter>scn</parameter> + parameter is a null pointer.</simpara> + </refsect1> + </refentry> + + <refentry> + <refnamediv> + <refname id="elfUupdate.refname">elf_update</refname> + <refpurpose>update an ELF descriptor</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <funcsynopsis> + <funcsynopsisinfo> +#include <libelf.h> +</funcsynopsisinfo> + <funcprototype> + <funcdef>off_t <function>elf_update</function></funcdef> + <paramdef>Elf *<parameter>elf</parameter></paramdef> + <paramdef>Elf_Cmd <parameter>cmd</parameter></paramdef> + </funcprototype> + </funcsynopsis> + </refsynopsisdiv> + + <refsect1> + <title>Description</title> + + <simpara>The user is responsible for filling in the following + fields in the named data structures:</simpara> + + <table> + <title>Fields not set by <function>elf_update</function></title> + <tgroup cols="3"> + <colspec colwidth="90pt"> + <colspec colwidth="110pt"> + <thead> + <row> + <entry>Data Structure</entry> + <entry>Member</entry> + <entry>Exception</entry> + </row> + </thead> + <tbody> + <row> + <entry morerows="8"><type>Elfxx_Ehdr</type></entry> + <entry>e_ident[EI_DATA]</entry> + <entry>see below</entry> + </row> + <row> + <entry></entry> + <entry>e_type</entry> + <!-- <entry morerows="1"></entry> --> + <entry></entry> + </row> + <row> + <entry></entry> + <entry>e_machine</entry> + <entry></entry> + </row> + <row> + <entry></entry> + <entry>e_version</entry> + <entry>see below</entry> + </row> + <row> + <entry></entry> + <entry>e_entry</entry> + <entry></entry> + </row> + <row> + <entry></entry> + <entry>e_phoff</entry> + <entry>if <symbol>ELF_F_LAYOUT</symbol> is used</entry> + </row> + <row> + <entry></entry> + <entry>e_shoff</entry> + <entry>if <symbol>ELF_F_LAYOUT</symbol> is used</entry> + </row> + <row> + <entry></entry> + <entry>e_flags</entry> + <entry></entry> + </row> + <row> + <entry></entry> + <entry>e_shstrndx</entry> + <entry></entry> + </row> + <row> + <entry morerows="7">Elfxx_Phdr</entry> + <entry>p_type</entry> + <entry morerows="7"></entry> + </row> + <row> + <entry></entry> + <entry>p_offset</entry> + <entry></entry> + </row> + <row> + <entry></entry> + <entry>p_vaddr</entry> + <entry></entry> + </row> + <row> + <entry></entry> + <entry>p_paddr</entry> + <entry></entry> + </row> + <row> + <entry></entry> + <entry>p_filesz</entry> + <entry></entry> + </row> + <row> + <entry></entry> + <entry>p_memsz</entry> + <entry></entry> + </row> + <row> + <entry></entry> + <entry>p_flags</entry> + <entry></entry> + </row> + <row> + <entry></entry> + <entry>p_align</entry> + <entry></entry> + </row> + + <row> + <entry morerows="9">Elfxx_Shdr</entry> + <entry>sh_name</entry> + <entry morerows="3"></entry> + </row> + <row> + <entry></entry> + <entry>sh_type</entry> + <entry></entry> + </row> + <row> + <entry></entry> + <entry>sh_flags</entry> + <entry></entry> + </row> + <row> + <entry></entry> + <entry>sh_addr</entry> + <entry></entry> + </row> + <row> + <entry></entry> + <entry>sh_offset</entry> + <entry>if <symbol>ELF_F_LAYOUT</symbol> is used</entry> + </row> + <row> + <entry></entry> + <entry>sh_size</entry> + <entry>if <symbol>ELF_F_LAYOUT</symbol> is used</entry> + </row> + <row> + <entry></entry> + <entry>sh_link</entry> + <!-- <entry morerows="1"></entry> --> + <entry></entry> + </row> + <row> + <entry></entry> + <entry>sh_info</entry> + <entry></entry> + </row> + <row> + <entry></entry> + <entry>sh_addralign</entry> + <entry>if <symbol>ELF_F_LAYOUT</symbol> is used</entry> + </row> + <row> + <entry></entry> + <entry>sh_entsize</entry> + <entry></entry> + </row> + + <row> + <entry morerows="5">Elf_Data</entry> + <entry>d_buf</entry> + <entry morerows="2"></entry> + </row> + <row> + <entry></entry> + <entry>d_type</entry> + <entry></entry> + </row> + <row> + <entry></entry> + <entry>d_size</entry> + <entry></entry> + </row> + <row> + <entry></entry> + <entry>d_off</entry> + <entry>if <symbol>ELF_F_LAYOUT</symbol> is used</entry> + </row> + <row> + <entry></entry> + <entry>d_align</entry> + <!-- <entry morerows="1"></entry> --> + <entry></entry> + </row> + <row> + <entry></entry> + <entry>d_version</entry> + <entry></entry> + </row> + </tbody> + </tgroup> + </table> + + <simpara>Two fields of the ELF header are handled in a special + way:</simpara> + + <variablelist> + <varlistentry> + <term>e_version</term> + <listitem> + <simpara>The user can set this field to the vvalue for + the version to be used. It is an error if the library + cannot handle this version. If the field contains the + value <symbol>EV_NONE</symbol> the library will fill in + its own internal version.</simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>e_ident[EI_DATA]</term> + <listitem> + <simpara>The user should fill in the byte ordering for + the file. If the value of the field is + <symbol>ELFDATANONE</symbol> the library replaces it + with the native byte ordering for the machine.</simpara> + </listitem> + </varlistentry> + </variablelist> + </refsect1> + </refentry> + </chapter> + + <chapter> + <title><filename>libelf</filename> Internals</title> + + <simpara>Since the binary format handling tools need constant + attention since there are always new machines and varients + therefore coming out it is important to have the implementation + weel documented. Only this way extensions can be made in the + right places and the mistakes of the past avoided.</simpara> + </chapter> +</book> +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omitag:nil +sgml-shorttag:t +End: +--> diff --git a/elfutils/elfutils.spec.in b/elfutils/elfutils.spec.in new file mode 100644 index 000000000..11837d7f8 --- /dev/null +++ b/elfutils/elfutils.spec.in @@ -0,0 +1,102 @@ +Summary: A collection of utilities and DSOs to handle compiled objects. +Name: elfutils +Version: @PACKAGE_VERSION@ +Release: 1 +Copyright: GPL +Group: Development/Tools +URL: http://sources.redhat.com/binutils +Source: elfutils-@PACKAGE_VERSION@.tar.gz + +# ExcludeArch: xxx + +BuildRoot: %{_tmppath}/%{name}-root +BuildRequires: gcc >= 3.2 + +%define _gnu %{nil} +%define _programprefix eu- + +%description +Elfutils is a collection of utilities, including ld (the GNU linker), +nm (for listing symbols from object files), size (for listing the +section sizes of an object or archive file), strip (for discarding +symbols), readline (the see the raw ELF file structures), and elflint +(to check for well-formed ELF files). Also included are numerous +helper libraries which implement DWARF, ELF, and machine-specific ELF +handling. + +%package devel +Summary: Development libraries to handle compiled objects. +Group: Development/Tools +Requires: elfutils = %{version}-%{release} + +%description devel +The elfutils-devel package containst he libraries to create +applications for handling compiled objects. libelf allows you to +access the internals of the ELF object file format, so you can see the +different sections of an ELF file. libebl provides some higher-level +ELF access functionality. libdwarf provides access to the DWARF +debugging information. libasm provides a programmable assembler +interface. + +%prep +%setup -q +# %patch0 -p1 -b .jbj + +%build +mkdir build-%{_target_platform} +cd build-%{_target_platform} +../configure \ + --prefix=%{_prefix} --exec-prefix=%{_exec_prefix} \ + --bindir=%{_bindir} --sbindir=%{_sbindir} --sysconfdir=%{_sysconfdir} \ + --datadir=%{_datadir} --includedir=%{_includedir} --libdir=%{_libdir} \ + --libexecdir=%{_libexecdir} --localstatedir=%{_localstatedir} \ + --sharedstatedir=%{_sharedstatedir} --mandir=%{_mandir} \ + --infodir=%{_infodir} --program-prefix=%{_programprefix} --enable-shared +cd .. + +%install +rm -rf ${RPM_BUILD_ROOT} +mkdir -p ${RPM_BUILD_ROOT}%{_prefix} + +cd build-%{_target_platform} +%makeinstall + +chmod +x ${RPM_BUILD_ROOT}%{_prefix}/%{_lib}/lib*.so* +chmod +x ${RPM_BUILD_ROOT}%{_prefix}/%{_lib}/elfutils/lib*.so* + +# The loadable modules need not exist in a form which can be linked with +rm ${RPM_BUILD_ROOT}%{_prefix}/%{_lib}/elfutils/lib*.a +rm ${RPM_BUILD_ROOT}%{_prefix}/%{_lib}/elfutils/lib*.la + +cd .. + +%clean +rm -rf ${RPM_BUILD_ROOT} + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%files +%defattr(-,root,root) +%doc README +%doc TODO +%doc libdwarf/AVAILABLE +%{_prefix}/bin/* +%{_prefix}/%{_lib}/lib*.so.* +%{_prefix}/%{_lib}/elfutils/lib*.so.* + +%files devel +%defattr(-,root,root) +%{_prefix}/include/* +%{_prefix}/%{_lib}/lib*.a +%{_prefix}/%{_lib}/lib*.la +%{_prefix}/%{_lib}/lib*.so + +%changelog +* Mon Oct 21 2002 Ulrich Drepper <drepper@redhat.com> 0.50 +- Split into runtime and devel package +* Fri Oct 18 2002 Ulrich Drepper <drepper@redhat.com> 0.49 +- integrate into official sources +* Wed Oct 16 2002 Jeff Johnson <jbj@redhat.com> 0.46-1 +- Swaddle. diff --git a/elfutils/libasm/libasm.map b/elfutils/libasm/libasm.map new file mode 100644 index 000000000..8dcd5fcc0 --- /dev/null +++ b/elfutils/libasm/libasm.map @@ -0,0 +1,31 @@ +ELFUTILS_1.0 { + global: + asm_abort; + asm_addint16; + asm_addint32; + asm_addint64; + asm_addint8; + asm_addstrz; + asm_adduint16; + asm_adduint32; + asm_adduint64; + asm_adduint8; + asm_align; + asm_begin; + asm_end; + asm_errmsg; + asm_errno; + asm_fill; + asm_getelf; + asm_newabssym; + asm_newcomsym; + asm_newscn; + asm_newscn_ingrp; + asm_newscngrp; + asm_newsubscn; + asm_newsym; + asm_scngrp_newsignature; + + local: + *; +}; diff --git a/elfutils/libcpu/Makefile.am b/elfutils/libcpu/Makefile.am new file mode 100644 index 000000000..140a5f70d --- /dev/null +++ b/elfutils/libcpu/Makefile.am @@ -0,0 +1,24 @@ +## Process this file with automake to create Makefile.in +## Configure input file for elfutils. +## +## Copyright (C) 2002 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 +## published by the Free Software Foundation. +## +## his 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. +## +DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -Wall -Wshadow +INCLUDES = -I$(srcdir) + +noinst_LTLIBRARIES = libcpu_i386.la + +libcpu_i386_la_SOURCES = i386_dis.c diff --git a/elfutils/libcpu/Makefile.in b/elfutils/libcpu/Makefile.in new file mode 100644 index 000000000..bd1d868fc --- /dev/null +++ b/elfutils/libcpu/Makefile.in @@ -0,0 +1,418 @@ +# Makefile.in generated by automake 1.7 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -Wall -Wshadow +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GMSGFMT = @GMSGFMT@ +INCLTDL = @INCLTDL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBLTDL = @LIBLTDL@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LOCALEDIR = @LOCALEDIR@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +YACC = @YACC@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +subdirs = @subdirs@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +INCLUDES = -I$(srcdir) + +noinst_LTLIBRARIES = libcpu_i386.la + +libcpu_i386_la_SOURCES = i386_dis.c +subdir = libcpu +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) + +libcpu_i386_la_LDFLAGS = +libcpu_i386_la_LIBADD = +am_libcpu_i386_la_OBJECTS = i386_dis.lo +libcpu_i386_la_OBJECTS = $(am_libcpu_i386_la_OBJECTS) + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/i386_dis.Plo +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ + $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(libcpu_i386_la_SOURCES) +DIST_COMMON = Makefile.am Makefile.in +SOURCES = $(libcpu_i386_la_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnits libcpu/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" = "$$p" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libcpu_i386.la: $(libcpu_i386_la_OBJECTS) $(libcpu_i386_la_DEPENDENCIES) + $(LINK) $(libcpu_i386_la_LDFLAGS) $(libcpu_i386_la_OBJECTS) $(libcpu_i386_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386_dis.Plo@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'`; \ +@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) + +installdirs: + +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-man install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/elfutils/libcpu/i386_dis.c b/elfutils/libcpu/i386_dis.c new file mode 100644 index 000000000..971746e3b --- /dev/null +++ b/elfutils/libcpu/i386_dis.c @@ -0,0 +1 @@ +int foo; diff --git a/elfutils/libdwarf/libdwarf.map b/elfutils/libdwarf/libdwarf.map new file mode 100644 index 000000000..ec0e805e0 --- /dev/null +++ b/elfutils/libdwarf/libdwarf.map @@ -0,0 +1,81 @@ +ELFUTILS_1.0 { + global: + dwarf_arrayorder; + dwarf_attr; + dwarf_attrlist; + dwarf_bitoffset; + dwarf_bitsize; + dwarf_bytesize; + dwarf_child; + dwarf_dealloc; + dwarf_die_CU_offset; + dwarf_diename; + dwarf_dieoffset; + dwarf_elf_init; + dwarf_errmsg; + dwarf_errno; + dwarf_find_macro_value_start; + dwarf_finish; + dwarf_formaddr; + dwarf_formblock; + dwarf_formflag; + dwarf_formref; + dwarf_formsdata; + dwarf_formstring; + dwarf_formudata; + dwarf_get_abbrev; + dwarf_get_abbrev_children_flag; + dwarf_get_abbrev_code; + dwarf_get_abbrev_entry; + dwarf_get_abbrev_tag; + dwarf_get_address_size; + dwarf_get_arange; + dwarf_get_arange_info; + dwarf_get_aranges; + dwarf_get_cie_info; + dwarf_get_cie_of_fde; + dwarf_get_cu_die_offset; + dwarf_get_elf_init; + dwarf_get_fde_at_pc; + dwarf_get_fde_instr_bytes; + dwarf_get_fde_list_eh; + dwarf_get_fde_n; + dwarf_get_fde_range; + dwarf_get_globals; + dwarf_get_loclist_entry; + dwarf_get_str; + dwarf_global_cu_offset; + dwarf_global_die_offset; + dwarf_global_formref; + dwarf_global_name_offsets; + dwarf_globname; + dwarf_hasattr; + dwarf_hasform; + dwarf_highpc; + dwarf_init; + dwarf_lineaddr; + dwarf_linebeginstatement; + dwarf_lineblock; + dwarf_lineendsequence; + dwarf_lineepiloguebegin; + dwarf_lineno; + dwarf_lineoff; + dwarf_lineprologueend; + dwarf_linesrc; + dwarf_loclist; + dwarf_lowpc; + dwarf_next_cu_header; + dwarf_offdie; + dwarf_seterrarg; + dwarf_seterrhand; + dwarf_siblingof; + dwarf_srcfiles; + dwarf_srclang; + dwarf_srclines; + dwarf_tag; + dwarf_whatattr; + dwarf_whatform; + + local: + *; +}; diff --git a/elfutils/libebl/eblcorenote.c b/elfutils/libebl/eblcorenote.c new file mode 100644 index 000000000..54b68f727 --- /dev/null +++ b/elfutils/libebl/eblcorenote.c @@ -0,0 +1,154 @@ +/* Print contents of core note. + Copyright (C) 2002 Red Hat, Inc. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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 + published by the Free Software Foundation. + + 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. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <inttypes.h> +#include <stdio.h> +#include <stddef.h> +#include <libeblP.h> + + +void +ebl_core_note (ebl, name, type, descsz, desc) + Ebl *ebl; + const char *name; + uint32_t type; + uint32_t descsz; + const char *desc; +{ + int class = gelf_getclass (ebl->elf); + + if (! ebl->core_note (name, type, descsz, desc)) + /* The machine specific function did not know this type. */ + switch (type) + { + case NT_PLATFORM: + printf (gettext (" Platform: %.*s\n"), (int) descsz, desc); + break; + + case NT_AUXV: + ; + size_t cnt; + size_t elsize = (class == ELFCLASS32 + ? sizeof (Elf32_auxv_t) : sizeof (Elf64_auxv_t)); + + for (cnt = 0; (cnt + 1) * elsize <= descsz; ++cnt) + { + unsigned long int type; + unsigned long int val; + + if (class == ELFCLASS32) + { + Elf32_auxv_t *auxv = &((Elf32_auxv_t *) desc)[cnt]; + + type = auxv->a_type; + val = auxv->a_un.a_val; + } + else + { + Elf64_auxv_t *auxv = &((Elf64_auxv_t *) desc)[cnt]; + + type = auxv->a_type; + val = auxv->a_un.a_val; + } + + /* XXX Do we need the auxiliary vector info anywhere + else? If yes, move code into a separate function. */ + const char *at; + + switch (type) + { +#define NEW_AT(name) case AT_##name: at = #name; break + NEW_AT (NULL); + NEW_AT (IGNORE); + NEW_AT (EXECFD); + NEW_AT (PHDR); + NEW_AT (PHENT); + NEW_AT (PHNUM); + NEW_AT (PAGESZ); + NEW_AT (BASE); + NEW_AT (FLAGS); + NEW_AT (ENTRY); + NEW_AT (NOTELF); + NEW_AT (UID); + NEW_AT (EUID); + NEW_AT (GID); + NEW_AT (EGID); + NEW_AT (CLKTCK); + NEW_AT (PLATFORM); + NEW_AT (HWCAP); + NEW_AT (FPUCW); + NEW_AT (DCACHEBSIZE); + NEW_AT (ICACHEBSIZE); + NEW_AT (UCACHEBSIZE); + NEW_AT (IGNOREPPC); + + default: + at = "???"; + break; + } + + switch (type) + { + case AT_NULL: + case AT_IGNORE: + case AT_IGNOREPPC: + case AT_NOTELF: + default: + printf (" %s\n", at); + break; + + case AT_EXECFD: + case AT_PHENT: + case AT_PHNUM: + case AT_PAGESZ: + case AT_UID: + case AT_EUID: + case AT_GID: + case AT_EGID: + case AT_CLKTCK: + case AT_FPUCW: + case AT_DCACHEBSIZE: + case AT_ICACHEBSIZE: + case AT_UCACHEBSIZE: + printf (" %s: %" PRId64 "\n", at, (int64_t) val); + break; + + case AT_PHDR: + case AT_BASE: + case AT_FLAGS: /* XXX Print flags? */ + case AT_ENTRY: + case AT_PLATFORM: /* XXX Get string? */ + case AT_HWCAP: /* XXX Print flags? */ + printf (" %s: %" PRIx64 "\n", at, (uint64_t) val); + break; + } + + if (type == AT_NULL) + /* Reached the end. */ + break; + } + break; + + default: + /* Unknown type. */ + break; + } +} diff --git a/elfutils/libebl/eblcorenotetypename.c b/elfutils/libebl/eblcorenotetypename.c new file mode 100644 index 000000000..0c23dd8da --- /dev/null +++ b/elfutils/libebl/eblcorenotetypename.c @@ -0,0 +1,71 @@ +/* Return note type name. + Copyright (C) 2002 Red Hat, Inc. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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 + published by the Free Software Foundation. + + 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. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <inttypes.h> +#include <stdio.h> +#include <libeblP.h> + + +const char * +ebl_core_note_type_name (ebl, type, buf, len) + Ebl *ebl; + uint32_t type; + char *buf; + size_t len; +{ + const char *res = ebl->core_note_type_name (type, buf, len); + + if (res == NULL) + { + static const char *knowntypes[] = + { +#define KNOWNSTYPE(name) [NT_##name] = #name + KNOWNSTYPE (PRSTATUS), + KNOWNSTYPE (FPREGSET), + KNOWNSTYPE (PRPSINFO), + KNOWNSTYPE (TASKSTRUCT), + KNOWNSTYPE (PLATFORM), + KNOWNSTYPE (AUXV), + KNOWNSTYPE (GWINDOWS), + KNOWNSTYPE (ASRS), + KNOWNSTYPE (PSTATUS), + KNOWNSTYPE (PSINFO), + KNOWNSTYPE (PRCRED), + KNOWNSTYPE (UTSNAME), + KNOWNSTYPE (LWPSTATUS), + KNOWNSTYPE (LWPSINFO), + KNOWNSTYPE (PRFPXREG) + }; + + /* Handle standard names. */ + if (type < sizeof (knowntypes) / sizeof (knowntypes[0]) + && knowntypes[type] != NULL) + res = knowntypes[type]; + else + { + snprintf (buf, len, "%s: %" PRIu32, gettext ("<unknown>"), type); + + res = buf; + } + } + + return res; +} diff --git a/elfutils/libebl/eblobjnote.c b/elfutils/libebl/eblobjnote.c new file mode 100644 index 000000000..816dd7443 --- /dev/null +++ b/elfutils/libebl/eblobjnote.c @@ -0,0 +1,90 @@ +/* Print contents of object file note. + Copyright (C) 2002 Red Hat, Inc. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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 + published by the Free Software Foundation. + + 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. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <inttypes.h> +#include <stdio.h> +#include <string.h> +#include <libeblP.h> + + +void +ebl_object_note (ebl, name, type, descsz, desc) + Ebl *ebl; + const char *name; + uint32_t type; + uint32_t descsz; + const char *desc; +{ + if (! ebl->object_note (name, type, descsz, desc)) + /* The machine specific function did not know this type. */ + switch (type) + { + case NT_VERSION: + if (strcmp (name, "GNU") == 0 && descsz >= 8) + { + struct + { + uint32_t os; + uint32_t version[descsz / 4 - 1]; + } *tag = (__typeof (tag)) desc; + + const char *os; + switch (tag->os) + { + case ELF_NOTE_OS_LINUX: + os = "Linux"; + break; + + case ELF_NOTE_OS_GNU: + os = "GNU"; + break; + + case ELF_NOTE_OS_SOLARIS2: + os = "Solaris"; + break; + + case ELF_NOTE_OS_FREEBSD: + os = "FreeBSD"; + break; + + default: + os = "???"; + break; + } + + printf (gettext (" OS: %s, ABI: "), os); + size_t cnt; + for (cnt = 0; cnt < descsz / 4 - 1; ++cnt) + { + if (cnt != 0) + putchar_unlocked ('.'); + printf ("%" PRIu32, tag->version[cnt]); + } + putchar_unlocked ('\n'); + break; + } + /* FALLTHROUGH */ + + default: + /* Unknown type. */ + break; + } +} diff --git a/elfutils/libebl/eblobjnotetypename.c b/elfutils/libebl/eblobjnotetypename.c new file mode 100644 index 000000000..0f0c7d79a --- /dev/null +++ b/elfutils/libebl/eblobjnotetypename.c @@ -0,0 +1,57 @@ +/* Return note type name. + Copyright (C) 2002 Red Hat, Inc. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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 + published by the Free Software Foundation. + + 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. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <inttypes.h> +#include <stdio.h> +#include <libeblP.h> + + +const char * +ebl_object_note_type_name (ebl, type, buf, len) + Ebl *ebl; + uint32_t type; + char *buf; + size_t len; +{ + const char *res = ebl->object_note_type_name (type, buf, len); + + if (res == NULL) + { + static const char *knowntypes[] = + { +#define KNOWNSTYPE(name) [NT_##name] = #name + KNOWNSTYPE (VERSION), + }; + + /* Handle standard names. */ + if (type < sizeof (knowntypes) / sizeof (knowntypes[0]) + && knowntypes[type] != NULL) + res = knowntypes[type]; + else + { + snprintf (buf, len, "%s: %" PRIu32, gettext ("<unknown>"), type); + + res = buf; + } + } + + return res; +} diff --git a/elfutils/libebl/i386_corenote.c b/elfutils/libebl/i386_corenote.c new file mode 100644 index 000000000..55464057b --- /dev/null +++ b/elfutils/libebl/i386_corenote.c @@ -0,0 +1,149 @@ +/* i386 specific core note handling. + Copyright (C) 2002 Red Hat, Inc. + Written by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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 + published by the Free Software Foundation. + + 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. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <elf.h> +#include <stddef.h> +#include <stdio.h> +#include <sys/time.h> + +#include <libebl_i386.h> + + +/* We cannot include <sys/procfs.h> since it is available only on x86 + systems. */ +struct elf_prstatus + { + struct + { + int si_signo; /* Signal number. */ + int si_code; /* Extra code. */ + int si_errno; /* Errno. */ + } pr_info; /* Info associated with signal. */ + short int pr_cursig; /* Current signal. */ + unsigned long int pr_sigpend; /* Set of pending signals. */ + unsigned long int pr_sighold; /* Set of held signals. */ + __pid_t pr_pid; + __pid_t pr_ppid; + __pid_t pr_pgrp; + __pid_t pr_sid; + struct timeval pr_utime; /* User time. */ + struct timeval pr_stime; /* System time. */ + struct timeval pr_cutime; /* Cumulative user time. */ + struct timeval pr_cstime; /* Cumulative system time. */ + unsigned long int pr_reg[17]; /* GP registers. */ + int pr_fpvalid; /* True if math copro being used. */ + }; + + +struct elf_prpsinfo + { + char pr_state; /* Numeric process state. */ + char pr_sname; /* Char for pr_state. */ + char pr_zomb; /* Zombie. */ + char pr_nice; /* Nice val. */ + unsigned long int pr_flag; /* Flags. */ + unsigned short int pr_uid; + unsigned short int pr_gid; + int pr_pid, pr_ppid, pr_pgrp, pr_sid; + /* Lots missing */ + char pr_fname[16]; /* Filename of executable. */ + char pr_psargs[80]; /* Initial part of arg list. */ + }; + + +bool +i386_core_note (name, type, descsz, desc) + const char *name; + uint32_t type; + uint32_t descsz; + const char *desc; +{ + bool result = false; + + switch (type) + { + case NT_PRSTATUS: + if (descsz < sizeof (struct elf_prstatus)) + /* Not enough data. */ + break; + + struct elf_prstatus *stat = (struct elf_prstatus *) desc; + + printf (" SIGINFO: signo: %d, code = %d, errno = %d\n" + " signal: %hd, pending: %#08lx, holding: %#08lx\n" + " pid: %d, ppid = %d, pgrp = %d, sid = %d\n" + " utime: %6ld.%06lds, stime: %6ld.%06lds\n" + " cutime: %6ld.%06lds, cstime: %6ld.%06lds\n" + " eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n" + " esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n" + " eip: %08lx eflags: %08lx, original eax: %08lx\n" + " cs: %04lx ds: %04lx es: %04lx fs: %04lx gs: %04lx" + " ss: %04lx\n\n" +, + stat->pr_info. si_signo, + stat->pr_info. si_code, + stat->pr_info. si_errno, + stat->pr_cursig, + stat->pr_sigpend, stat->pr_sighold, + stat->pr_pid, stat->pr_ppid, stat->pr_pgrp, stat->pr_sid, + stat->pr_utime.tv_sec, stat->pr_utime.tv_usec, + stat->pr_stime.tv_sec, stat->pr_stime.tv_usec, + stat->pr_cutime.tv_sec, stat->pr_cutime.tv_usec, + stat->pr_cstime.tv_sec, stat->pr_cstime.tv_usec, + stat->pr_reg[6], stat->pr_reg[0], stat->pr_reg[1], + stat->pr_reg[2], stat->pr_reg[3], stat->pr_reg[4], + stat->pr_reg[5], stat->pr_reg[15], stat->pr_reg[12], + stat->pr_reg[14], stat->pr_reg[11], stat->pr_reg[13] & 0xffff, + stat->pr_reg[7] & 0xffff, stat->pr_reg[8] & 0xffff, + stat->pr_reg[9] & 0xffff, stat->pr_reg[10] & 0xffff, + stat->pr_reg[16]); + + /* We handled this entry. */ + result = true; + break; + + case NT_PRPSINFO: + if (descsz < sizeof (struct elf_prpsinfo)) + /* Not enough data. */ + break; + + struct elf_prpsinfo *info = (struct elf_prpsinfo *) desc; + + printf (" state: %c (%hhd), zombie: %hhd, nice: %hhd\n" + " flags: %08lx, uid: %hd, gid: %hd\n" + " pid: %d, ppid: %d, pgrp: %d, sid: %d\n" + " fname: %.16s\n" + " args: %.80s\n\n", + info->pr_sname, info->pr_state, info->pr_zomb, info->pr_nice, + info->pr_flag, info->pr_uid, info->pr_gid, + info->pr_pid, info->pr_ppid, info->pr_pgrp, info->pr_sid, + info->pr_fname, info->pr_psargs); + + /* We handled this entry. */ + result = true; + break; + + default: + break; + } + + return result; +} diff --git a/elfutils/libebl/libebl.map b/elfutils/libebl/libebl.map new file mode 100644 index 000000000..1bb20f1c4 --- /dev/null +++ b/elfutils/libebl/libebl.map @@ -0,0 +1,45 @@ +ELFUTILS_1.0 { + global: + ebl_backend_name; + ebl_closebackend; + ebl_core_note; + ebl_core_note_type_name; + ebl_dynamic_tag_check; + ebl_dynamic_tag_name; + ebl_gstrtabadd; + ebl_gstrtabfinalize; + ebl_gstrtabfree; + ebl_gstrtabinit; + ebl_gstrtaboffset; + ebl_machine_flag_check; + ebl_machine_flag_name; + ebl_object_note; + ebl_object_note_type_name; + ebl_object_type_name; + ebl_openbackend; + ebl_openbackend_emulation; + ebl_openbackend_machine; + ebl_osabi_name; + ebl_reloc_type_check; + ebl_reloc_type_name; + ebl_section_name; + ebl_section_type_name; + ebl_segment_type_name; + ebl_sh_flags_combine; + ebl_string; + ebl_strtabadd; + ebl_strtabfinalize; + ebl_strtabfree; + ebl_strtabinit; + ebl_strtaboffset; + ebl_symbol_binding_name; + ebl_symbol_type_name; + ebl_wstrtabadd; + ebl_wstrtabfinalize; + ebl_wstrtabfree; + ebl_wstrtabinit; + ebl_wstrtaboffset; + + local: + *; +}; diff --git a/elfutils/libebl/libebl_i386.map b/elfutils/libebl/libebl_i386.map new file mode 100644 index 000000000..621db1beb --- /dev/null +++ b/elfutils/libebl/libebl_i386.map @@ -0,0 +1,11 @@ +ELFUTILS_1.0 { + global: + i386_backend_name; + i386_destr; + i386_init; + i386_reloc_type_check; + i386_reloc_type_name; + + local: + *; +}; diff --git a/elfutils/libebl/libebl_mips.map b/elfutils/libebl/libebl_mips.map new file mode 100644 index 000000000..9ddd366be --- /dev/null +++ b/elfutils/libebl/libebl_mips.map @@ -0,0 +1,14 @@ +ELFUTILS_1.0 { + global: + mips_backend_name; + mips_destr; + mips_dynamic_tag_name; + mips_init; + mips_machine_flag_name; + mips_reloc_type_name; + mips_section_type_name; + mips_segment_type_name; + + local: + *; +}; diff --git a/elfutils/libebl/libebl_sh.map b/elfutils/libebl/libebl_sh.map new file mode 100644 index 000000000..252720a98 --- /dev/null +++ b/elfutils/libebl/libebl_sh.map @@ -0,0 +1,10 @@ +ELFUTILS_1.0 { + global: + sh_backend_name; + sh_destr; + sh_init; + sh_reloc_type_name; + + local: + *; +}; diff --git a/elfutils/libelf/gelf_freechunk.c b/elfutils/libelf/gelf_freechunk.c new file mode 100644 index 000000000..5b35eff51 --- /dev/null +++ b/elfutils/libelf/gelf_freechunk.c @@ -0,0 +1,45 @@ +/* Release uninterpreted chunk of the file contents. + Copyright (C) 2002 Red Hat, Inc. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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 + published by the Free Software Foundation. + + 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. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <libelf.h> +#include <stddef.h> +#include <stdlib.h> + +#include "libelfP.h" + + +void +gelf_freechunk (elf, ptr) + Elf *elf; + char *ptr; +{ + if (elf == NULL) + /* No valid descriptor. */ + return; + + /* We do not have to do anything if the pointer returned by + gelf_rawchunk points into the memory allocated for the ELF + descriptor. */ + if (ptr < (char *) elf->map_address + elf->start_offset + || ptr >= ((char *) elf->map_address + elf->start_offset + + elf->maximum_size)) + free (ptr); +} diff --git a/elfutils/libelf/gelf_rawchunk.c b/elfutils/libelf/gelf_rawchunk.c new file mode 100644 index 000000000..056552d96 --- /dev/null +++ b/elfutils/libelf/gelf_rawchunk.c @@ -0,0 +1,70 @@ +/* Retrieve uninterpreted chunk of the file contents. + Copyright (C) 2002 Red Hat, Inc. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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 + published by the Free Software Foundation. + + 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. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <libelf.h> +#include <stddef.h> +#include <stdlib.h> +#include <unistd.h> + +#include "libelfP.h" + + +char * +gelf_rawchunk (elf, offset, size) + Elf *elf; + GElf_Off offset; + GElf_Word size; +{ + if (elf == NULL) + { + /* No valid descriptor. */ + __libelf_seterrno (ELF_E_INVALID_HANDLE); + return NULL; + } + + if (offset >= elf->maximum_size + || offset + size >= elf->maximum_size + || offset + size < offset) + { + /* Invalid request. */ + __libelf_seterrno (ELF_E_INVALID_OP); + return NULL; + } + + /* If the file is mmap'ed return an appropriate pointer. */ + if (elf->map_address != NULL) + return (char *) elf->map_address + elf->start_offset + offset; + + /* We allocate the memory and read the data from the file. */ + char *result = (char *) malloc (size); + if (result == NULL) + __libelf_seterrno (ELF_E_NOMEM); + else + /* Read the file content. */ + if (pread (elf->fildes, result, size, elf->start_offset + offset) != size) + { + /* Something went wrong. */ + __libelf_seterrno (ELF_E_READ_ERROR); + free (result); + } + + return result; +} diff --git a/elfutils/libelf/libelf.map b/elfutils/libelf/libelf.map new file mode 100644 index 000000000..0a2b3d3ff --- /dev/null +++ b/elfutils/libelf/libelf.map @@ -0,0 +1,99 @@ +ELFUTILS_1.0 { + global: + elf32_checksum; + elf32_fsize; + elf32_getehdr; + elf32_getphdr; + elf32_getshdr; + elf32_newehdr; + elf32_newphdr; + elf32_xlatetof; + elf32_xlatetom; + elf64_checksum; + elf64_fsize; + elf64_getehdr; + elf64_getphdr; + elf64_getshdr; + elf64_newehdr; + elf64_newphdr; + elf64_xlatetof; + elf64_xlatetom; + elf_begin; + elf_cntl; + elf_end; + elf_errmsg; + elf_errno; + elf_fill; + elf_flagdata; + elf_flagehdr; + elf_flagelf; + elf_flagphdr; + elf_flagscn; + elf_flagshdr; + elf_getarhdr; + elf_getarsym; + elf_getbase; + elf_getdata; + elf_getident; + elf_getscn; + elf_getshnum; + elf_getshstrndx; + elf_hash; + elf_kind; + elf_memory; + elf_ndxscn; + elf_newdata; + elf_newscn; + elf_next; + elf_nextscn; + elf_rand; + elf_rawdata; + elf_rawfile; + elf_scncnt; + elf_strptr; + elf_update; + elf_version; + gelf_checksum; + gelf_freechunk; + gelf_fsize; + gelf_getclass; + gelf_getdyn; + gelf_getehdr; + gelf_getmove; + gelf_getphdr; + gelf_getrel; + gelf_getrela; + gelf_getshdr; + gelf_getsym; + gelf_getsyminfo; + gelf_getsymshndx; + gelf_getverdaux; + gelf_getverdef; + gelf_getvernaux; + gelf_getverneed; + gelf_getversym; + gelf_newehdr; + gelf_newphdr; + gelf_rawchunk; + gelf_update_dyn; + gelf_update_ehdr; + gelf_update_move; + gelf_update_phdr; + gelf_update_rel; + gelf_update_rela; + gelf_update_shdr; + gelf_update_sym; + gelf_update_syminfo; + gelf_update_symshndx; + gelf_update_verdaux; + gelf_update_verdef; + gelf_update_vernaux; + gelf_update_verneed; + gelf_update_versym; + gelf_xlatetof; + gelf_xlatetom; + nlist; + + local: + *; +}; diff --git a/elfutils/m4/intdiv0.m4 b/elfutils/m4/intdiv0.m4 new file mode 100644 index 000000000..55dddcf1c --- /dev/null +++ b/elfutils/m4/intdiv0.m4 @@ -0,0 +1,72 @@ +# intdiv0.m4 serial 1 (gettext-0.11.3) +dnl Copyright (C) 2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +AC_DEFUN([gt_INTDIV0], +[ + AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_CANONICAL_HOST])dnl + + AC_CACHE_CHECK([whether integer division by zero raises SIGFPE], + gt_cv_int_divbyzero_sigfpe, + [ + AC_TRY_RUN([ +#include <stdlib.h> +#include <signal.h> + +static void +#ifdef __cplusplus +sigfpe_handler (int sig) +#else +sigfpe_handler (sig) int sig; +#endif +{ + /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ + exit (sig != SIGFPE); +} + +int x = 1; +int y = 0; +int z; +int nan; + +int main () +{ + signal (SIGFPE, sigfpe_handler); +/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */ +#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP) + signal (SIGTRAP, sigfpe_handler); +#endif +/* Linux/SPARC yields signal SIGILL. */ +#if defined (__sparc__) && defined (__linux__) + signal (SIGILL, sigfpe_handler); +#endif + + z = x / y; + nan = y / y; + exit (1); +} +], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no, + [ + # Guess based on the CPU. + case "$host_cpu" in + alpha* | i[34567]86 | m68k | s390*) + gt_cv_int_divbyzero_sigfpe="guessing yes";; + *) + gt_cv_int_divbyzero_sigfpe="guessing no";; + esac + ]) + ]) + case "$gt_cv_int_divbyzero_sigfpe" in + *yes) value=1;; + *) value=0;; + esac + AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value, + [Define if integer division by zero raises signal SIGFPE.]) +]) diff --git a/elfutils/m4/inttypes-pri.m4 b/elfutils/m4/inttypes-pri.m4 new file mode 100644 index 000000000..fd007c312 --- /dev/null +++ b/elfutils/m4/inttypes-pri.m4 @@ -0,0 +1,32 @@ +# inttypes-pri.m4 serial 1 (gettext-0.11.4) +dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +# Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI* +# macros to non-string values. This is the case on AIX 4.3.3. + +AC_DEFUN([gt_INTTYPES_PRI], +[ + AC_REQUIRE([gt_HEADER_INTTYPES_H]) + if test $gt_cv_header_inttypes_h = yes; then + AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken], + gt_cv_inttypes_pri_broken, + [ + AC_TRY_COMPILE([#include <inttypes.h> +#ifdef PRId32 +char *p = PRId32; +#endif +], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes) + ]) + fi + if test "$gt_cv_inttypes_pri_broken" = yes; then + AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1, + [Define if <inttypes.h> exists and defines unusable PRI* macros.]) + fi +]) diff --git a/elfutils/m4/inttypes.m4 b/elfutils/m4/inttypes.m4 new file mode 100644 index 000000000..ab370ffe0 --- /dev/null +++ b/elfutils/m4/inttypes.m4 @@ -0,0 +1,27 @@ +# inttypes.m4 serial 1 (gettext-0.11.4) +dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +# Define HAVE_INTTYPES_H if <inttypes.h> exists and doesn't clash with +# <sys/types.h>. + +AC_DEFUN([gt_HEADER_INTTYPES_H], +[ + AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h, + [ + AC_TRY_COMPILE( + [#include <sys/types.h> +#include <inttypes.h>], + [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no) + ]) + if test $gt_cv_header_inttypes_h = yes; then + AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1, + [Define if <inttypes.h> exists and doesn't clash with <sys/types.h>.]) + fi +]) diff --git a/elfutils/m4/inttypes_h.m4 b/elfutils/m4/inttypes_h.m4 new file mode 100644 index 000000000..400a11184 --- /dev/null +++ b/elfutils/m4/inttypes_h.m4 @@ -0,0 +1,28 @@ +# inttypes_h.m4 serial 4 (gettext-0.11.4) +dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +# Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists, +# doesn't clash with <sys/types.h>, and declares uintmax_t. + +AC_DEFUN([jm_AC_HEADER_INTTYPES_H], +[ + AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h, + [AC_TRY_COMPILE( + [#include <sys/types.h> +#include <inttypes.h>], + [uintmax_t i = (uintmax_t) -1;], + jm_ac_cv_header_inttypes_h=yes, + jm_ac_cv_header_inttypes_h=no)]) + if test $jm_ac_cv_header_inttypes_h = yes; then + AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1, +[Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, + and declares uintmax_t. ]) + fi +]) diff --git a/elfutils/m4/stdint_h.m4 b/elfutils/m4/stdint_h.m4 new file mode 100644 index 000000000..4b5a4ac60 --- /dev/null +++ b/elfutils/m4/stdint_h.m4 @@ -0,0 +1,28 @@ +# stdint_h.m4 serial 2 (gettext-0.11.4) +dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +# Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists, +# doesn't clash with <sys/types.h>, and declares uintmax_t. + +AC_DEFUN([jm_AC_HEADER_STDINT_H], +[ + AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h, + [AC_TRY_COMPILE( + [#include <sys/types.h> +#include <stdint.h>], + [uintmax_t i = (uintmax_t) -1;], + jm_ac_cv_header_stdint_h=yes, + jm_ac_cv_header_stdint_h=no)]) + if test $jm_ac_cv_header_stdint_h = yes; then + AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1, +[Define if <stdint.h> exists, doesn't clash with <sys/types.h>, + and declares uintmax_t. ]) + fi +]) diff --git a/elfutils/m4/uintmax_t.m4 b/elfutils/m4/uintmax_t.m4 new file mode 100644 index 000000000..ec3a8b922 --- /dev/null +++ b/elfutils/m4/uintmax_t.m4 @@ -0,0 +1,29 @@ +# uintmax_t.m4 serial 6 (gettext-0.11) +dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +AC_PREREQ(2.13) + +# Define uintmax_t to `unsigned long' or `unsigned long long' +# if <inttypes.h> does not exist. + +AC_DEFUN([jm_AC_TYPE_UINTMAX_T], +[ + AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) + AC_REQUIRE([jm_AC_HEADER_STDINT_H]) + if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then + AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG]) + test $ac_cv_type_unsigned_long_long = yes \ + && ac_type='unsigned long long' \ + || ac_type='unsigned long' + AC_DEFINE_UNQUOTED(uintmax_t, $ac_type, + [Define to unsigned long or unsigned long long + if <inttypes.h> and <stdint.h> don't define.]) + fi +]) diff --git a/elfutils/m4/ulonglong.m4 b/elfutils/m4/ulonglong.m4 new file mode 100644 index 000000000..c375e474c --- /dev/null +++ b/elfutils/m4/ulonglong.m4 @@ -0,0 +1,23 @@ +# ulonglong.m4 serial 2 (fileutils-4.0.32, gettext-0.10.40) +dnl Copyright (C) 1999-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Paul Eggert. + +AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG], +[ + AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long, + [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;], + [unsigned long long ullmax = (unsigned long long) -1; + return ull << i | ull >> i | ullmax / ull | ullmax % ull;], + ac_cv_type_unsigned_long_long=yes, + ac_cv_type_unsigned_long_long=no)]) + if test $ac_cv_type_unsigned_long_long = yes; then + AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1, + [Define if you have the unsigned long long type.]) + fi +]) |