diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2013-08-27 22:49:36 +0200 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2013-09-02 23:20:14 +0200 |
commit | ed9d2cad539eef89abac0490bbcbf647758905e3 (patch) | |
tree | a722b7f8e81c4668b0b40a4470e27f646a0e15bc | |
parent | 292b1787b6ccc429ebba177600dffdb5b33443f7 (diff) | |
download | elfutils-ed9d2cad539eef89abac0490bbcbf647758905e3.tar.gz |
backends: Hook abi_cfi for ppc and s390.
Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
-rw-r--r-- | backends/ChangeLog | 10 | ||||
-rw-r--r-- | backends/Makefile.am | 10 | ||||
-rw-r--r-- | backends/ppc64_init.c | 3 | ||||
-rw-r--r-- | backends/ppc_cfi.c | 77 | ||||
-rw-r--r-- | backends/ppc_init.c | 3 | ||||
-rw-r--r-- | backends/s390_cfi.c | 65 | ||||
-rw-r--r-- | backends/s390_init.c | 3 |
7 files changed, 164 insertions, 7 deletions
diff --git a/backends/ChangeLog b/backends/ChangeLog index 0863b566..48b1b7b9 100644 --- a/backends/ChangeLog +++ b/backends/ChangeLog @@ -1,3 +1,13 @@ +2013-08-27 Jan Kratochvil <jan.kratochvil@redhat.com> + + * Makefile.am (ppc_SRCS, ppc64_SRCS): Add ppc_cfi.c. + (s390_SRCS): Add s390_cfi.c. + * ppc64_init.c (ppc64_init): Initialize abi_cfi. + * ppc_cfi.c: New file. + * ppc_init.c (ppc_init): Initialize abi_cfi. + * s390_cfi.c: New file. + * s390_init.c (s390_init): Initialize abi_cfi. + 2013-08-28 Mark Wielaard <mjw@redhat.com> * arm_regs.c (arm_register_info): Set *prefix to "". diff --git a/backends/Makefile.am b/backends/Makefile.am index 19237027..ec022b02 100644 --- a/backends/Makefile.am +++ b/backends/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to create Makefile.in ## -## Copyright (C) 2000-2010 Red Hat, Inc. +## Copyright (C) 2000-2010, 2013 Red Hat, Inc. ## Copyright (C) 2012 Tilera Corporation ## This file is part of elfutils. ## @@ -85,17 +85,19 @@ 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 ppc_retval.c ppc_regs.c \ - ppc_corenote.c ppc_auxv.c ppc_attrs.c ppc_syscall.c + ppc_corenote.c ppc_auxv.c ppc_attrs.c ppc_syscall.c \ + ppc_cfi.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 ppc64_retval.c \ - ppc64_corenote.c ppc_regs.c ppc_auxv.c ppc_attrs.c ppc_syscall.c + ppc64_corenote.c ppc_regs.c ppc_auxv.c ppc_attrs.c ppc_syscall.c \ + ppc_cfi.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 s390_regs.c s390_retval.c \ - s390_corenote.c s390x_corenote.c + s390_corenote.c s390x_corenote.c s390_cfi.c libebl_s390_pic_a_SOURCES = $(s390_SRCS) am_libebl_s390_pic_a_OBJECTS = $(s390_SRCS:.c=.os) diff --git a/backends/ppc64_init.c b/backends/ppc64_init.c index 90d4f2ba..14358754 100644 --- a/backends/ppc64_init.c +++ b/backends/ppc64_init.c @@ -1,5 +1,5 @@ /* Initialization of PPC64 specific backend library. - Copyright (C) 2004, 2005, 2006, 2007, 2008 Red Hat, Inc. + Copyright (C) 2004, 2005, 2006, 2007, 2008, 2013 Red Hat, Inc. This file is part of elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. @@ -64,6 +64,7 @@ ppc64_init (elf, machine, eh, ehlen) HOOK (eh, syscall_abi); HOOK (eh, core_note); HOOK (eh, auxv_info); + HOOK (eh, abi_cfi); return MODVERSION; } diff --git a/backends/ppc_cfi.c b/backends/ppc_cfi.c new file mode 100644 index 00000000..6a4f4619 --- /dev/null +++ b/backends/ppc_cfi.c @@ -0,0 +1,77 @@ +/* ppc ABI-specified defaults for DWARF CFI. + Copyright (C) 2012, 2013 Red Hat, Inc. + 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 <dwarf.h> + +#define BACKEND ppc_ +#include "libebl_CPU.h" + +int +ppc_abi_cfi (Ebl *ebl __attribute__ ((unused)), Dwarf_CIE *abi_info) +{ + static const uint8_t abi_cfi[] = + { + /* This instruction is provided in every CIE. It is not repeated here: + DW_CFA_def_cfa, ULEB128_7 (1), ULEB128_7 (0) */ + /* r1 is assumed to be restored from cfa adress, + r1 acts as a stack frame pointer. */ + DW_CFA_val_expression, ULEB128_7 (1), ULEB128_7 (1), DW_OP_nop, + /* lr is not callee-saved but it needs to be preserved as it is pre-set + by the caller. */ + DW_CFA_same_value, ULEB128_7 (65), /* lr */ + + /* Callee-saved regs. */ +#define SV(n) DW_CFA_same_value, ULEB128_7 (n) + SV (2), /* r2 is TOC pointer. */ + SV (13), /* Reserved as system thread id (is it for CFI?). */ + /* r14-r31 are non-volatile registers. */ + SV (14), SV (15), SV (16), SV (17), SV (18), SV (19), SV (20), SV (21), + SV (22), SV (23), SV (24), SV (25), SV (26), SV (27), SV (28), SV (29), + SV (30), SV (31) + /* VMX registers v20-v31 and vrsave are non-volatile but they are + assigned DWARF registers 1144-1156 (v20-v31) which is outside of the + CFI supported range. */ +#undef SV + }; + + abi_info->initial_instructions = abi_cfi; + abi_info->initial_instructions_end = &abi_cfi[sizeof abi_cfi]; + abi_info->data_alignment_factor = ebl->class == ELFCLASS64 ? 8 : 4; + + abi_info->return_address_register = 65; + + return 0; +} + +__typeof (ppc_abi_cfi) + ppc64_abi_cfi + __attribute__ ((alias ("ppc_abi_cfi"))); diff --git a/backends/ppc_init.c b/backends/ppc_init.c index 6054007f..004c6016 100644 --- a/backends/ppc_init.c +++ b/backends/ppc_init.c @@ -1,5 +1,5 @@ /* Initialization of PPC specific backend library. - Copyright (C) 2004, 2005, 2006, 2007, 2008 Red Hat, Inc. + Copyright (C) 2004, 2005, 2006, 2007, 2008, 2013 Red Hat, Inc. This file is part of elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2004. @@ -64,6 +64,7 @@ ppc_init (elf, machine, eh, ehlen) HOOK (eh, core_note); HOOK (eh, auxv_info); HOOK (eh, check_object_attribute); + HOOK (eh, abi_cfi); return MODVERSION; } diff --git a/backends/s390_cfi.c b/backends/s390_cfi.c new file mode 100644 index 00000000..cb494861 --- /dev/null +++ b/backends/s390_cfi.c @@ -0,0 +1,65 @@ +/* s390 ABI-specified defaults for DWARF CFI. + Copyright (C) 2012, 2013 Red Hat, Inc. + 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 <dwarf.h> + +#define BACKEND s390_ +#include "libebl_CPU.h" + +int +s390_abi_cfi (Ebl *ebl, Dwarf_CIE *abi_info) +{ + static const uint8_t abi_cfi[] = + { + /* This instruction is provided in every CIE. It is not repeated here: + DW_CFA_def_cfa, ULEB128_7 (15), ULEB128_7 (96) */ + /* r14 is not callee-saved but it needs to be preserved as it is pre-set + by the caller. */ + DW_CFA_same_value, ULEB128_7 (14), /* r14 */ + + /* Callee-saved regs. */ +#define SV(n) DW_CFA_same_value, ULEB128_7 (n) + SV (6), SV (7), SV (8), SV (9), SV (10), /* r6-r13, r15 */ + SV (11), SV (12), SV (13), SV (15), + SV (16 + 8), SV (16 + 9), SV (16 + 10), SV (16 + 11), /* f8-f15 */ + SV (16 + 12), SV (16 + 13), SV (16 + 14), SV (16 + 15) +#undef SV + }; + + abi_info->initial_instructions = abi_cfi; + abi_info->initial_instructions_end = &abi_cfi[sizeof abi_cfi]; + abi_info->data_alignment_factor = ebl->class == ELFCLASS64 ? 8 : 4; + + abi_info->return_address_register = 14; + + return 0; +} diff --git a/backends/s390_init.c b/backends/s390_init.c index 91fe4b8d..630a2ee3 100644 --- a/backends/s390_init.c +++ b/backends/s390_init.c @@ -1,5 +1,5 @@ /* Initialization of S/390 specific backend library. - Copyright (C) 2005, 2006 Red Hat, Inc. + Copyright (C) 2005, 2006, 2013 Red Hat, Inc. This file is part of elfutils. This file is free software; you can redistribute it and/or modify @@ -61,6 +61,7 @@ s390_init (elf, machine, eh, ehlen) eh->core_note = s390x_core_note; else HOOK (eh, core_note); + HOOK (eh, abi_cfi); /* Only the 64-bit format uses the incorrect hash table entry size. */ if (eh->class == ELFCLASS64) |