From d9fb627db673d01a4e3a483730fa60085df0c1d7 Mon Sep 17 00:00:00 2001 From: jbj Date: Thu, 7 Nov 2002 13:14:30 +0000 Subject: Initial revision CVS patchset: 5834 CVS date: 2002/11/07 13:14:30 --- elfutils/elfutils.spec | 106 ++++++++++++++++++++++++++++++++++++++ elfutils/libebl/libebl_x86_64.h | 40 ++++++++++++++ elfutils/libebl/libebl_x86_64.map | 11 ++++ elfutils/libebl/x86_64_destr.c | 30 +++++++++++ elfutils/libebl/x86_64_init.c | 44 ++++++++++++++++ elfutils/libebl/x86_64_symbol.c | 83 +++++++++++++++++++++++++++++ 6 files changed, 314 insertions(+) create mode 100644 elfutils/elfutils.spec create mode 100644 elfutils/libebl/libebl_x86_64.h create mode 100644 elfutils/libebl/libebl_x86_64.map create mode 100644 elfutils/libebl/x86_64_destr.c create mode 100644 elfutils/libebl/x86_64_init.c create mode 100644 elfutils/libebl/x86_64_symbol.c (limited to 'elfutils') diff --git a/elfutils/elfutils.spec b/elfutils/elfutils.spec new file mode 100644 index 000000000..cbceaafbe --- /dev/null +++ b/elfutils/elfutils.spec @@ -0,0 +1,106 @@ +Summary: A collection of utilities and DSOs to handle compiled objects. +Name: elfutils +Version: 0.53 +Release: 1 +Copyright: GPL +Group: Development/Tools +URL: file://home/devel/drepper/ +Source: elfutils-0.53.tar.gz + +# ExcludeArch: xxx + +BuildRoot: %{_tmppath}/%{name}-root +BuildRequires: gcc >= 3.2 +BuildRequires: sharutils + +%define _gnu %{nil} +%define _programprefix eu- + +%description +Elfutils is a collection of utilities, including ld (a 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} +Conflicts: libelf-devel + +%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 +* Tue Oct 22 2002 Ulrich Drepper 0.52 +- Add libelf-devel to conflicts for elfutils-devel +* Mon Oct 21 2002 Ulrich Drepper 0.50 +- Split into runtime and devel package +* Fri Oct 18 2002 Ulrich Drepper 0.49 +- integrate into official sources +* Wed Oct 16 2002 Jeff Johnson 0.46-1 +- Swaddle. diff --git a/elfutils/libebl/libebl_x86_64.h b/elfutils/libebl/libebl_x86_64.h new file mode 100644 index 000000000..711c8c5af --- /dev/null +++ b/elfutils/libebl/libebl_x86_64.h @@ -0,0 +1,40 @@ +/* Interface for libebl_x86_64 module. + 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. + + 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 _LIBEBL_X86_64_H +#define _LIBEBL_X86_64_H 1 + +#include + + +/* Constructor. */ +extern int x86_64_init (Elf *elf, GElf_Half machine, Ebl *eh, size_t ehlen); + +/* Destructor. */ +extern void x86_64_destr (Ebl *bh); + + +/* Function to get relocation type name. */ +extern const char *x86_64_reloc_type_name (int type, char *buf, size_t len); + +/* Check relocation type. */ +extern bool x86_64_reloc_type_check (int type); + +/* Code note handling. */ +extern bool x86_64_core_note (const char *name, uint32_t type, uint32_t descsz, + const char *desc); + +#endif /* libebl_x86_64.h */ diff --git a/elfutils/libebl/libebl_x86_64.map b/elfutils/libebl/libebl_x86_64.map new file mode 100644 index 000000000..bf07cb9c2 --- /dev/null +++ b/elfutils/libebl/libebl_x86_64.map @@ -0,0 +1,11 @@ +ELFUTILS_1.0 { + global: + x86_64_backend_name; + x86_64_destr; + x86_64_init; + x86_64_reloc_type_check; + x86_64_reloc_type_name; + + local: + *; +}; diff --git a/elfutils/libebl/x86_64_destr.c b/elfutils/libebl/x86_64_destr.c new file mode 100644 index 000000000..afc2888b0 --- /dev/null +++ b/elfutils/libebl/x86_64_destr.c @@ -0,0 +1,30 @@ +/* Destructor for x86_64 specific backend library. + Copyright (C) 2002 Red Hat, Inc. + Written by Ulrich Drepper , 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 +#endif + +#include + + +void +x86_64_destr (bh) + Ebl *bh; +{ + /* Nothing to do so far. */ +} diff --git a/elfutils/libebl/x86_64_init.c b/elfutils/libebl/x86_64_init.c new file mode 100644 index 000000000..145dd0bac --- /dev/null +++ b/elfutils/libebl/x86_64_init.c @@ -0,0 +1,44 @@ +/* Initialization of x86-64 specific backend library. + Copyright (C) 2002 Red Hat, Inc. + Written by Ulrich Drepper , 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 +#endif + +#include + + +int +x86_64_init (elf, machine, eh, ehlen) + Elf *elf; + GElf_Half machine; + Ebl *eh; + size_t ehlen; +{ + /* Check whether the Elf_BH object has a sufficent size. */ + if (ehlen < sizeof (Ebl)) + return 1; + + /* We handle it. */ + eh->name = "AMD x86-64"; + eh->reloc_type_name = x86_64_reloc_type_name; + eh->reloc_type_check = x86_64_reloc_type_check; + //eh->core_note = i386_core_note; + eh->destr = x86_64_destr; + + return 0; +} diff --git a/elfutils/libebl/x86_64_symbol.c b/elfutils/libebl/x86_64_symbol.c new file mode 100644 index 000000000..2f00f9f57 --- /dev/null +++ b/elfutils/libebl/x86_64_symbol.c @@ -0,0 +1,83 @@ +/* x86_64 specific symbolic name handling. + Copyright (C) 2002 Red Hat, Inc. + Written by Ulrich Drepper , 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 +#endif + +#include +#include + +#include + + +/* Return of the backend. */ +const char * +x86_64_backend_name (void) +{ + return "x86-64"; +} + + +/* Relocation mapping table. */ +static const char *reloc_map_table[] = + { + [R_X86_64_NONE] = "R_X86_64_NONE", + [R_X86_64_64] = "R_X86_64_64", + [R_X86_64_PC32] = "R_X86_64_PC32", + [R_X86_64_GOT32] = "R_X86_64_GOT32", + [R_X86_64_PLT32] = "R_X86_64_PLT32", + [R_X86_64_COPY] = "R_X86_64_COPY", + [R_X86_64_GLOB_DAT] = "R_X86_64_GLOB_DAT", + [R_X86_64_JUMP_SLOT] = "R_X86_64_JUMP_SLOT", + [R_X86_64_RELATIVE] = "R_X86_64_RELATIVE", + [R_X86_64_GOTPCREL] = "R_X86_64_GOTPCREL", + [R_X86_64_32] = "R_X86_64_32", + [R_X86_64_32S] = "R_X86_64_32S", + [R_X86_64_16] = "R_X86_64_16", + [R_X86_64_PC16] = "R_X86_64_PC16", + [R_X86_64_8] = "R_X86_64_8", + [R_X86_64_PC8] = "R_X86_64_PC8", + [R_X86_64_DTPMOD64] = "R_X86_64_DTPMOD64", + [R_X86_64_DTPOFF64] = "R_X86_64_DTPOFF64", + [R_X86_64_TPOFF64] = "R_X86_64_TPOFF64", + [R_X86_64_TLSGD] = "R_X86_64_TLSGD", + [R_X86_64_TLSLD] = "R_X86_64_TLSLD", + [R_X86_64_DTPOFF32] = "R_X86_64_DTPOFF32", + [R_X86_64_GOTTPOFF] = "R_X86_64_GOTTPOFF", + [R_X86_64_TPOFF32] = "R_X86_64_TPOFF32" + }; + + +/* Determine relocation type string for x86-64. */ +const char * +x86_64_reloc_type_name (int type, char *buf, size_t len) +{ + if (type < 0 || type >= R_X86_64_NUM) + return NULL; + + return reloc_map_table[type]; +} + + +/* Check for correct relocation type. */ +bool +x86_64_reloc_type_check (int type) +{ + return (type >= R_X86_64_NONE && type < R_X86_64_NUM + && reloc_map_table[type] != NULL) ? true : false; +} -- cgit v1.2.3