]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
backends: Hook abi_cfi for ppc and s390.
authorJan Kratochvil <jan.kratochvil@redhat.com>
Tue, 27 Aug 2013 20:49:36 +0000 (22:49 +0200)
committerMark Wielaard <mjw@redhat.com>
Mon, 2 Sep 2013 21:20:14 +0000 (23:20 +0200)
Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
backends/ChangeLog
backends/Makefile.am
backends/ppc64_init.c
backends/ppc_cfi.c [new file with mode: 0644]
backends/ppc_init.c
backends/s390_cfi.c [new file with mode: 0644]
backends/s390_init.c

index 0863b566285057772d9e867e5e0a005b4662a695..48b1b7b9de60040abaebc17088f46547c2cadb45 100644 (file)
@@ -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 "".
index 192370271455c11c264b1b270e7eddb68c2a09e7..ec022b02c1d5853105696f69072c523708d331d4 100644 (file)
@@ -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)
 
index 90d4f2ba0df84cab3fbe85f2cba4f99a77a33b64..1435875461d7cdb0fbe6d59c845d606b5f901b39 100644 (file)
@@ -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 (file)
index 0000000..6a4f461
--- /dev/null
@@ -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")));
index 6054007ffe1962cad3637dfdb773e1c70f8efc63..004c6016553dddf942491da3b7024022b9dcc90d 100644 (file)
@@ -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 (file)
index 0000000..cb49486
--- /dev/null
@@ -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;
+}
index 91fe4b8d15abfb325bd3a01ce55ee7b97653d140..630a2ee366d38a414166a49cf6c61997f704faf5 100644 (file)
@@ -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)