diff options
| author | Roland McGrath <[email protected]> | 2005-11-17 03:16:00 +0000 |
|---|---|---|
| committer | Roland McGrath <[email protected]> | 2005-11-17 03:16:00 +0000 |
| commit | e47ab76f02c2a4f4d802ec298969ba67956435fe (patch) | |
| tree | 39dccb25273f15a488632c952738909f860c4b71 /libebl | |
| parent | d7f8d0caa7a357f9f4765e5dc93255f5057eba2e (diff) | |
Update new test after merge.
Diffstat (limited to 'libebl')
39 files changed, 121 insertions, 2453 deletions
diff --git a/libebl/ChangeLog b/libebl/ChangeLog index 5c66d56f..be170608 100644 --- a/libebl/ChangeLog +++ b/libebl/ChangeLog @@ -2,6 +2,64 @@ * libebl.h: Use "" for elf-knowledge.h, not <>. +2005-11-15 Roland McGrath <[email protected]> + + * Makefile.am: Removed everything for building libebl_*.so modules, + now in ../backends/Makefile.am instead. + * alpha_init.c: Moved to ../backends. + * alpha_reloc.def: Likewise. + * alpha_retval.c: Likewise. + * alpha_symbol.c: Likewise. + * arm_init.c: Likewise. + * arm_reloc.def: Likewise. + * arm_symbol.c: Likewise. + * common-reloc.c: Likewise. + * i386_corenote.c: Likewise. + * i386_init.c: Likewise. + * i386_reloc.def: Likewise. + * i386_retval.c: Likewise. + * i386_symbol.c: Likewise. + * ia64_init.c: Likewise. + * ia64_reloc.def: Likewise. + * ia64_symbol.c: Likewise. + * libebl_CPU.h: Likewise. + * ppc64_init.c: Likewise. + * ppc64_reloc.def: Likewise. + * ppc64_retval.c: Likewise. + * ppc64_symbol.c: Likewise. + * ppc_init.c: Likewise. + * ppc_reloc.def: Likewise. + * ppc_retval.c: Likewise. + * ppc_symbol.c: Likewise. + * s390_init.c: Likewise. + * s390_reloc.def: Likewise. + * s390_symbol.c: Likewise. + * sh_init.c: Likewise. + * sh_reloc.def: Likewise. + * sh_symbol.c: Likewise. + * sparc_init.c: Likewise. + * sparc_reloc.def: Likewise. + * sparc_symbol.c: Likewise. + * x86_64_corenote.c: Likewise. + * x86_64_init.c: Likewise. + * x86_64_reloc.def: Likewise. + * x86_64_retval.c: Likewise. + * x86_64_symbol.c: Likewise. + + * libebl.h: Comment fixes. + + * alpha_retval.c: New file. + * Makefile.am (alpha_SRCS): Add it. + * alpha_init.c (alpha_init): Initialize return_value_location hook. + + * ppc64_retval.c: New file. + * Makefile.am (ppc64_SRCS): Add it. + * ppc64_init.c (ppc64_init): Initialize return_value_location hook. + + * ppc_retval.c: New file. + * Makefile.am (ppc_SRCS): Add it. + * ppc_init.c (ppc_init): Initialize return_value_location hook. + 2005-11-14 Roland McGrath <[email protected]> * ia64_init.c (ia64_init): Initialize EH->reloc_simple_type. @@ -23,6 +81,26 @@ * alpha_reloc.def: Update bits per Richard Henderson <[email protected]>. +2005-11-13 Roland McGrath <[email protected]> + + * x86_64_retval.c: New file. + * Makefile.am (x86_64_SRCS): Add it. + * x86_64_init.c (x86_64_init): Use x86_64_return_value_location. + + * i386_retval.c: New file. + * Makefile.am (i386_SRCS): Add it. + (libdw): New variable. + (libebl_%.so): Use $(libdw) in link; use --as-needed. + * i386_init.c (i386_init): Use i386_return_value_location. + + * eblretval.c: New file. + * Makefile.am (gen_SOURCES): Add it. + (INCLUDES): Search in libdw. + * libebl.h: Include <libdw.h>. Declare ebl_return_value_location. + * ebl-hooks.h: Declare return_value_location hook. + * eblopenbackend.c (default_return_value_location): New function. + (fill_defaults): Use it. + 2005-11-10 Roland McGrath <[email protected]> * s390_init.c: New file. diff --git a/libebl/Makefile.am b/libebl/Makefile.am index 51b97ff2..f7c4a953 100644 --- a/libebl/Makefile.am +++ b/libebl/Makefile.am @@ -21,19 +21,13 @@ endif AM_CFLAGS += -fpic -Wall -Wshadow -Werror -Wunused -Wextra -Wformat=2 \ -std=gnu99 -INCLUDES = -I$(srcdir) -I$(top_srcdir)/libelf -I$(top_srcdir)/lib -I.. +INCLUDES = -I$(srcdir) -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw \ + -I$(top_srcdir)/lib -I.. VERSION = 1 PACKAGE_VERSION = @PACKAGE_VERSION@ LIBEBL_SUBDIR = @LIBEBL_SUBDIR@ lib_LIBRARIES = libebl.a -modules = i386 sh x86_64 ia64 alpha arm sparc ppc ppc64 s390 -libebl_pic = libebl_i386_pic.a libebl_sh_pic.a libebl_x86_64_pic.a \ - libebl_ia64_pic.a libebl_alpha_pic.a libebl_arm_pic.a \ - libebl_sparc_pic.a libebl_ppc_pic.a libebl_ppc64_pic.a \ - libebl_s390_pic.a -noinst_LIBRARIES = $(libebl_pic) -noinst_DATA = $(libebl_pic:_pic.a=.so) pkginclude_HEADERS = libebl.h @@ -49,69 +43,10 @@ gen_SOURCES = eblopenbackend.c eblclosebackend.c eblstrtab.c \ eblcorenote.c eblobjnote.c ebldebugscnp.c \ eblgotpcreloccheck.c eblcopyrelocp.c eblsectionstripp.c \ eblelfclass.c eblelfdata.c eblelfmachine.c \ - ebl_check_special_symbol.c eblbsspltp.c + ebl_check_special_symbol.c eblbsspltp.c eblretval.c libebl_a_SOURCES = $(gen_SOURCES) -i386_SRCS = i386_init.c i386_symbol.c i386_corenote.c -libebl_i386_pic_a_SOURCES = $(i386_SRCS) -am_libebl_i386_pic_a_OBJECTS = $(i386_SRCS:.c=.os) - -if MUDFLAP -libelf = ../libelf/libelf.a -libmudflap = -lmudflap -else -libelf = ../libelf/libelf.so -libmudflap = -endif - -textrel_check = if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi - -libebl_%.so: libebl_%_pic.a libebl_%.map - $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(word 2,$^) \ - -Wl,-z,defs $(libelf) $(libmudflap) - $(textrel_check) - -libebl_%.map: Makefile - echo 'ELFUTILS_$(PACKAGE_VERSION) { global: $*_init; local: *; };' > $@ - -sh_SRCS = sh_init.c sh_symbol.c -libebl_sh_pic_a_SOURCES = $(sh_SRCS) -am_libebl_sh_pic_a_OBJECTS = $(sh_SRCS:.c=.os) - -x86_64_SRCS = x86_64_init.c x86_64_symbol.c x86_64_corenote.c -libebl_x86_64_pic_a_SOURCES = $(x86_64_SRCS) -am_libebl_x86_64_pic_a_OBJECTS = $(x86_64_SRCS:.c=.os) - -ia64_SRCS = ia64_init.c ia64_symbol.c -libebl_ia64_pic_a_SOURCES = $(ia64_SRCS) -am_libebl_ia64_pic_a_OBJECTS = $(ia64_SRCS:.c=.os) - -alpha_SRCS = alpha_init.c alpha_symbol.c -libebl_alpha_pic_a_SOURCES = $(alpha_SRCS) -am_libebl_alpha_pic_a_OBJECTS = $(alpha_SRCS:.c=.os) - -arm_SRCS = arm_init.c arm_symbol.c -libebl_arm_pic_a_SOURCES = $(arm_SRCS) -am_libebl_arm_pic_a_OBJECTS = $(arm_SRCS:.c=.os) - -sparc_SRCS = sparc_init.c sparc_symbol.c -libebl_sparc_pic_a_SOURCES = $(sparc_SRCS) -am_libebl_sparc_pic_a_OBJECTS = $(sparc_SRCS:.c=.os) - -ppc_SRCS = ppc_init.c ppc_symbol.c -libebl_ppc_pic_a_SOURCES = $(ppc_SRCS) -am_libebl_ppc_pic_a_OBJECTS = $(ppc_SRCS:.c=.os) - -ppc64_SRCS = ppc64_init.c ppc64_symbol.c -libebl_ppc64_pic_a_SOURCES = $(ppc64_SRCS) -am_libebl_ppc64_pic_a_OBJECTS = $(ppc64_SRCS:.c=.os) - -s390_SRCS = s390_init.c s390_symbol.c -libebl_s390_pic_a_SOURCES = $(s390_SRCS) -am_libebl_s390_pic_a_OBJECTS = $(s390_SRCS:.c=.os) - %.os: %.c %.o if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ @@ -121,24 +56,6 @@ am_libebl_s390_pic_a_OBJECTS = $(s390_SRCS:.c=.os) else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ fi -install: install-am install-ebl-modules -install-ebl-modules: - $(mkinstalldirs) $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR) - for m in $(modules); do \ - $(INSTALL_PROGRAM) libebl_$${m}.so $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}-$(PACKAGE_VERSION).so; \ - ln -fs libebl_$${m}-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}.so; \ - done - -uninstall: uninstall-am - for m in $(modules); do \ - rm -f $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}-$(PACKAGE_VERSION).so; \ - rm -f $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}.so; \ - done - rmdir --ignore-fail-on-non-empty $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR) - rmdir --ignore-fail-on-non-empty $(DESTDIR)$(pkgincludedir) - -noinst_HEADERS = libeblP.h ebl-hooks.h libebl_CPU.h common-reloc.c -EXTRA_DIST = $(foreach m,$(modules),$($(m)_SRCS)) $(modules:=_reloc.def) +noinst_HEADERS = libeblP.h ebl-hooks.h -CLEANFILES = $(am_libebl_pic_a_OBJECTS) *.gcno *.gcda \ - $(foreach m,$(modules),$(am_libebl_$(m)_pic_a_OBJECTS)) +CLEANFILES = $(am_libebl_pic_a_OBJECTS) *.gcno *.gcda diff --git a/libebl/alpha_init.c b/libebl/alpha_init.c deleted file mode 100644 index 1ef87d63..00000000 --- a/libebl/alpha_init.c +++ /dev/null @@ -1,46 +0,0 @@ -/* Initialization of Alpha specific backend library. - Copyright (C) 2002, 2005 Red Hat, Inc. - Written by Ulrich Drepper <[email protected]>, 2002. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#define BACKEND alpha_ -#define RELOC_PREFIX R_ALPHA_ -#include "libebl_CPU.h" - -/* This defines the common reloc hooks based on alpha_reloc.def. */ -#include "common-reloc.c" - - -const char * -alpha_init (elf, machine, eh, ehlen) - Elf *elf __attribute__ ((unused)); - GElf_Half machine __attribute__ ((unused)); - Ebl *eh; - size_t ehlen; -{ - /* Check whether the Elf_BH object has a sufficent size. */ - if (ehlen < sizeof (Ebl)) - return NULL; - - /* We handle it. */ - eh->name = "Alpha"; - alpha_init_reloc (eh); - eh->dynamic_tag_name = alpha_dynamic_tag_name; - eh->dynamic_tag_check = alpha_dynamic_tag_check; - eh->reloc_simple_type = alpha_reloc_simple_type; - - return MODVERSION; -} diff --git a/libebl/alpha_reloc.def b/libebl/alpha_reloc.def deleted file mode 100644 index 488f448c..00000000 --- a/libebl/alpha_reloc.def +++ /dev/null @@ -1,48 +0,0 @@ -/* List the relocation types for alpha. -*- C -*- - Copyright (C) 2005 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -/* NAME, REL|EXEC|DYN */ - -RELOC_TYPE (NONE, 0) -RELOC_TYPE (REFLONG, REL|EXEC|DYN) -RELOC_TYPE (REFQUAD, REL|EXEC|DYN) -RELOC_TYPE (GPREL32, REL) -RELOC_TYPE (LITERAL, REL) -RELOC_TYPE (LITUSE, REL) -RELOC_TYPE (GPDISP, REL) -RELOC_TYPE (BRADDR, REL) -RELOC_TYPE (HINT, REL) -RELOC_TYPE (SREL16, REL) -RELOC_TYPE (SREL32, REL) -RELOC_TYPE (SREL64, REL) -RELOC_TYPE (GPRELHIGH, REL) -RELOC_TYPE (GPRELLOW, REL) -RELOC_TYPE (GPREL16, REL) -RELOC_TYPE (COPY, 0) -RELOC_TYPE (GLOB_DAT, EXEC|DYN) -RELOC_TYPE (JMP_SLOT, EXEC|DYN) -RELOC_TYPE (RELATIVE, EXEC|DYN) -RELOC_TYPE (TLS_GD_HI, REL) -RELOC_TYPE (TLSGD, REL) -RELOC_TYPE (TLS_LDM, REL) -RELOC_TYPE (DTPMOD64, REL|EXEC|DYN) -RELOC_TYPE (GOTDTPREL, REL) -RELOC_TYPE (DTPREL64, REL|EXEC|DYN) -RELOC_TYPE (DTPRELHI, REL) -RELOC_TYPE (DTPRELLO, REL) -RELOC_TYPE (DTPREL16, REL) -RELOC_TYPE (GOTTPREL, REL) -RELOC_TYPE (TPREL64, REL|EXEC|DYN) -RELOC_TYPE (TPRELHI, REL) -RELOC_TYPE (TPRELLO, REL) -RELOC_TYPE (TPREL16, REL) diff --git a/libebl/alpha_symbol.c b/libebl/alpha_symbol.c deleted file mode 100644 index b2e4cf77..00000000 --- a/libebl/alpha_symbol.c +++ /dev/null @@ -1,59 +0,0 @@ -/* Alpha specific symbolic name handling. - Copyright (C) 2002, 2005 Red Hat, Inc. - Written by Ulrich Drepper <[email protected]>, 2002. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <elf.h> -#include <stddef.h> - -#define BACKEND alpha_ -#include "libebl_CPU.h" - - -const char * -alpha_dynamic_tag_name (int64_t tag, char *buf __attribute__ ((unused)), - size_t len __attribute__ ((unused))) -{ - switch (tag) - { - case DT_ALPHA_PLTRO: - return "ALPHA_PLTRO"; - default: - break; - } - return NULL; -} - -bool -alpha_dynamic_tag_check (int64_t tag) -{ - return tag == DT_ALPHA_PLTRO; -} - -/* Check for the simple reloc types. */ -Elf_Type -alpha_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type) -{ - switch (type) - { - case R_ALPHA_REFLONG: - return ELF_T_WORD; - case R_ALPHA_REFQUAD: - return ELF_T_XWORD; - default: - return ELF_T_NUM; - } -} diff --git a/libebl/arm_init.c b/libebl/arm_init.c deleted file mode 100644 index ee739078..00000000 --- a/libebl/arm_init.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Initialization of Arm specific backend library. - Copyright (C) 2002, 2005 Red Hat, Inc. - Written by Ulrich Drepper <[email protected]>, 2002. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#define BACKEND arm_ -#define RELOC_PREFIX R_ARM_ -#include "libebl_CPU.h" - -/* This defines the common reloc hooks based on arm_reloc.def. */ -#include "common-reloc.c" - - -const char * -arm_init (elf, machine, eh, ehlen) - Elf *elf __attribute__ ((unused)); - GElf_Half machine __attribute__ ((unused)); - Ebl *eh; - size_t ehlen; -{ - /* Check whether the Elf_BH object has a sufficent size. */ - if (ehlen < sizeof (Ebl)) - return NULL; - - /* We handle it. */ - eh->name = "ARM"; - arm_init_reloc (eh); - eh->reloc_simple_type = arm_reloc_simple_type; - - return MODVERSION; -} diff --git a/libebl/arm_reloc.def b/libebl/arm_reloc.def deleted file mode 100644 index b76be778..00000000 --- a/libebl/arm_reloc.def +++ /dev/null @@ -1,65 +0,0 @@ -/* List the relocation types for arm. -*- C -*- - Copyright (C) 2005 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -/* NAME, REL|EXEC|DYN */ - -RELOC_TYPE (NONE, REL) /* It really is used in ET_REL on ARM. */ -RELOC_TYPE (PC24, REL) -RELOC_TYPE (ABS32, REL) -RELOC_TYPE (REL32, REL) -RELOC_TYPE (PC13, REL) -RELOC_TYPE (ABS16, REL) -RELOC_TYPE (ABS12, REL) -RELOC_TYPE (THM_ABS5, REL) -RELOC_TYPE (ABS8, REL) -RELOC_TYPE (SBREL32, REL) -RELOC_TYPE (THM_PC22, REL) -RELOC_TYPE (THM_PC8, REL) -RELOC_TYPE (AMP_VCALL9, REL) -RELOC_TYPE (SWI24, REL) -RELOC_TYPE (THM_SWI8, REL) -RELOC_TYPE (XPC25, REL) -RELOC_TYPE (THM_XPC22, REL) -RELOC_TYPE (TLS_DTPMOD32, EXEC|DYN) -RELOC_TYPE (TLS_DTPOFF32, EXEC|DYN) -RELOC_TYPE (TLS_TPOFF32, EXEC|DYN) -RELOC_TYPE (COPY, EXEC) -RELOC_TYPE (GLOB_DAT, EXEC|DYN) -RELOC_TYPE (JUMP_SLOT, EXEC|DYN) -RELOC_TYPE (RELATIVE, EXEC|DYN) -RELOC_TYPE (GOTOFF, REL) -RELOC_TYPE (GOTPC, REL) -RELOC_TYPE (GOT32, REL) -RELOC_TYPE (PLT32, REL) -RELOC_TYPE (ALU_PCREL_7_0, REL) -RELOC_TYPE (ALU_PCREL_15_8, REL) -RELOC_TYPE (ALU_PCREL_23_15, REL) -RELOC_TYPE (LDR_SBREL_11_0, REL) -RELOC_TYPE (ALU_SBREL_19_12, REL) -RELOC_TYPE (ALU_SBREL_27_20, REL) -RELOC_TYPE (GNU_VTENTRY, REL) -RELOC_TYPE (GNU_VTINHERIT, REL) -RELOC_TYPE (THM_PC11, REL) -RELOC_TYPE (THM_PC9, REL) -RELOC_TYPE (TLS_GD32, REL) -RELOC_TYPE (TLS_LDM32, REL) -RELOC_TYPE (TLS_LDO32, REL) -RELOC_TYPE (TLS_IE32, REL) -RELOC_TYPE (TLS_LE32, REL) -RELOC_TYPE (RXPC25, REL) -RELOC_TYPE (RSBREL32, REL) -RELOC_TYPE (THM_RPC22, REL) -RELOC_TYPE (RREL32, REL) -RELOC_TYPE (RABS22, REL) -RELOC_TYPE (RPC24, REL) -RELOC_TYPE (RBASE, REL) diff --git a/libebl/arm_symbol.c b/libebl/arm_symbol.c deleted file mode 100644 index 6eb40fc5..00000000 --- a/libebl/arm_symbol.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Arm specific symbolic name handling. - Copyright (C) 2002, 2005 Red Hat, Inc. - Written by Ulrich Drepper <[email protected]>, 2002. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <elf.h> -#include <stddef.h> - -#define BACKEND arm_ -#include "libebl_CPU.h" - -/* Check for the simple reloc types. */ -Elf_Type -arm_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type) -{ - switch (type) - { - case R_ARM_ABS32: - return ELF_T_WORD; - case R_ARM_ABS16: - return ELF_T_HALF; - case R_ARM_ABS8: - return ELF_T_BYTE; - default: - return ELF_T_NUM; - } -} diff --git a/libebl/common-reloc.c b/libebl/common-reloc.c deleted file mode 100644 index 0575e131..00000000 --- a/libebl/common-reloc.c +++ /dev/null @@ -1,112 +0,0 @@ -/* Common code for ebl reloc functions. - Copyright (C) 2005 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#include "libebl_CPU.h" -#include <assert.h> - -#define R_TYPE(name) PASTE (RELOC_PREFIX, name) -#define PASTE(a, b) PASTE_1 (a, b) -#define PASTE_1(a, b) a##b -#define R_NAME(name) R_NAME_1 (R_TYPE (name)) -#define R_NAME_1(type) #type - -#define RELOC_TYPES STRINGIFIED_PASTE (BACKEND, reloc.def) -#define STRINGIFIED_PASTE(a, b) STRINGIFY (PASTE (a, b)) -#define STRINGIFY(x) STRINGIFY_1 (x) -#define STRINGIFY_1(x) #x - -/* Provide a table of reloc type names, in a PIC-friendly fashion. */ - -static const struct EBLHOOK(reloc_nametable) -{ - char zero; -#define RELOC_TYPE(type, uses) \ - char name_##type[sizeof R_NAME (type)]; -#include RELOC_TYPES -#undef RELOC_TYPE -} EBLHOOK(reloc_nametable) = - { - '\0', -#define RELOC_TYPE(type, uses) R_NAME (type), -#include RELOC_TYPES -#undef RELOC_TYPE - }; -#define reloc_namestr (&EBLHOOK(reloc_nametable).zero) - -static const uint_fast16_t EBLHOOK(reloc_nameidx)[] = -{ -#define RELOC_TYPE(type, uses) \ - [R_TYPE (type)] = offsetof (struct EBLHOOK(reloc_nametable), name_##type), -#include RELOC_TYPES -#undef RELOC_TYPE -}; -#define nreloc \ - ((int) (sizeof EBLHOOK(reloc_nameidx) / sizeof EBLHOOK(reloc_nameidx)[0])) - -#define REL (1 << (ET_REL - 1)) -#define EXEC (1 << (ET_EXEC - 1)) -#define DYN (1 << (ET_DYN - 1)) -static const uint8_t EBLHOOK(reloc_valid)[] = -{ -#define RELOC_TYPE(type, uses) [R_TYPE (type)] = uses, -#include RELOC_TYPES -#undef RELOC_TYPE -}; -#undef REL -#undef EXEC -#undef DYN - -const char * -EBLHOOK(reloc_type_name) (int reloc, - char *buf __attribute__ ((unused)), - size_t len __attribute__ ((unused))) -{ - if (reloc >= 0 && reloc < nreloc && EBLHOOK(reloc_nameidx)[reloc] != 0) - return &reloc_namestr[EBLHOOK(reloc_nameidx)[reloc]]; - return NULL; -} - -bool -EBLHOOK(reloc_type_check) (int reloc) -{ - return reloc >= 0 && reloc < nreloc && EBLHOOK(reloc_nameidx)[reloc] != 0; -} - -bool -EBLHOOK(reloc_valid_use) (Elf *elf, int reloc) -{ - uint8_t uses = EBLHOOK(reloc_valid)[reloc]; - - GElf_Ehdr ehdr_mem; - GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem); - assert (ehdr != NULL); - uint8_t type = ehdr->e_type; - - return type > ET_NONE && type < ET_CORE && (uses & (1 << (type - 1))); -} - - -bool -EBLHOOK(copy_reloc_p) (int reloc) -{ - return reloc == R_TYPE (COPY); -} - -static void -EBLHOOK(init_reloc) (Ebl *ebl) -{ - ebl->reloc_type_name = EBLHOOK(reloc_type_name); - ebl->reloc_type_check = EBLHOOK(reloc_type_check); - ebl->reloc_valid_use = EBLHOOK(reloc_valid_use); - ebl->copy_reloc_p = EBLHOOK(copy_reloc_p); -} diff --git a/libebl/ebl-hooks.h b/libebl/ebl-hooks.h index 1056c42b..90a66c18 100644 --- a/libebl/ebl-hooks.h +++ b/libebl/ebl-hooks.h @@ -87,5 +87,10 @@ bool EBLHOOK(check_special_symbol) (Elf *, GElf_Ehdr *, const GElf_Sym *, /* Check if backend uses a bss PLT in this file. */ bool EBLHOOK(bss_plt_p) (Elf *, GElf_Ehdr *); +/* Return location expression to find return value given the + DW_AT_type DIE of a DW_TAG_subprogram DIE. */ +int EBLHOOK(return_value_location) (Dwarf_Die *functypedie, + const Dwarf_Op **locp); + /* Destructor for ELF backend handle. */ void EBLHOOK(destr) (struct ebl *); diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c index 9afbc88b..092cb97a 100644 --- a/libebl/eblopenbackend.c +++ b/libebl/eblopenbackend.c @@ -158,6 +158,8 @@ static bool default_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, const char *name, const GElf_Shdr *destshdr); static bool default_bss_plt_p (Elf *elf, GElf_Ehdr *ehdr); +static int default_return_value_location (Dwarf_Die *functypedie, + const Dwarf_Op **locops); static void @@ -188,6 +190,7 @@ fill_defaults (Ebl *result) result->copy_reloc_p = default_copy_reloc_p; result->check_special_symbol = default_check_special_symbol; result->bss_plt_p = default_bss_plt_p; + result->return_value_location = default_return_value_location; result->destr = default_destr; } @@ -577,3 +580,10 @@ default_bss_plt_p (Elf *elf __attribute__ ((unused)), { return false; } + +static int +default_return_value_location (Dwarf_Die *functypedie __attribute__ ((unused)), + const Dwarf_Op **locops __attribute__ ((unused))) +{ + return -2; +} diff --git a/libebl/s390_symbol.c b/libebl/eblretval.c index ddfefbb2..d23d9805 100644 --- a/libebl/s390_symbol.c +++ b/libebl/eblretval.c @@ -1,4 +1,4 @@ -/* S/390-specific symbolic name handling. +/* Return location expression to find return value given a function type DIE. Copyright (C) 2005 Red Hat, Inc. This program is Open Source software; you can redistribute it and/or @@ -15,27 +15,15 @@ # include <config.h> #endif -#include <elf.h> -#include <stddef.h> +#include <inttypes.h> +#include <libeblP.h> -#define BACKEND s390_ -#include "libebl_CPU.h" -/* Check for the simple reloc types. */ -Elf_Type -s390_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type) +int +ebl_return_value_location (ebl, functypedie, locops) + Ebl *ebl; + Dwarf_Die *functypedie; + const Dwarf_Op **locops; { - switch (type) - { - case R_390_64: - return ELF_T_SXWORD; - case R_390_32: - return ELF_T_SWORD; - case R_390_16: - return ELF_T_HALF; - case R_390_8: - return ELF_T_BYTE; - default: - return ELF_T_NUM; - } + return ebl == NULL ? -1 : ebl->return_value_location (functypedie, locops); } diff --git a/libebl/i386_corenote.c b/libebl/i386_corenote.c deleted file mode 100644 index 20750a9d..00000000 --- a/libebl/i386_corenote.c +++ /dev/null @@ -1,163 +0,0 @@ -/* i386 specific core note handling. - Copyright (C) 2002, 2005 Red Hat, Inc. - Written by Ulrich Drepper <[email protected]>, 2002. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <elf.h> -#include <inttypes.h> -#include <stddef.h> -#include <stdio.h> -#include <sys/time.h> - -#define BACKEND i386_ -#include "libebl_CPU.h" - - -/* We cannot include <sys/procfs.h> since the definition would be for - the host platform and not always x86 as required here. */ -struct elf_prstatus - { - struct - { - int32_t si_signo; /* Signal number. */ - int32_t si_code; /* Extra code. */ - int32_t si_errno; /* Errno. */ - } pr_info; /* Info associated with signal. */ - int16_t pr_cursig; /* Current signal. */ - uint32_t pr_sigpend; /* Set of pending signals. */ - uint32_t pr_sighold; /* Set of held signals. */ - int32_t pr_pid; - int32_t pr_ppid; - int32_t pr_pgrp; - int32_t pr_sid; - struct i386_timeval - { - int32_t tv_sec; - int32_t tv_usec; - } pr_utime; /* User time. */ - struct i386_timeval pr_stime; /* System time. */ - struct i386_timeval pr_cutime; /* Cumulative user time. */ - struct i386_timeval pr_cstime; /* Cumulative system time. */ - uint32_t pr_reg[17]; /* GP registers. */ - int32_t 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. */ - uint32_t pr_flag; /* Flags. */ - uint16_t pr_uid; - uint16_t pr_gid; - int32_t pr_pid; - int32_t pr_ppid; - int32_t pr_pgrp; - int32_t 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 __attribute__ ((unused)); - 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: %" PRId32 ", code = %" PRId32 - ", errno = %" PRId32 "\n" - " signal: %" PRId16 ", pending: %08" PRIx32 - ", holding: %8" PRIx32 "\n" - " pid: %" PRId32 ", ppid = %" PRId32 ", pgrp = %" PRId32 - ", sid = %" PRId32 "\n" - " utime: %6" PRId32 ".%06" PRId32 - "s, stime: %6" PRId32 ".%06" PRId32 "s\n" - " cutime: %6" PRId32 ".%06" PRId32 - "s, cstime: %6" PRId32 ".%06" PRId32 "s\n" - " eax: %08" PRIx32 " ebx: %08" PRIx32 " ecx: %08" PRIx32 - " edx: %08" PRIx32 "\n" - " esi: %08" PRIx32 " edi: %08" PRIx32 " ebp: %08" PRIx32 - " esp: %08" PRIx32 "\n" - " eip: %08" PRIx32 " eflags: %08" PRIx32 - " original eax: %08" PRIx32 "\n" - " cs: %04" PRIx32 " ds: %04" PRIx32 " es: %04" PRIx32 - " fs: %04" PRIx32 " gs: %04" PRIx32 " ss: %04" PRIx32 "\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: %08" PRIx32 ", uid: %" PRId16 ", gid: %" PRId16"\n" - " pid: %" PRId32 ", ppid: %" PRId32 ", pgrp: %" PRId32 - ", sid: %" PRId32 "\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/libebl/i386_init.c b/libebl/i386_init.c deleted file mode 100644 index 477243f3..00000000 --- a/libebl/i386_init.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Initialization of i386 specific backend library. - Copyright (C) 2000, 2001, 2002, 2005 Red Hat, Inc. - Written by Ulrich Drepper <[email protected]>, 2000. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#define BACKEND i386_ -#define RELOC_PREFIX R_386_ -#include "libebl_CPU.h" - -/* This defines the common reloc hooks based on i386_reloc.def. */ -#include "common-reloc.c" - -const char * -i386_init (elf, machine, eh, ehlen) - Elf *elf __attribute__ ((unused)); - GElf_Half machine __attribute__ ((unused)); - Ebl *eh; - size_t ehlen; -{ - /* Check whether the Elf_BH object has a sufficent size. */ - if (ehlen < sizeof (Ebl)) - return NULL; - - /* We handle it. */ - eh->name = "Intel 80386"; - i386_init_reloc (eh); - eh->reloc_simple_type = i386_reloc_simple_type; - eh->gotpc_reloc_check = i386_gotpc_reloc_check; - eh->core_note = i386_core_note; - generic_debugscn_p = eh->debugscn_p; - eh->debugscn_p = i386_debugscn_p; - - return MODVERSION; -} diff --git a/libebl/i386_reloc.def b/libebl/i386_reloc.def deleted file mode 100644 index ba750d0d..00000000 --- a/libebl/i386_reloc.def +++ /dev/null @@ -1,51 +0,0 @@ -/* List the relocation types for i386. -*- C -*- - Copyright (C) 2000, 2001, 2002, 2003, 2005 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -/* NAME, REL|EXEC|DYN */ - -RELOC_TYPE (NONE, 0) -RELOC_TYPE (COPY, EXEC) -RELOC_TYPE (32, REL|EXEC|DYN) -RELOC_TYPE (PC32, REL|EXEC|DYN) -RELOC_TYPE (GOT32, REL) -RELOC_TYPE (PLT32, REL) -RELOC_TYPE (GLOB_DAT, EXEC|DYN) -RELOC_TYPE (JMP_SLOT, EXEC|DYN) -RELOC_TYPE (RELATIVE, EXEC|DYN) -RELOC_TYPE (GOTOFF, REL) -RELOC_TYPE (GOTPC, REL) -RELOC_TYPE (32PLT, REL) -RELOC_TYPE (TLS_TPOFF, EXEC|DYN) -RELOC_TYPE (TLS_IE, REL) -RELOC_TYPE (TLS_GOTIE, REL) -RELOC_TYPE (TLS_LE, REL) -RELOC_TYPE (TLS_GD, REL) -RELOC_TYPE (TLS_LDM, REL) -RELOC_TYPE (16, REL) -RELOC_TYPE (PC16, REL) -RELOC_TYPE (8, REL) -RELOC_TYPE (PC8, REL) -RELOC_TYPE (TLS_GD_32, REL) -RELOC_TYPE (TLS_GD_PUSH, REL) -RELOC_TYPE (TLS_GD_CALL, REL) -RELOC_TYPE (TLS_GD_POP, REL) -RELOC_TYPE (TLS_LDM_32, REL) -RELOC_TYPE (TLS_LDM_PUSH, REL) -RELOC_TYPE (TLS_LDM_CALL, REL) -RELOC_TYPE (TLS_LDM_POP, REL) -RELOC_TYPE (TLS_LDO_32, REL) -RELOC_TYPE (TLS_IE_32, REL) -RELOC_TYPE (TLS_LE_32, REL) -RELOC_TYPE (TLS_DTPMOD32, EXEC|DYN) -RELOC_TYPE (TLS_DTPOFF32, EXEC|DYN) -RELOC_TYPE (TLS_TPOFF32, EXEC|DYN) diff --git a/libebl/i386_symbol.c b/libebl/i386_symbol.c deleted file mode 100644 index dadcc107..00000000 --- a/libebl/i386_symbol.c +++ /dev/null @@ -1,60 +0,0 @@ -/* i386 specific symbolic name handling. - Copyright (C) 2000, 2001, 2002, 2005 Red Hat, Inc. - Written by Ulrich Drepper <[email protected]>, 2000. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <assert.h> -#include <elf.h> -#include <stddef.h> -#include <string.h> - -#define BACKEND i386_ -#include "libebl_CPU.h" - - -/* Return true if the symbol type is that referencing the GOT. */ -bool -i386_gotpc_reloc_check (Elf *elf __attribute__ ((unused)), int type) -{ - return type == R_386_GOTPC; -} - -/* Check for the simple reloc types. */ -Elf_Type -i386_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type) -{ - switch (type) - { - case R_386_32: - return ELF_T_SWORD; - case R_386_16: - return ELF_T_HALF; - case R_386_8: - return ELF_T_BYTE; - default: - return ELF_T_NUM; - } -} - -/* Check section name for being that of a debug information section. */ -bool (*generic_debugscn_p) (const char *); -bool -i386_debugscn_p (const char *name) -{ - return (generic_debugscn_p (name) - || strcmp (name, ".stab") == 0 - || strcmp (name, ".stabstr") == 0); -} diff --git a/libebl/ia64_init.c b/libebl/ia64_init.c deleted file mode 100644 index 1431f2de..00000000 --- a/libebl/ia64_init.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Initialization of IA-64 specific backend library. - Copyright (C) 2002, 2003, 2005 Red Hat, Inc. - Written by Ulrich Drepper <[email protected]>, 2002. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#define BACKEND ia64_ -#define RELOC_PREFIX R_IA64_ -#include "libebl_CPU.h" - -/* This defines the common reloc hooks based on ia64_reloc.def. */ -#include "common-reloc.c" - -const char * -ia64_init (elf, machine, eh, ehlen) - Elf *elf __attribute__ ((unused)); - GElf_Half machine __attribute__ ((unused)); - Ebl *eh; - size_t ehlen; -{ - /* Check whether the Elf_BH object has a sufficent size. */ - if (ehlen < sizeof (Ebl)) - return NULL; - - /* We handle it. */ - eh->name = "Intel IA-64"; - ia64_init_reloc (eh); - eh->reloc_simple_type = ia64_reloc_simple_type; - eh->segment_type_name = ia64_segment_type_name; - eh->section_type_name = ia64_section_type_name; - eh->dynamic_tag_name = ia64_dynamic_tag_name; - eh->dynamic_tag_check = ia64_dynamic_tag_check; - eh->machine_flag_check = ia64_machine_flag_check; - - return MODVERSION; -} diff --git a/libebl/ia64_reloc.def b/libebl/ia64_reloc.def deleted file mode 100644 index a0d42155..00000000 --- a/libebl/ia64_reloc.def +++ /dev/null @@ -1,96 +0,0 @@ -/* List the relocation types for ia64. -*- C -*- - Copyright (C) 2005 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -/* NAME, REL|EXEC|DYN */ - -RELOC_TYPE (NONE, 0) -RELOC_TYPE (IMM14, REL) -RELOC_TYPE (IMM22, REL) -RELOC_TYPE (IMM64, REL) -RELOC_TYPE (DIR32MSB, REL|EXEC|DYN) -RELOC_TYPE (DIR32LSB, REL|EXEC|DYN) -RELOC_TYPE (DIR64MSB, REL|EXEC|DYN) -RELOC_TYPE (DIR64LSB, REL|EXEC|DYN) -RELOC_TYPE (GPREL22, REL) -RELOC_TYPE (GPREL64I, REL) -RELOC_TYPE (GPREL32MSB, REL) -RELOC_TYPE (GPREL32LSB, REL) -RELOC_TYPE (GPREL64MSB, REL) -RELOC_TYPE (GPREL64LSB, REL) -RELOC_TYPE (LTOFF22, REL) -RELOC_TYPE (LTOFF64I, REL) -RELOC_TYPE (PLTOFF22, REL) -RELOC_TYPE (PLTOFF64I, REL) -RELOC_TYPE (PLTOFF64MSB, REL) -RELOC_TYPE (PLTOFF64LSB, REL) -RELOC_TYPE (FPTR64I, REL) -RELOC_TYPE (FPTR32MSB, REL|EXEC|DYN) -RELOC_TYPE (FPTR32LSB, REL|EXEC|DYN) -RELOC_TYPE (FPTR64MSB, REL|EXEC|DYN) -RELOC_TYPE (FPTR64LSB, REL|EXEC|DYN) -RELOC_TYPE (PCREL60B, REL) -RELOC_TYPE (PCREL21B, REL) -RELOC_TYPE (PCREL21M, REL) -RELOC_TYPE (PCREL21F, REL) -RELOC_TYPE (PCREL32MSB, REL|EXEC|DYN) -RELOC_TYPE (PCREL32LSB, REL|EXEC|DYN) -RELOC_TYPE (PCREL64MSB, REL|EXEC|DYN) -RELOC_TYPE (PCREL64LSB, REL|EXEC|DYN) -RELOC_TYPE (LTOFF_FPTR22, REL) -RELOC_TYPE (LTOFF_FPTR64I, REL) -RELOC_TYPE (LTOFF_FPTR32MSB, REL) -RELOC_TYPE (LTOFF_FPTR32LSB, REL) -RELOC_TYPE (LTOFF_FPTR64MSB, REL) -RELOC_TYPE (LTOFF_FPTR64LSB, REL) -RELOC_TYPE (SEGREL32MSB, REL) -RELOC_TYPE (SEGREL32LSB, REL) -RELOC_TYPE (SEGREL64MSB, REL) -RELOC_TYPE (SEGREL64LSB, REL) -RELOC_TYPE (SECREL32MSB, REL) -RELOC_TYPE (SECREL32LSB, REL) -RELOC_TYPE (SECREL64MSB, REL) -RELOC_TYPE (SECREL64LSB, REL) -RELOC_TYPE (REL32MSB, EXEC|DYN) -RELOC_TYPE (REL32LSB, EXEC|DYN) -RELOC_TYPE (REL64MSB, EXEC|DYN) -RELOC_TYPE (REL64LSB, EXEC|DYN) -RELOC_TYPE (LTV32MSB, REL) -RELOC_TYPE (LTV32LSB, REL) -RELOC_TYPE (LTV64MSB, REL) -RELOC_TYPE (LTV64LSB, REL) -RELOC_TYPE (PCREL21BI, REL) -RELOC_TYPE (PCREL22, REL) -RELOC_TYPE (PCREL64I, REL) -RELOC_TYPE (IPLTMSB, REL|EXEC|DYN) -RELOC_TYPE (IPLTLSB, REL|EXEC|DYN) -RELOC_TYPE (COPY, EXEC) -RELOC_TYPE (SUB, 0) -RELOC_TYPE (LTOFF22X, REL) -RELOC_TYPE (LDXMOV, REL) -RELOC_TYPE (TPREL14, REL) -RELOC_TYPE (TPREL22, REL) -RELOC_TYPE (TPREL64I, REL) -RELOC_TYPE (TPREL64MSB, REL|EXEC|DYN) -RELOC_TYPE (TPREL64LSB, REL|EXEC|DYN) -RELOC_TYPE (LTOFF_TPREL22, REL) -RELOC_TYPE (DTPMOD64MSB, REL|EXEC|DYN) -RELOC_TYPE (DTPMOD64LSB, REL|EXEC|DYN) -RELOC_TYPE (LTOFF_DTPMOD22, REL) -RELOC_TYPE (DTPREL14, REL) -RELOC_TYPE (DTPREL22, REL) -RELOC_TYPE (DTPREL64I, REL) -RELOC_TYPE (DTPREL32MSB, REL|EXEC|DYN) -RELOC_TYPE (DTPREL32LSB, REL|EXEC|DYN) -RELOC_TYPE (DTPREL64MSB, REL|EXEC|DYN) -RELOC_TYPE (DTPREL64LSB, REL|EXEC|DYN) -RELOC_TYPE (LTOFF_DTPREL22, REL) diff --git a/libebl/ia64_symbol.c b/libebl/ia64_symbol.c deleted file mode 100644 index 1b500873..00000000 --- a/libebl/ia64_symbol.c +++ /dev/null @@ -1,119 +0,0 @@ -/* IA-64 specific symbolic name handling. - Copyright (C) 2002, 2003, 2005 Red Hat, Inc. - Written by Ulrich Drepper <[email protected]>, 2002. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <elf.h> -#include <stddef.h> -#include <assert.h> - -#define BACKEND ia64_ -#include "libebl_CPU.h" - - -const char * -ia64_segment_type_name (int segment, char *buf __attribute__ ((unused)), - size_t len __attribute__ ((unused))) -{ - switch (segment) - { - case PT_IA_64_ARCHEXT: - return "IA_64_ARCHEXT"; - case PT_IA_64_UNWIND: - return "IA_64_UNWIND"; - case PT_IA_64_HP_OPT_ANOT: - return "IA_64_HP_OPT_ANOT"; - case PT_IA_64_HP_HSL_ANOT: - return "IA_64_HP_HSL_ANOT"; - case PT_IA_64_HP_STACK: - return "IA_64_HP_STACK"; - default: - break; - } - return NULL; -} - -const char * -ia64_dynamic_tag_name (int64_t tag, char *buf __attribute__ ((unused)), - size_t len __attribute__ ((unused))) -{ - switch (tag) - { - case DT_IA_64_PLT_RESERVE: - return "IA_64_PLT_RESERVE"; - default: - break; - } - return NULL; -} - -/* Check dynamic tag. */ -bool -ia64_dynamic_tag_check (int64_t tag) -{ - return tag == DT_IA_64_PLT_RESERVE; -} - -/* Check whether machine flags are valid. */ -bool -ia64_machine_flag_check (GElf_Word flags) -{ - return ((flags &~ EF_IA_64_ABI64) == 0); -} - -/* Return symbolic representation of section type. */ -const char * -ia64_section_type_name (int type, - char *buf __attribute__ ((unused)), - size_t len __attribute__ ((unused))) -{ - switch (type) - { - case SHT_IA_64_EXT: - return "SHT_IA_64_EXT"; - case SHT_IA_64_UNWIND: - return "HT_IA_64_UNWIND"; - } - - return NULL; -} - -/* Check for the simple reloc types. */ -Elf_Type -ia64_reloc_simple_type (Ebl *ebl, int type) -{ - switch (type) - { - case R_IA64_DIR32MSB: - if (ebl->data == ELFDATA2MSB) - return ELF_T_WORD; - break; - case R_IA64_DIR32LSB: - if (ebl->data == ELFDATA2LSB) - return ELF_T_WORD; - break; - case R_IA64_DIR64MSB: - if (ebl->data == ELFDATA2MSB) - return ELF_T_XWORD; - break; - case R_IA64_DIR64LSB: - if (ebl->data == ELFDATA2LSB) - return ELF_T_XWORD; - break; - } - - return ELF_T_NUM; -} diff --git a/libebl/libebl.h b/libebl/libebl.h index 1f9a5a25..7e91b308 100644 --- a/libebl/libebl.h +++ b/libebl/libebl.h @@ -15,6 +15,7 @@ #define _LIBEBL_H 1 #include <gelf.h> +#include "libdw.h" #include <stdbool.h> #include <stddef.h> #include <stdint.h> @@ -156,6 +157,19 @@ extern bool ebl_section_strip_p (Ebl *ebl, const GElf_Ehdr *ehdr, /* Check if backend uses a bss PLT in this file. */ extern bool ebl_bss_plt_p (Ebl *ebl, GElf_Ehdr *ehdr); +/* Return location expression to find return value given a + DW_TAG_subprogram, DW_TAG_subroutine_type, or similar DIE describing + function itself (whose DW_AT_type attribute describes its return type). + Returns -1 for a libdw error (see dwarf_errno). + Returns -2 for an unrecognized type formation. + Returns zero if the function has no return value (e.g. "void" in C). + Otherwise, *LOCOPS gets a location expression to find the return value, + and returns the number of operations in the expression. The pointer is + permanently allocated at least as long as the Ebl handle is open. */ +extern int ebl_return_value_location (Ebl *ebl, + Dwarf_Die *functypedie, + const Dwarf_Op **locops); + /* ELF string table handling. */ struct Ebl_Strtab; diff --git a/libebl/libebl_CPU.h b/libebl/libebl_CPU.h deleted file mode 100644 index 607c1543..00000000 --- a/libebl/libebl_CPU.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Common interface for libebl modules. - Copyright (C) 2000, 2001, 2002, 2003, 2005 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifndef _LIBEBL_CPU_H -#define _LIBEBL_CPU_H 1 - -#include <libeblP.h> - -#define EBLHOOK(name) EBLHOOK_1(BACKEND, name) -#define EBLHOOK_1(a, b) EBLHOOK_2(a, b) -#define EBLHOOK_2(a, b) a##b - -/* Constructor. */ -extern const char *EBLHOOK(init) (Elf *elf, GElf_Half machine, - Ebl *eh, size_t ehlen); - -#include "ebl-hooks.h" - -#define HOOK(eh, name) eh->name = EBLHOOK(name) - -extern bool (*generic_debugscn_p) (const char *) attribute_hidden; - - -#endif /* libebl_CPU.h */ diff --git a/libebl/ppc64_init.c b/libebl/ppc64_init.c deleted file mode 100644 index c8a93546..00000000 --- a/libebl/ppc64_init.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Initialization of PPC64 specific backend library. - Copyright (C) 2004, 2005 Red Hat, Inc. - Written by Ulrich Drepper <[email protected]>, 2004. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#define BACKEND ppc64_ -#define RELOC_PREFIX R_PPC64_ -#include "libebl_CPU.h" - -/* This defines the common reloc hooks based on ppc64_reloc.def. */ -#include "common-reloc.c" - - -const char * -ppc64_init (elf, machine, eh, ehlen) - Elf *elf __attribute__ ((unused)); - GElf_Half machine __attribute__ ((unused)); - Ebl *eh; - size_t ehlen; -{ - /* Check whether the Elf_BH object has a sufficent size. */ - if (ehlen < sizeof (Ebl)) - return NULL; - - /* We handle it. */ - eh->name = "PowerPC 64-bit"; - ppc64_init_reloc (eh); - eh->reloc_simple_type = ppc64_reloc_simple_type; - eh->dynamic_tag_name = ppc64_dynamic_tag_name; - eh->dynamic_tag_check = ppc64_dynamic_tag_check; - eh->copy_reloc_p = ppc64_copy_reloc_p; - eh->check_special_symbol = ppc64_check_special_symbol; - eh->bss_plt_p = ppc64_bss_plt_p; - - return MODVERSION; -} diff --git a/libebl/ppc64_reloc.def b/libebl/ppc64_reloc.def deleted file mode 100644 index d0cb2f91..00000000 --- a/libebl/ppc64_reloc.def +++ /dev/null @@ -1,119 +0,0 @@ -/* List the relocation types for ppc64. -*- C -*- - Copyright (C) 2005 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -/* NAME, REL|EXEC|DYN */ - -RELOC_TYPE (NONE, REL) -RELOC_TYPE (ADDR32, REL) -RELOC_TYPE (ADDR24, REL|EXEC|DYN) -RELOC_TYPE (ADDR16, REL|EXEC|DYN) -RELOC_TYPE (ADDR16_LO, REL|EXEC|DYN) -RELOC_TYPE (ADDR16_HI, REL|EXEC|DYN) -RELOC_TYPE (ADDR16_HA, REL|EXEC|DYN) -RELOC_TYPE (ADDR14, REL|EXEC|DYN) -RELOC_TYPE (ADDR14_BRTAKEN, REL|EXEC|DYN) -RELOC_TYPE (ADDR14_BRNTAKEN, REL|EXEC|DYN) -RELOC_TYPE (REL24, REL) -RELOC_TYPE (REL14, REL) -RELOC_TYPE (REL14_BRTAKEN, REL) -RELOC_TYPE (REL14_BRNTAKEN, REL) -RELOC_TYPE (GOT16, REL) -RELOC_TYPE (GOT16_LO, REL) -RELOC_TYPE (GOT16_HI, REL) -RELOC_TYPE (GOT16_HA, REL) -RELOC_TYPE (COPY, EXEC) -RELOC_TYPE (GLOB_DAT, EXEC|DYN) -RELOC_TYPE (JMP_SLOT, EXEC|DYN) -RELOC_TYPE (RELATIVE, EXEC|DYN) -RELOC_TYPE (UADDR32, REL|EXEC|DYN) -RELOC_TYPE (UADDR16, REL|EXEC|DYN) -RELOC_TYPE (REL32, REL|EXEC|DYN) -RELOC_TYPE (PLT32, REL) -RELOC_TYPE (PLTREL32, REL) -RELOC_TYPE (PLT16_LO, REL) -RELOC_TYPE (PLT16_HI, REL) -RELOC_TYPE (PLT16_HA, REL) -RELOC_TYPE (SECTOFF, REL) -RELOC_TYPE (SECTOFF_LO, REL) -RELOC_TYPE (SECTOFF_HI, REL) -RELOC_TYPE (SECTOFF_HA, REL) -RELOC_TYPE (ADDR30, REL|EXEC|DYN) -RELOC_TYPE (ADDR64, REL|EXEC|DYN) -RELOC_TYPE (ADDR16_HIGHER, REL) -RELOC_TYPE (ADDR16_HIGHERA, REL) -RELOC_TYPE (ADDR16_HIGHEST, REL) -RELOC_TYPE (ADDR16_HIGHESTA, REL) -RELOC_TYPE (UADDR64, REL|EXEC|DYN) -RELOC_TYPE (REL64, REL|EXEC|DYN) -RELOC_TYPE (PLT64, REL) -RELOC_TYPE (PLTREL64, REL) -RELOC_TYPE (TOC16, REL) -RELOC_TYPE (TOC16_LO, REL) -RELOC_TYPE (TOC16_HI, REL) -RELOC_TYPE (TOC16_HA, REL) -RELOC_TYPE (TOC, REL) -RELOC_TYPE (PLTGOT16, REL) -RELOC_TYPE (PLTGOT16_LO, REL) -RELOC_TYPE (PLTGOT16_HI, REL) -RELOC_TYPE (PLTGOT16_HA, REL) -RELOC_TYPE (ADDR16_DS, REL) -RELOC_TYPE (ADDR16_LO_DS, REL|EXEC|DYN) -RELOC_TYPE (GOT16_DS, REL) -RELOC_TYPE (GOT16_LO_DS, REL) -RELOC_TYPE (PLT16_LO_DS, REL) -RELOC_TYPE (SECTOFF_DS, REL) -RELOC_TYPE (SECTOFF_LO_DS, REL) -RELOC_TYPE (TOC16_DS, REL) -RELOC_TYPE (TOC16_LO_DS, REL) -RELOC_TYPE (PLTGOT16_DS, REL) -RELOC_TYPE (PLTGOT16_LO_DS, REL) -RELOC_TYPE (TLS, REL) -RELOC_TYPE (DTPMOD64, EXEC|DYN) -RELOC_TYPE (TPREL16, EXEC|DYN) -RELOC_TYPE (TPREL16_LO, EXEC|DYN) -RELOC_TYPE (TPREL16_HI, EXEC|DYN) -RELOC_TYPE (TPREL16_HA, EXEC|DYN) -RELOC_TYPE (TPREL64, EXEC|DYN) -RELOC_TYPE (DTPREL16, REL) -RELOC_TYPE (DTPREL16_LO, REL) -RELOC_TYPE (DTPREL16_HI, REL) -RELOC_TYPE (DTPREL16_HA, REL) -RELOC_TYPE (DTPREL64, EXEC|DYN) -RELOC_TYPE (GOT_TLSGD16, REL) -RELOC_TYPE (GOT_TLSGD16_LO, REL) -RELOC_TYPE (GOT_TLSGD16_HI, REL) -RELOC_TYPE (GOT_TLSGD16_HA, REL) -RELOC_TYPE (GOT_TLSLD16, REL) -RELOC_TYPE (GOT_TLSLD16_LO, REL) -RELOC_TYPE (GOT_TLSLD16_HI, REL) -RELOC_TYPE (GOT_TLSLD16_HA, REL) -RELOC_TYPE (GOT_TPREL16_DS, REL) -RELOC_TYPE (GOT_TPREL16_LO_DS, REL) -RELOC_TYPE (GOT_TPREL16_HI, REL) -RELOC_TYPE (GOT_TPREL16_HA, REL) -RELOC_TYPE (GOT_DTPREL16_DS, REL) -RELOC_TYPE (GOT_DTPREL16_LO_DS, REL) -RELOC_TYPE (GOT_DTPREL16_HI, REL) -RELOC_TYPE (GOT_DTPREL16_HA, REL) -RELOC_TYPE (TPREL16_DS, REL) -RELOC_TYPE (TPREL16_LO_DS, EXEC|DYN) -RELOC_TYPE (TPREL16_HIGHER, EXEC|DYN) -RELOC_TYPE (TPREL16_HIGHERA, EXEC|DYN) -RELOC_TYPE (TPREL16_HIGHEST, EXEC|DYN) -RELOC_TYPE (TPREL16_HIGHESTA, EXEC|DYN) -RELOC_TYPE (DTPREL16_DS, REL) -RELOC_TYPE (DTPREL16_LO_DS, REL) -RELOC_TYPE (DTPREL16_HIGHER, REL) -RELOC_TYPE (DTPREL16_HIGHERA, REL) -RELOC_TYPE (DTPREL16_HIGHEST, REL) -RELOC_TYPE (DTPREL16_HIGHESTA, REL) diff --git a/libebl/ppc64_symbol.c b/libebl/ppc64_symbol.c deleted file mode 100644 index db486176..00000000 --- a/libebl/ppc64_symbol.c +++ /dev/null @@ -1,97 +0,0 @@ -/* PPC64 specific symbolic name handling. - Copyright (C) 2004, 2005 Red Hat, Inc. - Written by Ulrich Drepper <[email protected]>, 2004. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <assert.h> -#include <elf.h> -#include <stddef.h> -#include <string.h> - -#define BACKEND ppc64_ -#include "libebl_CPU.h" - - -/* Check for the simple reloc types. */ -Elf_Type -ppc64_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type) -{ - switch (type) - { - case R_PPC64_ADDR64: - case R_PPC64_UADDR64: - return ELF_T_XWORD; - case R_PPC64_ADDR32: - case R_PPC64_UADDR32: - return ELF_T_WORD; - case R_PPC64_UADDR16: - return ELF_T_HALF; - default: - return ELF_T_NUM; - } -} - - -const char * -ppc64_dynamic_tag_name (int64_t tag, char *buf __attribute__ ((unused)), - size_t len __attribute__ ((unused))) -{ - switch (tag) - { - case DT_PPC64_GLINK: - return "PPC64_GLINK"; - case DT_PPC64_OPD: - return "PPC64_OPD"; - case DT_PPC64_OPDSZ: - return "PPC64_OPDSZ"; - default: - break; - } - return NULL; -} - - -bool -ppc64_dynamic_tag_check (int64_t tag) -{ - return (tag == DT_PPC64_GLINK - || tag == DT_PPC64_OPD - || tag == DT_PPC64_OPDSZ); -} - - -/* Check whether given symbol's st_value and st_size are OK despite failing - normal checks. */ -bool -ppc64_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, - const GElf_Sym *sym __attribute__ ((unused)), - const char *name __attribute__ ((unused)), - const GElf_Shdr *destshdr) -{ - const char *sname = elf_strptr (elf, ehdr->e_shstrndx, destshdr->sh_name); - if (sname == NULL) - return false; - return strcmp (sname, ".opd") == 0; -} - - -/* Check if backend uses a bss PLT in this file. */ -bool -ppc64_bss_plt_p (Elf *elf __attribute__ ((unused)), - GElf_Ehdr *ehdr __attribute__ ((unused))) -{ - return true; -} diff --git a/libebl/ppc_init.c b/libebl/ppc_init.c deleted file mode 100644 index 375b79ed..00000000 --- a/libebl/ppc_init.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Initialization of PPC specific backend library. - Copyright (C) 2004, 2005 Red Hat, Inc. - Written by Ulrich Drepper <[email protected]>, 2004. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#define BACKEND ppc_ -#define RELOC_PREFIX R_PPC_ -#include "libebl_CPU.h" - -/* This defines the common reloc hooks based on ppc_reloc.def. */ -#include "common-reloc.c" - - -const char * -ppc_init (elf, machine, eh, ehlen) - Elf *elf __attribute__ ((unused)); - GElf_Half machine __attribute__ ((unused)); - Ebl *eh; - size_t ehlen; -{ - /* Check whether the Elf_BH object has a sufficent size. */ - if (ehlen < sizeof (Ebl)) - return NULL; - - /* We handle it. */ - eh->name = "PowerPC"; - ppc_init_reloc (eh); - eh->reloc_simple_type = ppc_reloc_simple_type; - eh->dynamic_tag_name = ppc_dynamic_tag_name; - eh->dynamic_tag_check = ppc_dynamic_tag_check; - eh->check_special_symbol = ppc_check_special_symbol; - eh->bss_plt_p = ppc_bss_plt_p; - - return MODVERSION; -} diff --git a/libebl/ppc_reloc.def b/libebl/ppc_reloc.def deleted file mode 100644 index 97187381..00000000 --- a/libebl/ppc_reloc.def +++ /dev/null @@ -1,107 +0,0 @@ -/* List the relocation types for ppc. -*- C -*- - Copyright (C) 2005 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -/* NAME, REL|EXEC|DYN */ - -RELOC_TYPE (NONE, 0) -RELOC_TYPE (ADDR32, REL|EXEC|DYN) -RELOC_TYPE (ADDR24, REL) -RELOC_TYPE (ADDR16, REL) -RELOC_TYPE (ADDR16_LO, REL) -RELOC_TYPE (ADDR16_HI, REL) -RELOC_TYPE (ADDR16_HA, REL) -RELOC_TYPE (ADDR14, REL) -RELOC_TYPE (ADDR14_BRTAKEN, REL) -RELOC_TYPE (ADDR14_BRNTAKEN, REL) -RELOC_TYPE (REL24, REL) -RELOC_TYPE (REL14, REL) -RELOC_TYPE (REL14_BRTAKEN, REL) -RELOC_TYPE (REL14_BRNTAKEN, REL) -RELOC_TYPE (GOT16, REL) -RELOC_TYPE (GOT16_LO, REL) -RELOC_TYPE (GOT16_HI, REL) -RELOC_TYPE (GOT16_HA, REL) -RELOC_TYPE (PLTREL24, REL) -RELOC_TYPE (COPY, EXEC) -RELOC_TYPE (GLOB_DAT, EXEC|DYN) -RELOC_TYPE (JMP_SLOT, EXEC|DYN) -RELOC_TYPE (RELATIVE, EXEC|DYN) -RELOC_TYPE (LOCAL24PC, REL) -RELOC_TYPE (UADDR32, REL) -RELOC_TYPE (UADDR16, REL) -RELOC_TYPE (REL32, REL) -RELOC_TYPE (PLT32, REL) -RELOC_TYPE (PLTREL32, REL) -RELOC_TYPE (PLT16_LO, REL) -RELOC_TYPE (PLT16_HI, REL) -RELOC_TYPE (PLT16_HA, REL) -RELOC_TYPE (SDAREL16, REL) -RELOC_TYPE (SECTOFF, REL) -RELOC_TYPE (SECTOFF_LO, REL) -RELOC_TYPE (SECTOFF_HI, REL) -RELOC_TYPE (SECTOFF_HA, REL) -RELOC_TYPE (TLS, REL) -RELOC_TYPE (DTPMOD32, EXEC|DYN) -RELOC_TYPE (TPREL16, REL) -RELOC_TYPE (TPREL16_LO, REL) -RELOC_TYPE (TPREL16_HI, REL) -RELOC_TYPE (TPREL16_HA, REL) -RELOC_TYPE (TPREL32, EXEC|DYN) -RELOC_TYPE (DTPREL16, REL) -RELOC_TYPE (DTPREL16_LO, REL) -RELOC_TYPE (DTPREL16_HI, REL) -RELOC_TYPE (DTPREL16_HA, REL) -RELOC_TYPE (DTPREL32, EXEC|DYN) -RELOC_TYPE (GOT_TLSGD16, REL) -RELOC_TYPE (GOT_TLSGD16_LO, REL) -RELOC_TYPE (GOT_TLSGD16_HI, REL) -RELOC_TYPE (GOT_TLSGD16_HA, REL) -RELOC_TYPE (GOT_TLSLD16, REL) -RELOC_TYPE (GOT_TLSLD16_LO, REL) -RELOC_TYPE (GOT_TLSLD16_HI, REL) -RELOC_TYPE (GOT_TLSLD16_HA, REL) -RELOC_TYPE (GOT_TPREL16, REL) -RELOC_TYPE (GOT_TPREL16_LO, REL) -RELOC_TYPE (GOT_TPREL16_HI, REL) -RELOC_TYPE (GOT_TPREL16_HA, REL) -RELOC_TYPE (GOT_DTPREL16, REL) -RELOC_TYPE (GOT_DTPREL16_LO, REL) -RELOC_TYPE (GOT_DTPREL16_HI, REL) -RELOC_TYPE (GOT_DTPREL16_HA, REL) -RELOC_TYPE (EMB_NADDR32, REL) -RELOC_TYPE (EMB_NADDR16, REL) -RELOC_TYPE (EMB_NADDR16_LO, REL) -RELOC_TYPE (EMB_NADDR16_HI, REL) -RELOC_TYPE (EMB_NADDR16_HA, REL) -RELOC_TYPE (EMB_SDAI16, REL) -RELOC_TYPE (EMB_SDA2I16, REL) -RELOC_TYPE (EMB_SDA2REL, REL) -RELOC_TYPE (EMB_SDA21, REL) -RELOC_TYPE (EMB_MRKREF, REL) -RELOC_TYPE (EMB_RELSEC16, REL) -RELOC_TYPE (EMB_RELST_LO, REL) -RELOC_TYPE (EMB_RELST_HI, REL) -RELOC_TYPE (EMB_RELST_HA, REL) -RELOC_TYPE (EMB_BIT_FLD, REL) -RELOC_TYPE (EMB_RELSDA, REL) -RELOC_TYPE (DIAB_SDA21_LO, REL) -RELOC_TYPE (DIAB_SDA21_HI, REL) -RELOC_TYPE (DIAB_SDA21_HA, REL) -RELOC_TYPE (DIAB_RELSDA_LO, REL) -RELOC_TYPE (DIAB_RELSDA_HI, REL) -RELOC_TYPE (DIAB_RELSDA_HA, REL) -RELOC_TYPE (REL16, REL) -RELOC_TYPE (REL16_LO, REL) -RELOC_TYPE (REL16_HI, REL) -RELOC_TYPE (REL16_HA, REL) -RELOC_TYPE (TOC16, REL) diff --git a/libebl/ppc_symbol.c b/libebl/ppc_symbol.c deleted file mode 100644 index f161d70e..00000000 --- a/libebl/ppc_symbol.c +++ /dev/null @@ -1,143 +0,0 @@ -/* PPC specific symbolic name handling. - Copyright (C) 2004, 2005 Red Hat, Inc. - Written by Ulrich Drepper <[email protected]>, 2004. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <assert.h> -#include <elf.h> -#include <stddef.h> -#include <string.h> - -#define BACKEND ppc_ -#include "libebl_CPU.h" - - -/* Check for the simple reloc types. */ -Elf_Type -ppc_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type) -{ - switch (type) - { - case R_PPC_ADDR32: - case R_PPC_UADDR32: - return ELF_T_WORD; - case R_PPC_UADDR16: - return ELF_T_HALF; - default: - return ELF_T_NUM; - } -} - - -const char * -ppc_dynamic_tag_name (int64_t tag, char *buf __attribute__ ((unused)), - size_t len __attribute__ ((unused))) -{ - switch (tag) - { - case DT_PPC_GOT: - return "PPC_GOT"; - default: - break; - } - return NULL; -} - - -bool -ppc_dynamic_tag_check (int64_t tag) -{ - return tag == DT_PPC_GOT; -} - - -/* Look for DT_PPC_GOT. */ -static bool -find_dyn_got (Elf *elf, GElf_Ehdr *ehdr, GElf_Addr *addr) -{ - for (int i = 0; i < ehdr->e_phnum; ++i) - { - GElf_Phdr phdr_mem; - GElf_Phdr *phdr = gelf_getphdr (elf, i, &phdr_mem); - if (phdr == NULL || phdr->p_type != PT_DYNAMIC) - continue; - - Elf_Scn *scn = gelf_offscn (elf, phdr->p_offset); - GElf_Shdr shdr_mem; - GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); - Elf_Data *data = elf_getdata (scn, NULL); - if (shdr != NULL && shdr->sh_type == SHT_DYNAMIC && data != NULL) - for (unsigned int j = 0; j < shdr->sh_size / shdr->sh_entsize; ++j) - { - GElf_Dyn dyn_mem; - GElf_Dyn *dyn = gelf_getdyn (data, j, &dyn_mem); - if (dyn != NULL && dyn->d_tag == DT_PPC_GOT) - { - *addr = dyn->d_un.d_ptr; - return true; - } - } - - /* There is only one PT_DYNAMIC entry. */ - break; - } - - return false; -} - - -/* Check whether given symbol's st_value and st_size are OK despite failing - normal checks. */ -bool -ppc_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, const GElf_Sym *sym, - const char *name, const GElf_Shdr *destshdr) -{ - if (name == NULL) - return false; - - if (strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0) - { - GElf_Addr gotaddr; - if (find_dyn_got (elf, ehdr, &gotaddr)) - return sym->st_value == gotaddr; - return sym->st_value == destshdr->sh_addr + 4; - } - - const char *sname = elf_strptr (elf, ehdr->e_shstrndx, destshdr->sh_name); - if (sname == NULL) - return false; - - if (strcmp (name, "_SDA_BASE_") == 0) - return (strcmp (sname, ".sdata") == 0 - && sym->st_value == destshdr->sh_addr + 0x8000 - && sym->st_size == 0); - - if (strcmp (name, "_SDA2_BASE_") == 0) - return (strcmp (sname, ".sdata2") == 0 - && sym->st_value == destshdr->sh_addr + 0x8000 - && sym->st_size == 0); - - return false; -} - - -/* Check if backend uses a bss PLT in this file. */ -bool -ppc_bss_plt_p (Elf *elf, GElf_Ehdr *ehdr) -{ - GElf_Addr addr; - return ! find_dyn_got (elf, ehdr, &addr); -} diff --git a/libebl/s390_init.c b/libebl/s390_init.c deleted file mode 100644 index 14578660..00000000 --- a/libebl/s390_init.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Initialization of S/390 specific backend library. - Copyright (C) 2005 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#define BACKEND s390_ -#define RELOC_PREFIX R_390_ -#include "libebl_CPU.h" - -/* This defines the common reloc hooks based on arm_reloc.def. */ -#include "common-reloc.c" - - -const char * -s390_init (elf, machine, eh, ehlen) - Elf *elf __attribute__ ((unused)); - GElf_Half machine __attribute__ ((unused)); - Ebl *eh; - size_t ehlen; -{ - /* Check whether the Elf_BH object has a sufficent size. */ - if (ehlen < sizeof (Ebl)) - return NULL; - - /* We handle it. */ - eh->name = "IBM S/390"; - s390_init_reloc (eh); - eh->reloc_simple_type = s390_reloc_simple_type; - - return MODVERSION; -} diff --git a/libebl/s390_reloc.def b/libebl/s390_reloc.def deleted file mode 100644 index bee67b33..00000000 --- a/libebl/s390_reloc.def +++ /dev/null @@ -1,76 +0,0 @@ -/* List the relocation types for s390. -*- C -*- - Copyright (C) 2005 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -/* NAME, REL|EXEC|DYN */ - -RELOC_TYPE (NONE, 0) -RELOC_TYPE (8, 0) -RELOC_TYPE (12, 0) -RELOC_TYPE (16, 0) -RELOC_TYPE (32, 0) -RELOC_TYPE (PC32, 0) -RELOC_TYPE (GOT12, 0) -RELOC_TYPE (GOT32, 0) -RELOC_TYPE (PLT32, 0) -RELOC_TYPE (COPY, EXEC) -RELOC_TYPE (GLOB_DAT, EXEC|DYN) -RELOC_TYPE (JMP_SLOT, EXEC|DYN) -RELOC_TYPE (RELATIVE, EXEC|DYN) -RELOC_TYPE (GOTOFF32, 0) -RELOC_TYPE (GOTPC, 0) -RELOC_TYPE (GOT16, 0) -RELOC_TYPE (PC16, 0) -RELOC_TYPE (PC16DBL, 0) -RELOC_TYPE (PLT16DBL, 0) -RELOC_TYPE (PC32DBL, 0) -RELOC_TYPE (PLT32DBL, 0) -RELOC_TYPE (GOTPCDBL, 0) -RELOC_TYPE (64, 0) -RELOC_TYPE (PC64, 0) -RELOC_TYPE (GOT64, 0) -RELOC_TYPE (PLT64, 0) -RELOC_TYPE (GOTENT, 0) -RELOC_TYPE (GOTOFF16, 0) -RELOC_TYPE (GOTOFF64, 0) -RELOC_TYPE (GOTPLT12, 0) -RELOC_TYPE (GOTPLT16, 0) -RELOC_TYPE (GOTPLT32, 0) -RELOC_TYPE (GOTPLT64, 0) -RELOC_TYPE (GOTPLTENT, 0) -RELOC_TYPE (PLTOFF16, 0) -RELOC_TYPE (PLTOFF32, 0) -RELOC_TYPE (PLTOFF64, 0) -RELOC_TYPE (TLS_LOAD, 0) -RELOC_TYPE (TLS_GDCALL, 0) -RELOC_TYPE (TLS_LDCALL, 0) -RELOC_TYPE (TLS_GD32, 0) -RELOC_TYPE (TLS_GD64, 0) -RELOC_TYPE (TLS_GOTIE12, 0) -RELOC_TYPE (TLS_GOTIE32, 0) -RELOC_TYPE (TLS_GOTIE64, 0) -RELOC_TYPE (TLS_LDM32, 0) -RELOC_TYPE (TLS_LDM64, 0) -RELOC_TYPE (TLS_IE32, 0) -RELOC_TYPE (TLS_IE64, 0) -RELOC_TYPE (TLS_IEENT, 0) -RELOC_TYPE (TLS_LE32, 0) -RELOC_TYPE (TLS_LE64, 0) -RELOC_TYPE (TLS_LDO32, 0) -RELOC_TYPE (TLS_LDO64, 0) -RELOC_TYPE (TLS_DTPMOD, 0) -RELOC_TYPE (TLS_DTPOFF, 0) -RELOC_TYPE (TLS_TPOFF, 0) -RELOC_TYPE (20, 0) -RELOC_TYPE (GOT20, 0) -RELOC_TYPE (GOTPLT20, 0) -RELOC_TYPE (TLS_GOTIE20, 0) diff --git a/libebl/sh_init.c b/libebl/sh_init.c deleted file mode 100644 index 4fadd9b4..00000000 --- a/libebl/sh_init.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Initialization of SH specific backend library. - Copyright (C) 2000, 2001, 2002, 2005 Red Hat, Inc. - Written by Ulrich Drepper <[email protected]>, 2000. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#define BACKEND sh_ -#define RELOC_PREFIX R_SH_ -#include "libebl_CPU.h" - -/* This defines the common reloc hooks based on sh_reloc.def. */ -#include "common-reloc.c" - - -const char * -sh_init (elf, machine, eh, ehlen) - Elf *elf __attribute__ ((unused)); - GElf_Half machine __attribute__ ((unused)); - Ebl *eh; - size_t ehlen; -{ - /* Check whether the Elf_BH object has a sufficent size. */ - if (ehlen < sizeof (Ebl)) - return NULL; - - /* We handle it. */ - eh->name = "Hitachi SH"; - sh_init_reloc (eh); - eh->reloc_simple_type = sh_reloc_simple_type; - - return MODVERSION; -} diff --git a/libebl/sh_reloc.def b/libebl/sh_reloc.def deleted file mode 100644 index 56db1071..00000000 --- a/libebl/sh_reloc.def +++ /dev/null @@ -1,52 +0,0 @@ -/* List the relocation types for SH. -*- C -*- - Copyright (C) 2005 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -/* NAME, REL|EXEC|DYN */ - -RELOC_TYPE (NONE, 0) -RELOC_TYPE (DIR32, REL|DYN) -RELOC_TYPE (REL32, REL|DYN) -RELOC_TYPE (DIR8WPN, REL) -RELOC_TYPE (IND12W, REL) -RELOC_TYPE (DIR8WPL, REL) -RELOC_TYPE (DIR8WPZ, REL) -RELOC_TYPE (DIR8BP, REL) -RELOC_TYPE (DIR8W, REL) -RELOC_TYPE (DIR8L, REL) -RELOC_TYPE (SWITCH16, REL) -RELOC_TYPE (SWITCH32, REL) -RELOC_TYPE (USES, REL) -RELOC_TYPE (COUNT, REL) -RELOC_TYPE (ALIGN, REL) -RELOC_TYPE (CODE, REL) -RELOC_TYPE (DATA, REL) -RELOC_TYPE (LABEL, REL) -RELOC_TYPE (SWITCH8, REL) -RELOC_TYPE (GNU_VTINHERIT, REL) -RELOC_TYPE (GNU_VTENTRY, REL) -RELOC_TYPE (TLS_GD_32, REL) -RELOC_TYPE (TLS_LD_32, REL) -RELOC_TYPE (TLS_LDO_32, REL) -RELOC_TYPE (TLS_IE_32, REL) -RELOC_TYPE (TLS_LE_32, REL) -RELOC_TYPE (TLS_DTPMOD32, DYN) -RELOC_TYPE (TLS_DTPOFF32, DYN) -RELOC_TYPE (TLS_TPOFF32, DYN) -RELOC_TYPE (GOT32, REL) -RELOC_TYPE (PLT32, REL) -RELOC_TYPE (COPY, EXEC) -RELOC_TYPE (GLOB_DAT, EXEC|DYN) -RELOC_TYPE (JMP_SLOT, EXEC|DYN) -RELOC_TYPE (RELATIVE, EXEC|DYN) -RELOC_TYPE (GOTOFF, REL) -RELOC_TYPE (GOTPC, REL) diff --git a/libebl/sh_symbol.c b/libebl/sh_symbol.c deleted file mode 100644 index 3209d34e..00000000 --- a/libebl/sh_symbol.c +++ /dev/null @@ -1,44 +0,0 @@ -/* SH specific relocation handling. - Copyright (C) 2000, 2001, 2002, 2005 Red Hat, Inc. - Written by Ulrich Drepper <[email protected]>, 2000. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <elf.h> -#include <stddef.h> - -#define BACKEND sh_ -#include "libebl_CPU.h" - - -/* Return true if the symbol type is that referencing the GOT. */ -bool -sh_gotpc_reloc_check (Elf *elf __attribute__ ((unused)), int type) -{ - return type == R_SH_GOTPC; -} - -/* Check for the simple reloc types. */ -Elf_Type -sh_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type) -{ - switch (type) - { - case R_SH_DIR32: - return ELF_T_WORD; - default: - return ELF_T_NUM; - } -} diff --git a/libebl/sparc_init.c b/libebl/sparc_init.c deleted file mode 100644 index 541df842..00000000 --- a/libebl/sparc_init.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Initialization of SPARC specific backend library. - Copyright (C) 2002, 2005 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#define BACKEND sparc_ -#define RELOC_PREFIX R_SPARC_ -#include "libebl_CPU.h" - -/* This defines the common reloc hooks based on sparc_reloc.def. */ -#include "common-reloc.c" - - -const char * -sparc_init (elf, machine, eh, ehlen) - Elf *elf __attribute__ ((unused)); - GElf_Half machine __attribute__ ((unused)); - Ebl *eh; - size_t ehlen; -{ - /* Check whether the Elf_BH object has a sufficent size. */ - if (ehlen < sizeof (Ebl)) - return NULL; - - /* We handle it. */ - if (machine == EM_SPARCV9) - eh->name = "SPARC v9"; - else if (machine == EM_SPARC32PLUS) - eh->name = "SPARC v8+"; - else - eh->name = "SPARC"; - sparc_init_reloc (eh); - eh->reloc_simple_type = sparc_reloc_simple_type; - //eh->core_note = sparc_core_note; - - return MODVERSION; -} diff --git a/libebl/sparc_reloc.def b/libebl/sparc_reloc.def deleted file mode 100644 index 91fcad74..00000000 --- a/libebl/sparc_reloc.def +++ /dev/null @@ -1,94 +0,0 @@ -/* List the relocation types for sparc. -*- C -*- - Copyright (C) 2005 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -/* NAME, REL|EXEC|DYN */ - -RELOC_TYPE (NONE, 0) -RELOC_TYPE (8, 0) -RELOC_TYPE (16, 0) -RELOC_TYPE (32, 0) -RELOC_TYPE (DISP8, 0) -RELOC_TYPE (DISP16, 0) -RELOC_TYPE (DISP32, 0) -RELOC_TYPE (WDISP30, 0) -RELOC_TYPE (WDISP22, 0) -RELOC_TYPE (HI22, 0) -RELOC_TYPE (22, 0) -RELOC_TYPE (13, 0) -RELOC_TYPE (LO10, 0) -RELOC_TYPE (GOT10, 0) -RELOC_TYPE (GOT13, 0) -RELOC_TYPE (GOT22, 0) -RELOC_TYPE (PC10, 0) -RELOC_TYPE (PC22, 0) -RELOC_TYPE (WPLT30, 0) -RELOC_TYPE (COPY, EXEC) -RELOC_TYPE (GLOB_DAT, EXEC|DYN) -RELOC_TYPE (JMP_SLOT, EXEC|DYN) -RELOC_TYPE (RELATIVE, EXEC|DYN) -RELOC_TYPE (UA32, 0) -RELOC_TYPE (PLT32, 0) -RELOC_TYPE (HIPLT22, 0) -RELOC_TYPE (LOPLT10, 0) -RELOC_TYPE (PCPLT32, 0) -RELOC_TYPE (PCPLT22, 0) -RELOC_TYPE (PCPLT10, 0) -RELOC_TYPE (10, 0) -RELOC_TYPE (11, 0) -RELOC_TYPE (64, 0) -RELOC_TYPE (OLO10, 0) -RELOC_TYPE (HH22, 0) -RELOC_TYPE (HM10, 0) -RELOC_TYPE (LM22, 0) -RELOC_TYPE (PC_HH22, 0) -RELOC_TYPE (PC_HM10, 0) -RELOC_TYPE (PC_LM22, 0) -RELOC_TYPE (WDISP16, 0) -RELOC_TYPE (WDISP19, 0) -RELOC_TYPE (7, 0) -RELOC_TYPE (5, 0) -RELOC_TYPE (6, 0) -RELOC_TYPE (DISP64, 0) -RELOC_TYPE (PLT64, 0) -RELOC_TYPE (HIX22, 0) -RELOC_TYPE (LOX10, 0) -RELOC_TYPE (H44, 0) -RELOC_TYPE (M44, 0) -RELOC_TYPE (L44, 0) -RELOC_TYPE (REGISTER, 0) -RELOC_TYPE (UA64, 0) -RELOC_TYPE (UA16, 0) -RELOC_TYPE (TLS_GD_HI22, 0) -RELOC_TYPE (TLS_GD_LO10, 0) -RELOC_TYPE (TLS_GD_ADD, 0) -RELOC_TYPE (TLS_GD_CALL, 0) -RELOC_TYPE (TLS_LDM_HI22, 0) -RELOC_TYPE (TLS_LDM_LO10, 0) -RELOC_TYPE (TLS_LDM_ADD, 0) -RELOC_TYPE (TLS_LDM_CALL, 0) -RELOC_TYPE (TLS_LDO_HIX22, 0) -RELOC_TYPE (TLS_LDO_LOX10, 0) -RELOC_TYPE (TLS_LDO_ADD, 0) -RELOC_TYPE (TLS_IE_HI22, 0) -RELOC_TYPE (TLS_IE_LO10, 0) -RELOC_TYPE (TLS_IE_LD, 0) -RELOC_TYPE (TLS_IE_LDX, 0) -RELOC_TYPE (TLS_IE_ADD, 0) -RELOC_TYPE (TLS_LE_HIX22, 0) -RELOC_TYPE (TLS_LE_LOX10, 0) -RELOC_TYPE (TLS_DTPMOD32, 0) -RELOC_TYPE (TLS_DTPMOD64, 0) -RELOC_TYPE (TLS_DTPOFF32, 0) -RELOC_TYPE (TLS_DTPOFF64, 0) -RELOC_TYPE (TLS_TPOFF32, 0) -RELOC_TYPE (TLS_TPOFF64, 0) diff --git a/libebl/sparc_symbol.c b/libebl/sparc_symbol.c deleted file mode 100644 index c83e5d3a..00000000 --- a/libebl/sparc_symbol.c +++ /dev/null @@ -1,45 +0,0 @@ -/* SPARC specific symbolic name handling. - Copyright (C) 2002, 2003, 2005 Red Hat, Inc. - Written by Jakub Jelinek <[email protected]>, 2002. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <elf.h> -#include <stddef.h> - -#define BACKEND sparc_ -#include "libebl_CPU.h" - -/* Check for the simple reloc types. */ -Elf_Type -sparc_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type) -{ - switch (type) - { - case R_SPARC_8: - return ELF_T_BYTE; - case R_SPARC_16: - case R_SPARC_UA16: - return ELF_T_HALF; - case R_SPARC_32: - case R_SPARC_UA32: - return ELF_T_WORD; - case R_SPARC_64: - case R_SPARC_UA64: - return ELF_T_XWORD; - default: - return ELF_T_NUM; - } -} diff --git a/libebl/x86_64_corenote.c b/libebl/x86_64_corenote.c deleted file mode 100644 index 2fd775b6..00000000 --- a/libebl/x86_64_corenote.c +++ /dev/null @@ -1,172 +0,0 @@ -/* x86-64 specific core note handling. - Copyright (C) 2005 Red Hat, Inc. - Written by Ulrich Drepper <[email protected]>, 2005. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <elf.h> -#include <inttypes.h> -#include <stddef.h> -#include <stdio.h> -#include <sys/time.h> - -#define BACKEND x86_64_ -#include "libebl_CPU.h" - - -/* We cannot include <sys/procfs.h> since the definition would be for - the host platform and not always x86-64 as required here. */ -struct elf_prstatus - { - struct - { - int32_t si_signo; /* Signal number. */ - int32_t si_code; /* Extra code. */ - int32_t si_errno; /* Errno. */ - } pr_info; /* Info associated with signal. */ - int16_t pr_cursig; /* Current signal. */ - uint64_t pr_sigpend; /* Set of pending signals. */ - uint64_t pr_sighold; /* Set of held signals. */ - int32_t pr_pid; - int32_t pr_ppid; - int32_t pr_pgrp; - int32_t pr_sid; - struct x86_64_timeval - { - int64_t tv_sec; - int32_t tv_usec; - } pr_utime; /* User time. */ - struct x86_64_timeval pr_stime; /* System time. */ - struct x86_64_timeval pr_cutime; /* Cumulative user time. */ - struct x86_64_timeval pr_cstime; /* Cumulative system time. */ - uint64_t pr_reg[27]; /* GP registers. */ - int32_t 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. */ - uint64_t pr_flag; /* Flags. */ - uint32_t pr_uid; - uint32_t pr_gid; - int32_t pr_pid; - int32_t pr_ppid; - int32_t pr_pgrp; - int32_t pr_sid; - /* Lots missing */ - char pr_fname[16]; /* Filename of executable. */ - char pr_psargs[80]; /* Initial part of arg list. */ - }; - - -bool -x86_64_core_note (name, type, descsz, desc) - const char *name __attribute__ ((unused)); - 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: %" PRId32 ", code = %" PRId32 - ", errno = %" PRId32 "\n" - " signal: %" PRId16 ", pending: %#08" PRIx64 ", holding: %#08" - PRIx64 "\n" - " pid: %" PRId32 ", ppid = %" PRId32 ", pgrp = %" PRId32 - ", sid = %" PRId32 "\n" - " utime: %6" PRId64 ".%06" PRId32 - "s, stime: %6" PRId64 ".%06" PRId32 "s\n" - " cutime: %6" PRId64 ".%06" PRId32 - "s, cstime: %6" PRId64 ".%06" PRId32 "s\n" - " rax: %016" PRIx64 " rbx: %016" PRIx64 "\n" - " rcx: %016" PRIx64 " rdx: %016" PRIx64 "\n" - " rsi: %016" PRIx64 " rdi: %016" PRIx64 "\n" - " rbp: %016" PRIx64 " rsp: %016" PRIx64 "\n" - " r8: %016" PRIx64 " r9: %016" PRIx64 "\n" - " r10: %016" PRIx64 " r11: %016" PRIx64 "\n" - " r12: %016" PRIx64 " r13: %016" PRIx64 "\n" - " r14: %016" PRIx64 " r15: %016" PRIx64 "\n" - " rip: %016" PRIx64 " eflags: %08" PRIx64 "\n" - " original rax: %016" PRIx64 "\n" - " cs: %04" PRIx64 " ds: %04" PRIx64 " es: %04" PRIx64 - " ss: %04" PRIx64 "\n" - " fs: %04" PRIx64 " fs_base: %016" PRIx64 - " gs: %04" PRIx64 " gs_base: %016" PRIx64 "\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[10], stat->pr_reg[5], stat->pr_reg[11], - stat->pr_reg[12], stat->pr_reg[13], stat->pr_reg[14], - stat->pr_reg[4], stat->pr_reg[10], stat->pr_reg[9], - stat->pr_reg[7], stat->pr_reg[6], stat->pr_reg[5], - stat->pr_reg[3], stat->pr_reg[2], stat->pr_reg[1], - stat->pr_reg[0], stat->pr_reg[16], stat->pr_reg[18], - stat->pr_reg[15], stat->pr_reg[17], stat->pr_reg[23], - stat->pr_reg[24], stat->pr_reg[20], - stat->pr_reg[25], stat->pr_reg[21], - stat->pr_reg[26], stat->pr_reg[22]); - - /* 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: %08" PRIx64 " uid: %" PRIu32 " gid: %" PRIu32 "\n" - " pid: %" PRId32 " ppid: %" PRId32 " pgrp: %" PRId32 - " sid: %" PRId32 "\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/libebl/x86_64_init.c b/libebl/x86_64_init.c deleted file mode 100644 index e4799725..00000000 --- a/libebl/x86_64_init.c +++ /dev/null @@ -1,46 +0,0 @@ -/* Initialization of x86-64 specific backend library. - Copyright (C) 2002, 2005 Red Hat, Inc. - Written by Ulrich Drepper <[email protected]>, 2002. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#define BACKEND x86_64_ -#define RELOC_PREFIX R_X86_64_ -#include "libebl_CPU.h" - -/* This defines the common reloc hooks based on x86_64_reloc.def. */ -#include "common-reloc.c" - - - -const char * -x86_64_init (elf, machine, eh, ehlen) - Elf *elf __attribute__ ((unused)); - GElf_Half machine __attribute__ ((unused)); - Ebl *eh; - size_t ehlen; -{ - /* Check whether the Elf_BH object has a sufficent size. */ - if (ehlen < sizeof (Ebl)) - return NULL; - - /* We handle it. */ - eh->name = "AMD x86-64"; - x86_64_init_reloc (eh); - eh->reloc_simple_type = x86_64_reloc_simple_type; - eh->core_note = x86_64_core_note; - - return MODVERSION; -} diff --git a/libebl/x86_64_reloc.def b/libebl/x86_64_reloc.def deleted file mode 100644 index 83a18280..00000000 --- a/libebl/x86_64_reloc.def +++ /dev/null @@ -1,39 +0,0 @@ -/* List the relocation types for x86-64. -*- C -*- - Copyright (C) 2000, 2001, 2002, 2003, 2005 Red Hat, Inc. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -/* NAME, REL|EXEC|DYN */ - -RELOC_TYPE (NONE, 0) -RELOC_TYPE (64, REL|EXEC|DYN) -RELOC_TYPE (PC32, REL|EXEC|DYN) -RELOC_TYPE (GOT32, REL) -RELOC_TYPE (PLT32, REL) -RELOC_TYPE (COPY, EXEC) -RELOC_TYPE (GLOB_DAT, EXEC|DYN) -RELOC_TYPE (JUMP_SLOT, EXEC|DYN) -RELOC_TYPE (RELATIVE, EXEC|DYN) -RELOC_TYPE (GOTPCREL, REL) -RELOC_TYPE (32, REL|EXEC|DYN) -RELOC_TYPE (32S, REL) -RELOC_TYPE (16, REL) -RELOC_TYPE (PC16, REL) -RELOC_TYPE (8, REL) -RELOC_TYPE (PC8, REL) -RELOC_TYPE (DTPMOD64, EXEC|DYN) -RELOC_TYPE (DTPOFF64, EXEC|DYN) -RELOC_TYPE (TPOFF64, EXEC|DYN) -RELOC_TYPE (TLSGD, REL) -RELOC_TYPE (TLSLD, REL) -RELOC_TYPE (DTPOFF32, REL) -RELOC_TYPE (GOTTPOFF, REL) -RELOC_TYPE (TPOFF32, REL) diff --git a/libebl/x86_64_symbol.c b/libebl/x86_64_symbol.c deleted file mode 100644 index c48af103..00000000 --- a/libebl/x86_64_symbol.c +++ /dev/null @@ -1,45 +0,0 @@ -/* x86_64 specific symbolic name handling. - Copyright (C) 2002, 2005 Red Hat, Inc. - Written by Ulrich Drepper <[email protected]>, 2002. - - This program is Open Source software; you can redistribute it and/or - modify it under the terms of the Open Software License version 1.0 as - published by the Open Source Initiative. - - You should have received a copy of the Open Software License along - with this program; if not, you may obtain a copy of the Open Software - License version 1.0 from http://www.opensource.org/licenses/osl.php or - by writing the Open Source Initiative c/o Lawrence Rosen, Esq., - 3001 King Ranch Road, Ukiah, CA 95482. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <assert.h> -#include <elf.h> -#include <stddef.h> - -#define BACKEND x86_64_ -#include "libebl_CPU.h" - -/* Check for the simple reloc types. */ -Elf_Type -x86_64_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type) -{ - switch (type) - { - case R_X86_64_64: - return ELF_T_XWORD; - case R_X86_64_32: - return ELF_T_WORD; - case R_X86_64_32S: - return ELF_T_SWORD; - case R_X86_64_16: - return ELF_T_HALF; - case R_X86_64_8: - return ELF_T_BYTE; - default: - return ELF_T_NUM; - } -} |
