mirror of
https://git.yoctoproject.org/poky
synced 2026-07-26 07:07:08 +00:00
elfutils: 0.162 -> 0.163
(From OE-Core rev: cb8fc7521cdaaa7b8f82a0c6dfc6526778c99099) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
d32b383c3a
commit
f9ac3f3e20
+35
@@ -0,0 +1,35 @@
|
||||
From 668accf322fd7185e273bfd50b84320e71d9de5a Mon Sep 17 00:00:00 2001
|
||||
From: Martin Jansa <Martin.Jansa@gmail.com>
|
||||
Date: Fri, 10 Apr 2015 00:29:18 +0200
|
||||
Subject: [PATCH] elf_getarsym: Silence -Werror=maybe-uninitialized false
|
||||
positive
|
||||
|
||||
Upstream-Status: Pending
|
||||
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
|
||||
---
|
||||
libelf/elf_getarsym.c | 9 +++++++--
|
||||
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libelf/elf_getarsym.c b/libelf/elf_getarsym.c
|
||||
index d0bb28a..08954d2 100644
|
||||
--- a/libelf/elf_getarsym.c
|
||||
+++ b/libelf/elf_getarsym.c
|
||||
@@ -165,8 +165,13 @@ elf_getarsym (elf, ptr)
|
||||
int w = index64_p ? 8 : 4;
|
||||
|
||||
/* We have an archive. The first word in there is the number of
|
||||
- entries in the table. */
|
||||
- uint64_t n;
|
||||
+ entries in the table.
|
||||
+ Set to SIZE_MAX just to silence -Werror=maybe-uninitialized
|
||||
+ elf_getarsym.c:290:9: error: 'n' may be used uninitialized in this function
|
||||
+ The read_number_entries function doesn't initialize n only when returning
|
||||
+ -1 which in turn ensures to jump over usage of this uninitialized variable.
|
||||
+ */
|
||||
+ uint64_t n = SIZE_MAX;
|
||||
size_t off = elf->start_offset + SARMAG + sizeof (struct ar_hdr);
|
||||
if (read_number_entries (&n, elf, &off, index64_p) < 0)
|
||||
{
|
||||
--
|
||||
2.3.5
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
Disable the test to convert euc-jp
|
||||
|
||||
Remove the test "Test against HP-UX 11.11 bug:
|
||||
No converter from EUC-JP to UTF-8 is provided"
|
||||
since we don't support HP-UX and if the euc-jp is not
|
||||
installed on the host, the dependence will be built without
|
||||
iconv support and will cause guild-native building fail.
|
||||
|
||||
Upstream-Status: Inappropriate [OE specific]
|
||||
|
||||
Signed-off-by: Roy Li <rongqing.li@windriver.com>
|
||||
---
|
||||
m4/iconv.m4 | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/m4/iconv.m4 b/m4/iconv.m4
|
||||
index a503646..299f1eb 100644
|
||||
--- a/m4/iconv.m4
|
||||
+++ b/m4/iconv.m4
|
||||
@@ -159,6 +159,7 @@ int main ()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
+#if 0
|
||||
/* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
|
||||
provided. */
|
||||
if (/* Try standardized names. */
|
||||
@@ -170,6 +171,7 @@ int main ()
|
||||
/* Try HP-UX names. */
|
||||
&& iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
|
||||
result |= 16;
|
||||
+#endif
|
||||
return result;
|
||||
}]])],
|
||||
[am_cv_func_iconv_works=yes],
|
||||
--
|
||||
2.0.1
|
||||
|
||||
@@ -0,0 +1,625 @@
|
||||
From 0db1687eee0b4d16ccbc40db5a06b574fca6614c Mon Sep 17 00:00:00 2001
|
||||
From: Hongxu Jia <hongxu.jia@windriver.com>
|
||||
Date: Fri, 14 Nov 2014 15:25:42 +0800
|
||||
Subject: [PATCH] Rebase arm_backend.diff from 0.159 to 0.160
|
||||
|
||||
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
|
||||
---
|
||||
backends/arm_init.c | 18 ++++-
|
||||
backends/arm_regs.c | 132 ++++++++++++++++++++++++++++++++++++
|
||||
backends/arm_retval.c | 44 +++++++++++-
|
||||
backends/libebl_arm.h | 9 +++
|
||||
libelf/elf.h | 11 +++
|
||||
tests/run-addrcfi.sh | 93 ++++++++++++++++++++++++-
|
||||
tests/run-allregs.sh | 95 +++++++++++++++++++++++++-
|
||||
tests/run-readelf-mixed-corenote.sh | 11 ++-
|
||||
8 files changed, 401 insertions(+), 12 deletions(-)
|
||||
create mode 100644 backends/libebl_arm.h
|
||||
|
||||
diff --git a/backends/arm_init.c b/backends/arm_init.c
|
||||
index 3283c97..8b57d3f 100644
|
||||
--- a/backends/arm_init.c
|
||||
+++ b/backends/arm_init.c
|
||||
@@ -35,21 +35,32 @@
|
||||
#define RELOC_PREFIX R_ARM_
|
||||
#include "libebl_CPU.h"
|
||||
|
||||
+#include "libebl_arm.h"
|
||||
+
|
||||
/* This defines the common reloc hooks based on arm_reloc.def. */
|
||||
#include "common-reloc.c"
|
||||
|
||||
|
||||
const char *
|
||||
arm_init (elf, machine, eh, ehlen)
|
||||
- Elf *elf __attribute__ ((unused));
|
||||
+ Elf *elf;
|
||||
GElf_Half machine __attribute__ ((unused));
|
||||
Ebl *eh;
|
||||
size_t ehlen;
|
||||
{
|
||||
+ int soft_float = 0;
|
||||
+
|
||||
/* Check whether the Elf_BH object has a sufficent size. */
|
||||
if (ehlen < sizeof (Ebl))
|
||||
return NULL;
|
||||
|
||||
+ if (elf) {
|
||||
+ GElf_Ehdr ehdr_mem;
|
||||
+ GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem);
|
||||
+ if (ehdr && (ehdr->e_flags & EF_ARM_SOFT_FLOAT))
|
||||
+ soft_float = 1;
|
||||
+ }
|
||||
+
|
||||
/* We handle it. */
|
||||
eh->name = "ARM";
|
||||
arm_init_reloc (eh);
|
||||
@@ -61,7 +72,10 @@ arm_init (elf, machine, eh, ehlen)
|
||||
HOOK (eh, core_note);
|
||||
HOOK (eh, auxv_info);
|
||||
HOOK (eh, check_object_attribute);
|
||||
- HOOK (eh, return_value_location);
|
||||
+ if (soft_float)
|
||||
+ eh->return_value_location = arm_return_value_location_soft;
|
||||
+ else
|
||||
+ eh->return_value_location = arm_return_value_location_hard;
|
||||
HOOK (eh, abi_cfi);
|
||||
HOOK (eh, check_reloc_target_type);
|
||||
|
||||
diff --git a/backends/arm_regs.c b/backends/arm_regs.c
|
||||
index 21c5ad3..4ee1039 100644
|
||||
--- a/backends/arm_regs.c
|
||||
+++ b/backends/arm_regs.c
|
||||
@@ -31,6 +31,7 @@
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
+#include <stdio.h>
|
||||
#include <dwarf.h>
|
||||
|
||||
#define BACKEND arm_
|
||||
@@ -76,6 +77,9 @@ arm_register_info (Ebl *ebl __attribute__ ((unused)),
|
||||
break;
|
||||
|
||||
case 16 + 0 ... 16 + 7:
|
||||
+ /* AADWARF says that there are no registers in that range,
|
||||
+ * but gcc maps FPA registers here
|
||||
+ */
|
||||
regno += 96 - 16;
|
||||
/* Fall through. */
|
||||
case 96 + 0 ... 96 + 7:
|
||||
@@ -87,11 +91,139 @@ arm_register_info (Ebl *ebl __attribute__ ((unused)),
|
||||
namelen = 2;
|
||||
break;
|
||||
|
||||
+ case 64 + 0 ... 64 + 9:
|
||||
+ *setname = "VFP";
|
||||
+ *bits = 32;
|
||||
+ *type = DW_ATE_float;
|
||||
+ name[0] = 's';
|
||||
+ name[1] = regno - 64 + '0';
|
||||
+ namelen = 2;
|
||||
+ break;
|
||||
+
|
||||
+ case 64 + 10 ... 64 + 31:
|
||||
+ *setname = "VFP";
|
||||
+ *bits = 32;
|
||||
+ *type = DW_ATE_float;
|
||||
+ name[0] = 's';
|
||||
+ name[1] = (regno - 64) / 10 + '0';
|
||||
+ name[2] = (regno - 64) % 10 + '0';
|
||||
+ namelen = 3;
|
||||
+ break;
|
||||
+
|
||||
+ case 104 + 0 ... 104 + 7:
|
||||
+ /* XXX TODO:
|
||||
+ * This can be either intel wireless MMX general purpose/control
|
||||
+ * registers or xscale accumulator, which have different usage.
|
||||
+ * We only have the intel wireless MMX here now.
|
||||
+ * The name needs to be changed for the xscale accumulator too. */
|
||||
+ *setname = "MMX";
|
||||
+ *type = DW_ATE_unsigned;
|
||||
+ *bits = 32;
|
||||
+ memcpy(name, "wcgr", 4);
|
||||
+ name[4] = regno - 104 + '0';
|
||||
+ namelen = 5;
|
||||
+ break;
|
||||
+
|
||||
+ case 112 + 0 ... 112 + 9:
|
||||
+ *setname = "MMX";
|
||||
+ *type = DW_ATE_unsigned;
|
||||
+ *bits = 64;
|
||||
+ name[0] = 'w';
|
||||
+ name[1] = 'r';
|
||||
+ name[2] = regno - 112 + '0';
|
||||
+ namelen = 3;
|
||||
+ break;
|
||||
+
|
||||
+ case 112 + 10 ... 112 + 15:
|
||||
+ *setname = "MMX";
|
||||
+ *type = DW_ATE_unsigned;
|
||||
+ *bits = 64;
|
||||
+ name[0] = 'w';
|
||||
+ name[1] = 'r';
|
||||
+ name[2] = '1';
|
||||
+ name[3] = regno - 112 - 10 + '0';
|
||||
+ namelen = 4;
|
||||
+ break;
|
||||
+
|
||||
case 128:
|
||||
+ *setname = "state";
|
||||
*type = DW_ATE_unsigned;
|
||||
return stpcpy (name, "spsr") + 1 - name;
|
||||
|
||||
+ case 129:
|
||||
+ *setname = "state";
|
||||
+ *type = DW_ATE_unsigned;
|
||||
+ return stpcpy(name, "spsr_fiq") + 1 - name;
|
||||
+
|
||||
+ case 130:
|
||||
+ *setname = "state";
|
||||
+ *type = DW_ATE_unsigned;
|
||||
+ return stpcpy(name, "spsr_irq") + 1 - name;
|
||||
+
|
||||
+ case 131:
|
||||
+ *setname = "state";
|
||||
+ *type = DW_ATE_unsigned;
|
||||
+ return stpcpy(name, "spsr_abt") + 1 - name;
|
||||
+
|
||||
+ case 132:
|
||||
+ *setname = "state";
|
||||
+ *type = DW_ATE_unsigned;
|
||||
+ return stpcpy(name, "spsr_und") + 1 - name;
|
||||
+
|
||||
+ case 133:
|
||||
+ *setname = "state";
|
||||
+ *type = DW_ATE_unsigned;
|
||||
+ return stpcpy(name, "spsr_svc") + 1 - name;
|
||||
+
|
||||
+ case 144 ... 150:
|
||||
+ *setname = "integer";
|
||||
+ *type = DW_ATE_signed;
|
||||
+ *bits = 32;
|
||||
+ return sprintf(name, "r%d_usr", regno - 144 + 8) + 1;
|
||||
+
|
||||
+ case 151 ... 157:
|
||||
+ *setname = "integer";
|
||||
+ *type = DW_ATE_signed;
|
||||
+ *bits = 32;
|
||||
+ return sprintf(name, "r%d_fiq", regno - 151 + 8) + 1;
|
||||
+
|
||||
+ case 158 ... 159:
|
||||
+ *setname = "integer";
|
||||
+ *type = DW_ATE_signed;
|
||||
+ *bits = 32;
|
||||
+ return sprintf(name, "r%d_irq", regno - 158 + 13) + 1;
|
||||
+
|
||||
+ case 160 ... 161:
|
||||
+ *setname = "integer";
|
||||
+ *type = DW_ATE_signed;
|
||||
+ *bits = 32;
|
||||
+ return sprintf(name, "r%d_abt", regno - 160 + 13) + 1;
|
||||
+
|
||||
+ case 162 ... 163:
|
||||
+ *setname = "integer";
|
||||
+ *type = DW_ATE_signed;
|
||||
+ *bits = 32;
|
||||
+ return sprintf(name, "r%d_und", regno - 162 + 13) + 1;
|
||||
+
|
||||
+ case 164 ... 165:
|
||||
+ *setname = "integer";
|
||||
+ *type = DW_ATE_signed;
|
||||
+ *bits = 32;
|
||||
+ return sprintf(name, "r%d_svc", regno - 164 + 13) + 1;
|
||||
+
|
||||
+ case 192 ... 199:
|
||||
+ *setname = "MMX";
|
||||
+ *bits = 32;
|
||||
+ *type = DW_ATE_unsigned;
|
||||
+ name[0] = 'w';
|
||||
+ name[1] = 'c';
|
||||
+ name[2] = regno - 192 + '0';
|
||||
+ namelen = 3;
|
||||
+ break;
|
||||
+
|
||||
case 256 + 0 ... 256 + 9:
|
||||
+ /* XXX TODO: Neon also uses those registers and can contain
|
||||
+ * both float and integers */
|
||||
*setname = "VFP";
|
||||
*type = DW_ATE_float;
|
||||
*bits = 64;
|
||||
diff --git a/backends/arm_retval.c b/backends/arm_retval.c
|
||||
index 7aced74..052132e 100644
|
||||
--- a/backends/arm_retval.c
|
||||
+++ b/backends/arm_retval.c
|
||||
@@ -48,6 +48,13 @@ static const Dwarf_Op loc_intreg[] =
|
||||
#define nloc_intreg 1
|
||||
#define nloc_intregs(n) (2 * (n))
|
||||
|
||||
+/* f1 */ /* XXX TODO: f0 can also have number 96 if program was compiled with -mabi=aapcs */
|
||||
+static const Dwarf_Op loc_fpreg[] =
|
||||
+ {
|
||||
+ { .atom = DW_OP_reg16 },
|
||||
+ };
|
||||
+#define nloc_fpreg 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. */
|
||||
@@ -58,8 +65,9 @@ static const Dwarf_Op loc_aggregate[] =
|
||||
#define nloc_aggregate 1
|
||||
|
||||
|
||||
-int
|
||||
-arm_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
+static int
|
||||
+arm_return_value_location_ (Dwarf_Die *functypedie, const Dwarf_Op **locp,
|
||||
+ int soft_float)
|
||||
{
|
||||
/* Start with the function's type, and get the DW_AT_type attribute,
|
||||
which is the type of the return value. */
|
||||
@@ -98,14 +106,31 @@ arm_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
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;
|
||||
+
|
||||
+ if ((encoding == DW_ATE_float) && !soft_float)
|
||||
+ {
|
||||
+ *locp = loc_fpreg;
|
||||
+ if (size <= 8)
|
||||
+ return nloc_fpreg;
|
||||
+ goto aggregate;
|
||||
+ }
|
||||
+ }
|
||||
if (size <= 16)
|
||||
{
|
||||
intreg:
|
||||
*locp = loc_intreg;
|
||||
return size <= 4 ? nloc_intreg : nloc_intregs ((size + 3) / 4);
|
||||
}
|
||||
+ /* fall through. */
|
||||
|
||||
aggregate:
|
||||
+ /* XXX TODO sometimes aggregates are returned in r0 (-mabi=aapcs) */
|
||||
*locp = loc_aggregate;
|
||||
return nloc_aggregate;
|
||||
}
|
||||
@@ -125,3 +150,18 @@ arm_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
DWARF and might be valid. */
|
||||
return -2;
|
||||
}
|
||||
+
|
||||
+/* return location for -mabi=apcs-gnu -msoft-float */
|
||||
+int
|
||||
+arm_return_value_location_soft (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
+{
|
||||
+ return arm_return_value_location_ (functypedie, locp, 1);
|
||||
+}
|
||||
+
|
||||
+/* return location for -mabi=apcs-gnu -mhard-float (current default) */
|
||||
+int
|
||||
+arm_return_value_location_hard (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
+{
|
||||
+ return arm_return_value_location_ (functypedie, locp, 0);
|
||||
+}
|
||||
+
|
||||
diff --git a/backends/libebl_arm.h b/backends/libebl_arm.h
|
||||
new file mode 100644
|
||||
index 0000000..c00770c
|
||||
--- /dev/null
|
||||
+++ b/backends/libebl_arm.h
|
||||
@@ -0,0 +1,9 @@
|
||||
+#ifndef _LIBEBL_ARM_H
|
||||
+#define _LIBEBL_ARM_H 1
|
||||
+
|
||||
+#include <libdw.h>
|
||||
+
|
||||
+extern int arm_return_value_location_soft(Dwarf_Die *, const Dwarf_Op **locp);
|
||||
+extern int arm_return_value_location_hard(Dwarf_Die *, const Dwarf_Op **locp);
|
||||
+
|
||||
+#endif
|
||||
diff --git a/libelf/elf.h b/libelf/elf.h
|
||||
index a3cce3e..0891674 100644
|
||||
--- a/libelf/elf.h
|
||||
+++ b/libelf/elf.h
|
||||
@@ -2346,6 +2346,9 @@ typedef Elf32_Addr Elf32_Conflict;
|
||||
#define EF_ARM_EABI_VER4 0x04000000
|
||||
#define EF_ARM_EABI_VER5 0x05000000
|
||||
|
||||
+/* EI_OSABI values */
|
||||
+#define ELFOSABI_ARM_AEABI 64 /* Contains symbol versioning. */
|
||||
+
|
||||
/* Additional symbol types for Thumb. */
|
||||
#define STT_ARM_TFUNC STT_LOPROC /* A Thumb function. */
|
||||
#define STT_ARM_16BIT STT_HIPROC /* A Thumb label. */
|
||||
@@ -2363,12 +2366,19 @@ typedef Elf32_Addr Elf32_Conflict;
|
||||
|
||||
/* Processor specific values for the Phdr p_type field. */
|
||||
#define PT_ARM_EXIDX (PT_LOPROC + 1) /* ARM unwind segment. */
|
||||
+#define PT_ARM_UNWIND PT_ARM_EXIDX
|
||||
|
||||
/* 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. */
|
||||
|
||||
+/* Processor specific values for the Dyn d_tag field. */
|
||||
+#define DT_ARM_RESERVED1 (DT_LOPROC + 0)
|
||||
+#define DT_ARM_SYMTABSZ (DT_LOPROC + 1)
|
||||
+#define DT_ARM_PREEMTMAB (DT_LOPROC + 2)
|
||||
+#define DT_ARM_RESERVED2 (DT_LOPROC + 3)
|
||||
+#define DT_ARM_NUM 4
|
||||
|
||||
/* AArch64 relocs. */
|
||||
|
||||
@@ -2647,6 +2657,7 @@ typedef Elf32_Addr Elf32_Conflict;
|
||||
TLS block (LDR, STR). */
|
||||
#define R_ARM_TLS_IE12GP 111 /* 12 bit GOT entry relative
|
||||
to GOT origin (LDR). */
|
||||
+/* 112 - 127 private range */
|
||||
#define R_ARM_ME_TOO 128 /* Obsolete. */
|
||||
#define R_ARM_THM_TLS_DESCSEQ 129
|
||||
#define R_ARM_THM_TLS_DESCSEQ16 129
|
||||
diff --git a/tests/run-addrcfi.sh b/tests/run-addrcfi.sh
|
||||
index 5d33246..78464a8 100755
|
||||
--- a/tests/run-addrcfi.sh
|
||||
+++ b/tests/run-addrcfi.sh
|
||||
@@ -2530,6 +2530,38 @@ dwarf_cfi_addrframe (.eh_frame): no matching address range
|
||||
FPA reg21 (f5): undefined
|
||||
FPA reg22 (f6): undefined
|
||||
FPA reg23 (f7): undefined
|
||||
+ VFP reg64 (s0): undefined
|
||||
+ VFP reg65 (s1): undefined
|
||||
+ VFP reg66 (s2): undefined
|
||||
+ VFP reg67 (s3): undefined
|
||||
+ VFP reg68 (s4): undefined
|
||||
+ VFP reg69 (s5): undefined
|
||||
+ VFP reg70 (s6): undefined
|
||||
+ VFP reg71 (s7): undefined
|
||||
+ VFP reg72 (s8): undefined
|
||||
+ VFP reg73 (s9): undefined
|
||||
+ VFP reg74 (s10): undefined
|
||||
+ VFP reg75 (s11): undefined
|
||||
+ VFP reg76 (s12): undefined
|
||||
+ VFP reg77 (s13): undefined
|
||||
+ VFP reg78 (s14): undefined
|
||||
+ VFP reg79 (s15): undefined
|
||||
+ VFP reg80 (s16): undefined
|
||||
+ VFP reg81 (s17): undefined
|
||||
+ VFP reg82 (s18): undefined
|
||||
+ VFP reg83 (s19): undefined
|
||||
+ VFP reg84 (s20): undefined
|
||||
+ VFP reg85 (s21): undefined
|
||||
+ VFP reg86 (s22): undefined
|
||||
+ VFP reg87 (s23): undefined
|
||||
+ VFP reg88 (s24): undefined
|
||||
+ VFP reg89 (s25): undefined
|
||||
+ VFP reg90 (s26): undefined
|
||||
+ VFP reg91 (s27): undefined
|
||||
+ VFP reg92 (s28): undefined
|
||||
+ VFP reg93 (s29): undefined
|
||||
+ VFP reg94 (s30): undefined
|
||||
+ VFP reg95 (s31): undefined
|
||||
FPA reg96 (f0): undefined
|
||||
FPA reg97 (f1): undefined
|
||||
FPA reg98 (f2): undefined
|
||||
@@ -2538,7 +2570,66 @@ dwarf_cfi_addrframe (.eh_frame): no matching address range
|
||||
FPA reg101 (f5): undefined
|
||||
FPA reg102 (f6): undefined
|
||||
FPA reg103 (f7): undefined
|
||||
- integer reg128 (spsr): undefined
|
||||
+ MMX reg104 (wcgr0): undefined
|
||||
+ MMX reg105 (wcgr1): undefined
|
||||
+ MMX reg106 (wcgr2): undefined
|
||||
+ MMX reg107 (wcgr3): undefined
|
||||
+ MMX reg108 (wcgr4): undefined
|
||||
+ MMX reg109 (wcgr5): undefined
|
||||
+ MMX reg110 (wcgr6): undefined
|
||||
+ MMX reg111 (wcgr7): undefined
|
||||
+ MMX reg112 (wr0): undefined
|
||||
+ MMX reg113 (wr1): undefined
|
||||
+ MMX reg114 (wr2): undefined
|
||||
+ MMX reg115 (wr3): undefined
|
||||
+ MMX reg116 (wr4): undefined
|
||||
+ MMX reg117 (wr5): undefined
|
||||
+ MMX reg118 (wr6): undefined
|
||||
+ MMX reg119 (wr7): undefined
|
||||
+ MMX reg120 (wr8): undefined
|
||||
+ MMX reg121 (wr9): undefined
|
||||
+ MMX reg122 (wr10): undefined
|
||||
+ MMX reg123 (wr11): undefined
|
||||
+ MMX reg124 (wr12): undefined
|
||||
+ MMX reg125 (wr13): undefined
|
||||
+ MMX reg126 (wr14): undefined
|
||||
+ MMX reg127 (wr15): undefined
|
||||
+ state reg128 (spsr): undefined
|
||||
+ state reg129 (spsr_fiq): undefined
|
||||
+ state reg130 (spsr_irq): undefined
|
||||
+ state reg131 (spsr_abt): undefined
|
||||
+ state reg132 (spsr_und): undefined
|
||||
+ state reg133 (spsr_svc): undefined
|
||||
+ integer reg144 (r8_usr): undefined
|
||||
+ integer reg145 (r9_usr): undefined
|
||||
+ integer reg146 (r10_usr): undefined
|
||||
+ integer reg147 (r11_usr): undefined
|
||||
+ integer reg148 (r12_usr): undefined
|
||||
+ integer reg149 (r13_usr): undefined
|
||||
+ integer reg150 (r14_usr): undefined
|
||||
+ integer reg151 (r8_fiq): undefined
|
||||
+ integer reg152 (r9_fiq): undefined
|
||||
+ integer reg153 (r10_fiq): undefined
|
||||
+ integer reg154 (r11_fiq): undefined
|
||||
+ integer reg155 (r12_fiq): undefined
|
||||
+ integer reg156 (r13_fiq): undefined
|
||||
+ integer reg157 (r14_fiq): undefined
|
||||
+ integer reg158 (r13_irq): undefined
|
||||
+ integer reg159 (r14_irq): undefined
|
||||
+ integer reg160 (r13_abt): undefined
|
||||
+ integer reg161 (r14_abt): undefined
|
||||
+ integer reg162 (r13_und): undefined
|
||||
+ integer reg163 (r14_und): undefined
|
||||
+ integer reg164 (r13_svc): undefined
|
||||
+ integer reg165 (r14_svc): undefined
|
||||
+ MMX reg192 (wc0): undefined
|
||||
+ MMX reg193 (wc1): undefined
|
||||
+ MMX reg194 (wc2): undefined
|
||||
+ MMX reg195 (wc3): undefined
|
||||
+ MMX reg196 (wc4): undefined
|
||||
+ MMX reg197 (wc5): undefined
|
||||
+ MMX reg198 (wc6): undefined
|
||||
+ MMX reg199 (wc7): undefined
|
||||
VFP reg256 (d0): undefined
|
||||
VFP reg257 (d1): undefined
|
||||
VFP reg258 (d2): undefined
|
||||
diff --git a/tests/run-allregs.sh b/tests/run-allregs.sh
|
||||
index 6f3862e..13557d5 100755
|
||||
--- a/tests/run-allregs.sh
|
||||
+++ b/tests/run-allregs.sh
|
||||
@@ -2671,7 +2671,28 @@ integer registers:
|
||||
13: sp (sp), address 32 bits
|
||||
14: lr (lr), address 32 bits
|
||||
15: pc (pc), address 32 bits
|
||||
- 128: spsr (spsr), unsigned 32 bits
|
||||
+ 144: r8_usr (r8_usr), signed 32 bits
|
||||
+ 145: r9_usr (r9_usr), signed 32 bits
|
||||
+ 146: r10_usr (r10_usr), signed 32 bits
|
||||
+ 147: r11_usr (r11_usr), signed 32 bits
|
||||
+ 148: r12_usr (r12_usr), signed 32 bits
|
||||
+ 149: r13_usr (r13_usr), signed 32 bits
|
||||
+ 150: r14_usr (r14_usr), signed 32 bits
|
||||
+ 151: r8_fiq (r8_fiq), signed 32 bits
|
||||
+ 152: r9_fiq (r9_fiq), signed 32 bits
|
||||
+ 153: r10_fiq (r10_fiq), signed 32 bits
|
||||
+ 154: r11_fiq (r11_fiq), signed 32 bits
|
||||
+ 155: r12_fiq (r12_fiq), signed 32 bits
|
||||
+ 156: r13_fiq (r13_fiq), signed 32 bits
|
||||
+ 157: r14_fiq (r14_fiq), signed 32 bits
|
||||
+ 158: r13_irq (r13_irq), signed 32 bits
|
||||
+ 159: r14_irq (r14_irq), signed 32 bits
|
||||
+ 160: r13_abt (r13_abt), signed 32 bits
|
||||
+ 161: r14_abt (r14_abt), signed 32 bits
|
||||
+ 162: r13_und (r13_und), signed 32 bits
|
||||
+ 163: r14_und (r14_und), signed 32 bits
|
||||
+ 164: r13_svc (r13_svc), signed 32 bits
|
||||
+ 165: r14_svc (r14_svc), signed 32 bits
|
||||
FPA registers:
|
||||
16: f0 (f0), float 96 bits
|
||||
17: f1 (f1), float 96 bits
|
||||
@@ -2689,7 +2710,72 @@ FPA registers:
|
||||
101: f5 (f5), float 96 bits
|
||||
102: f6 (f6), float 96 bits
|
||||
103: f7 (f7), float 96 bits
|
||||
+MMX registers:
|
||||
+ 104: wcgr0 (wcgr0), unsigned 32 bits
|
||||
+ 105: wcgr1 (wcgr1), unsigned 32 bits
|
||||
+ 106: wcgr2 (wcgr2), unsigned 32 bits
|
||||
+ 107: wcgr3 (wcgr3), unsigned 32 bits
|
||||
+ 108: wcgr4 (wcgr4), unsigned 32 bits
|
||||
+ 109: wcgr5 (wcgr5), unsigned 32 bits
|
||||
+ 110: wcgr6 (wcgr6), unsigned 32 bits
|
||||
+ 111: wcgr7 (wcgr7), unsigned 32 bits
|
||||
+ 112: wr0 (wr0), unsigned 64 bits
|
||||
+ 113: wr1 (wr1), unsigned 64 bits
|
||||
+ 114: wr2 (wr2), unsigned 64 bits
|
||||
+ 115: wr3 (wr3), unsigned 64 bits
|
||||
+ 116: wr4 (wr4), unsigned 64 bits
|
||||
+ 117: wr5 (wr5), unsigned 64 bits
|
||||
+ 118: wr6 (wr6), unsigned 64 bits
|
||||
+ 119: wr7 (wr7), unsigned 64 bits
|
||||
+ 120: wr8 (wr8), unsigned 64 bits
|
||||
+ 121: wr9 (wr9), unsigned 64 bits
|
||||
+ 122: wr10 (wr10), unsigned 64 bits
|
||||
+ 123: wr11 (wr11), unsigned 64 bits
|
||||
+ 124: wr12 (wr12), unsigned 64 bits
|
||||
+ 125: wr13 (wr13), unsigned 64 bits
|
||||
+ 126: wr14 (wr14), unsigned 64 bits
|
||||
+ 127: wr15 (wr15), unsigned 64 bits
|
||||
+ 192: wc0 (wc0), unsigned 32 bits
|
||||
+ 193: wc1 (wc1), unsigned 32 bits
|
||||
+ 194: wc2 (wc2), unsigned 32 bits
|
||||
+ 195: wc3 (wc3), unsigned 32 bits
|
||||
+ 196: wc4 (wc4), unsigned 32 bits
|
||||
+ 197: wc5 (wc5), unsigned 32 bits
|
||||
+ 198: wc6 (wc6), unsigned 32 bits
|
||||
+ 199: wc7 (wc7), unsigned 32 bits
|
||||
VFP registers:
|
||||
+ 64: s0 (s0), float 32 bits
|
||||
+ 65: s1 (s1), float 32 bits
|
||||
+ 66: s2 (s2), float 32 bits
|
||||
+ 67: s3 (s3), float 32 bits
|
||||
+ 68: s4 (s4), float 32 bits
|
||||
+ 69: s5 (s5), float 32 bits
|
||||
+ 70: s6 (s6), float 32 bits
|
||||
+ 71: s7 (s7), float 32 bits
|
||||
+ 72: s8 (s8), float 32 bits
|
||||
+ 73: s9 (s9), float 32 bits
|
||||
+ 74: s10 (s10), float 32 bits
|
||||
+ 75: s11 (s11), float 32 bits
|
||||
+ 76: s12 (s12), float 32 bits
|
||||
+ 77: s13 (s13), float 32 bits
|
||||
+ 78: s14 (s14), float 32 bits
|
||||
+ 79: s15 (s15), float 32 bits
|
||||
+ 80: s16 (s16), float 32 bits
|
||||
+ 81: s17 (s17), float 32 bits
|
||||
+ 82: s18 (s18), float 32 bits
|
||||
+ 83: s19 (s19), float 32 bits
|
||||
+ 84: s20 (s20), float 32 bits
|
||||
+ 85: s21 (s21), float 32 bits
|
||||
+ 86: s22 (s22), float 32 bits
|
||||
+ 87: s23 (s23), float 32 bits
|
||||
+ 88: s24 (s24), float 32 bits
|
||||
+ 89: s25 (s25), float 32 bits
|
||||
+ 90: s26 (s26), float 32 bits
|
||||
+ 91: s27 (s27), float 32 bits
|
||||
+ 92: s28 (s28), float 32 bits
|
||||
+ 93: s29 (s29), float 32 bits
|
||||
+ 94: s30 (s30), float 32 bits
|
||||
+ 95: s31 (s31), float 32 bits
|
||||
256: d0 (d0), float 64 bits
|
||||
257: d1 (d1), float 64 bits
|
||||
258: d2 (d2), float 64 bits
|
||||
@@ -2722,6 +2808,13 @@ VFP registers:
|
||||
285: d29 (d29), float 64 bits
|
||||
286: d30 (d30), float 64 bits
|
||||
287: d31 (d31), float 64 bits
|
||||
+state registers:
|
||||
+ 128: spsr (spsr), unsigned 32 bits
|
||||
+ 129: spsr_fiq (spsr_fiq), unsigned 32 bits
|
||||
+ 130: spsr_irq (spsr_irq), unsigned 32 bits
|
||||
+ 131: spsr_abt (spsr_abt), unsigned 32 bits
|
||||
+ 132: spsr_und (spsr_und), unsigned 32 bits
|
||||
+ 133: spsr_svc (spsr_svc), unsigned 32 bits
|
||||
EOF
|
||||
|
||||
# See run-readelf-mixed-corenote.sh for instructions to regenerate
|
||||
diff --git a/tests/run-readelf-mixed-corenote.sh b/tests/run-readelf-mixed-corenote.sh
|
||||
index 01e4594..9a8a380 100755
|
||||
--- a/tests/run-readelf-mixed-corenote.sh
|
||||
+++ b/tests/run-readelf-mixed-corenote.sh
|
||||
@@ -30,12 +30,11 @@ Note segment of 892 bytes at offset 0x274:
|
||||
pid: 11087, ppid: 11063, pgrp: 11087, sid: 11063
|
||||
utime: 0.000000, stime: 0.010000, cutime: 0.000000, cstime: 0.000000
|
||||
orig_r0: -1, fpvalid: 1
|
||||
- r0: 1 r1: -1091672508 r2: -1091672500
|
||||
- r3: 0 r4: 0 r5: 0
|
||||
- r6: 33728 r7: 0 r8: 0
|
||||
- r9: 0 r10: -1225703496 r11: -1091672844
|
||||
- r12: 0 sp: 0xbeee64f4 lr: 0xb6dc3f48
|
||||
- pc: 0x00008500 spsr: 0x60000010
|
||||
+ r0: 1 r1: -1091672508 r2: -1091672500 r3: 0
|
||||
+ r4: 0 r5: 0 r6: 33728 r7: 0
|
||||
+ r8: 0 r9: 0 r10: -1225703496 r11: -1091672844
|
||||
+ r12: 0 sp: 0xbeee64f4 lr: 0xb6dc3f48 pc: 0x00008500
|
||||
+ spsr: 0x60000010
|
||||
CORE 124 PRPSINFO
|
||||
state: 0, sname: R, zomb: 0, nice: 0, flag: 0x00400500
|
||||
uid: 0, gid: 0, pid: 11087, ppid: 11063, pgrp: 11087, sid: 11063
|
||||
--
|
||||
1.9.1
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
From: Mark Wielaard <mjw@redhat.com>
|
||||
Date: Sun, 15 Jun 2014 11:30:35 +0200
|
||||
Subject: libebl: Add sym_func_value hook.
|
||||
|
||||
The ARM EABI says that the zero bit of function symbol st_value indicates
|
||||
whether the symbol points to a THUMB or ARM function. Add a new ebl hook
|
||||
to adjust the st_value in such a case so that we get the actual value that
|
||||
the symbol points to. It isn't easily possible to reuse the existing
|
||||
resolve_sym_value for this purpose, so we end up with another hook that
|
||||
can be used from dwfl_module_getsym and elflint.
|
||||
|
||||
Rebase arm_func_value.patch from 0.159 to 0.160
|
||||
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
|
||||
---
|
||||
backends/arm_init.c | 1 +
|
||||
backends/arm_symbol.c | 8 ++++++++
|
||||
libdwfl/dwfl_module_getsym.c | 2 +-
|
||||
libebl/Makefile.am | 3 ++-
|
||||
libebl/ebl-hooks.h | 3 +++
|
||||
libebl/eblsymfuncval.c | 43 ++++++++++++++++++++++++++++++++++++++++++
|
||||
libebl/libebl.h | 11 +++++++++++
|
||||
7 files changed, 69 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/backends/arm_init.c b/backends/arm_init.c
|
||||
index 7171186..9f03630 100644
|
||||
--- a/backends/arm_init.c
|
||||
+++ b/backends/arm_init.c
|
||||
@@ -78,6 +78,7 @@ arm_init (elf, machine, eh, ehlen)
|
||||
eh->return_value_location = arm_return_value_location_hard;
|
||||
HOOK (eh, abi_cfi);
|
||||
HOOK (eh, check_reloc_target_type);
|
||||
+ HOOK (eh, sym_func_value);
|
||||
HOOK (eh, symbol_type_name);
|
||||
|
||||
/* We only unwind the core integer registers. */
|
||||
diff --git a/backends/arm_symbol.c b/backends/arm_symbol.c
|
||||
index da4a50a..ccea03b 100644
|
||||
--- a/backends/arm_symbol.c
|
||||
+++ b/backends/arm_symbol.c
|
||||
@@ -130,6 +130,14 @@ arm_check_reloc_target_type (Ebl *ebl __attribute__ ((unused)), Elf64_Word sh_ty
|
||||
return sh_type == SHT_ARM_EXIDX;
|
||||
}
|
||||
|
||||
+/* ARM EABI says that the low bit indicates whether the function
|
||||
+ symbol value is a THUMB function or not. Mask it off. */
|
||||
+GElf_Addr
|
||||
+arm_sym_func_value (Ebl *ebl __attribute__ ((unused)), GElf_Addr val)
|
||||
+{
|
||||
+ return val & ~(GElf_Addr)1;
|
||||
+}
|
||||
+
|
||||
const char *
|
||||
arm_symbol_type_name (int type,
|
||||
char *buf __attribute__ ((unused)),
|
||||
diff --git a/libdwfl/dwfl_module_getsym.c b/libdwfl/dwfl_module_getsym.c
|
||||
index 42d2b67..fb192d7 100644
|
||||
--- a/libdwfl/dwfl_module_getsym.c
|
||||
+++ b/libdwfl/dwfl_module_getsym.c
|
||||
@@ -119,7 +119,7 @@ __libdwfl_getsym (Dwfl_Module *mod, int ndx, GElf_Sym *sym, GElf_Addr *addr,
|
||||
descriptors). */
|
||||
|
||||
char *ident;
|
||||
- GElf_Addr st_value = sym->st_value & ebl_func_addr_mask (mod->ebl);
|
||||
+ GElf_Addr st_value = ebl_sym_func_value (mod->ebl, sym->st_value);
|
||||
*resolved = false;
|
||||
if (! adjust_st_value && mod->e_type != ET_REL && alloc
|
||||
&& (GELF_ST_TYPE (sym->st_info) == STT_FUNC
|
||||
diff --git a/libebl/Makefile.am b/libebl/Makefile.am
|
||||
index ec4477b..889c21b 100644
|
||||
--- a/libebl/Makefile.am
|
||||
+++ b/libebl/Makefile.am
|
||||
@@ -55,7 +55,8 @@ gen_SOURCES = eblopenbackend.c eblclosebackend.c eblstrtab.c \
|
||||
eblsysvhashentrysize.c eblauxvinfo.c eblcheckobjattr.c \
|
||||
ebl_check_special_section.c ebl_syscall_abi.c eblabicfi.c \
|
||||
eblstother.c eblinitreg.c ebldwarftoregno.c eblnormalizepc.c \
|
||||
- eblunwind.c eblresolvesym.c eblcheckreloctargettype.c
|
||||
+ eblunwind.c eblresolvesym.c eblcheckreloctargettype.c \
|
||||
+ eblsymfuncval.c
|
||||
|
||||
libebl_a_SOURCES = $(gen_SOURCES)
|
||||
|
||||
diff --git a/libebl/ebl-hooks.h b/libebl/ebl-hooks.h
|
||||
index 2e31446..9df945d 100644
|
||||
--- a/libebl/ebl-hooks.h
|
||||
+++ b/libebl/ebl-hooks.h
|
||||
@@ -191,5 +191,8 @@ bool EBLHOOK(unwind) (Ebl *ebl, Dwarf_Addr pc, ebl_tid_registers_t *setfunc,
|
||||
(e.g. function descriptor resolving) */
|
||||
bool EBLHOOK(resolve_sym_value) (Ebl *ebl, GElf_Addr *addr);
|
||||
|
||||
+/* Returns the real value of a symbol function address or offset. */
|
||||
+GElf_Addr EBLHOOK(sym_func_value) (Ebl *ebl, GElf_Addr val);
|
||||
+
|
||||
/* Destructor for ELF backend handle. */
|
||||
void EBLHOOK(destr) (struct ebl *);
|
||||
diff --git a/libebl/eblsymfuncval.c b/libebl/eblsymfuncval.c
|
||||
new file mode 100644
|
||||
index 0000000..c0b322f
|
||||
--- /dev/null
|
||||
+++ b/libebl/eblsymfuncval.c
|
||||
@@ -0,0 +1,43 @@
|
||||
+/* Turn a symbol function value into a real function address or offset.
|
||||
+ Copyright (C) 2014 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 <libeblP.h>
|
||||
+#include <assert.h>
|
||||
+
|
||||
+GElf_Addr
|
||||
+ebl_sym_func_value (Ebl *ebl, GElf_Addr val)
|
||||
+{
|
||||
+ if (ebl == NULL || ebl->sym_func_value == NULL)
|
||||
+ return val;
|
||||
+
|
||||
+ return ebl->sym_func_value (ebl, val);
|
||||
+}
|
||||
diff --git a/libebl/libebl.h b/libebl/libebl.h
|
||||
index 7dbf460..96c076b 100644
|
||||
--- a/libebl/libebl.h
|
||||
+++ b/libebl/libebl.h
|
||||
@@ -472,6 +472,17 @@ extern bool ebl_unwind (Ebl *ebl, Dwarf_Addr pc, ebl_tid_registers_t *setfunc,
|
||||
extern bool ebl_resolve_sym_value (Ebl *ebl, GElf_Addr *addr)
|
||||
__nonnull_attribute__ (2);
|
||||
|
||||
+/* Returns the real value of a symbol function address or offset
|
||||
+ (e.g. when the st_value contains some flag bits that need to be
|
||||
+ masked off). This is different from ebl_resolve_sym_value which
|
||||
+ only works for actual symbol addresses (in non-ET_REL files) that
|
||||
+ might resolve to an address in a different section.
|
||||
+ ebl_sym_func_value is called to turn the given value into the a
|
||||
+ real address or offset (the original value might not be a real
|
||||
+ address). This works for both ET_REL when the value is a section
|
||||
+ offset or ET_EXEC or ET_DYN symbol values, which are addresses. */
|
||||
+extern GElf_Addr ebl_sym_func_value (Ebl *ebl, GElf_Addr val);
|
||||
+
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,83 @@
|
||||
From: Mark Wielaard <mjw@redhat.com>
|
||||
Date: Sun, 15 Jun 2014 12:30:02 +0200
|
||||
Subject: libebl: Add ebl_unwind_ret_mask.
|
||||
|
||||
Another ARM oddity. A return value address in an unwind will contain an
|
||||
extra bit to indicate whether to return to a regular ARM or THUMB function.
|
||||
Add a new ebl function to return a mask to use to get the actual return
|
||||
address during an unwind ebl_unwind_ret_mask.
|
||||
|
||||
Rebase arm_unwind_ret_mask.patch from 0.159 to 0.160
|
||||
|
||||
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
|
||||
---
|
||||
backends/arm_init.c | 3 +++
|
||||
libebl/eblinitreg.c | 8 ++++++++
|
||||
libebl/libebl.h | 4 ++++
|
||||
libebl/libeblP.h | 6 ++++++
|
||||
4 files changed, 21 insertions(+)
|
||||
|
||||
diff --git a/backends/arm_init.c b/backends/arm_init.c
|
||||
index 2266829..f8df042 100644
|
||||
--- a/backends/arm_init.c
|
||||
+++ b/backends/arm_init.c
|
||||
@@ -87,5 +87,8 @@ arm_init (elf, machine, eh, ehlen)
|
||||
/* Bit zero encodes whether an function address is THUMB or ARM. */
|
||||
eh->func_addr_mask = ~(GElf_Addr)1;
|
||||
|
||||
+ /* Bit zero encodes whether to return to a THUMB or ARM function. */
|
||||
+ eh->unwind_ret_mask = ~(GElf_Addr)1;
|
||||
+
|
||||
return MODVERSION;
|
||||
}
|
||||
diff --git a/libebl/eblinitreg.c b/libebl/eblinitreg.c
|
||||
index 5729b3c..ca681c0 100644
|
||||
--- a/libebl/eblinitreg.c
|
||||
+++ b/libebl/eblinitreg.c
|
||||
@@ -56,3 +56,11 @@ ebl_func_addr_mask (Ebl *ebl)
|
||||
return ((ebl == NULL || ebl->func_addr_mask == 0)
|
||||
? ~(GElf_Addr)0 : ebl->func_addr_mask);
|
||||
}
|
||||
+
|
||||
+GElf_Addr
|
||||
+ebl_unwind_ret_mask (Ebl *ebl)
|
||||
+{
|
||||
+ return ((ebl == NULL || ebl->unwind_ret_mask == 0)
|
||||
+ ? ~(GElf_Addr)0 : ebl->unwind_ret_mask);
|
||||
+}
|
||||
+
|
||||
diff --git a/libebl/libebl.h b/libebl/libebl.h
|
||||
index 40cf635..be70027 100644
|
||||
--- a/libebl/libebl.h
|
||||
+++ b/libebl/libebl.h
|
||||
@@ -420,6 +420,10 @@ extern size_t ebl_frame_nregs (Ebl *ebl)
|
||||
tables) is needed. */
|
||||
extern GElf_Addr ebl_func_addr_mask (Ebl *ebl);
|
||||
|
||||
+/* Mask to use for unwind return address in case the architecture adds
|
||||
+ some extra non-address bits to it. */
|
||||
+extern GElf_Addr ebl_unwind_ret_mask (Ebl *ebl);
|
||||
+
|
||||
/* Convert *REGNO as is in DWARF to a lower range suitable for
|
||||
Dwarf_Frame->REGS indexing. */
|
||||
extern bool ebl_dwarf_to_regno (Ebl *ebl, unsigned *regno)
|
||||
diff --git a/libebl/libeblP.h b/libebl/libeblP.h
|
||||
index dbd67f3..e18ace6 100644
|
||||
--- a/libebl/libeblP.h
|
||||
+++ b/libebl/libeblP.h
|
||||
@@ -70,6 +70,12 @@ struct ebl
|
||||
otherwise it should be the actual mask to use. */
|
||||
GElf_Addr func_addr_mask;
|
||||
|
||||
+ /* Mask to use to get the return address from an unwind in case the
|
||||
+ architecture adds some extra non-address bits to it. When not
|
||||
+ initialized (0) then ebl_unwind_ret_mask will return ~0, otherwise
|
||||
+ it should be the actual mask to use. */
|
||||
+ GElf_Addr unwind_ret_mask;
|
||||
+
|
||||
/* Function descriptor load address and table as used by
|
||||
ebl_resolve_sym_value if available for this arch. */
|
||||
GElf_Addr fd_addr;
|
||||
--
|
||||
1.9.1
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
For some binaries we can get a invalid section alignment, for example if
|
||||
sh_align = 1 and sh_addralign is 0. In the case of a zero size section like
|
||||
".note.GNU-stack", this is irrelavent as far as I can tell and we shouldn't
|
||||
error in this case.
|
||||
|
||||
RP 2014/6/11
|
||||
|
||||
Upstream-Status: Pending
|
||||
|
||||
diff --git a/libelf/elf32_updatenull.c b/libelf/elf32_updatenull.c
|
||||
--- a/libelf/elf32_updatenull.c
|
||||
+++ b/libelf/elf32_updatenull.c
|
||||
@@ -339,8 +339,8 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum)
|
||||
we test for the alignment of the section being large
|
||||
enough for the largest alignment required by a data
|
||||
block. */
|
||||
- if (unlikely (! powerof2 (shdr->sh_addralign))
|
||||
- || unlikely ((shdr->sh_addralign ?: 1) < sh_align))
|
||||
+ if (shdr->sh_size && (unlikely (! powerof2 (shdr->sh_addralign))
|
||||
+ || unlikely ((shdr->sh_addralign ?: 1) < sh_align)))
|
||||
{
|
||||
__libelf_seterrno (ELF_E_INVALID_ALIGN);
|
||||
return -1;
|
||||
@@ -0,0 +1,800 @@
|
||||
Index: elfutils-0.158/backends/parisc_init.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ elfutils-0.158/backends/parisc_init.c 2014-04-21 11:12:12.228150280 +0000
|
||||
@@ -0,0 +1,74 @@
|
||||
+/* Initialization of PA-RISC specific backend library.
|
||||
+ Copyright (C) 2002, 2005, 2006 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
|
||||
+ 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 parisc_
|
||||
+#define RELOC_PREFIX R_PARISC_
|
||||
+#include "libebl_CPU.h"
|
||||
+#include "libebl_parisc.h"
|
||||
+
|
||||
+/* This defines the common reloc hooks based on parisc_reloc.def. */
|
||||
+#include "common-reloc.c"
|
||||
+
|
||||
+
|
||||
+const char *
|
||||
+parisc_init (elf, machine, eh, ehlen)
|
||||
+ Elf *elf __attribute__ ((unused));
|
||||
+ GElf_Half machine __attribute__ ((unused));
|
||||
+ Ebl *eh;
|
||||
+ size_t ehlen;
|
||||
+{
|
||||
+ int pa64 = 0;
|
||||
+
|
||||
+ /* Check whether the Elf_BH object has a sufficent size. */
|
||||
+ if (ehlen < sizeof (Ebl))
|
||||
+ return NULL;
|
||||
+
|
||||
+ if (elf) {
|
||||
+ GElf_Ehdr ehdr_mem;
|
||||
+ GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem);
|
||||
+ if (ehdr && (ehdr->e_flags & EF_PARISC_WIDE))
|
||||
+ pa64 = 1;
|
||||
+ }
|
||||
+ /* We handle it. */
|
||||
+ eh->name = "PA-RISC";
|
||||
+ parisc_init_reloc (eh);
|
||||
+ HOOK (eh, reloc_simple_type);
|
||||
+ HOOK (eh, machine_flag_check);
|
||||
+ HOOK (eh, symbol_type_name);
|
||||
+ HOOK (eh, segment_type_name);
|
||||
+ HOOK (eh, section_type_name);
|
||||
+ HOOK (eh, register_info);
|
||||
+ if (pa64)
|
||||
+ eh->return_value_location = parisc_return_value_location_64;
|
||||
+ else
|
||||
+ eh->return_value_location = parisc_return_value_location_32;
|
||||
+
|
||||
+ return MODVERSION;
|
||||
+}
|
||||
Index: elfutils-0.158/backends/parisc_regs.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ elfutils-0.158/backends/parisc_regs.c 2014-04-21 11:12:12.228150280 +0000
|
||||
@@ -0,0 +1,159 @@
|
||||
+/* Register names and numbers for PA-RISC DWARF.
|
||||
+ Copyright (C) 2005, 2006 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 parisc_
|
||||
+#include "libebl_CPU.h"
|
||||
+
|
||||
+ssize_t
|
||||
+parisc_register_info (Ebl *ebl, int regno, char *name, size_t namelen,
|
||||
+ const char **prefix, const char **setname,
|
||||
+ int *bits, int *type)
|
||||
+{
|
||||
+ int pa64 = 0;
|
||||
+
|
||||
+ if (ebl->elf) {
|
||||
+ GElf_Ehdr ehdr_mem;
|
||||
+ GElf_Ehdr *ehdr = gelf_getehdr (ebl->elf, &ehdr_mem);
|
||||
+ if (ehdr->e_flags & EF_PARISC_WIDE)
|
||||
+ pa64 = 1;
|
||||
+ }
|
||||
+
|
||||
+ int nregs = pa64 ? 127 : 128;
|
||||
+
|
||||
+ if (name == NULL)
|
||||
+ return nregs;
|
||||
+
|
||||
+ if (regno < 0 || regno >= nregs || namelen < 6)
|
||||
+ return -1;
|
||||
+
|
||||
+ *prefix = "%";
|
||||
+
|
||||
+ if (regno < 32)
|
||||
+ {
|
||||
+ *setname = "integer";
|
||||
+ *type = DW_ATE_signed;
|
||||
+ if (pa64)
|
||||
+ {
|
||||
+ *bits = 64;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ *bits = 32;
|
||||
+ }
|
||||
+ }
|
||||
+ else if (regno == 32)
|
||||
+ {
|
||||
+ *setname = "special";
|
||||
+ if (pa64)
|
||||
+ {
|
||||
+ *bits = 6;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ *bits = 5;
|
||||
+ }
|
||||
+ *type = DW_ATE_unsigned;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ *setname = "FPU";
|
||||
+ *type = DW_ATE_float;
|
||||
+ if (pa64)
|
||||
+ {
|
||||
+ *bits = 64;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ *bits = 32;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (regno < 33) {
|
||||
+ switch (regno)
|
||||
+ {
|
||||
+ case 0 ... 9:
|
||||
+ name[0] = 'r';
|
||||
+ name[1] = regno + '0';
|
||||
+ namelen = 2;
|
||||
+ break;
|
||||
+ case 10 ... 31:
|
||||
+ name[0] = 'r';
|
||||
+ name[1] = regno / 10 + '0';
|
||||
+ name[2] = regno % 10 + '0';
|
||||
+ namelen = 3;
|
||||
+ break;
|
||||
+ case 32:
|
||||
+ *prefix = NULL;
|
||||
+ name[0] = 'S';
|
||||
+ name[1] = 'A';
|
||||
+ name[2] = 'R';
|
||||
+ namelen = 3;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ else {
|
||||
+ if (pa64 && ((regno - 72) % 2)) {
|
||||
+ *setname = NULL;
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ switch (regno)
|
||||
+ {
|
||||
+ case 72 + 0 ... 72 + 11:
|
||||
+ name[0] = 'f';
|
||||
+ name[1] = 'r';
|
||||
+ name[2] = (regno + 8 - 72) / 2 + '0';
|
||||
+ namelen = 3;
|
||||
+ if ((regno + 8 - 72) % 2) {
|
||||
+ name[3] = 'R';
|
||||
+ namelen++;
|
||||
+ }
|
||||
+ break;
|
||||
+ case 72 + 12 ... 72 + 55:
|
||||
+ name[0] = 'f';
|
||||
+ name[1] = 'r';
|
||||
+ name[2] = (regno + 8 - 72) / 2 / 10 + '0';
|
||||
+ name[3] = (regno + 8 - 72) / 2 % 10 + '0';
|
||||
+ namelen = 4;
|
||||
+ if ((regno + 8 - 72) % 2) {
|
||||
+ name[4] = 'R';
|
||||
+ namelen++;
|
||||
+ }
|
||||
+ break;
|
||||
+ default:
|
||||
+ *setname = NULL;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ name[namelen++] = '\0';
|
||||
+ return namelen;
|
||||
+}
|
||||
Index: elfutils-0.158/backends/parisc_reloc.def
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ elfutils-0.158/backends/parisc_reloc.def 2014-04-21 11:12:12.228150280 +0000
|
||||
@@ -0,0 +1,128 @@
|
||||
+/* List the relocation types for PA-RISC. -*- C -*-
|
||||
+ Copyright (C) 2005 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>. */
|
||||
+
|
||||
+/* NAME, REL|EXEC|DYN */
|
||||
+
|
||||
+RELOC_TYPE (NONE, EXEC|DYN)
|
||||
+RELOC_TYPE (DIR32, REL|EXEC|DYN)
|
||||
+RELOC_TYPE (DIR21L, REL|EXEC|DYN)
|
||||
+RELOC_TYPE (DIR17R, REL)
|
||||
+RELOC_TYPE (DIR17F, REL)
|
||||
+RELOC_TYPE (DIR14R, REL|DYN)
|
||||
+RELOC_TYPE (PCREL32, REL)
|
||||
+RELOC_TYPE (PCREL21L, REL)
|
||||
+RELOC_TYPE (PCREL17R, REL)
|
||||
+RELOC_TYPE (PCREL17F, REL)
|
||||
+RELOC_TYPE (PCREL14R, REL|EXEC)
|
||||
+RELOC_TYPE (DPREL21L, REL)
|
||||
+RELOC_TYPE (DPREL14WR, REL)
|
||||
+RELOC_TYPE (DPREL14DR, REL)
|
||||
+RELOC_TYPE (DPREL14R, REL)
|
||||
+RELOC_TYPE (GPREL21L, 0)
|
||||
+RELOC_TYPE (GPREL14R, 0)
|
||||
+RELOC_TYPE (LTOFF21L, REL)
|
||||
+RELOC_TYPE (LTOFF14R, REL)
|
||||
+RELOC_TYPE (DLTIND14F, 0)
|
||||
+RELOC_TYPE (SETBASE, 0)
|
||||
+RELOC_TYPE (SECREL32, REL)
|
||||
+RELOC_TYPE (BASEREL21L, 0)
|
||||
+RELOC_TYPE (BASEREL17R, 0)
|
||||
+RELOC_TYPE (BASEREL14R, 0)
|
||||
+RELOC_TYPE (SEGBASE, 0)
|
||||
+RELOC_TYPE (SEGREL32, REL)
|
||||
+RELOC_TYPE (PLTOFF21L, 0)
|
||||
+RELOC_TYPE (PLTOFF14R, 0)
|
||||
+RELOC_TYPE (PLTOFF14F, 0)
|
||||
+RELOC_TYPE (LTOFF_FPTR32, 0)
|
||||
+RELOC_TYPE (LTOFF_FPTR21L, 0)
|
||||
+RELOC_TYPE (LTOFF_FPTR14R, 0)
|
||||
+RELOC_TYPE (FPTR64, 0)
|
||||
+RELOC_TYPE (PLABEL32, REL|DYN)
|
||||
+RELOC_TYPE (PCREL64, 0)
|
||||
+RELOC_TYPE (PCREL22C, 0)
|
||||
+RELOC_TYPE (PCREL22F, 0)
|
||||
+RELOC_TYPE (PCREL14WR, 0)
|
||||
+RELOC_TYPE (PCREL14DR, 0)
|
||||
+RELOC_TYPE (PCREL16F, 0)
|
||||
+RELOC_TYPE (PCREL16WF, 0)
|
||||
+RELOC_TYPE (PCREL16DF, 0)
|
||||
+RELOC_TYPE (DIR64, REL|DYN)
|
||||
+RELOC_TYPE (DIR14WR, REL)
|
||||
+RELOC_TYPE (DIR14DR, REL)
|
||||
+RELOC_TYPE (DIR16F, REL)
|
||||
+RELOC_TYPE (DIR16WF, REL)
|
||||
+RELOC_TYPE (DIR16DF, REL)
|
||||
+RELOC_TYPE (GPREL64, 0)
|
||||
+RELOC_TYPE (GPREL14WR, 0)
|
||||
+RELOC_TYPE (GPREL14DR, 0)
|
||||
+RELOC_TYPE (GPREL16F, 0)
|
||||
+RELOC_TYPE (GPREL16WF, 0)
|
||||
+RELOC_TYPE (GPREL16DF, 0)
|
||||
+RELOC_TYPE (LTOFF64, 0)
|
||||
+RELOC_TYPE (LTOFF14WR, 0)
|
||||
+RELOC_TYPE (LTOFF14DR, 0)
|
||||
+RELOC_TYPE (LTOFF16F, 0)
|
||||
+RELOC_TYPE (LTOFF16WF, 0)
|
||||
+RELOC_TYPE (LTOFF16DF, 0)
|
||||
+RELOC_TYPE (SECREL64, 0)
|
||||
+RELOC_TYPE (BASEREL14WR, 0)
|
||||
+RELOC_TYPE (BASEREL14DR, 0)
|
||||
+RELOC_TYPE (SEGREL64, 0)
|
||||
+RELOC_TYPE (PLTOFF14WR, 0)
|
||||
+RELOC_TYPE (PLTOFF14DR, 0)
|
||||
+RELOC_TYPE (PLTOFF16F, 0)
|
||||
+RELOC_TYPE (PLTOFF16WF, 0)
|
||||
+RELOC_TYPE (PLTOFF16DF, 0)
|
||||
+RELOC_TYPE (LTOFF_FPTR64, 0)
|
||||
+RELOC_TYPE (LTOFF_FPTR14WR, 0)
|
||||
+RELOC_TYPE (LTOFF_FPTR14DR, 0)
|
||||
+RELOC_TYPE (LTOFF_FPTR16F, 0)
|
||||
+RELOC_TYPE (LTOFF_FPTR16WF, 0)
|
||||
+RELOC_TYPE (LTOFF_FPTR16DF, 0)
|
||||
+RELOC_TYPE (COPY, EXEC)
|
||||
+RELOC_TYPE (IPLT, EXEC|DYN)
|
||||
+RELOC_TYPE (EPLT, 0)
|
||||
+RELOC_TYPE (TPREL32, DYN)
|
||||
+RELOC_TYPE (TPREL21L, 0)
|
||||
+RELOC_TYPE (TPREL14R, 0)
|
||||
+RELOC_TYPE (LTOFF_TP21L, 0)
|
||||
+RELOC_TYPE (LTOFF_TP14R, 0)
|
||||
+RELOC_TYPE (LTOFF_TP14F, 0)
|
||||
+RELOC_TYPE (TPREL64, 0)
|
||||
+RELOC_TYPE (TPREL14WR, 0)
|
||||
+RELOC_TYPE (TPREL14DR, 0)
|
||||
+RELOC_TYPE (TPREL16F, 0)
|
||||
+RELOC_TYPE (TPREL16WF, 0)
|
||||
+RELOC_TYPE (TPREL16DF, 0)
|
||||
+RELOC_TYPE (LTOFF_TP64, 0)
|
||||
+RELOC_TYPE (LTOFF_TP14WR, 0)
|
||||
+RELOC_TYPE (LTOFF_TP14DR, 0)
|
||||
+RELOC_TYPE (LTOFF_TP16F, 0)
|
||||
+RELOC_TYPE (LTOFF_TP16WF, 0)
|
||||
+RELOC_TYPE (LTOFF_TP16DF, 0)
|
||||
+RELOC_TYPE (TLS_DTPMOD32, DYN)
|
||||
+RELOC_TYPE (TLS_DTPMOD64, DYN)
|
||||
+
|
||||
+#define NO_RELATIVE_RELOC 1
|
||||
Index: elfutils-0.158/backends/parisc_retval.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ elfutils-0.158/backends/parisc_retval.c 2014-04-21 11:12:12.228150280 +0000
|
||||
@@ -0,0 +1,213 @@
|
||||
+/* Function return value location for Linux/PA-RISC ABI.
|
||||
+ Copyright (C) 2005 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 parisc_
|
||||
+#include "libebl_CPU.h"
|
||||
+#include "libebl_parisc.h"
|
||||
+
|
||||
+/* %r28, or pair %r28, %r29. */
|
||||
+static const Dwarf_Op loc_intreg32[] =
|
||||
+ {
|
||||
+ { .atom = DW_OP_reg28 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
+ { .atom = DW_OP_reg29 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
+ };
|
||||
+
|
||||
+static const Dwarf_Op loc_intreg[] =
|
||||
+ {
|
||||
+ { .atom = DW_OP_reg28 }, { .atom = DW_OP_piece, .number = 8 },
|
||||
+ { .atom = DW_OP_reg29 }, { .atom = DW_OP_piece, .number = 8 },
|
||||
+ };
|
||||
+#define nloc_intreg 1
|
||||
+#define nloc_intregpair 4
|
||||
+
|
||||
+/* %fr4L, or pair %fr4L, %fr4R on pa-32 */
|
||||
+static const Dwarf_Op loc_fpreg32[] =
|
||||
+ {
|
||||
+ { .atom = DW_OP_regx, .number = 72 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
+ { .atom = DW_OP_regx, .number = 73 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
+ };
|
||||
+#define nloc_fpreg32 2
|
||||
+#define nloc_fpregpair32 4
|
||||
+
|
||||
+/* $fr4 */
|
||||
+static const Dwarf_Op loc_fpreg[] =
|
||||
+ {
|
||||
+ { .atom = DW_OP_regx, .number = 72 },
|
||||
+ };
|
||||
+#define nloc_fpreg 1
|
||||
+
|
||||
+#if 0
|
||||
+/* The return value is a structure and is actually stored in stack space
|
||||
+ passed in a hidden argument by the caller. Address of the location is stored
|
||||
+ in %r28 before function call, but it may be changed by function. */
|
||||
+static const Dwarf_Op loc_aggregate[] =
|
||||
+ {
|
||||
+ { .atom = DW_OP_breg28 },
|
||||
+ };
|
||||
+#define nloc_aggregate 1
|
||||
+#endif
|
||||
+
|
||||
+static int
|
||||
+parisc_return_value_location_ (Dwarf_Die *functypedie, const Dwarf_Op **locp, int pa64)
|
||||
+{
|
||||
+ Dwarf_Word regsize = pa64 ? 8 : 4;
|
||||
+
|
||||
+ /* 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)
|
||||
+ {
|
||||
+ attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
|
||||
+ typedie = dwarf_formref_die (attr, &die_mem);
|
||||
+ tag = dwarf_tag (typedie);
|
||||
+ }
|
||||
+
|
||||
+ 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:
|
||||
+ {
|
||||
+ Dwarf_Word size;
|
||||
+ 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 (tag == DW_TAG_base_type)
|
||||
+ {
|
||||
+ Dwarf_Word encoding;
|
||||
+ if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding,
|
||||
+ &attr_mem), &encoding) != 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ if (encoding == DW_ATE_float)
|
||||
+ {
|
||||
+ if (pa64) {
|
||||
+ *locp = loc_fpreg;
|
||||
+ if (size <= 8)
|
||||
+ return nloc_fpreg;
|
||||
+ }
|
||||
+ else {
|
||||
+ *locp = loc_fpreg32;
|
||||
+ if (size <= 4)
|
||||
+ return nloc_fpreg32;
|
||||
+ else if (size <= 8)
|
||||
+ return nloc_fpregpair32;
|
||||
+ }
|
||||
+ goto aggregate;
|
||||
+ }
|
||||
+ }
|
||||
+ if (pa64)
|
||||
+ *locp = loc_intreg;
|
||||
+ else
|
||||
+ *locp = loc_intreg32;
|
||||
+ if (size <= regsize)
|
||||
+ return nloc_intreg;
|
||||
+ if (size <= 2 * regsize)
|
||||
+ return nloc_intregpair;
|
||||
+
|
||||
+ /* Else fall through. */
|
||||
+ }
|
||||
+
|
||||
+ case DW_TAG_structure_type:
|
||||
+ case DW_TAG_class_type:
|
||||
+ case DW_TAG_union_type:
|
||||
+ case DW_TAG_array_type:
|
||||
+ aggregate: {
|
||||
+ Dwarf_Word size;
|
||||
+ if (dwarf_aggregate_size (typedie, &size) != 0)
|
||||
+ return -1;
|
||||
+ if (pa64)
|
||||
+ *locp = loc_intreg;
|
||||
+ else
|
||||
+ *locp = loc_intreg32;
|
||||
+ if (size <= regsize)
|
||||
+ return nloc_intreg;
|
||||
+ if (size <= 2 * regsize)
|
||||
+ return nloc_intregpair;
|
||||
+#if 0
|
||||
+ /* there should be some way to know this location... But I do not see it. */
|
||||
+ *locp = loc_aggregate;
|
||||
+ return nloc_aggregate;
|
||||
+#endif
|
||||
+ /* fall through. */
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* 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;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+parisc_return_value_location_32 (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
+{
|
||||
+ return parisc_return_value_location_ (functypedie, locp, 0);
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+parisc_return_value_location_64 (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
+{
|
||||
+ return parisc_return_value_location_ (functypedie, locp, 1);
|
||||
+}
|
||||
+
|
||||
Index: elfutils-0.158/backends/parisc_symbol.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ elfutils-0.158/backends/parisc_symbol.c 2014-04-21 11:12:12.228150280 +0000
|
||||
@@ -0,0 +1,112 @@
|
||||
+/* PA-RISC specific symbolic name handling.
|
||||
+ Copyright (C) 2002, 2005 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
|
||||
+ 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 <stddef.h>
|
||||
+
|
||||
+#define BACKEND parisc_
|
||||
+#include "libebl_CPU.h"
|
||||
+
|
||||
+const char *
|
||||
+parisc_segment_type_name (int segment, char *buf __attribute__ ((unused)),
|
||||
+ size_t len __attribute__ ((unused)))
|
||||
+{
|
||||
+ switch (segment)
|
||||
+ {
|
||||
+ case PT_PARISC_ARCHEXT:
|
||||
+ return "PARISC_ARCHEXT";
|
||||
+ case PT_PARISC_UNWIND:
|
||||
+ return "PARISC_UNWIND";
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+/* Return symbolic representation of symbol type. */
|
||||
+const char *
|
||||
+parisc_symbol_type_name(int symbol, char *buf __attribute__ ((unused)),
|
||||
+ size_t len __attribute__ ((unused)))
|
||||
+{
|
||||
+ if (symbol == STT_PARISC_MILLICODE)
|
||||
+ return "PARISC_MILLI";
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+/* Return symbolic representation of section type. */
|
||||
+const char *
|
||||
+parisc_section_type_name (int type,
|
||||
+ char *buf __attribute__ ((unused)),
|
||||
+ size_t len __attribute__ ((unused)))
|
||||
+{
|
||||
+ switch (type)
|
||||
+ {
|
||||
+ case SHT_PARISC_EXT:
|
||||
+ return "PARISC_EXT";
|
||||
+ case SHT_PARISC_UNWIND:
|
||||
+ return "PARISC_UNWIND";
|
||||
+ case SHT_PARISC_DOC:
|
||||
+ return "PARISC_DOC";
|
||||
+ }
|
||||
+
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+/* Check whether machine flags are valid. */
|
||||
+bool
|
||||
+parisc_machine_flag_check (GElf_Word flags)
|
||||
+{
|
||||
+ if (flags &~ (EF_PARISC_TRAPNIL | EF_PARISC_EXT | EF_PARISC_LSB |
|
||||
+ EF_PARISC_WIDE | EF_PARISC_NO_KABP |
|
||||
+ EF_PARISC_LAZYSWAP | EF_PARISC_ARCH))
|
||||
+ return 0;
|
||||
+
|
||||
+ GElf_Word arch = flags & EF_PARISC_ARCH;
|
||||
+
|
||||
+ return ((arch == EFA_PARISC_1_0) || (arch == EFA_PARISC_1_1) ||
|
||||
+ (arch == EFA_PARISC_2_0));
|
||||
+}
|
||||
+
|
||||
+/* Check for the simple reloc types. */
|
||||
+Elf_Type
|
||||
+parisc_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type)
|
||||
+{
|
||||
+ switch (type)
|
||||
+ {
|
||||
+ case R_PARISC_DIR64:
|
||||
+ case R_PARISC_SECREL64:
|
||||
+ return ELF_T_XWORD;
|
||||
+ case R_PARISC_DIR32:
|
||||
+ case R_PARISC_SECREL32:
|
||||
+ return ELF_T_WORD;
|
||||
+ default:
|
||||
+ return ELF_T_NUM;
|
||||
+ }
|
||||
+}
|
||||
Index: elfutils-0.158/backends/libebl_parisc.h
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ elfutils-0.158/backends/libebl_parisc.h 2014-04-21 11:12:12.228150280 +0000
|
||||
@@ -0,0 +1,9 @@
|
||||
+#ifndef _LIBEBL_HPPA_H
|
||||
+#define _LIBEBL_HPPA_H 1
|
||||
+
|
||||
+#include <libdw.h>
|
||||
+
|
||||
+extern int parisc_return_value_location_32(Dwarf_Die *, const Dwarf_Op **locp);
|
||||
+extern int parisc_return_value_location_64(Dwarf_Die *, const Dwarf_Op **locp);
|
||||
+
|
||||
+#endif
|
||||
Index: elfutils-0.158/backends/Makefile.am
|
||||
===================================================================
|
||||
--- elfutils-0.158.orig/backends/Makefile.am 2014-04-21 11:12:12.252149737 +0000
|
||||
+++ elfutils-0.158/backends/Makefile.am 2014-04-21 11:13:11.910801105 +0000
|
||||
@@ -33,11 +33,12 @@
|
||||
|
||||
|
||||
modules = i386 sh x86_64 ia64 alpha arm aarch64 sparc ppc ppc64 s390 \
|
||||
- tilegx
|
||||
+ tilegx parisc
|
||||
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_aarch64_pic.a libebl_sparc_pic.a libebl_ppc_pic.a \
|
||||
- libebl_ppc64_pic.a libebl_s390_pic.a libebl_tilegx_pic.a
|
||||
+ libebl_ppc64_pic.a libebl_s390_pic.a libebl_tilegx_pic.a \
|
||||
+ libebl_parisc_pic.a
|
||||
noinst_LIBRARIES = $(libebl_pic)
|
||||
noinst_DATA = $(libebl_pic:_pic.a=.so)
|
||||
|
||||
@@ -116,6 +117,9 @@
|
||||
libebl_tilegx_pic_a_SOURCES = $(tilegx_SRCS)
|
||||
am_libebl_tilegx_pic_a_OBJECTS = $(tilegx_SRCS:.c=.os)
|
||||
|
||||
+parisc_SRCS = parisc_init.c parisc_symbol.c parisc_regs.c parisc_retval.c
|
||||
+libebl_parisc_pic_a_SOURCES = $(parisc_SRCS)
|
||||
+am_libebl_parisc_pic_a_OBJECTS = $(parisc_SRCS:.c=.os)
|
||||
|
||||
libebl_%.so libebl_%.map: libebl_%_pic.a $(libelf) $(libdw)
|
||||
@rm -f $(@:.so=.map)
|
||||
Index: elfutils-0.158/libelf/elf.h
|
||||
===================================================================
|
||||
--- elfutils-0.158.orig/libelf/elf.h 2014-04-21 11:12:12.252149737 +0000
|
||||
+++ elfutils-0.158/libelf/elf.h 2014-04-21 11:12:12.228150280 +0000
|
||||
@@ -1814,16 +1814,24 @@
|
||||
#define R_PARISC_PCREL17F 12 /* 17 bits of rel. address. */
|
||||
#define R_PARISC_PCREL14R 14 /* Right 14 bits of rel. address. */
|
||||
#define R_PARISC_DPREL21L 18 /* Left 21 bits of rel. address. */
|
||||
+#define R_PARISC_DPREL14WR 19
|
||||
+#define R_PARISC_DPREL14DR 20
|
||||
#define R_PARISC_DPREL14R 22 /* Right 14 bits of rel. address. */
|
||||
#define R_PARISC_GPREL21L 26 /* GP-relative, left 21 bits. */
|
||||
#define R_PARISC_GPREL14R 30 /* GP-relative, right 14 bits. */
|
||||
#define R_PARISC_LTOFF21L 34 /* LT-relative, left 21 bits. */
|
||||
#define R_PARISC_LTOFF14R 38 /* LT-relative, right 14 bits. */
|
||||
+#define R_PARISC_DLTIND14F 39
|
||||
+#define R_PARISC_SETBASE 40
|
||||
#define R_PARISC_SECREL32 41 /* 32 bits section rel. address. */
|
||||
+#define R_PARISC_BASEREL21L 42
|
||||
+#define R_PARISC_BASEREL17R 43
|
||||
+#define R_PARISC_BASEREL14R 46
|
||||
#define R_PARISC_SEGBASE 48 /* No relocation, set segment base. */
|
||||
#define R_PARISC_SEGREL32 49 /* 32 bits segment rel. address. */
|
||||
#define R_PARISC_PLTOFF21L 50 /* PLT rel. address, left 21 bits. */
|
||||
#define R_PARISC_PLTOFF14R 54 /* PLT rel. address, right 14 bits. */
|
||||
+#define R_PARISC_PLTOFF14F 55
|
||||
#define R_PARISC_LTOFF_FPTR32 57 /* 32 bits LT-rel. function pointer. */
|
||||
#define R_PARISC_LTOFF_FPTR21L 58 /* LT-rel. fct ptr, left 21 bits. */
|
||||
#define R_PARISC_LTOFF_FPTR14R 62 /* LT-rel. fct ptr, right 14 bits. */
|
||||
@@ -1832,6 +1840,7 @@
|
||||
#define R_PARISC_PLABEL21L 66 /* Left 21 bits of fdesc address. */
|
||||
#define R_PARISC_PLABEL14R 70 /* Right 14 bits of fdesc address. */
|
||||
#define R_PARISC_PCREL64 72 /* 64 bits PC-rel. address. */
|
||||
+#define R_PARISC_PCREL22C 73
|
||||
#define R_PARISC_PCREL22F 74 /* 22 bits PC-rel. address. */
|
||||
#define R_PARISC_PCREL14WR 75 /* PC-rel. address, right 14 bits. */
|
||||
#define R_PARISC_PCREL14DR 76 /* PC rel. address, right 14 bits. */
|
||||
@@ -1857,6 +1866,8 @@
|
||||
#define R_PARISC_LTOFF16WF 102 /* 16 bits LT-rel. address. */
|
||||
#define R_PARISC_LTOFF16DF 103 /* 16 bits LT-rel. address. */
|
||||
#define R_PARISC_SECREL64 104 /* 64 bits section rel. address. */
|
||||
+#define R_PARISC_BASEREL14WR 107
|
||||
+#define R_PARISC_BASEREL14DR 108
|
||||
#define R_PARISC_SEGREL64 112 /* 64 bits segment rel. address. */
|
||||
#define R_PARISC_PLTOFF14WR 115 /* PLT-rel. address, right 14 bits. */
|
||||
#define R_PARISC_PLTOFF14DR 116 /* PLT-rel. address, right 14 bits. */
|
||||
@@ -0,0 +1,493 @@
|
||||
From: Kurt Roeckx <kurt@roeckx.be>
|
||||
From: Thorsten Glaser <tg@mirbsd.de>
|
||||
Subject: m68k support
|
||||
|
||||
Written by Kurt Roeckx, except for the retval support which was written
|
||||
by Thorsten Glaser
|
||||
|
||||
|
||||
Index: elfutils-0.158/backends/m68k_init.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ elfutils-0.158/backends/m68k_init.c 2014-04-21 11:14:23.813175704 +0000
|
||||
@@ -0,0 +1,50 @@
|
||||
+/* Initialization of m68k specific backend library.
|
||||
+ Copyright (C) 2007 Kurt Roeckx <kurt@roeckx.be>
|
||||
+
|
||||
+ This software 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.
|
||||
+
|
||||
+ This softare 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 this software; if not, write to the Free Software Foundation,
|
||||
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
|
||||
+
|
||||
+*/
|
||||
+
|
||||
+#ifdef HAVE_CONFIG_H
|
||||
+# include <config.h>
|
||||
+#endif
|
||||
+
|
||||
+#define BACKEND m68k_
|
||||
+#define RELOC_PREFIX R_68K_
|
||||
+#include "libebl_CPU.h"
|
||||
+
|
||||
+/* This defines the common reloc hooks based on m68k_reloc.def. */
|
||||
+#include "common-reloc.c"
|
||||
+
|
||||
+
|
||||
+const char *
|
||||
+m68k_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 = "m68k";
|
||||
+ m68k_init_reloc (eh);
|
||||
+ HOOK (eh, reloc_simple_type);
|
||||
+ HOOK (eh, return_value_location);
|
||||
+ HOOK (eh, register_info);
|
||||
+
|
||||
+ return MODVERSION;
|
||||
+}
|
||||
Index: elfutils-0.158/backends/m68k_regs.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ elfutils-0.158/backends/m68k_regs.c 2014-04-21 11:14:23.813175704 +0000
|
||||
@@ -0,0 +1,106 @@
|
||||
+/* Register names and numbers for m68k DWARF.
|
||||
+ Copyright (C) 2007 Kurt Roeckx <kurt@roeckx.be>
|
||||
+
|
||||
+ This software 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.
|
||||
+
|
||||
+ This software 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 this software; if not, write to the Free Software Foundation,
|
||||
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
|
||||
+
|
||||
+ */
|
||||
+
|
||||
+#ifdef HAVE_CONFIG_H
|
||||
+# include <config.h>
|
||||
+#endif
|
||||
+
|
||||
+#include <string.h>
|
||||
+#include <dwarf.h>
|
||||
+
|
||||
+#define BACKEND m68k_
|
||||
+#include "libebl_CPU.h"
|
||||
+
|
||||
+ssize_t
|
||||
+m68k_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 25;
|
||||
+
|
||||
+ if (regno < 0 || regno > 24 || namelen < 5)
|
||||
+ return -1;
|
||||
+
|
||||
+ *prefix = "%";
|
||||
+ *bits = 32;
|
||||
+ *type = (regno < 8 ? DW_ATE_signed
|
||||
+ : regno < 16 ? DW_ATE_address : DW_ATE_float);
|
||||
+
|
||||
+ if (regno < 8)
|
||||
+ {
|
||||
+ *setname = "integer";
|
||||
+ }
|
||||
+ else if (regno < 16)
|
||||
+ {
|
||||
+ *setname = "address";
|
||||
+ }
|
||||
+ else if (regno < 24)
|
||||
+ {
|
||||
+ *setname = "FPU";
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ *setname = "address";
|
||||
+ *type = DW_ATE_address;
|
||||
+ }
|
||||
+
|
||||
+ switch (regno)
|
||||
+ {
|
||||
+ case 0 ... 7:
|
||||
+ name[0] = 'd';
|
||||
+ name[1] = regno + '0';
|
||||
+ namelen = 2;
|
||||
+ break;
|
||||
+
|
||||
+ case 8 ... 13:
|
||||
+ name[0] = 'a';
|
||||
+ name[1] = regno - 8 + '0';
|
||||
+ namelen = 2;
|
||||
+ break;
|
||||
+
|
||||
+ case 14:
|
||||
+ name[0] = 'f';
|
||||
+ name[1] = 'p';
|
||||
+ namelen = 2;
|
||||
+ break;
|
||||
+
|
||||
+ case 15:
|
||||
+ name[0] = 's';
|
||||
+ name[1] = 'p';
|
||||
+ namelen = 2;
|
||||
+ break;
|
||||
+
|
||||
+ case 16 ... 23:
|
||||
+ name[0] = 'f';
|
||||
+ name[1] = 'p';
|
||||
+ name[2] = regno - 16 + '0';
|
||||
+ namelen = 3;
|
||||
+ break;
|
||||
+
|
||||
+ case 24:
|
||||
+ name[0] = 'p';
|
||||
+ name[1] = 'c';
|
||||
+ namelen = 2;
|
||||
+ }
|
||||
+
|
||||
+ name[namelen++] = '\0';
|
||||
+ return namelen;
|
||||
+}
|
||||
+
|
||||
Index: elfutils-0.158/backends/m68k_reloc.def
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ elfutils-0.158/backends/m68k_reloc.def 2014-04-21 11:14:23.813175704 +0000
|
||||
@@ -0,0 +1,45 @@
|
||||
+/* List the relocation types for m68k. -*- C -*-
|
||||
+ Copyright (C) 2007 Kurt Roeckx <kurt@roeckx.be>
|
||||
+
|
||||
+ This software 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.
|
||||
+
|
||||
+ This software 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 this software; if not, write to the Free Software Foundation,
|
||||
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
|
||||
+*/
|
||||
+
|
||||
+/* NAME, REL|EXEC|DYN */
|
||||
+
|
||||
+RELOC_TYPE (NONE, 0)
|
||||
+RELOC_TYPE (32, REL|EXEC|DYN)
|
||||
+RELOC_TYPE (16, REL)
|
||||
+RELOC_TYPE (8, REL)
|
||||
+RELOC_TYPE (PC32, REL|EXEC|DYN)
|
||||
+RELOC_TYPE (PC16, REL)
|
||||
+RELOC_TYPE (PC8, REL)
|
||||
+RELOC_TYPE (GOT32, REL)
|
||||
+RELOC_TYPE (GOT16, REL)
|
||||
+RELOC_TYPE (GOT8, REL)
|
||||
+RELOC_TYPE (GOT32O, REL)
|
||||
+RELOC_TYPE (GOT16O, REL)
|
||||
+RELOC_TYPE (GOT8O, REL)
|
||||
+RELOC_TYPE (PLT32, REL)
|
||||
+RELOC_TYPE (PLT16, REL)
|
||||
+RELOC_TYPE (PLT8, REL)
|
||||
+RELOC_TYPE (PLT32O, REL)
|
||||
+RELOC_TYPE (PLT16O, REL)
|
||||
+RELOC_TYPE (PLT8O, REL)
|
||||
+RELOC_TYPE (COPY, EXEC)
|
||||
+RELOC_TYPE (GLOB_DAT, EXEC|DYN)
|
||||
+RELOC_TYPE (JMP_SLOT, EXEC|DYN)
|
||||
+RELOC_TYPE (RELATIVE, EXEC|DYN)
|
||||
+RELOC_TYPE (GNU_VTINHERIT, REL)
|
||||
+RELOC_TYPE (GNU_VTENTRY, REL)
|
||||
+
|
||||
Index: elfutils-0.158/libelf/elf.h
|
||||
===================================================================
|
||||
--- elfutils-0.158.orig/libelf/elf.h 2014-04-21 11:14:23.813175704 +0000
|
||||
+++ elfutils-0.158/libelf/elf.h 2014-04-21 11:14:23.813175704 +0000
|
||||
@@ -1157,6 +1157,9 @@
|
||||
#define R_68K_GLOB_DAT 20 /* Create GOT entry */
|
||||
#define R_68K_JMP_SLOT 21 /* Create PLT entry */
|
||||
#define R_68K_RELATIVE 22 /* Adjust by program base */
|
||||
+/* The next 2 are GNU extensions to enable C++ vtable garbage collection. */
|
||||
+#define R_68K_GNU_VTINHERIT 23
|
||||
+#define R_68K_GNU_VTENTRY 24
|
||||
#define R_68K_TLS_GD32 25 /* 32 bit GOT offset for GD */
|
||||
#define R_68K_TLS_GD16 26 /* 16 bit GOT offset for GD */
|
||||
#define R_68K_TLS_GD8 27 /* 8 bit GOT offset for GD */
|
||||
Index: elfutils-0.158/backends/Makefile.am
|
||||
===================================================================
|
||||
--- elfutils-0.158.orig/backends/Makefile.am 2014-04-21 11:14:23.813175704 +0000
|
||||
+++ elfutils-0.158/backends/Makefile.am 2014-04-21 11:14:48.344621167 +0000
|
||||
@@ -33,12 +33,12 @@
|
||||
|
||||
|
||||
modules = i386 sh x86_64 ia64 alpha arm aarch64 sparc ppc ppc64 s390 \
|
||||
- tilegx parisc mips
|
||||
+ tilegx parisc mips m68k
|
||||
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_aarch64_pic.a libebl_sparc_pic.a libebl_ppc_pic.a \
|
||||
libebl_ppc64_pic.a libebl_s390_pic.a libebl_tilegx_pic.a \
|
||||
- libebl_parisc_pic.a libebl_mips_pic.a
|
||||
+ libebl_parisc_pic.a libebl_mips_pic.a libebl_m68k_pic.a
|
||||
noinst_LIBRARIES = $(libebl_pic)
|
||||
noinst_DATA = $(libebl_pic:_pic.a=.so)
|
||||
|
||||
@@ -125,6 +125,10 @@
|
||||
libebl_mips_pic_a_SOURCES = $(mips_SRCS)
|
||||
am_libebl_mips_pic_a_OBJECTS = $(mips_SRCS:.c=.os)
|
||||
|
||||
+m68k_SRCS = m68k_init.c m68k_symbol.c m68k_regs.c m68k_retval.c
|
||||
+libebl_m68k_pic_a_SOURCES = $(m68k_SRCS)
|
||||
+am_libebl_m68k_pic_a_OBJECTS = $(m68k_SRCS:.c=.os)
|
||||
+
|
||||
libebl_%.so libebl_%.map: libebl_%_pic.a $(libelf) $(libdw)
|
||||
@rm -f $(@:.so=.map)
|
||||
echo 'ELFUTILS_$(PACKAGE_VERSION) { global: $*_init; local: *; };' \
|
||||
Index: elfutils-0.158/backends/m68k_symbol.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ elfutils-0.158/backends/m68k_symbol.c 2014-04-21 11:14:23.813175704 +0000
|
||||
@@ -0,0 +1,43 @@
|
||||
+/* m68k specific symbolic name handling.
|
||||
+ Copyright (C) 2007 Kurt Roeckx <kurt@roeckx.be>
|
||||
+
|
||||
+ This software 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.
|
||||
+
|
||||
+ This software 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 this software; if not, write to the Free Software Foundation,
|
||||
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
|
||||
+*/
|
||||
+
|
||||
+#ifdef HAVE_CONFIG_H
|
||||
+# include <config.h>
|
||||
+#endif
|
||||
+
|
||||
+#include <elf.h>
|
||||
+#include <stddef.h>
|
||||
+
|
||||
+#define BACKEND m68k_
|
||||
+#include "libebl_CPU.h"
|
||||
+
|
||||
+/* Check for the simple reloc types. */
|
||||
+Elf_Type
|
||||
+m68k_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type)
|
||||
+{
|
||||
+ switch (type)
|
||||
+ {
|
||||
+ case R_68K_32:
|
||||
+ return ELF_T_SWORD;
|
||||
+ case R_68K_16:
|
||||
+ return ELF_T_HALF;
|
||||
+ case R_68K_8:
|
||||
+ return ELF_T_BYTE;
|
||||
+ default:
|
||||
+ return ELF_T_NUM;
|
||||
+ }
|
||||
+}
|
||||
Index: elfutils-0.158/backends/m68k_retval.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ elfutils-0.158/backends/m68k_retval.c 2014-04-21 11:14:23.813175704 +0000
|
||||
@@ -0,0 +1,172 @@
|
||||
+/* Function return value location for Linux/m68k ABI.
|
||||
+ Copyright (C) 2005-2010 Red Hat, Inc.
|
||||
+ Copyright (c) 2011 Thorsten Glaser, Debian.
|
||||
+ 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 m68k_
|
||||
+#include "libebl_CPU.h"
|
||||
+
|
||||
+
|
||||
+/* %d0, or pair %d0, %d1, or %a0 */
|
||||
+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 },
|
||||
+ };
|
||||
+static const Dwarf_Op loc_ptrreg[] =
|
||||
+ {
|
||||
+ { .atom = DW_OP_reg8 },
|
||||
+ };
|
||||
+#define nloc_intreg 1
|
||||
+#define nloc_intregpair 4
|
||||
+#define nloc_ptrreg 1
|
||||
+
|
||||
+/* %f0 */
|
||||
+static const Dwarf_Op loc_fpreg[] =
|
||||
+ {
|
||||
+ { .atom = DW_OP_reg16 }
|
||||
+ };
|
||||
+#define nloc_fpreg 1
|
||||
+
|
||||
+/* Structures are a bit more complicated - small structures are returned
|
||||
+ in %d0 / %d1 (-freg-struct-return which is enabled by default), large
|
||||
+ structures use %a1 (in constrast to the SYSV psABI which says %a0) as
|
||||
+ reentrant storage space indicator. */
|
||||
+static const Dwarf_Op loc_aggregate[] =
|
||||
+ {
|
||||
+ { .atom = DW_OP_breg9, .number = 0 }
|
||||
+ };
|
||||
+#define nloc_aggregate 1
|
||||
+
|
||||
+int
|
||||
+m68k_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
+{
|
||||
+ Dwarf_Word size;
|
||||
+
|
||||
+ /* 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)
|
||||
+ {
|
||||
+ attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
|
||||
+ typedie = dwarf_formref_die (attr, &die_mem);
|
||||
+ tag = dwarf_tag (typedie);
|
||||
+ }
|
||||
+
|
||||
+ 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 (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type)
|
||||
+ {
|
||||
+ *locp = loc_ptrreg;
|
||||
+ return nloc_ptrreg;
|
||||
+ }
|
||||
+ 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;
|
||||
+ if (encoding == DW_ATE_float)
|
||||
+ {
|
||||
+ /* XXX really 10? */
|
||||
+ if (size > 10)
|
||||
+ return -2;
|
||||
+ *locp = loc_fpreg;
|
||||
+ return nloc_fpreg;
|
||||
+ }
|
||||
+ }
|
||||
+ if (size <= 8)
|
||||
+ {
|
||||
+ intreg:
|
||||
+ /* XXX check endianness of dword pair, int64 vs aggregate */
|
||||
+ *locp = loc_intreg;
|
||||
+ return size <= 4 ? nloc_intreg : nloc_intregpair;
|
||||
+ }
|
||||
+
|
||||
+ 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_aggregate_size (typedie, &size) == 0
|
||||
+ && size > 0 && size <= 8)
|
||||
+ /* not accurate for a struct whose only member is a float */
|
||||
+ 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;
|
||||
+}
|
||||
@@ -0,0 +1,712 @@
|
||||
Index: elfutils-0.158/backends/mips_init.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ elfutils-0.158/backends/mips_init.c 2014-04-21 11:13:36.910235965 +0000
|
||||
@@ -0,0 +1,60 @@
|
||||
+/* Initialization of mips specific backend library.
|
||||
+ Copyright (C) 2006 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 mips_
|
||||
+#define RELOC_PREFIX R_MIPS_
|
||||
+#include "libebl_CPU.h"
|
||||
+
|
||||
+/* This defines the common reloc hooks based on mips_reloc.def. */
|
||||
+#include "common-reloc.c"
|
||||
+
|
||||
+const char *
|
||||
+mips_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. */
|
||||
+ if (machine == EM_MIPS)
|
||||
+ eh->name = "MIPS R3000 big-endian";
|
||||
+ else if (machine == EM_MIPS_RS3_LE)
|
||||
+ eh->name = "MIPS R3000 little-endian";
|
||||
+
|
||||
+ mips_init_reloc (eh);
|
||||
+ HOOK (eh, reloc_simple_type);
|
||||
+ HOOK (eh, return_value_location);
|
||||
+ HOOK (eh, register_info);
|
||||
+
|
||||
+ return MODVERSION;
|
||||
+}
|
||||
Index: elfutils-0.158/backends/mips_regs.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ elfutils-0.158/backends/mips_regs.c 2014-04-21 11:13:36.910235965 +0000
|
||||
@@ -0,0 +1,104 @@
|
||||
+/* Register names and numbers for MIPS DWARF.
|
||||
+ Copyright (C) 2006 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 mips_
|
||||
+#include "libebl_CPU.h"
|
||||
+
|
||||
+ssize_t
|
||||
+mips_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 66;
|
||||
+
|
||||
+ if (regno < 0 || regno > 65 || namelen < 4)
|
||||
+ return -1;
|
||||
+
|
||||
+ *prefix = "$";
|
||||
+
|
||||
+ if (regno < 32)
|
||||
+ {
|
||||
+ *setname = "integer";
|
||||
+ *type = DW_ATE_signed;
|
||||
+ *bits = 32;
|
||||
+ if (regno < 32 + 10)
|
||||
+ {
|
||||
+ name[0] = regno + '0';
|
||||
+ namelen = 1;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ name[0] = (regno / 10) + '0';
|
||||
+ name[1] = (regno % 10) + '0';
|
||||
+ namelen = 2;
|
||||
+ }
|
||||
+ }
|
||||
+ else if (regno < 64)
|
||||
+ {
|
||||
+ *setname = "FPU";
|
||||
+ *type = DW_ATE_float;
|
||||
+ *bits = 32;
|
||||
+ name[0] = 'f';
|
||||
+ if (regno < 32 + 10)
|
||||
+ {
|
||||
+ name[1] = (regno - 32) + '0';
|
||||
+ namelen = 2;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ name[1] = (regno - 32) / 10 + '0';
|
||||
+ name[2] = (regno - 32) % 10 + '0';
|
||||
+ namelen = 3;
|
||||
+ }
|
||||
+ }
|
||||
+ else if (regno == 64)
|
||||
+ {
|
||||
+ *type = DW_ATE_signed;
|
||||
+ *bits = 32;
|
||||
+ name[0] = 'h';
|
||||
+ name[1] = 'i';
|
||||
+ namelen = 2;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ *type = DW_ATE_signed;
|
||||
+ *bits = 32;
|
||||
+ name[0] = 'l';
|
||||
+ name[1] = 'o';
|
||||
+ namelen = 2;
|
||||
+ }
|
||||
+
|
||||
+ name[namelen++] = '\0';
|
||||
+ return namelen;
|
||||
+}
|
||||
Index: elfutils-0.158/backends/mips_reloc.def
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ elfutils-0.158/backends/mips_reloc.def 2014-04-21 11:13:36.910235965 +0000
|
||||
@@ -0,0 +1,79 @@
|
||||
+/* List the relocation types for mips. -*- C -*-
|
||||
+ Copyright (C) 2006 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>. */
|
||||
+
|
||||
+/* NAME, REL|EXEC|DYN */
|
||||
+
|
||||
+RELOC_TYPE (NONE, 0)
|
||||
+RELOC_TYPE (16, 0)
|
||||
+RELOC_TYPE (32, 0)
|
||||
+RELOC_TYPE (REL32, 0)
|
||||
+RELOC_TYPE (26, 0)
|
||||
+RELOC_TYPE (HI16, 0)
|
||||
+RELOC_TYPE (LO16, 0)
|
||||
+RELOC_TYPE (GPREL16, 0)
|
||||
+RELOC_TYPE (LITERAL, 0)
|
||||
+RELOC_TYPE (GOT16, 0)
|
||||
+RELOC_TYPE (PC16, 0)
|
||||
+RELOC_TYPE (CALL16, 0)
|
||||
+RELOC_TYPE (GPREL32, 0)
|
||||
+
|
||||
+RELOC_TYPE (SHIFT5, 0)
|
||||
+RELOC_TYPE (SHIFT6, 0)
|
||||
+RELOC_TYPE (64, 0)
|
||||
+RELOC_TYPE (GOT_DISP, 0)
|
||||
+RELOC_TYPE (GOT_PAGE, 0)
|
||||
+RELOC_TYPE (GOT_OFST, 0)
|
||||
+RELOC_TYPE (GOT_HI16, 0)
|
||||
+RELOC_TYPE (GOT_LO16, 0)
|
||||
+RELOC_TYPE (SUB, 0)
|
||||
+RELOC_TYPE (INSERT_A, 0)
|
||||
+RELOC_TYPE (INSERT_B, 0)
|
||||
+RELOC_TYPE (DELETE, 0)
|
||||
+RELOC_TYPE (HIGHER, 0)
|
||||
+RELOC_TYPE (HIGHEST, 0)
|
||||
+RELOC_TYPE (CALL_HI16, 0)
|
||||
+RELOC_TYPE (CALL_LO16, 0)
|
||||
+RELOC_TYPE (SCN_DISP, 0)
|
||||
+RELOC_TYPE (REL16, 0)
|
||||
+RELOC_TYPE (ADD_IMMEDIATE, 0)
|
||||
+RELOC_TYPE (PJUMP, 0)
|
||||
+RELOC_TYPE (RELGOT, 0)
|
||||
+RELOC_TYPE (JALR, 0)
|
||||
+RELOC_TYPE (TLS_DTPMOD32, 0)
|
||||
+RELOC_TYPE (TLS_DTPREL32, 0)
|
||||
+RELOC_TYPE (TLS_DTPMOD64, 0)
|
||||
+RELOC_TYPE (TLS_DTPREL64, 0)
|
||||
+RELOC_TYPE (TLS_GD, 0)
|
||||
+RELOC_TYPE (TLS_LDM, 0)
|
||||
+RELOC_TYPE (TLS_DTPREL_HI16, 0)
|
||||
+RELOC_TYPE (TLS_DTPREL_LO16, 0)
|
||||
+RELOC_TYPE (TLS_GOTTPREL, 0)
|
||||
+RELOC_TYPE (TLS_TPREL32, 0)
|
||||
+RELOC_TYPE (TLS_TPREL64, 0)
|
||||
+RELOC_TYPE (TLS_TPREL_HI16, 0)
|
||||
+RELOC_TYPE (TLS_TPREL_LO16, 0)
|
||||
+
|
||||
+#define NO_COPY_RELOC 1
|
||||
+#define NO_RELATIVE_RELOC 1
|
||||
Index: elfutils-0.158/backends/mips_retval.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ elfutils-0.158/backends/mips_retval.c 2014-04-21 11:13:36.910235965 +0000
|
||||
@@ -0,0 +1,321 @@
|
||||
+/* Function return value location for Linux/mips ABI.
|
||||
+ Copyright (C) 2005 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 <assert.h>
|
||||
+#include <dwarf.h>
|
||||
+#include <elf.h>
|
||||
+
|
||||
+#include "../libebl/libeblP.h"
|
||||
+#include "../libdw/libdwP.h"
|
||||
+
|
||||
+#define BACKEND mips_
|
||||
+#include "libebl_CPU.h"
|
||||
+
|
||||
+/* The ABI of the file. Also see EF_MIPS_ABI2 above. */
|
||||
+#define EF_MIPS_ABI 0x0000F000
|
||||
+
|
||||
+/* The original o32 abi. */
|
||||
+#define E_MIPS_ABI_O32 0x00001000
|
||||
+
|
||||
+/* O32 extended to work on 64 bit architectures */
|
||||
+#define E_MIPS_ABI_O64 0x00002000
|
||||
+
|
||||
+/* EABI in 32 bit mode */
|
||||
+#define E_MIPS_ABI_EABI32 0x00003000
|
||||
+
|
||||
+/* EABI in 64 bit mode */
|
||||
+#define E_MIPS_ABI_EABI64 0x00004000
|
||||
+
|
||||
+/* All the possible MIPS ABIs. */
|
||||
+enum mips_abi
|
||||
+ {
|
||||
+ MIPS_ABI_UNKNOWN = 0,
|
||||
+ MIPS_ABI_N32,
|
||||
+ MIPS_ABI_O32,
|
||||
+ MIPS_ABI_N64,
|
||||
+ MIPS_ABI_O64,
|
||||
+ MIPS_ABI_EABI32,
|
||||
+ MIPS_ABI_EABI64,
|
||||
+ MIPS_ABI_LAST
|
||||
+ };
|
||||
+
|
||||
+/* Find the mips ABI of the current file */
|
||||
+enum mips_abi find_mips_abi(Elf *elf)
|
||||
+{
|
||||
+ GElf_Ehdr ehdr_mem;
|
||||
+ GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem);
|
||||
+
|
||||
+ if (ehdr == NULL)
|
||||
+ return MIPS_ABI_LAST;
|
||||
+
|
||||
+ GElf_Word elf_flags = ehdr->e_flags;
|
||||
+
|
||||
+ /* Check elf_flags to see if it specifies the ABI being used. */
|
||||
+ switch ((elf_flags & EF_MIPS_ABI))
|
||||
+ {
|
||||
+ case E_MIPS_ABI_O32:
|
||||
+ return MIPS_ABI_O32;
|
||||
+ case E_MIPS_ABI_O64:
|
||||
+ return MIPS_ABI_O64;
|
||||
+ case E_MIPS_ABI_EABI32:
|
||||
+ return MIPS_ABI_EABI32;
|
||||
+ case E_MIPS_ABI_EABI64:
|
||||
+ return MIPS_ABI_EABI64;
|
||||
+ default:
|
||||
+ if ((elf_flags & EF_MIPS_ABI2))
|
||||
+ return MIPS_ABI_N32;
|
||||
+ }
|
||||
+
|
||||
+ /* GCC creates a pseudo-section whose name describes the ABI. */
|
||||
+ size_t shstrndx;
|
||||
+ if (elf_getshdrstrndx (elf, &shstrndx) < 0)
|
||||
+ return MIPS_ABI_LAST;
|
||||
+
|
||||
+ const char *name;
|
||||
+ Elf_Scn *scn = NULL;
|
||||
+ while ((scn = elf_nextscn (elf, scn)) != NULL)
|
||||
+ {
|
||||
+ GElf_Shdr shdr_mem;
|
||||
+ GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
|
||||
+ if (shdr == NULL)
|
||||
+ return MIPS_ABI_LAST;
|
||||
+
|
||||
+ name = elf_strptr (elf, shstrndx, shdr->sh_name) ?: "";
|
||||
+ if (strncmp (name, ".mdebug.", 8) != 0)
|
||||
+ continue;
|
||||
+
|
||||
+ if (strcmp (name, ".mdebug.abi32") == 0)
|
||||
+ return MIPS_ABI_O32;
|
||||
+ else if (strcmp (name, ".mdebug.abiN32") == 0)
|
||||
+ return MIPS_ABI_N32;
|
||||
+ else if (strcmp (name, ".mdebug.abi64") == 0)
|
||||
+ return MIPS_ABI_N64;
|
||||
+ else if (strcmp (name, ".mdebug.abiO64") == 0)
|
||||
+ return MIPS_ABI_O64;
|
||||
+ else if (strcmp (name, ".mdebug.eabi32") == 0)
|
||||
+ return MIPS_ABI_EABI32;
|
||||
+ else if (strcmp (name, ".mdebug.eabi64") == 0)
|
||||
+ return MIPS_ABI_EABI64;
|
||||
+ else
|
||||
+ return MIPS_ABI_UNKNOWN;
|
||||
+ }
|
||||
+
|
||||
+ return MIPS_ABI_UNKNOWN;
|
||||
+}
|
||||
+
|
||||
+unsigned int
|
||||
+mips_abi_regsize (enum mips_abi abi)
|
||||
+{
|
||||
+ switch (abi)
|
||||
+ {
|
||||
+ case MIPS_ABI_EABI32:
|
||||
+ case MIPS_ABI_O32:
|
||||
+ return 4;
|
||||
+ case MIPS_ABI_N32:
|
||||
+ case MIPS_ABI_N64:
|
||||
+ case MIPS_ABI_O64:
|
||||
+ case MIPS_ABI_EABI64:
|
||||
+ return 8;
|
||||
+ case MIPS_ABI_UNKNOWN:
|
||||
+ case MIPS_ABI_LAST:
|
||||
+ default:
|
||||
+ return 0;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/* $v0 or pair $v0, $v1 */
|
||||
+static const Dwarf_Op loc_intreg_o32[] =
|
||||
+ {
|
||||
+ { .atom = DW_OP_reg2 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
+ { .atom = DW_OP_reg3 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
+ };
|
||||
+
|
||||
+static const Dwarf_Op loc_intreg[] =
|
||||
+ {
|
||||
+ { .atom = DW_OP_reg2 }, { .atom = DW_OP_piece, .number = 8 },
|
||||
+ { .atom = DW_OP_reg3 }, { .atom = DW_OP_piece, .number = 8 },
|
||||
+ };
|
||||
+#define nloc_intreg 1
|
||||
+#define nloc_intregpair 4
|
||||
+
|
||||
+/* $f0 (float), or pair $f0, $f1 (double).
|
||||
+ * f2/f3 are used for COMPLEX (= 2 doubles) returns in Fortran */
|
||||
+static const Dwarf_Op loc_fpreg_o32[] =
|
||||
+ {
|
||||
+ { .atom = DW_OP_regx, .number = 32 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
+ { .atom = DW_OP_regx, .number = 33 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
+ { .atom = DW_OP_regx, .number = 34 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
+ { .atom = DW_OP_regx, .number = 35 }, { .atom = DW_OP_piece, .number = 4 },
|
||||
+ };
|
||||
+
|
||||
+/* $f0, or pair $f0, $f2. */
|
||||
+static const Dwarf_Op loc_fpreg[] =
|
||||
+ {
|
||||
+ { .atom = DW_OP_regx, .number = 32 }, { .atom = DW_OP_piece, .number = 8 },
|
||||
+ { .atom = DW_OP_regx, .number = 34 }, { .atom = DW_OP_piece, .number = 8 },
|
||||
+ };
|
||||
+#define nloc_fpreg 1
|
||||
+#define nloc_fpregpair 4
|
||||
+#define nloc_fpregquad 8
|
||||
+
|
||||
+/* 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 $v0. */
|
||||
+static const Dwarf_Op loc_aggregate[] =
|
||||
+ {
|
||||
+ { .atom = DW_OP_breg2, .number = 0 }
|
||||
+ };
|
||||
+#define nloc_aggregate 1
|
||||
+
|
||||
+int
|
||||
+mips_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
|
||||
+{
|
||||
+ /* First find the ABI used by the elf object */
|
||||
+ enum mips_abi abi = find_mips_abi(functypedie->cu->dbg->elf);
|
||||
+
|
||||
+ /* Something went seriously wrong while trying to figure out the ABI */
|
||||
+ if (abi == MIPS_ABI_LAST)
|
||||
+ return -1;
|
||||
+
|
||||
+ /* We couldn't identify the ABI, but the file seems valid */
|
||||
+ if (abi == MIPS_ABI_UNKNOWN)
|
||||
+ return -2;
|
||||
+
|
||||
+ /* Can't handle EABI variants */
|
||||
+ if ((abi == MIPS_ABI_EABI32) || (abi == MIPS_ABI_EABI64))
|
||||
+ return -2;
|
||||
+
|
||||
+ unsigned int regsize = mips_abi_regsize (abi);
|
||||
+ if (!regsize)
|
||||
+ return -2;
|
||||
+
|
||||
+ /* 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)
|
||||
+ {
|
||||
+ attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
|
||||
+ typedie = dwarf_formref_die (attr, &die_mem);
|
||||
+ tag = dwarf_tag (typedie);
|
||||
+ }
|
||||
+
|
||||
+ 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:
|
||||
+ {
|
||||
+ Dwarf_Word size;
|
||||
+ 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 = regsize;
|
||||
+ 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;
|
||||
+
|
||||
+#define ABI_LOC(loc, regsize) ((regsize) == 4 ? (loc ## _o32) : (loc))
|
||||
+
|
||||
+ if (encoding == DW_ATE_float)
|
||||
+ {
|
||||
+ *locp = ABI_LOC(loc_fpreg, regsize);
|
||||
+ if (size <= regsize)
|
||||
+ return nloc_fpreg;
|
||||
+
|
||||
+ if (size <= 2*regsize)
|
||||
+ return nloc_fpregpair;
|
||||
+
|
||||
+ if (size <= 4*regsize && abi == MIPS_ABI_O32)
|
||||
+ return nloc_fpregquad;
|
||||
+
|
||||
+ goto aggregate;
|
||||
+ }
|
||||
+ }
|
||||
+ *locp = ABI_LOC(loc_intreg, regsize);
|
||||
+ if (size <= regsize)
|
||||
+ return nloc_intreg;
|
||||
+ if (size <= 2*regsize)
|
||||
+ return nloc_intregpair;
|
||||
+
|
||||
+ /* Else fall through. Shouldn't happen though (at least with gcc) */
|
||||
+ }
|
||||
+
|
||||
+ case DW_TAG_structure_type:
|
||||
+ case DW_TAG_class_type:
|
||||
+ case DW_TAG_union_type:
|
||||
+ case DW_TAG_array_type:
|
||||
+ aggregate:
|
||||
+ /* XXX TODO: Can't handle structure return with other ABI's yet :-/ */
|
||||
+ if ((abi != MIPS_ABI_O32) && (abi != MIPS_ABI_O64))
|
||||
+ return -2;
|
||||
+
|
||||
+ *locp = loc_aggregate;
|
||||
+ return nloc_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;
|
||||
+}
|
||||
Index: elfutils-0.158/backends/mips_symbol.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ elfutils-0.158/backends/mips_symbol.c 2014-04-21 11:13:36.910235965 +0000
|
||||
@@ -0,0 +1,52 @@
|
||||
+/* MIPS specific symbolic name handling.
|
||||
+ Copyright (C) 2002, 2003, 2005 Red Hat, Inc.
|
||||
+ This file is part of Red Hat elfutils.
|
||||
+ Written by Jakub Jelinek <jakub@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
|
||||
+ 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 <stddef.h>
|
||||
+
|
||||
+#define BACKEND mips_
|
||||
+#include "libebl_CPU.h"
|
||||
+
|
||||
+/* Check for the simple reloc types. */
|
||||
+Elf_Type
|
||||
+mips_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type)
|
||||
+{
|
||||
+ switch (type)
|
||||
+ {
|
||||
+ case R_MIPS_16:
|
||||
+ return ELF_T_HALF;
|
||||
+ case R_MIPS_32:
|
||||
+ return ELF_T_WORD;
|
||||
+ case R_MIPS_64:
|
||||
+ return ELF_T_XWORD;
|
||||
+ default:
|
||||
+ return ELF_T_NUM;
|
||||
+ }
|
||||
+}
|
||||
Index: elfutils-0.158/libebl/eblopenbackend.c
|
||||
===================================================================
|
||||
--- elfutils-0.158.orig/libebl/eblopenbackend.c 2014-04-21 11:13:36.914235875 +0000
|
||||
+++ elfutils-0.158/libebl/eblopenbackend.c 2014-04-21 11:13:36.910235965 +0000
|
||||
@@ -71,6 +71,8 @@
|
||||
{ "sparc", "elf_sparc", "sparc", 5, EM_SPARC, 0, 0 },
|
||||
{ "sparc", "elf_sparcv8plus", "sparc", 5, EM_SPARC32PLUS, 0, 0 },
|
||||
{ "s390", "ebl_s390", "s390", 4, EM_S390, 0, 0 },
|
||||
+ { "mips", "elf_mips", "mips", 4, EM_MIPS, 0, 0 },
|
||||
+ { "mips", "elf_mipsel", "mipsel", 4, EM_MIPS_RS3_LE, 0, 0 },
|
||||
|
||||
{ "m32", "elf_m32", "m32", 3, EM_M32, 0, 0 },
|
||||
{ "m68k", "elf_m68k", "m68k", 4, EM_68K, 0, 0 },
|
||||
Index: elfutils-0.158/backends/common-reloc.c
|
||||
===================================================================
|
||||
--- elfutils-0.158.orig/backends/common-reloc.c 2014-04-21 11:13:36.914235875 +0000
|
||||
+++ elfutils-0.158/backends/common-reloc.c 2014-04-21 11:13:36.910235965 +0000
|
||||
@@ -112,11 +112,13 @@
|
||||
}
|
||||
|
||||
|
||||
+#ifndef NO_COPY_RELOC
|
||||
bool
|
||||
EBLHOOK(copy_reloc_p) (int reloc)
|
||||
{
|
||||
return reloc == R_TYPE (COPY);
|
||||
}
|
||||
+#endif
|
||||
|
||||
bool
|
||||
EBLHOOK(none_reloc_p) (int reloc)
|
||||
@@ -138,7 +140,9 @@
|
||||
ebl->reloc_type_name = EBLHOOK(reloc_type_name);
|
||||
ebl->reloc_type_check = EBLHOOK(reloc_type_check);
|
||||
ebl->reloc_valid_use = EBLHOOK(reloc_valid_use);
|
||||
+#ifndef NO_COPY_RELOC
|
||||
ebl->copy_reloc_p = EBLHOOK(copy_reloc_p);
|
||||
+#endif
|
||||
ebl->none_reloc_p = EBLHOOK(none_reloc_p);
|
||||
#ifndef NO_RELATIVE_RELOC
|
||||
ebl->relative_reloc_p = EBLHOOK(relative_reloc_p);
|
||||
Index: elfutils-0.158/backends/Makefile.am
|
||||
===================================================================
|
||||
--- elfutils-0.158.orig/backends/Makefile.am 2014-04-21 11:13:36.914235875 +0000
|
||||
+++ elfutils-0.158/backends/Makefile.am 2014-04-21 11:14:10.841468934 +0000
|
||||
@@ -33,12 +33,12 @@
|
||||
|
||||
|
||||
modules = i386 sh x86_64 ia64 alpha arm aarch64 sparc ppc ppc64 s390 \
|
||||
- tilegx parisc
|
||||
+ tilegx parisc mips
|
||||
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_aarch64_pic.a libebl_sparc_pic.a libebl_ppc_pic.a \
|
||||
libebl_ppc64_pic.a libebl_s390_pic.a libebl_tilegx_pic.a \
|
||||
- libebl_parisc_pic.a
|
||||
+ libebl_parisc_pic.a libebl_mips_pic.a
|
||||
noinst_LIBRARIES = $(libebl_pic)
|
||||
noinst_DATA = $(libebl_pic:_pic.a=.so)
|
||||
|
||||
@@ -121,6 +121,10 @@
|
||||
libebl_parisc_pic_a_SOURCES = $(parisc_SRCS)
|
||||
am_libebl_parisc_pic_a_OBJECTS = $(parisc_SRCS:.c=.os)
|
||||
|
||||
+mips_SRCS = mips_init.c mips_symbol.c mips_regs.c mips_retval.c
|
||||
+libebl_mips_pic_a_SOURCES = $(mips_SRCS)
|
||||
+am_libebl_mips_pic_a_OBJECTS = $(mips_SRCS:.c=.os)
|
||||
+
|
||||
libebl_%.so libebl_%.map: libebl_%_pic.a $(libelf) $(libdw)
|
||||
@rm -f $(@:.so=.map)
|
||||
echo 'ELFUTILS_$(PACKAGE_VERSION) { global: $*_init; local: *; };' \
|
||||
@@ -0,0 +1,22 @@
|
||||
From: Kurt Roeckx <kurt@roeckx.be>
|
||||
Subject: Make readelf -w output debug information on mips
|
||||
Bug-Debian: http://bugs.debian.org/662041
|
||||
Forwarded: not-needed
|
||||
|
||||
Upstreams wants a change where this is handled by a hook that needs
|
||||
to be filled in by the backend for the arch.
|
||||
|
||||
Index: elfutils-0.153/src/readelf.c
|
||||
===================================================================
|
||||
--- elfutils-0.153.orig/src/readelf.c 2012-08-10 22:01:55.000000000 +0200
|
||||
+++ elfutils-0.153/src/readelf.c 2012-09-18 21:46:27.000000000 +0200
|
||||
@@ -7364,7 +7364,8 @@
|
||||
GElf_Shdr shdr_mem;
|
||||
GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
|
||||
|
||||
- if (shdr != NULL && shdr->sh_type == SHT_PROGBITS)
|
||||
+ if (shdr != NULL && (
|
||||
+ (shdr->sh_type == SHT_PROGBITS) || (shdr->sh_type == SHT_MIPS_DWARF)))
|
||||
{
|
||||
static const struct
|
||||
{
|
||||
@@ -0,0 +1,35 @@
|
||||
Index: elfutils-0.159/libdwfl/linux-pid-attach.c
|
||||
===================================================================
|
||||
--- elfutils-0.159.orig/libdwfl/linux-pid-attach.c
|
||||
+++ elfutils-0.159/libdwfl/linux-pid-attach.c
|
||||
@@ -393,6 +393,16 @@ pid_getthread (Dwfl *dwfl __attribute__
|
||||
return false;
|
||||
}
|
||||
|
||||
+bool
|
||||
+internal_function
|
||||
+__libdwfl_ptrace_attach (pid_t tid __attribute__ ((unused)),
|
||||
+ bool *tid_was_stoppedp __attribute__ ((unused)))
|
||||
+{
|
||||
+ errno = ENOSYS;
|
||||
+ __libdwfl_seterrno (DWFL_E_ERRNO);
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
static bool
|
||||
pid_memory_read (Dwfl *dwfl __attribute__ ((unused)),
|
||||
Dwarf_Addr addr __attribute__ ((unused)),
|
||||
@@ -419,6 +429,13 @@ pid_detach (Dwfl *dwfl __attribute__ ((u
|
||||
{
|
||||
}
|
||||
|
||||
+void
|
||||
+internal_function
|
||||
+__libdwfl_ptrace_detach (pid_t tid __attribute__ ((unused)),
|
||||
+ bool tid_was_stopped __attribute__ ((unused)))
|
||||
+{
|
||||
+}
|
||||
+
|
||||
static void
|
||||
pid_thread_detach (Dwfl_Thread *thread __attribute__ ((unused)),
|
||||
void *thread_arg __attribute__ ((unused)))
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,40 @@
|
||||
From: Kurt Roeckx <kurt@roeckx.be>
|
||||
Subject: Use %m[ instead of %a[ in scanf()
|
||||
|
||||
%a was a gnu extention, but C99 made this a float. So it got
|
||||
changed to %m (supported by glibc 2.7), but %a[ and %as are
|
||||
still supported by glibc. The portability branch changed this
|
||||
from %m to %a again since that's supported by more versions of
|
||||
glibc. However gcc gives a warning about this using -Wformat
|
||||
and we have a new enough libc to use %m.
|
||||
|
||||
Index: elfutils-0.153/src/addr2line.c
|
||||
===================================================================
|
||||
--- elfutils-0.153.orig/src/addr2line.c 2012-02-24 22:29:50.000000000 +0000
|
||||
+++ elfutils-0.153/src/addr2line.c 2012-02-24 22:29:52.000000000 +0000
|
||||
@@ -455,10 +455,10 @@
|
||||
bool parsed = false;
|
||||
int i, j;
|
||||
char *name = NULL;
|
||||
- if (sscanf (string, "(%a[^)])%" PRIiMAX "%n", &name, &addr, &i) == 2
|
||||
+ if (sscanf (string, "(%m[^)])%" PRIiMAX "%n", &name, &addr, &i) == 2
|
||||
&& string[i] == '\0')
|
||||
parsed = adjust_to_section (name, &addr, dwfl);
|
||||
- switch (sscanf (string, "%a[^-+]%n%" PRIiMAX "%n", &name, &i, &addr, &j))
|
||||
+ switch (sscanf (string, "%m[^-+]%n%" PRIiMAX "%n", &name, &i, &addr, &j))
|
||||
{
|
||||
default:
|
||||
break;
|
||||
Index: elfutils-0.153/tests/line2addr.c
|
||||
===================================================================
|
||||
--- elfutils-0.153.orig/tests/line2addr.c 2012-02-24 22:29:50.000000000 +0000
|
||||
+++ elfutils-0.153/tests/line2addr.c 2012-02-24 22:29:52.000000000 +0000
|
||||
@@ -132,7 +132,7 @@
|
||||
{
|
||||
struct args a = { .arg = argv[cnt] };
|
||||
|
||||
- switch (sscanf (a.arg, "%a[^:]:%d", &a.file, &a.line))
|
||||
+ switch (sscanf (a.arg, "%m[^:]:%d", &a.file, &a.line))
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
@@ -0,0 +1,39 @@
|
||||
On many architectures this test fails because binaries/libs produced by
|
||||
binutils don't pass elflint. However elfutils shouldn't FTBFS because of this.
|
||||
|
||||
So we run the tests on all archs to see what breaks, but if it breaks we ignore
|
||||
the result (exitcode 77 means: this test was skipped).
|
||||
|
||||
Index: elfutils-0.156/tests/run-elflint-self.sh
|
||||
===================================================================
|
||||
--- elfutils-0.156.orig/tests/run-elflint-self.sh 2013-07-28 14:35:36.000000000 +0200
|
||||
+++ elfutils-0.156/tests/run-elflint-self.sh 2013-07-28 14:36:10.000000000 +0200
|
||||
@@ -18,4 +18,4 @@
|
||||
|
||||
. $srcdir/test-subr.sh
|
||||
|
||||
-testrun_on_self ${abs_top_builddir}/src/elflint --quiet --gnu-ld
|
||||
+testrun_on_self_skip ${abs_top_builddir}/src/elflint --quiet --gnu-ld
|
||||
Index: elfutils-0.156/tests/test-subr.sh
|
||||
===================================================================
|
||||
--- elfutils-0.156.orig/tests/test-subr.sh 2013-07-28 14:35:36.000000000 +0200
|
||||
+++ elfutils-0.156/tests/test-subr.sh 2013-07-28 14:35:36.000000000 +0200
|
||||
@@ -149,3 +149,18 @@
|
||||
# Only exit if something failed
|
||||
if test $exit_status != 0; then exit $exit_status; fi
|
||||
}
|
||||
+
|
||||
+# Same as testrun_on_self(), but skip on failure.
|
||||
+testrun_on_self_skip()
|
||||
+{
|
||||
+ exit_status=0
|
||||
+
|
||||
+ for file in $self_test_files; do
|
||||
+ testrun $* $file \
|
||||
+ || { echo "*** failure in $* $file"; exit_status=77; }
|
||||
+ done
|
||||
+
|
||||
+ # Only exit if something failed
|
||||
+ if test $exit_status != 0; then exit $exit_status; fi
|
||||
+}
|
||||
+
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
From 3daec2dd11a04955f95e8f65a48820103d84dbec Mon Sep 17 00:00:00 2001
|
||||
From: Junling Zheng <zhengjunling@huawei.com>
|
||||
Date: Thu, 9 Apr 2015 12:12:49 +0000
|
||||
Subject: [PATCH] uclibc support for elfutils 0.161
|
||||
|
||||
on uclibc systems libintl and libuargp are separate from libc.
|
||||
so they need to be specified on commandline when we use proxy-libintl
|
||||
then libintl is a static archive so it should be listed last since
|
||||
elfutils does not respect disable-nls we need to link in libintl
|
||||
|
||||
We add a new option --enable-uclibc which will be used to control
|
||||
the uclibc specific configurations during build.
|
||||
|
||||
Upstream-Status: Inappropriate [uclibc specific]
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem>
|
||||
Signed-off-by: Junling Zheng <zhengjunling@huawei.com>
|
||||
[Junling Zheng:
|
||||
- adjust context
|
||||
]
|
||||
---
|
||||
configure.ac | 8 ++++++++
|
||||
libcpu/Makefile.am | 4 ++++
|
||||
libdw/Makefile.am | 7 ++++++-
|
||||
libelf/Makefile.am | 5 +++++
|
||||
4 files changed, 23 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index a1ad6db..81fc33f 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -70,6 +70,14 @@ AS_IF([test "$use_locks" = yes],
|
||||
|
||||
AH_TEMPLATE([USE_LOCKS], [Defined if libraries should be thread-safe.])
|
||||
|
||||
+AC_ARG_ENABLE([uclibc],
|
||||
+AS_HELP_STRING([--enable-uclibc], [Use uclibc for system libraries]),
|
||||
+use_uclibc=yes, use_uclibc=no)
|
||||
+AM_CONDITIONAL(USE_UCLIBC, test "$use_uclibc" = yes)
|
||||
+AS_IF([test "$use_uclibc" = yes], [AC_DEFINE(USE_UCLIBC)])
|
||||
+
|
||||
+AH_TEMPLATE([USE_UCLIBC], [Defined if uclibc libraries are used.])
|
||||
+
|
||||
AC_PROG_CC
|
||||
AC_PROG_RANLIB
|
||||
AC_PROG_YACC
|
||||
diff --git a/libcpu/Makefile.am b/libcpu/Makefile.am
|
||||
index 3beccf3..9ba6c04 100644
|
||||
--- a/libcpu/Makefile.am
|
||||
+++ b/libcpu/Makefile.am
|
||||
@@ -80,6 +80,10 @@ i386_parse_CFLAGS = -DNMNES="`wc -l < i386.mnemonics`"
|
||||
i386_lex.o: i386_parse.h
|
||||
i386_gendis_LDADD = $(libeu) -lm
|
||||
|
||||
+if USE_UCLIBC
|
||||
+i386_gendis_LDADD += -luargp -lintl
|
||||
+endif
|
||||
+
|
||||
i386_parse.h: i386_parse.c ;
|
||||
|
||||
EXTRA_DIST = defs/i386
|
||||
diff --git a/libdw/Makefile.am b/libdw/Makefile.am
|
||||
index 887da6b..d31b428 100644
|
||||
--- a/libdw/Makefile.am
|
||||
+++ b/libdw/Makefile.am
|
||||
@@ -102,6 +102,11 @@ endif
|
||||
libdw_pic_a_SOURCES =
|
||||
am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os)
|
||||
|
||||
+libdw_so_LDLIBS =
|
||||
+if USE_UCLIBC
|
||||
+libdw_so_LDLIBS += -lintl -luargp
|
||||
+endif
|
||||
+
|
||||
libdw_so_SOURCES =
|
||||
libdw.so$(EXEEXT): $(srcdir)/libdw.map libdw_pic.a ../libdwelf/libdwelf_pic.a \
|
||||
../libdwfl/libdwfl_pic.a ../libebl/libebl.a \
|
||||
@@ -112,7 +117,7 @@ libdw.so$(EXEEXT): $(srcdir)/libdw.map libdw_pic.a ../libdwelf/libdwelf_pic.a \
|
||||
-Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
|
||||
-Wl,--version-script,$<,--no-undefined \
|
||||
-Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
|
||||
- -ldl $(zip_LIBS)
|
||||
+ -ldl $(zip_LIBS) $(libdw_so_LDLIBS)
|
||||
@$(textrel_check)
|
||||
ln -fs $@ $@.$(VERSION)
|
||||
|
||||
diff --git a/libelf/Makefile.am b/libelf/Makefile.am
|
||||
index afcb2aa..02836a1 100644
|
||||
--- a/libelf/Makefile.am
|
||||
+++ b/libelf/Makefile.am
|
||||
@@ -93,7 +93,12 @@ libelf_a_SOURCES = elf_version.c elf_hash.c elf_error.c elf_fill.c \
|
||||
libelf_pic_a_SOURCES =
|
||||
am_libelf_pic_a_OBJECTS = $(libelf_a_SOURCES:.c=.os)
|
||||
|
||||
+
|
||||
libelf_so_LDLIBS =
|
||||
+if USE_UCLIBC
|
||||
+libelf_so_LDLIBS += -lintl -luargp
|
||||
+endif
|
||||
+
|
||||
if USE_LOCKS
|
||||
libelf_so_LDLIBS += -lpthread
|
||||
endif
|
||||
--
|
||||
1.8.3.4
|
||||
|
||||
Reference in New Issue
Block a user