mirror of
https://github.com/openharmony/third_party_elfutils.git
synced 2026-07-19 19:43:34 -04:00
Nominal ARM support.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
Version 0.141:
|
||||
|
||||
libebl: sparc backend fixes
|
||||
libebl: sparc backend fixes;
|
||||
some more arm backend support
|
||||
libdwfl: fix dwfl_module_build_id for prelinked DSO case;
|
||||
fixes in core file support;
|
||||
dwfl_module_getsym interface improved for non-address symbols
|
||||
|
||||
@@ -1,3 +1,22 @@
|
||||
2009-04-14 Roland McGrath <roland@redhat.com>
|
||||
|
||||
* arm_retval.c: New file.
|
||||
* arm_attrs.c: New file.
|
||||
* Makefile.am (arm_SRCS): Add them.
|
||||
* arm_symbol.c (arm_segment_type_name): New function.
|
||||
(arm_section_type_name): New function.
|
||||
(arm_machine_flag_check): New function.
|
||||
* arm_init.c (arm_init): Initialize those hooks.
|
||||
|
||||
* arm_regs.c: New file.
|
||||
* arm_corenote.c: New file.
|
||||
* arm_auxv.c: New file.
|
||||
* Makefile.am (arm_SRCS): Add them.
|
||||
* arm_init.c (arm_init): Initialize core_note, register_info,
|
||||
and auxv_info hooks.
|
||||
|
||||
* ia64_symbol.c (ia64_section_type_name): Remove "SHT_" prefixes.
|
||||
|
||||
2009-04-01 Roland McGrath <roland@redhat.com>
|
||||
|
||||
* sparc_reloc.def: Update table.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## Process this file with automake to create Makefile.in
|
||||
##
|
||||
## Copyright (C) 2000-2006, 2007, 2008 Red Hat, Inc.
|
||||
## Copyright (C) 2000-2009 Red Hat, Inc.
|
||||
## This file is part of Red Hat elfutils.
|
||||
##
|
||||
## Red Hat elfutils is free software; you can redistribute it and/or modify
|
||||
@@ -85,7 +85,8 @@ alpha_SRCS = alpha_init.c alpha_symbol.c alpha_retval.c alpha_regs.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
|
||||
arm_SRCS = arm_init.c arm_symbol.c arm_regs.c arm_corenote.c \
|
||||
arm_auxv.c arm_attrs.c arm_retval.c
|
||||
libebl_arm_pic_a_SOURCES = $(arm_SRCS)
|
||||
am_libebl_arm_pic_a_OBJECTS = $(arm_SRCS:.c=.os)
|
||||
|
||||
|
||||
@@ -0,0 +1,242 @@
|
||||
/* Object attribute tags for ARM.
|
||||
Copyright (C) 2009 Red Hat, Inc.
|
||||
This file is part of Red Hat elfutils.
|
||||
|
||||
Red Hat elfutils is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; version 2 of the License.
|
||||
|
||||
Red Hat 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 a copy of the GNU General Public License along
|
||||
with Red Hat elfutils; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
|
||||
|
||||
Red Hat elfutils is an included package of the Open Invention Network.
|
||||
An included package of the Open Invention Network is a package for which
|
||||
Open Invention Network licensees cross-license their patents. No patent
|
||||
license is granted, either expressly or impliedly, by designation as an
|
||||
included package. Should you wish to participate in the Open Invention
|
||||
Network licensing program, please visit www.openinventionnetwork.com
|
||||
<http://www.openinventionnetwork.com>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <dwarf.h>
|
||||
|
||||
#define BACKEND arm_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
#define KNOWN_VALUES(...) do \
|
||||
{ \
|
||||
static const char *table[] = { __VA_ARGS__ }; \
|
||||
if (value < sizeof table / sizeof table[0]) \
|
||||
*value_name = table[value]; \
|
||||
} while (0)
|
||||
|
||||
bool
|
||||
arm_check_object_attribute (ebl, vendor, tag, value, tag_name, value_name)
|
||||
Ebl *ebl __attribute__ ((unused));
|
||||
const char *vendor;
|
||||
int tag;
|
||||
uint64_t value __attribute__ ((unused));
|
||||
const char **tag_name;
|
||||
const char **value_name;
|
||||
{
|
||||
if (!strcmp (vendor, "aeabi"))
|
||||
switch (tag)
|
||||
{
|
||||
case 4:
|
||||
*tag_name = "CPU_raw_name";
|
||||
return true;
|
||||
case 5:
|
||||
*tag_name = "CPU_name";
|
||||
return true;
|
||||
case 6:
|
||||
*tag_name = "CPU_arch";
|
||||
KNOWN_VALUES ("Pre-v4",
|
||||
"v4",
|
||||
"v4T",
|
||||
"v5T",
|
||||
"v5TE",
|
||||
"v5TEJ",
|
||||
"v6",
|
||||
"v6KZ",
|
||||
"v6T2",
|
||||
"v6K",
|
||||
"v7",
|
||||
"v6-M",
|
||||
"v6S-M");
|
||||
return true;
|
||||
case 7:
|
||||
*tag_name = "CPU_arch_profile";
|
||||
switch (value)
|
||||
{
|
||||
case 'A':
|
||||
*value_name = "Application";
|
||||
break;
|
||||
case 'R':
|
||||
*value_name = "Realtime";
|
||||
break;
|
||||
case 'M':
|
||||
*value_name = "Microcontroller";
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
case 8:
|
||||
*tag_name = "ARM_ISA_use";
|
||||
KNOWN_VALUES ("No", "Yes");
|
||||
return true;
|
||||
case 9:
|
||||
*tag_name = "THUMB_ISA_use";
|
||||
KNOWN_VALUES ("No", "Thumb-1", "Thumb-2");
|
||||
return true;
|
||||
case 10:
|
||||
*tag_name = "VFP_arch";
|
||||
KNOWN_VALUES ("No", "VFPv1", "VFPv2", "VFPv3", "VFPv3-D16");
|
||||
return true;
|
||||
case 11:
|
||||
*tag_name = "WMMX_arch";
|
||||
KNOWN_VALUES ("No", "WMMXv1", "WMMXv2");
|
||||
return true;
|
||||
case 12:
|
||||
*tag_name = "Advanced_SIMD_arch";
|
||||
KNOWN_VALUES ("No", "NEONv1");
|
||||
return true;
|
||||
case 13:
|
||||
*tag_name = "PCS_config";
|
||||
KNOWN_VALUES ("None",
|
||||
"Bare platform",
|
||||
"Linux application",
|
||||
"Linux DSO",
|
||||
"PalmOS 2004",
|
||||
"PalmOS (reserved)",
|
||||
"SymbianOS 2004",
|
||||
"SymbianOS (reserved)");
|
||||
return true;
|
||||
case 14:
|
||||
*tag_name = "ABI_PCS_R9_use";
|
||||
KNOWN_VALUES ("V6", "SB", "TLS", "Unused");
|
||||
return true;
|
||||
case 15:
|
||||
*tag_name = "ABI_PCS_RW_data";
|
||||
KNOWN_VALUES ("Absolute", "PC-relative", "SB-relative", "None");
|
||||
return true;
|
||||
case 16:
|
||||
*tag_name = "ABI_PCS_RO_data";
|
||||
KNOWN_VALUES ("Absolute", "PC-relative", "None");
|
||||
return true;
|
||||
case 17:
|
||||
*tag_name = "ABI_PCS_GOT_use";
|
||||
KNOWN_VALUES ("None", "direct", "GOT-indirect");
|
||||
return true;
|
||||
case 18:
|
||||
*tag_name = "ABI_PCS_wchar_t";
|
||||
return true;
|
||||
case 19:
|
||||
*tag_name = "ABI_FP_rounding";
|
||||
KNOWN_VALUES ("Unused", "Needed");
|
||||
return true;
|
||||
case 20:
|
||||
*tag_name = "ABI_FP_denormal";
|
||||
KNOWN_VALUES ("Unused", "Needed", "Sign only");
|
||||
return true;
|
||||
case 21:
|
||||
*tag_name = "ABI_FP_exceptions";
|
||||
KNOWN_VALUES ("Unused", "Needed");
|
||||
return true;
|
||||
case 22:
|
||||
*tag_name = "ABI_FP_user_exceptions";
|
||||
KNOWN_VALUES ("Unused", "Needed");
|
||||
return true;
|
||||
case 23:
|
||||
*tag_name = "ABI_FP_number_model";
|
||||
KNOWN_VALUES ("Unused", "Finite", "RTABI", "IEEE 754");
|
||||
return true;
|
||||
case 24:
|
||||
*tag_name = "ABI_align8_needed";
|
||||
KNOWN_VALUES ("No", "Yes", "4-byte");
|
||||
return true;
|
||||
case 25:
|
||||
*tag_name = "ABI_align8_preserved";
|
||||
KNOWN_VALUES ("No", "Yes, except leaf SP", "Yes");
|
||||
return true;
|
||||
case 26:
|
||||
*tag_name = "ABI_enum_size";
|
||||
KNOWN_VALUES ("Unused", "small", "int", "forced to int");
|
||||
return true;
|
||||
case 27:
|
||||
*tag_name = "ABI_HardFP_use";
|
||||
KNOWN_VALUES ("as VFP_arch", "SP only", "DP only", "SP and DP");
|
||||
return true;
|
||||
case 28:
|
||||
*tag_name = "ABI_VFP_args";
|
||||
KNOWN_VALUES ("AAPCS", "VFP registers", "custom");
|
||||
return true;
|
||||
case 29:
|
||||
*tag_name = "ABI_WMMX_args";
|
||||
KNOWN_VALUES ("AAPCS", "WMMX registers", "custom");
|
||||
return true;
|
||||
case 30:
|
||||
*tag_name = "ABI_optimization_goals";
|
||||
KNOWN_VALUES ("None",
|
||||
"Prefer Speed",
|
||||
"Aggressive Speed",
|
||||
"Prefer Size",
|
||||
"Aggressive Size",
|
||||
"Prefer Debug",
|
||||
"Aggressive Debug");
|
||||
return true;
|
||||
case 31:
|
||||
*tag_name = "ABI_FP_optimization_goals";
|
||||
KNOWN_VALUES ("None",
|
||||
"Prefer Speed",
|
||||
"Aggressive Speed",
|
||||
"Prefer Size",
|
||||
"Aggressive Size",
|
||||
"Prefer Accuracy",
|
||||
"Aggressive Accuracy");
|
||||
return true;
|
||||
case 34:
|
||||
*tag_name = "CPU_unaligned_access";
|
||||
KNOWN_VALUES ("None", "v6");
|
||||
return true;
|
||||
case 36:
|
||||
*tag_name = "VFP_HP_extension";
|
||||
KNOWN_VALUES ("Not Allowed", "Allowed");
|
||||
return true;
|
||||
case 38:
|
||||
*tag_name = "ABI_FP_16bit_format";
|
||||
KNOWN_VALUES ("None", "IEEE 754", "Alternative Format");
|
||||
return true;
|
||||
case 64:
|
||||
*tag_name = "nodefaults";
|
||||
return true;
|
||||
case 65:
|
||||
*tag_name = "also_compatible_with";
|
||||
return true;
|
||||
case 66:
|
||||
*tag_name = "T2EE_use";
|
||||
KNOWN_VALUES ("Not Allowed", "Allowed");
|
||||
return true;
|
||||
case 67:
|
||||
*tag_name = "conformance";
|
||||
return true;
|
||||
case 68:
|
||||
*tag_name = "Virtualization_use";
|
||||
KNOWN_VALUES ("Not Allowed", "Allowed");
|
||||
return true;
|
||||
case 70:
|
||||
*tag_name = "MPextension_use";
|
||||
KNOWN_VALUES ("Not Allowed", "Allowed");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/* ARM-specific auxv handling.
|
||||
Copyright (C) 2009 Red Hat, Inc.
|
||||
This file is part of Red Hat elfutils.
|
||||
|
||||
Red Hat elfutils is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; version 2 of the License.
|
||||
|
||||
Red Hat 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 a copy of the GNU General Public License along
|
||||
with Red Hat elfutils; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
|
||||
|
||||
Red Hat elfutils is an included package of the Open Invention Network.
|
||||
An included package of the Open Invention Network is a package for which
|
||||
Open Invention Network licensees cross-license their patents. No patent
|
||||
license is granted, either expressly or impliedly, by designation as an
|
||||
included package. Should you wish to participate in the Open Invention
|
||||
Network licensing program, please visit www.openinventionnetwork.com
|
||||
<http://www.openinventionnetwork.com>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#define BACKEND arm_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
int
|
||||
EBLHOOK(auxv_info) (GElf_Xword a_type, const char **name, const char **format)
|
||||
{
|
||||
if (a_type != AT_HWCAP)
|
||||
return 0;
|
||||
|
||||
*name = "HWCAP";
|
||||
*format = "b"
|
||||
"swp\0" "half\0" "thumb\0" "26bit\0"
|
||||
"fast-mult\0" "fpa\0" "vfp\0" "edsp\0"
|
||||
"java\0" "iwmmxt\0"
|
||||
"\0";
|
||||
return 1;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/* ARM specific core note handling.
|
||||
Copyright (C) 2009 Red Hat, Inc.
|
||||
This file is part of Red Hat elfutils.
|
||||
|
||||
Red Hat elfutils is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; version 2 of the License.
|
||||
|
||||
Red Hat 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 a copy of the GNU General Public License along
|
||||
with Red Hat elfutils; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
|
||||
|
||||
Red Hat elfutils is an included package of the Open Invention Network.
|
||||
An included package of the Open Invention Network is a package for which
|
||||
Open Invention Network licensees cross-license their patents. No patent
|
||||
license is granted, either expressly or impliedly, by designation as an
|
||||
included package. Should you wish to participate in the Open Invention
|
||||
Network licensing program, please visit www.openinventionnetwork.com
|
||||
<http://www.openinventionnetwork.com>. */
|
||||
|
||||
#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 arm_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
|
||||
static const Ebl_Register_Location prstatus_regs[] =
|
||||
{
|
||||
{ .offset = 0, .regno = 0, .count = 16, .bits = 32 }, /* r0..r15 */
|
||||
{ .offset = 16 * 4, .regno = 128, .count = 1, .bits = 32 }, /* cpsr */
|
||||
};
|
||||
#define PRSTATUS_REGS_SIZE (18 * 4)
|
||||
|
||||
#define PRSTATUS_REGSET_ITEMS \
|
||||
{ \
|
||||
.name = "orig_r0", .type = ELF_T_SWORD, .format = 'd', \
|
||||
.offset = offsetof (struct EBLHOOK(prstatus), pr_reg) + (4 * 17), \
|
||||
.group = "register" \
|
||||
}
|
||||
|
||||
static const Ebl_Register_Location fpregset_regs[] =
|
||||
{
|
||||
{ .offset = 0, .regno = 96, .count = 8, .bits = 96 }, /* f0..f7 */
|
||||
};
|
||||
#define FPREGSET_SIZE 140
|
||||
|
||||
#define ULONG uint32_t
|
||||
#define PID_T int32_t
|
||||
#define UID_T uint16_t
|
||||
#define GID_T uint16_t
|
||||
#define ALIGN_ULONG 4
|
||||
#define ALIGN_PID_T 4
|
||||
#define ALIGN_UID_T 2
|
||||
#define ALIGN_GID_T 2
|
||||
#define TYPE_ULONG ELF_T_WORD
|
||||
#define TYPE_PID_T ELF_T_SWORD
|
||||
#define TYPE_UID_T ELF_T_HALF
|
||||
#define TYPE_GID_T ELF_T_HALF
|
||||
|
||||
#include "linux-core-note.c"
|
||||
+9
-1
@@ -1,5 +1,5 @@
|
||||
/* Initialization of Arm specific backend library.
|
||||
Copyright (C) 2002, 2005 Red Hat, Inc.
|
||||
Copyright (C) 2002, 2005, 2009 Red Hat, Inc.
|
||||
This file is part of Red Hat elfutils.
|
||||
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
|
||||
|
||||
@@ -50,7 +50,15 @@ arm_init (elf, machine, eh, ehlen)
|
||||
/* We handle it. */
|
||||
eh->name = "ARM";
|
||||
arm_init_reloc (eh);
|
||||
HOOK (eh, segment_type_name);
|
||||
HOOK (eh, section_type_name);
|
||||
HOOK (eh, machine_flag_check);
|
||||
HOOK (eh, reloc_simple_type);
|
||||
HOOK (eh, register_info);
|
||||
HOOK (eh, core_note);
|
||||
HOOK (eh, auxv_info);
|
||||
HOOK (eh, check_object_attribute);
|
||||
HOOK (eh, return_value_location);
|
||||
|
||||
return MODVERSION;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
/* Register names and numbers for ARM DWARF.
|
||||
Copyright (C) 2009 Red Hat, Inc.
|
||||
This file is part of Red Hat elfutils.
|
||||
|
||||
Red Hat elfutils is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; version 2 of the License.
|
||||
|
||||
Red Hat 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 a copy of the GNU General Public License along
|
||||
with Red Hat elfutils; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
|
||||
|
||||
Red Hat elfutils is an included package of the Open Invention Network.
|
||||
An included package of the Open Invention Network is a package for which
|
||||
Open Invention Network licensees cross-license their patents. No patent
|
||||
license is granted, either expressly or impliedly, by designation as an
|
||||
included package. Should you wish to participate in the Open Invention
|
||||
Network licensing program, please visit www.openinventionnetwork.com
|
||||
<http://www.openinventionnetwork.com>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <dwarf.h>
|
||||
|
||||
#define BACKEND arm_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
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)
|
||||
{
|
||||
if (name == NULL)
|
||||
return 129;
|
||||
|
||||
if (regno < 0 || regno > 128 || namelen < 5)
|
||||
return -1;
|
||||
|
||||
*prefix = NULL;
|
||||
*bits = 32;
|
||||
*type = DW_ATE_signed;
|
||||
*setname = "integer";
|
||||
|
||||
switch (regno)
|
||||
{
|
||||
case 0 ... 9:
|
||||
name[0] = 'r';
|
||||
name[1] = regno + '0';
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
case 10 ... 12:
|
||||
name[0] = 'r';
|
||||
name[1] = '1';
|
||||
name[2] = regno % 10 + '0';
|
||||
namelen = 3;
|
||||
break;
|
||||
|
||||
case 13 ... 15:
|
||||
*type = DW_ATE_address;
|
||||
name[0] = "slp"[regno - 13];
|
||||
name[1] = "prc"[regno - 13];
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
case 16 + 0 ... 16 + 7:
|
||||
regno += 96 - 16;
|
||||
/* Fall through. */
|
||||
case 96 + 0 ... 96 + 7:
|
||||
*setname = "FPA";
|
||||
*type = DW_ATE_float;
|
||||
*bits = 96;
|
||||
name[0] = 'f';
|
||||
name[1] = regno - 96 + '0';
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
case 128:
|
||||
*type = DW_ATE_unsigned;
|
||||
return stpcpy (name, "spsr") + 1 - name;
|
||||
|
||||
default:
|
||||
*setname = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
name[namelen++] = '\0';
|
||||
return namelen;
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
/* Function return value location for ARM EABI.
|
||||
Copyright (C) 2009 Red Hat, Inc.
|
||||
This file is part of Red Hat elfutils.
|
||||
|
||||
Red Hat elfutils is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; version 2 of the License.
|
||||
|
||||
Red Hat 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 a copy of the GNU General Public License along
|
||||
with Red Hat elfutils; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
|
||||
|
||||
Red Hat elfutils is an included package of the Open Invention Network.
|
||||
An included package of the Open Invention Network is a package for which
|
||||
Open Invention Network licensees cross-license their patents. No patent
|
||||
license is granted, either expressly or impliedly, by designation as an
|
||||
included package. Should you wish to participate in the Open Invention
|
||||
Network licensing program, please visit www.openinventionnetwork.com
|
||||
<http://www.openinventionnetwork.com>. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <dwarf.h>
|
||||
|
||||
#define BACKEND arm_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
|
||||
/* r0, or pair r0, r1, or aggregate up to r0-r3. */
|
||||
static const Dwarf_Op loc_intreg[] =
|
||||
{
|
||||
{ .atom = DW_OP_reg0 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
{ .atom = DW_OP_reg1 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
{ .atom = DW_OP_reg2 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
{ .atom = DW_OP_reg3 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
};
|
||||
#define nloc_intreg 1
|
||||
#define nloc_intregs(n) (2 * (n))
|
||||
|
||||
/* 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
|
||||
arm_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 = 4;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
if (size <= 16)
|
||||
{
|
||||
intreg:
|
||||
*locp = loc_intreg;
|
||||
return size <= 4 ? nloc_intreg : nloc_intregs ((size + 3) / 4);
|
||||
}
|
||||
|
||||
aggregate:
|
||||
*locp = loc_aggregate;
|
||||
return nloc_aggregate;
|
||||
|
||||
case DW_TAG_structure_type:
|
||||
case DW_TAG_class_type:
|
||||
case DW_TAG_union_type:
|
||||
case DW_TAG_array_type:
|
||||
if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size,
|
||||
&attr_mem), &size) == 0
|
||||
&& size > 0 && size <= 4)
|
||||
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;
|
||||
}
|
||||
+71
-2
@@ -1,7 +1,6 @@
|
||||
/* Arm specific symbolic name handling.
|
||||
Copyright (C) 2002, 2005 Red Hat, Inc.
|
||||
Copyright (C) 2002-2009 Red Hat, Inc.
|
||||
This file is part of Red Hat elfutils.
|
||||
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
|
||||
|
||||
Red Hat elfutils is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by the
|
||||
@@ -34,6 +33,76 @@
|
||||
#define BACKEND arm_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
|
||||
const char *
|
||||
arm_segment_type_name (int segment, char *buf __attribute__ ((unused)),
|
||||
size_t len __attribute__ ((unused)))
|
||||
{
|
||||
switch (segment)
|
||||
{
|
||||
case PT_ARM_EXIDX:
|
||||
return "ARM_EXIDX";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Return symbolic representation of section type. */
|
||||
const char *
|
||||
arm_section_type_name (int type,
|
||||
char *buf __attribute__ ((unused)),
|
||||
size_t len __attribute__ ((unused)))
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SHT_ARM_EXIDX:
|
||||
return "ARM_EXIDX";
|
||||
case SHT_ARM_PREEMPTMAP:
|
||||
return "ARM_PREEMPTMAP";
|
||||
case SHT_ARM_ATTRIBUTES:
|
||||
return "ARM_ATTRIBUTES";
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Check whether machine flags are valid. */
|
||||
bool
|
||||
arm_machine_flag_check (GElf_Word flags)
|
||||
{
|
||||
switch (flags & EF_ARM_EABIMASK)
|
||||
{
|
||||
case EF_ARM_EABI_UNKNOWN:
|
||||
case EF_ARM_EABI_VER1:
|
||||
case EF_ARM_EABI_VER2:
|
||||
case EF_ARM_EABI_VER3:
|
||||
case EF_ARM_EABI_VER4:
|
||||
case EF_ARM_EABI_VER5:
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((flags &~ (EF_ARM_EABIMASK
|
||||
| EF_ARM_RELEXEC
|
||||
| EF_ARM_HASENTRY
|
||||
| EF_ARM_INTERWORK
|
||||
| EF_ARM_APCS_26
|
||||
| EF_ARM_APCS_FLOAT
|
||||
| EF_ARM_PIC
|
||||
| EF_ARM_ALIGN8
|
||||
| EF_ARM_NEW_ABI
|
||||
| EF_ARM_OLD_ABI
|
||||
| EF_ARM_SOFT_FLOAT
|
||||
| EF_ARM_VFP_FLOAT
|
||||
| EF_ARM_MAVERICK_FLOAT
|
||||
| EF_ARM_SYMSARESORTED
|
||||
| EF_ARM_DYNSYMSUSESEGIDX
|
||||
| EF_ARM_MAPSYMSFIRST
|
||||
| EF_ARM_EABIMASK
|
||||
| EF_ARM_BE8
|
||||
| EF_ARM_LE8)) == 0);
|
||||
}
|
||||
|
||||
/* Check for the simple reloc types. */
|
||||
Elf_Type
|
||||
arm_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* IA-64 specific symbolic name handling.
|
||||
Copyright (C) 2002, 2003, 2005, 2006, 2007 Red Hat, Inc.
|
||||
Copyright (C) 2002-2009 Red Hat, Inc.
|
||||
This file is part of Red Hat elfutils.
|
||||
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
|
||||
|
||||
@@ -102,9 +102,9 @@ ia64_section_type_name (int type,
|
||||
switch (type)
|
||||
{
|
||||
case SHT_IA_64_EXT:
|
||||
return "SHT_IA_64_EXT";
|
||||
return "IA_64_EXT";
|
||||
case SHT_IA_64_UNWIND:
|
||||
return "SHT_IA_64_UNWIND";
|
||||
return "IA_64_UNWIND";
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2009-04-14 Roland McGrath <roland@redhat.com>
|
||||
|
||||
* Makefile.am (AM_CFLAGS): Add -fdollars-in-identifiers; it is not the
|
||||
default on every machine.
|
||||
|
||||
2009-01-23 Roland McGrath <roland@redhat.com>
|
||||
|
||||
* Makefile.am (i386_parse_CFLAGS): Use quotes around command
|
||||
|
||||
@@ -31,6 +31,7 @@ else
|
||||
AM_CFLAGS =
|
||||
endif
|
||||
AM_CFLAGS += -Wall -Wshadow -Wunused -Wextra -std=gnu99 -fpic \
|
||||
-fdollars-in-identifiers \
|
||||
$($(*F)_CFLAGS) \
|
||||
$(if $($(*F)_no_Werror),,-Werror)
|
||||
INCLUDES = -I$(srcdir) -I$(srcdir)/../lib -I$(srcdir)/../libelf \
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
2009-04-14 Roland McGrath <roland@redhat.com>
|
||||
|
||||
* elf.h: Update from glibc.
|
||||
|
||||
2009-04-01 Roland McGrath <roland@redhat.com>
|
||||
|
||||
* elf.h: Update from glibc.
|
||||
|
||||
+42
-22
@@ -2205,42 +2205,62 @@ typedef Elf32_Addr Elf32_Conflict;
|
||||
/* ARM specific declarations */
|
||||
|
||||
/* Processor specific flags for the ELF header e_flags field. */
|
||||
#define EF_ARM_RELEXEC 0x01
|
||||
#define EF_ARM_HASENTRY 0x02
|
||||
#define EF_ARM_INTERWORK 0x04
|
||||
#define EF_ARM_APCS_26 0x08
|
||||
#define EF_ARM_APCS_FLOAT 0x10
|
||||
#define EF_ARM_PIC 0x20
|
||||
#define EF_ARM_ALIGN8 0x40 /* 8-bit structure alignment is in use */
|
||||
#define EF_ARM_NEW_ABI 0x80
|
||||
#define EF_ARM_OLD_ABI 0x100
|
||||
#define EF_ARM_RELEXEC 0x01
|
||||
#define EF_ARM_HASENTRY 0x02
|
||||
#define EF_ARM_INTERWORK 0x04
|
||||
#define EF_ARM_APCS_26 0x08
|
||||
#define EF_ARM_APCS_FLOAT 0x10
|
||||
#define EF_ARM_PIC 0x20
|
||||
#define EF_ARM_ALIGN8 0x40 /* 8-bit structure alignment is in use */
|
||||
#define EF_ARM_NEW_ABI 0x80
|
||||
#define EF_ARM_OLD_ABI 0x100
|
||||
#define EF_ARM_SOFT_FLOAT 0x200
|
||||
#define EF_ARM_VFP_FLOAT 0x400
|
||||
#define EF_ARM_MAVERICK_FLOAT 0x800
|
||||
|
||||
|
||||
/* Other constants defined in the ARM ELF spec. version B-01. */
|
||||
/* NB. These conflict with values defined above. */
|
||||
#define EF_ARM_SYMSARESORTED 0x04
|
||||
#define EF_ARM_DYNSYMSUSESEGIDX 0x08
|
||||
#define EF_ARM_DYNSYMSUSESEGIDX 0x08
|
||||
#define EF_ARM_MAPSYMSFIRST 0x10
|
||||
#define EF_ARM_EABIMASK 0XFF000000
|
||||
|
||||
#define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK)
|
||||
#define EF_ARM_EABI_UNKNOWN 0x00000000
|
||||
#define EF_ARM_EABI_VER1 0x01000000
|
||||
#define EF_ARM_EABI_VER2 0x02000000
|
||||
/* Constants defined in AAELF. */
|
||||
#define EF_ARM_BE8 0x00800000
|
||||
#define EF_ARM_LE8 0x00400000
|
||||
|
||||
/* Additional symbol types for Thumb */
|
||||
#define STT_ARM_TFUNC 0xd
|
||||
#define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK)
|
||||
#define EF_ARM_EABI_UNKNOWN 0x00000000
|
||||
#define EF_ARM_EABI_VER1 0x01000000
|
||||
#define EF_ARM_EABI_VER2 0x02000000
|
||||
#define EF_ARM_EABI_VER3 0x03000000
|
||||
#define EF_ARM_EABI_VER4 0x04000000
|
||||
#define EF_ARM_EABI_VER5 0x05000000
|
||||
|
||||
/* Additional symbol types for Thumb. */
|
||||
#define STT_ARM_TFUNC STT_LOPROC /* A Thumb function. */
|
||||
#define STT_ARM_16BIT STT_HIPROC /* A Thumb label. */
|
||||
|
||||
/* ARM-specific values for sh_flags */
|
||||
#define SHF_ARM_ENTRYSECT 0x10000000 /* Section contains an entry point */
|
||||
#define SHF_ARM_COMDEF 0x80000000 /* Section may be multiply defined
|
||||
in the input to a link step */
|
||||
#define SHF_ARM_ENTRYSECT 0x10000000 /* Section contains an entry point */
|
||||
#define SHF_ARM_COMDEF 0x80000000 /* Section may be multiply defined
|
||||
in the input to a link step. */
|
||||
|
||||
/* ARM-specific program header flags */
|
||||
#define PF_ARM_SB 0x10000000 /* Segment contains the location
|
||||
addressed by the static base */
|
||||
#define PF_ARM_SB 0x10000000 /* Segment contains the location
|
||||
addressed by the static base. */
|
||||
#define PF_ARM_PI 0x20000000 /* Position-independent segment. */
|
||||
#define PF_ARM_ABS 0x40000000 /* Absolute segment. */
|
||||
|
||||
/* Processor specific values for the Phdr p_type field. */
|
||||
#define PT_ARM_EXIDX 0x70000001 /* .ARM.exidx segment */
|
||||
#define PT_ARM_EXIDX (PT_LOPROC + 1) /* ARM unwind segment. */
|
||||
|
||||
/* Processor specific values for the Shdr sh_type field. */
|
||||
#define SHT_ARM_EXIDX (SHT_LOPROC + 1) /* ARM unwind section. */
|
||||
#define SHT_ARM_PREEMPTMAP (SHT_LOPROC + 2) /* Preemption details. */
|
||||
#define SHT_ARM_ATTRIBUTES (SHT_LOPROC + 3) /* ARM attributes section. */
|
||||
|
||||
|
||||
/* ARM relocs. */
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
2009-04-14 Roland McGrath <roland@redhat.com>
|
||||
|
||||
* readelf.c (print_attributes): Treat SHT_ARM_ATTRIBUTES on EM_ARM
|
||||
like SHT_GNU_ATTRIBUTES.
|
||||
|
||||
* readelf.c (handle_core_registers): Fix error message.
|
||||
|
||||
* strip.c (handle_elf: check_preserved): Don't note any change when
|
||||
|
||||
+6
-3
@@ -2824,7 +2824,9 @@ print_attributes (Ebl *ebl, const GElf_Ehdr *ehdr)
|
||||
GElf_Shdr shdr_mem;
|
||||
GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
|
||||
|
||||
if (shdr == NULL || shdr->sh_type != SHT_GNU_ATTRIBUTES)
|
||||
if (shdr == NULL || (shdr->sh_type != SHT_GNU_ATTRIBUTES
|
||||
&& (shdr->sh_type != SHT_ARM_ATTRIBUTES
|
||||
|| ehdr->e_machine != EM_ARM)))
|
||||
continue;
|
||||
|
||||
printf (gettext ("\
|
||||
@@ -2871,8 +2873,9 @@ print_attributes (Ebl *ebl, const GElf_Ehdr *ehdr)
|
||||
|
||||
printf (gettext (" %-13s %4" PRIu32 "\n"), name, len);
|
||||
|
||||
if (q - name == sizeof "gnu"
|
||||
&& !memcmp (name, "gnu", sizeof "gnu"))
|
||||
if (shdr->sh_type != SHT_GNU_ATTRIBUTES
|
||||
|| (q - name == sizeof "gnu"
|
||||
&& !memcmp (name, "gnu", sizeof "gnu")))
|
||||
while (q < p)
|
||||
{
|
||||
const unsigned char *const sub = q;
|
||||
|
||||
Reference in New Issue
Block a user