This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On 08/21/2012 08:11 AM, Mark Wielaard wrote: > On Mon, 2012-08-20 at 11:37 -0400, Jeff Kenton wrote: >> 2. Changelog: >> >> backends/ >> *Makefile.am: added tilegx processor. >> *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. >> libebl/ >> *eblopenbackend.c: added tilegx processor. >> src/ >> *elflint.c: added tilegx processor. >> tests/ >> *run-allregs.sh: added testfile60 for tilegx processor. >> *testfile60.bz2: new file. > Please just include those in the ChangeLog files. It should look > something like the attached ChangeLog.diff. > >> 1 of 88 tests failed > So that is the only failure. Good. > >> -## Copyright (C) 2000-2010 Red Hat, Inc. >> +## Copyright (C) 2000-2012 Red Hat, Inc. > You should add a correct Copyright line. You/Tilera made the changes and > so holds copyright on them. Please add a new Copyright line just after > this line with the current year and the copyright holder. In new files > you write from scratch just have only you/Tilera as copyright holder. > >> +#if 0 >> +ssize_t >> +arm_register_info (Ebl *ebl __attribute__ ((unused)), >> + int regno, char *name, size_t namelen, >> + const char **prefix, const char **setname, >> + int *bits, int *type) >> +{ >> + switch (regno) >> + { >> + case 13 ... 15: >> + *type = DW_ATE_address; >> + name[0] = "slp"[regno - 13]; >> + name[1] = "prc"[regno - 13]; >> + namelen = 2; >> + break; >> + >> + case 128: >> + *type = DW_ATE_unsigned; >> + return stpcpy (name, "spsr") + 1 - name; >> + } >> + >> + name[namelen++] = '\0'; >> + return namelen; >> +} >> +#endif > That should not be there. > > Thanks, > > Mark Done. New patch attached. Thanks. --jeff kenton
On 08/21/2012 08:11 AM, Mark Wielaard wrote:
On Mon, 2012-08-20 at 11:37 -0400, Jeff Kenton wrote:2. Changelog: backends/ *Makefile.am: added tilegx processor. *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. libebl/ *eblopenbackend.c: added tilegx processor. src/ *elflint.c: added tilegx processor. tests/ *run-allregs.sh: added testfile60 for tilegx processor. *testfile60.bz2: new file.Please just include those in the ChangeLog files. It should look something like the attached ChangeLog.diff.1 of 88 tests failedSo that is the only failure. Good.-## Copyright (C) 2000-2010 Red Hat, Inc. +## Copyright (C) 2000-2012 Red Hat, Inc.You should add a correct Copyright line. You/Tilera made the changes and so holds copyright on them. Please add a new Copyright line just after this line with the current year and the copyright holder. In new files you write from scratch just have only you/Tilera as copyright holder.+#if 0 +ssize_t +arm_register_info (Ebl *ebl __attribute__ ((unused)), + int regno, char *name, size_t namelen, + const char **prefix, const char **setname, + int *bits, int *type) +{ + switch (regno) + { + case 13 ... 15: + *type = DW_ATE_address; + name[0] = "slp"[regno - 13]; + name[1] = "prc"[regno - 13]; + namelen = 2; + break; + + case 128: + *type = DW_ATE_unsigned; + return stpcpy (name, "spsr") + 1 - name; + } + + name[namelen++] = '\0'; + return namelen; +} +#endifThat should not be there. Thanks, Mark Done. New patch attached. Thanks. --jeff kenton |
>From f8dbdcea571bd5ed64ae3d850958f45bc3293519 Mon Sep 17 00:00:00 2001 From: Jeff Kenton <jkenton@tilera.com> Date: Wed, 22 Aug 2012 09:00:03 -0400 Subject: [PATCH] Add support for Tilera TILE-Gx processor. Signed-off-by: Jeff Kenton <jkenton@tilera.com> --- backends/ChangeLog | 15 ++++ backends/Makefile.am | 10 ++- backends/tilegx_corenote.c | 64 +++++++++++++++++ backends/tilegx_init.c | 60 ++++++++++++++++ backends/tilegx_regs.c | 129 ++++++++++++++++++++++++++++++++++ backends/tilegx_reloc.def | 120 ++++++++++++++++++++++++++++++++ backends/tilegx_retval.c | 165 ++++++++++++++++++++++++++++++++++++++++++++ backends/tilegx_symbol.c | 57 +++++++++++++++ libebl/ChangeLog | 5 ++ libebl/eblopenbackend.c | 1 + src/ChangeLog | 5 ++ src/elflint.c | 3 +- tests/ChangeLog | 5 ++ tests/run-allregs.sh | 69 ++++++++++++++++++ tests/testfile60.bz2 | Bin 0 -> 2974 bytes 15 files changed, 705 insertions(+), 3 deletions(-) create mode 100644 backends/tilegx_corenote.c create mode 100644 backends/tilegx_init.c create mode 100644 backends/tilegx_regs.c create mode 100644 backends/tilegx_reloc.def create mode 100644 backends/tilegx_retval.c create mode 100644 backends/tilegx_symbol.c create mode 100755 tests/testfile60.bz2 diff --git a/backends/ChangeLog b/backends/ChangeLog index 744d1d5..2610fed 100644 --- a/backends/ChangeLog +++ b/backends/ChangeLog @@ -1,3 +1,18 @@ +2012-08-21 Jeff Kenton <jkenton@tilera.com> + + * 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 <mjw@redhat.com> * alpha_init.c (alpha_init): Initialize check_st_other_bits hook. diff --git a/backends/Makefile.am b/backends/Makefile.am index 3b34e88..982ff2a 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 0000000..be3e7db --- /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 0000000..858798b --- /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 0000000..c96132d --- /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 0000000..9736286 --- /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 0000000..fd4feef --- /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 0000000..b653326 --- /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; + } +} diff --git a/libebl/ChangeLog b/libebl/ChangeLog index 941ed6f..7d32fe5 100644 --- a/libebl/ChangeLog +++ b/libebl/ChangeLog @@ -1,3 +1,8 @@ +2012-08-21 Jeff Kenton <jkenton@tilera.com> + + * eblopenbackend.c (machines): Add tilegx. + + 2011-06-26 Mark Wielaard <mjw@redhat.com> * eblopenbackend.c (default_debugscn_p): Add .debug_macro. diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c index b39ab2e..89e5da5 100644 --- a/libebl/eblopenbackend.c +++ b/libebl/eblopenbackend.c @@ -63,6 +63,7 @@ static const struct { "x86_64", "elf_x86_64", "x86_64", 6, EM_X86_64, ELFCLASS64, ELFDATA2LSB }, { "ppc", "elf_ppc", "ppc", 3, EM_PPC, ELFCLASS32, ELFDATA2MSB }, { "ppc64", "elf_ppc64", "ppc64", 5, EM_PPC64, ELFCLASS64, ELFDATA2MSB }, + { "tilegx", "elf_tilegx", "tilegx", 6, EM_TILEGX, ELFCLASS64, ELFDATA2LSB }, // XXX class and machine fields need to be filled in for all archs. { "sh", "elf_sh", "sh", 2, EM_SH, 0, 0 }, { "arm", "ebl_arm", "arm", 3, EM_ARM, 0, 0 }, diff --git a/src/ChangeLog b/src/ChangeLog index 725554d..909852e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2012-08-21 Jeff Kenton <jkenton@tilera.com> + + * elflint.c (valid_e_machine): Add EM_TILEGX and EM_TILEPRO. + + 2012-08-16 Mark Wielaard <mjw@redhat.com> * readelf.c (dwarf_tag_name): Renamed from dwarf_tag_string. diff --git a/src/elflint.c b/src/elflint.c index 1ff2809..4084987 100644 --- a/src/elflint.c +++ b/src/elflint.c @@ -330,7 +330,8 @@ static const int valid_e_machine[] = EM_68HC16, EM_68HC11, EM_68HC08, EM_68HC05, EM_SVX, EM_ST19, EM_VAX, EM_CRIS, EM_JAVELIN, EM_FIREPATH, EM_ZSP, EM_MMIX, EM_HUANY, EM_PRISM, EM_AVR, EM_FR30, EM_D10V, EM_D30V, EM_V850, EM_M32R, EM_MN10300, - EM_MN10200, EM_PJ, EM_OPENRISC, EM_ARC_A5, EM_XTENSA, EM_ALPHA + EM_MN10200, EM_PJ, EM_OPENRISC, EM_ARC_A5, EM_XTENSA, EM_ALPHA, + EM_TILEGX, EM_TILEPRO }; #define nvalid_e_machine \ (sizeof (valid_e_machine) / sizeof (valid_e_machine[0])) diff --git a/tests/ChangeLog b/tests/ChangeLog index f0c83e6..d308489 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,8 @@ +2012-08-21 Jeff Kenton <jkenton@tilera.com> + + * testfile60.bz2: New testfile. + * run-allregs.sh: Run reg_test testfile60. + 2012-08-16 Mark Wielaard <mjw@redhat.com> * allregs.c (dwarf_encoding_string): Rewritten using known-dwarf diff --git a/tests/run-allregs.sh b/tests/run-allregs.sh index cc48342..0965715 100755 --- a/tests/run-allregs.sh +++ b/tests/run-allregs.sh @@ -2584,4 +2584,73 @@ FPU registers: 63: $fpcr (fpcr), unsigned 64 bits EOF +regs_test testfile60 <<\EOF +integer registers: + 0: r0 (r0), signed 64 bits + 1: r1 (r1), signed 64 bits + 2: r2 (r2), signed 64 bits + 3: r3 (r3), signed 64 bits + 4: r4 (r4), signed 64 bits + 5: r5 (r5), signed 64 bits + 6: r6 (r6), signed 64 bits + 7: r7 (r7), signed 64 bits + 8: r8 (r8), signed 64 bits + 9: r9 (r9), signed 64 bits + 10: r10 (r10), signed 64 bits + 11: r11 (r11), signed 64 bits + 12: r12 (r12), signed 64 bits + 13: r13 (r13), signed 64 bits + 14: r14 (r14), signed 64 bits + 15: r15 (r15), signed 64 bits + 16: r16 (r16), signed 64 bits + 17: r17 (r17), signed 64 bits + 18: r18 (r18), signed 64 bits + 19: r19 (r19), signed 64 bits + 20: r20 (r20), signed 64 bits + 21: r21 (r21), signed 64 bits + 22: r22 (r22), signed 64 bits + 23: r23 (r23), signed 64 bits + 24: r24 (r24), signed 64 bits + 25: r25 (r25), signed 64 bits + 26: r26 (r26), signed 64 bits + 27: r27 (r27), signed 64 bits + 28: r28 (r28), signed 64 bits + 29: r29 (r29), signed 64 bits + 30: r30 (r30), signed 64 bits + 31: r31 (r31), signed 64 bits + 32: r32 (r32), signed 64 bits + 33: r33 (r33), signed 64 bits + 34: r34 (r34), signed 64 bits + 35: r35 (r35), signed 64 bits + 36: r36 (r36), signed 64 bits + 37: r37 (r37), signed 64 bits + 38: r38 (r38), signed 64 bits + 39: r39 (r39), signed 64 bits + 40: r40 (r40), signed 64 bits + 41: r41 (r41), signed 64 bits + 42: r42 (r42), signed 64 bits + 43: r43 (r43), signed 64 bits + 44: r44 (r44), signed 64 bits + 45: r45 (r45), signed 64 bits + 46: r46 (r46), signed 64 bits + 47: r47 (r47), signed 64 bits + 48: r48 (r48), signed 64 bits + 49: r49 (r49), signed 64 bits + 50: r50 (r50), signed 64 bits + 51: r51 (r51), signed 64 bits + 52: r52 (r52), signed 64 bits + 53: tp (tp), address 64 bits + 54: sp (sp), address 64 bits + 55: lr (lr), address 64 bits + 56: sn (sn), unsigned 64 bits + 57: idn0 (idn0), unsigned 64 bits + 58: idn1 (idn1), unsigned 64 bits + 59: udn0 (udn0), unsigned 64 bits + 60: udn1 (udn1), unsigned 64 bits + 61: udn2 (udn2), unsigned 64 bits + 62: udn3 (udn3), unsigned 64 bits + 63: zero (zero), unsigned 64 bits + 64: pc (pc), address 64 bits +EOF + exit 0 diff --git a/tests/testfile60.bz2 b/tests/testfile60.bz2 new file mode 100755 index 0000000000000000000000000000000000000000..6a0cd7bcddd7a62d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