diff options
| author | Jeff Kenton <[email protected]> | 2012-08-22 09:00:03 -0400 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2012-08-24 15:33:55 +0200 |
| commit | 257dcf47ed0cf57bcd2ad225cc7aaa6a8dfeb2ab (patch) | |
| tree | 58e59d3f75f4477c87dab4fe0db6446af89da07f /backends | |
| parent | f5519fc244d95dc04b3e3de88644d149a36a76b6 (diff) | |
Add support for Tilera TILE-Gx processor.
Signed-off-by: Jeff Kenton <[email protected]>
Diffstat (limited to 'backends')
| -rw-r--r-- | backends/ChangeLog | 14 | ||||
| -rw-r--r-- | backends/Makefile.am | 10 | ||||
| -rw-r--r-- | backends/tilegx_corenote.c | 64 | ||||
| -rw-r--r-- | backends/tilegx_init.c | 60 | ||||
| -rw-r--r-- | backends/tilegx_regs.c | 129 | ||||
| -rw-r--r-- | backends/tilegx_reloc.def | 120 | ||||
| -rw-r--r-- | backends/tilegx_retval.c | 165 | ||||
| -rw-r--r-- | backends/tilegx_symbol.c | 57 |
8 files changed, 617 insertions, 2 deletions
diff --git a/backends/ChangeLog b/backends/ChangeLog index 744d1d55..0d51e739 100644 --- a/backends/ChangeLog +++ b/backends/ChangeLog @@ -1,3 +1,17 @@ +2012-08-22 Jeff Kenton <[email protected]> + + * Makefile.am (modules): Add tilegx. + (libebl_pic): Add libebl_tilegx_pic.a. + (tilegx_SRCS): New variable. + (libebl_tilegx_pic_a_SOURCES): Likewise. + (am_libebl_tilegx_pic_a_OBJECTS): Likewise. + * tilegx_corenote.c: New file. + * tilegx_regs.c: New file. + * tilegx_reloc.def: New file. + * tilegx_init.c: New file. + * tilegx_retval.c: New file. + * tilegx_symbol.c: New file. + 2011-03-09 Mark Wielaard <[email protected]> * alpha_init.c (alpha_init): Initialize check_st_other_bits hook. diff --git a/backends/Makefile.am b/backends/Makefile.am index 3b34e880..982ff2a7 100644 --- a/backends/Makefile.am +++ b/backends/Makefile.am @@ -1,6 +1,7 @@ ## Process this file with automake to create Makefile.in ## ## Copyright (C) 2000-2010 Red Hat, Inc. +## Copyright (C) 2012 Tilera Corporation ## This file is part of elfutils. ## ## This file is free software; you can redistribute it and/or modify @@ -31,11 +32,11 @@ INCLUDES += -I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \ -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw -modules = i386 sh x86_64 ia64 alpha arm sparc ppc ppc64 s390 +modules = i386 sh x86_64 ia64 alpha arm sparc ppc ppc64 s390 tilegx 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 + libebl_s390_pic.a libebl_tilegx_pic.a noinst_LIBRARIES = $(libebl_pic) noinst_DATA = $(libebl_pic:_pic.a=.so) @@ -97,6 +98,11 @@ s390_SRCS = s390_init.c s390_symbol.c s390_regs.c s390_retval.c libebl_s390_pic_a_SOURCES = $(s390_SRCS) am_libebl_s390_pic_a_OBJECTS = $(s390_SRCS:.c=.os) +tilegx_SRCS = tilegx_init.c tilegx_symbol.c tilegx_regs.c \ + tilegx_retval.c tilegx_corenote.c +libebl_tilegx_pic_a_SOURCES = $(tilegx_SRCS) +am_libebl_tilegx_pic_a_OBJECTS = $(tilegx_SRCS:.c=.os) + libebl_%.so libebl_%.map: libebl_%_pic.a $(libelf) $(libdw) @rm -f $(@:.so=.map) diff --git a/backends/tilegx_corenote.c b/backends/tilegx_corenote.c new file mode 100644 index 00000000..be3e7dbf --- /dev/null +++ b/backends/tilegx_corenote.c @@ -0,0 +1,64 @@ +/* TILE-Gx specific core note handling. + Copyright (C) 2012 Tilera Corporation + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils 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 copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + + +#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 tilegx_ +#include "libebl_CPU.h" + +static const Ebl_Register_Location prstatus_regs[] = + { + { .offset = 0, .regno = 0, .count = 56, .bits = 64 }, /* r0-r55 */ + { .offset = 56 * 8, .regno = 64, .count = 1, .bits = 64 } /* pc */ + }; +#define PRSTATUS_REGS_SIZE (57 * 8) + +#define ULONG uint64_t +#define ALIGN_ULONG 8 +#define TYPE_ULONG ELF_T_XWORD +#define TYPE_LONG ELF_T_SXWORD +#define PID_T int32_t +#define UID_T uint32_t +#define GID_T uint32_t +#define ALIGN_PID_T 4 +#define ALIGN_UID_T 4 +#define ALIGN_GID_T 4 +#define TYPE_PID_T ELF_T_SWORD +#define TYPE_UID_T ELF_T_WORD +#define TYPE_GID_T ELF_T_WORD + +#include "linux-core-note.c" diff --git a/backends/tilegx_init.c b/backends/tilegx_init.c new file mode 100644 index 00000000..858798bf --- /dev/null +++ b/backends/tilegx_init.c @@ -0,0 +1,60 @@ +/* Initialization of TILE-Gx specific backend library. + Copyright (C) 2012 Tilera Corporation + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils 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 copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#define BACKEND tilegx_ +#define RELOC_PREFIX R_TILEGX_ +#include "libebl_CPU.h" + +/* This defines the common reloc hooks based on tilegx_reloc.def. */ +#include "common-reloc.c" + +const char * +tilegx_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 = "TILE-Gx"; + tilegx_init_reloc (eh); + HOOK (eh, reloc_simple_type); + HOOK (eh, return_value_location); + HOOK (eh, register_info); + HOOK (eh, core_note); + + return MODVERSION; +} diff --git a/backends/tilegx_regs.c b/backends/tilegx_regs.c new file mode 100644 index 00000000..b1e17439 --- /dev/null +++ b/backends/tilegx_regs.c @@ -0,0 +1,129 @@ +/* Register names and numbers for TILE-Gx DWARF. + Copyright (C) 2012 Tilera Corporation + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils 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 copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdio.h> +#include <string.h> +#include <dwarf.h> + +#define BACKEND tilegx_ +#include "libebl_CPU.h" + +ssize_t +tilegx_register_info (Ebl *ebl __attribute__ ((unused)), + int regno, char *name, size_t namelen, + const char **prefix, const char **setname, + int *bits, int *type) +{ + if (name == NULL) + return 65; + + if (regno < 0 || regno > 64 || namelen < 5) + return -1; + + *prefix = ""; + *setname = "integer"; + *bits = 64; + + switch (regno) + { + case 0 ... 9: + *type = DW_ATE_signed; + name[0] = 'r'; + name[1] = regno + '0'; + namelen = 2; + break; + + case 10 ... 52: + *type = DW_ATE_signed; + name[0] = 'r'; + name[1] = regno / 10 + '0'; + name[2] = regno % 10 + '0'; + namelen = 3; + break; + + case 53: + *type = DW_ATE_address; + return stpcpy (name, "tp") + 1 - name; + + case 54: + *type = DW_ATE_address; + return stpcpy (name, "sp") + 1 - name; + + case 55: + *type = DW_ATE_address; + return stpcpy (name, "lr") + 1 - name; + + case 56: + *type = DW_ATE_unsigned; + return stpcpy (name, "sn") + 1 - name; + + case 57: + *type = DW_ATE_unsigned; + return stpcpy (name, "idn0") + 1 - name; + + case 58: + *type = DW_ATE_unsigned; + return stpcpy (name, "idn1") + 1 - name; + + case 59: + *type = DW_ATE_unsigned; + return stpcpy (name, "udn0") + 1 - name; + + case 60: + *type = DW_ATE_unsigned; + return stpcpy (name, "udn1") + 1 - name; + + case 61: + *type = DW_ATE_unsigned; + return stpcpy (name, "udn2") + 1 - name; + + case 62: + *type = DW_ATE_unsigned; + return stpcpy (name, "udn3") + 1 - name; + + case 63: + *type = DW_ATE_unsigned; + return stpcpy (name, "zero") + 1 - name; + + case 64: + *type = DW_ATE_address; + return stpcpy (name, "pc") + 1 - name; + + /* Can't happen. */ + default: + *setname = NULL; + return 0; + } + + name[namelen++] = '\0'; + return namelen; +} diff --git a/backends/tilegx_reloc.def b/backends/tilegx_reloc.def new file mode 100644 index 00000000..9736286e --- /dev/null +++ b/backends/tilegx_reloc.def @@ -0,0 +1,120 @@ +/* List the relocation types for tilegx. -*- C -*- + Copyright (C) 2012 Tilera Corporation + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils 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 copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + +/* NAME, REL|EXEC|DYN */ + +RELOC_TYPE (NONE, 0) +RELOC_TYPE (64, REL|EXEC|DYN) +RELOC_TYPE (32, REL|EXEC|DYN) +RELOC_TYPE (16, REL|EXEC|DYN) +RELOC_TYPE (8, REL|EXEC|DYN) +RELOC_TYPE (64_PCREL, REL) +RELOC_TYPE (32_PCREL, REL) +RELOC_TYPE (16_PCREL, REL) +RELOC_TYPE (8_PCREL, REL) +RELOC_TYPE (HW0, REL) +RELOC_TYPE (HW1, REL) +RELOC_TYPE (HW2, REL) +RELOC_TYPE (HW3, REL) +RELOC_TYPE (HW0_LAST, REL) +RELOC_TYPE (HW1_LAST, REL) +RELOC_TYPE (HW2_LAST, REL) +RELOC_TYPE (COPY, EXEC) +RELOC_TYPE (GLOB_DAT, EXEC|DYN) +RELOC_TYPE (JMP_SLOT, EXEC|DYN) +RELOC_TYPE (RELATIVE, EXEC|DYN) +RELOC_TYPE (BROFF_X1, REL) +RELOC_TYPE (JUMPOFF_X1, REL) +RELOC_TYPE (JUMPOFF_X1_PLT, REL) +RELOC_TYPE (IMM8_X0, REL) +RELOC_TYPE (IMM8_Y0, REL) +RELOC_TYPE (IMM8_X1, REL) +RELOC_TYPE (IMM8_Y1, REL) +RELOC_TYPE (DEST_IMM8_X1, REL) +RELOC_TYPE (MT_IMM14_X1, REL) +RELOC_TYPE (MF_IMM14_X1, REL) +RELOC_TYPE (MMSTART_X0, REL) +RELOC_TYPE (MMEND_X0, REL) +RELOC_TYPE (SHAMT_X0, REL) +RELOC_TYPE (SHAMT_X1, REL) +RELOC_TYPE (SHAMT_Y0, REL) +RELOC_TYPE (SHAMT_Y1, REL) +RELOC_TYPE (IMM16_X0_HW0, REL) +RELOC_TYPE (IMM16_X1_HW0, REL) +RELOC_TYPE (IMM16_X0_HW1, REL) +RELOC_TYPE (IMM16_X1_HW1, REL) +RELOC_TYPE (IMM16_X0_HW2, REL) +RELOC_TYPE (IMM16_X1_HW2, REL) +RELOC_TYPE (IMM16_X0_HW3, REL) +RELOC_TYPE (IMM16_X1_HW3, REL) +RELOC_TYPE (IMM16_X0_HW0_LAST, REL) +RELOC_TYPE (IMM16_X1_HW0_LAST, REL) +RELOC_TYPE (IMM16_X0_HW1_LAST, REL) +RELOC_TYPE (IMM16_X1_HW1_LAST, REL) +RELOC_TYPE (IMM16_X0_HW2_LAST, REL) +RELOC_TYPE (IMM16_X1_HW2_LAST, REL) +RELOC_TYPE (IMM16_X0_HW0_PCREL, REL) +RELOC_TYPE (IMM16_X1_HW0_PCREL, REL) +RELOC_TYPE (IMM16_X0_HW1_PCREL, REL) +RELOC_TYPE (IMM16_X1_HW1_PCREL, REL) +RELOC_TYPE (IMM16_X0_HW2_PCREL, REL) +RELOC_TYPE (IMM16_X1_HW2_PCREL, REL) +RELOC_TYPE (IMM16_X0_HW3_PCREL, REL) +RELOC_TYPE (IMM16_X1_HW3_PCREL, REL) +RELOC_TYPE (IMM16_X0_HW0_LAST_PCREL, REL) +RELOC_TYPE (IMM16_X1_HW0_LAST_PCREL, REL) +RELOC_TYPE (IMM16_X0_HW1_LAST_PCREL, REL) +RELOC_TYPE (IMM16_X1_HW1_LAST_PCREL, REL) +RELOC_TYPE (IMM16_X0_HW2_LAST_PCREL, REL) +RELOC_TYPE (IMM16_X1_HW2_LAST_PCREL, REL) +RELOC_TYPE (IMM16_X0_HW0_GOT, REL) +RELOC_TYPE (IMM16_X1_HW0_GOT, REL) +RELOC_TYPE (IMM16_X0_HW0_LAST_GOT, REL) +RELOC_TYPE (IMM16_X1_HW0_LAST_GOT, REL) +RELOC_TYPE (IMM16_X0_HW1_LAST_GOT, REL) +RELOC_TYPE (IMM16_X1_HW1_LAST_GOT, REL) +RELOC_TYPE (IMM16_X0_HW0_TLS_GD, REL) +RELOC_TYPE (IMM16_X1_HW0_TLS_GD, REL) +RELOC_TYPE (IMM16_X0_HW0_LAST_TLS_GD, REL) +RELOC_TYPE (IMM16_X1_HW0_LAST_TLS_GD, REL) +RELOC_TYPE (IMM16_X0_HW1_LAST_TLS_GD, REL) +RELOC_TYPE (IMM16_X1_HW1_LAST_TLS_GD, REL) +RELOC_TYPE (IMM16_X0_HW0_TLS_IE, REL) +RELOC_TYPE (IMM16_X1_HW0_TLS_IE, REL) +RELOC_TYPE (IMM16_X0_HW0_LAST_TLS_IE, REL) +RELOC_TYPE (IMM16_X1_HW0_LAST_TLS_IE, REL) +RELOC_TYPE (IMM16_X0_HW1_LAST_TLS_IE, REL) +RELOC_TYPE (IMM16_X1_HW1_LAST_TLS_IE, REL) +RELOC_TYPE (TLS_DTPMOD64, EXEC|DYN) +RELOC_TYPE (TLS_DTPOFF64, EXEC|DYN) +RELOC_TYPE (TLS_TPOFF64, EXEC|DYN) +RELOC_TYPE (TLS_DTPMOD32, EXEC|DYN) +RELOC_TYPE (TLS_DTPOFF32, EXEC|DYN) +RELOC_TYPE (TLS_TPOFF32, EXEC|DYN) +RELOC_TYPE (GNU_VTINHERIT, REL) +RELOC_TYPE (GNU_VTENTRY, REL) diff --git a/backends/tilegx_retval.c b/backends/tilegx_retval.c new file mode 100644 index 00000000..fd4feef3 --- /dev/null +++ b/backends/tilegx_retval.c @@ -0,0 +1,165 @@ +/* Function return value location for Linux/TILE-Gx ABI. + Copyright (C) 2012 Tilera Corporation + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils 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 copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <assert.h> +#include <dwarf.h> + +#define BACKEND tilegx_ +#include "libebl_CPU.h" + + +/* r0. */ +static const Dwarf_Op loc_intreg[] = + { + { .atom = DW_OP_reg0 } + }; +#define nloc_intreg 1 + +/* The return value is a structure and is actually stored in stack space + passed in a hidden argument by the caller. But, the compiler + helpfully returns the address of that space in r0. */ +static const Dwarf_Op loc_aggregate[] = + { + { .atom = DW_OP_breg0, .number = 0 } + }; +#define nloc_aggregate 1 + +int +tilegx_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) +{ + /* Start with the function's type, and get the DW_AT_type attribute, + which is the type of the return value. */ + + Dwarf_Attribute attr_mem; + Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, + &attr_mem); + if (attr == NULL) + /* The function has no return value, like a `void' function in C. */ + return 0; + + Dwarf_Die die_mem; + Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem); + int tag = dwarf_tag (typedie); + + /* Follow typedefs and qualifiers to get to the actual type. */ + while (tag == DW_TAG_typedef + || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type + || tag == DW_TAG_restrict_type || tag == DW_TAG_mutable_type) + { + attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); + typedie = dwarf_formref_die (attr, &die_mem); + tag = dwarf_tag (typedie); + } + + Dwarf_Word size; + switch (tag) + { + case -1: + return -1; + + case DW_TAG_subrange_type: + if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size)) + { + attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); + typedie = dwarf_formref_die (attr, &die_mem); + tag = dwarf_tag (typedie); + } + /* Fall through. */ + + case DW_TAG_base_type: + case DW_TAG_enumeration_type: + case DW_TAG_pointer_type: + case DW_TAG_ptr_to_member_type: + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, + &attr_mem), &size) != 0) + { + if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) + size = 8; + else + return -1; + } + if (tag == DW_TAG_base_type) + { + Dwarf_Word encoding; + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding, + &attr_mem), + &encoding) != 0) + return -1; + } + + /* Small enough structs are passed directly in registers R0 ... R7. */ + if (size <= 8) + { + intreg: + *locp = loc_intreg; + return nloc_intreg; + } + + /* Else fall through. */ + case DW_TAG_structure_type: + case DW_TAG_class_type: + case DW_TAG_union_type: + aggregate: + *locp = loc_aggregate; + return nloc_aggregate; + + case DW_TAG_array_type: + case DW_TAG_string_type: + if (dwarf_aggregate_size (typedie, &size) == 0 && size <= 8) + { + if (tag == DW_TAG_array_type) + { + /* Check if it's a character array. */ + attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); + typedie = dwarf_formref_die (attr, &die_mem); + tag = dwarf_tag (typedie); + if (tag != DW_TAG_base_type) + goto aggregate; + if (dwarf_formudata (dwarf_attr_integrate (typedie, + DW_AT_byte_size, + &attr_mem), + &size) != 0) + return -1; + if (size != 1) + goto aggregate; + } + goto intreg; + } + goto aggregate; + } + + /* XXX We don't have a good way to return specific errors from ebl calls. + This value means we do not understand the type, but it is well-formed + DWARF and might be valid. */ + return -2; +} diff --git a/backends/tilegx_symbol.c b/backends/tilegx_symbol.c new file mode 100644 index 00000000..b6533266 --- /dev/null +++ b/backends/tilegx_symbol.c @@ -0,0 +1,57 @@ +/* TILEGX-specific symbolic name handling. + Copyright (C) 2012 Tilera Corporation + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils 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 copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <elf.h> +#include <stddef.h> + +#define BACKEND tilegx_ +#include "libebl_CPU.h" + +/* Check for the simple reloc types. */ +Elf_Type +tilegx_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type) +{ + switch (type) + { + case R_TILEGX_64: + return ELF_T_SXWORD; + case R_TILEGX_32: + return ELF_T_SWORD; + case R_TILEGX_16: + return ELF_T_HALF; + case R_TILEGX_8: + return ELF_T_BYTE; + default: + return ELF_T_NUM; + } +} |
