Package: src:elfutils
Version: 0.159-4
Tags: patch
User: [email protected]
Usertags: ppc64el
Hi Kurt,
This patch adds support for the ppc64el port to elfutils, with 2 patches
from upstream.
May you please consider it for an upload?
The test-suite results for your convenience:
cat tests/test-suite.log
==========================================
elfutils 0.159: tests/test-suite.log
==========================================
# TOTAL: 123
# PASS: 120
# SKIP: 3
# XFAIL: 0
# FAIL: 0
# XPASS: 0
# ERROR: 0
.. contents:: :depth: 2
SKIP: run-backtrace-data.sh
===========================
/root/elfutils-0.159/tests/backtrace-data: Unwinding not supported for
this architecture
data: arch not supported
SKIP: run-backtrace-native-biarch.sh
====================================
SKIP: run-backtrace-native-core-biarch.sh
=========================================
<EOF>
Thank you,
--
Mauricio Faria de Oliveira
IBM Linux Technology Center
diff -Nru elfutils-0.159/debian/changelog elfutils-0.159/debian/changelog
--- elfutils-0.159/debian/changelog 2014-07-06 10:21:54.000000000 -0300
+++ elfutils-0.159/debian/changelog 2014-07-14 08:40:59.000000000 -0300
@@ -1,3 +1,10 @@
+elfutils (0.159-4.1) UNRELEASED; urgency=medium
+
+ * Non-maintainer upload.
+ * Add ppc64el patches (ppc64el-elf.h-update, ppc64el-ELFv2-abi-support).
+
+ -- Mauricio Faria de Oliveira <[email protected]> Mon, 14 Jul 2014
08:36:32 -0300
+
elfutils (0.159-4) unstable; urgency=medium
[ Wookey ]
diff -Nru elfutils-0.159/debian/patches/ppc64el-ELFv2-abi-support.patch
elfutils-0.159/debian/patches/ppc64el-ELFv2-abi-support.patch
--- elfutils-0.159/debian/patches/ppc64el-ELFv2-abi-support.patch
1969-12-31 21:00:00.000000000 -0300
+++ elfutils-0.159/debian/patches/ppc64el-ELFv2-abi-support.patch
2014-07-14 08:34:40.000000000 -0300
@@ -0,0 +1,105 @@
+Origin: upstream,
https://git.fedorahosted.org/cgit/elfutils.git/commit/?id=16e2d351bf31d0ce09ce9632ff196cbd973b656b
+From a95c4ad24cf83b2b0273fee73162bf476cebec8f Mon Sep 17 00:00:00 2001
+From: Mark Wielaard <[email protected]>
+Date: Fri, 4 Jul 2014 14:30:48 +0200
+Subject: Add ppc64le ELFv2 abi support to backends and elflint.
+Last-Update: 2014-07-14
+
+The big endian vs little endian changes are already handled by detecting
+the EI_DATA data encoding. And the function descriptors are already not
+used when we see there is no .opd section. This change adds new checks
+for st_other bits, new relocations and recognizes DT_PPC64_OPT.
+
+Signed-off-by: Menanteau Guy <[email protected]>
+Signed-off-by: Mark Wielaard <[email protected]>
+
+Update 2014-07-14: Remove {backends,src}/ChangeLog chunks from upstream patch.
+
+diff --git a/backends/ppc64_init.c b/backends/ppc64_init.c
+index e52231c..7ea2b23 100644
+--- a/backends/ppc64_init.c
++++ b/backends/ppc64_init.c
+@@ -61,6 +61,7 @@ ppc64_init (elf, machine, eh, ehlen)
+ HOOK (eh, machine_flag_check);
+ HOOK (eh, copy_reloc_p);
+ HOOK (eh, check_special_symbol);
++ HOOK (eh, check_st_other_bits);
+ HOOK (eh, bss_plt_p);
+ HOOK (eh, return_value_location);
+ HOOK (eh, register_info);
+diff --git a/backends/ppc64_reloc.def b/backends/ppc64_reloc.def
+index 6366f46..3a693cf 100644
+--- a/backends/ppc64_reloc.def
++++ b/backends/ppc64_reloc.def
+@@ -132,6 +132,21 @@ RELOC_TYPE (DTPREL16_HIGHER, REL)
+ RELOC_TYPE (DTPREL16_HIGHERA, REL)
+ RELOC_TYPE (DTPREL16_HIGHEST, REL)
+ RELOC_TYPE (DTPREL16_HIGHESTA, REL)
++RELOC_TYPE (TLSGD, REL)
++RELOC_TYPE (TLSLD, REL)
++RELOC_TYPE (TOCSAVE, REL)
++RELOC_TYPE (ADDR16_HIGH, REL)
++RELOC_TYPE (ADDR16_HIGHA, REL)
++RELOC_TYPE (TPREL16_HIGH, REL)
++RELOC_TYPE (TPREL16_HIGHA, REL)
++RELOC_TYPE (DTPREL16_HIGH, REL)
++RELOC_TYPE (DTPREL16_HIGHA, REL)
++RELOC_TYPE (JMP_IREL, REL)
++RELOC_TYPE (IRELATIVE, REL)
++RELOC_TYPE (REL16, REL)
++RELOC_TYPE (REL16_LO, REL)
++RELOC_TYPE (REL16_HI, REL)
++RELOC_TYPE (REL16_HA, REL)
+
+ /* Notes from Alan Modra:
+
+diff --git a/backends/ppc64_symbol.c b/backends/ppc64_symbol.c
+index 212d414..5a020d8 100644
+--- a/backends/ppc64_symbol.c
++++ b/backends/ppc64_symbol.c
+@@ -72,6 +72,8 @@ ppc64_dynamic_tag_name (int64_t tag, char *buf __attribute__
((unused)),
+ return "PPC64_OPD";
+ case DT_PPC64_OPDSZ:
+ return "PPC64_OPDSZ";
++ case DT_PPC64_OPT:
++ return "PPC64_OPT";
+ default:
+ break;
+ }
+@@ -84,7 +86,8 @@ ppc64_dynamic_tag_check (int64_t tag)
+ {
+ return (tag == DT_PPC64_GLINK
+ || tag == DT_PPC64_OPD
+- || tag == DT_PPC64_OPDSZ);
++ || tag == DT_PPC64_OPDSZ
++ || tag == DT_PPC64_OPT);
+ }
+
+
+@@ -120,3 +123,9 @@ ppc64_machine_flag_check (GElf_Word flags)
+ {
+ return flags == 0 || flags == 1 || flags == 2;
+ }
++
++bool
++ppc64_check_st_other_bits (unsigned char st_other)
++{
++ return (PPC64_LOCAL_ENTRY_OFFSET (st_other) != 0);
++}
+diff --git a/src/elflint.c b/src/elflint.c
+index 5568c65..d6a4774 100644
+--- a/src/elflint.c
++++ b/src/elflint.c
+@@ -799,7 +799,8 @@ section [%2d] '%s': symbol %zu: function in COMMON section
is nonsense\n"),
+ && strcmp (name, "__fini_array_end") != 0
+ && strcmp (name, "__bss_start") != 0
+ && strcmp (name, "__bss_start__") != 0
+- && strcmp (name, "__TMC_END__") != 0))
++ && strcmp (name, "__TMC_END__") != 0
++ && strcmp (name, ".TOC.") != 0))
+ ERROR (gettext ("\
+ section [%2d] '%s': symbol %zu: st_value out of bounds\n"),
+ idx, section_name (ebl, idx), cnt);
+--
+cgit v0.10.2
+
diff -Nru elfutils-0.159/debian/patches/ppc64el-elf.h-update.patch
elfutils-0.159/debian/patches/ppc64el-elf.h-update.patch
--- elfutils-0.159/debian/patches/ppc64el-elf.h-update.patch 1969-12-31
21:00:00.000000000 -0300
+++ elfutils-0.159/debian/patches/ppc64el-elf.h-update.patch 2014-07-14
08:34:26.000000000 -0300
@@ -0,0 +1,85 @@
+Origin: upstream,
https://git.fedorahosted.org/cgit/elfutils.git/commit/?id=16e2d351bf31d0ce09ce9632ff196cbd973b656b
+From 16e2d351bf31d0ce09ce9632ff196cbd973b656b Mon Sep 17 00:00:00 2001
+From: Mark Wielaard <[email protected]>
+Date: Fri, 4 Jul 2014 13:39:18 +0200
+Subject: Update elf.h from glibc.
+
+Includes new bits needed for ppc64le ELFv2 abi.
+https://bugzilla.redhat.com/show_bug.cgi?id=1110249
+
+Signed-off-by: Mark Wielaard <[email protected]>
+
+diff --git a/libelf/ChangeLog b/libelf/ChangeLog
+index bd009cd..4bc8f56 100644
+--- a/libelf/ChangeLog
++++ b/libelf/ChangeLog
+@@ -1,3 +1,7 @@
++2014-07-07 Mark Wielaard <[email protected]>
++
++ * elf.h: Update from glibc.
++
+ 2014-04-13 Mark Wielaard <[email protected]>
+
+ * Makefile.am: Remove !MUDFLAP conditions.
+diff --git a/libelf/elf.h b/libelf/elf.h
+index a05ea3b..40e87b2 100644
+--- a/libelf/elf.h
++++ b/libelf/elf.h
+@@ -1,5 +1,5 @@
+ /* This file defines standard ELF types, structures, and macros.
+- Copyright (C) 1995-2013 Free Software Foundation, Inc.
++ Copyright (C) 1995-2014 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+@@ -2252,6 +2252,17 @@ typedef Elf32_Addr Elf32_Conflict;
+ #define R_PPC64_DTPREL16_HIGHERA 104 /* half16
(sym+add)@dtprel@highera */
+ #define R_PPC64_DTPREL16_HIGHEST 105 /* half16
(sym+add)@dtprel@highest */
+ #define R_PPC64_DTPREL16_HIGHESTA 106 /* half16
(sym+add)@dtprel@highesta */
++#define R_PPC64_TLSGD 107 /* none (sym+add)@tlsgd */
++#define R_PPC64_TLSLD 108 /* none (sym+add)@tlsld */
++#define R_PPC64_TOCSAVE 109 /* none */
++
++/* Added when HA and HI relocs were changed to report overflows. */
++#define R_PPC64_ADDR16_HIGH 110
++#define R_PPC64_ADDR16_HIGHA 111
++#define R_PPC64_TPREL16_HIGH 112
++#define R_PPC64_TPREL16_HIGHA 113
++#define R_PPC64_DTPREL16_HIGH 114
++#define R_PPC64_DTPREL16_HIGHA 115
+
+ /* GNU extension to support local ifunc. */
+ #define R_PPC64_JMP_IREL 247
+@@ -2261,12 +2272,29 @@ typedef Elf32_Addr Elf32_Conflict;
+ #define R_PPC64_REL16_HI 251 /* half16 (sym+add-.)@h */
+ #define R_PPC64_REL16_HA 252 /* half16 (sym+add-.)@ha */
+
++/* e_flags bits specifying ABI.
++ 1 for original function descriptor using ABI,
++ 2 for revised ABI without function descriptors,
++ 0 for unspecified or not using any features affected by the differences.
*/
++#define EF_PPC64_ABI 3
++
+ /* PowerPC64 specific values for the Dyn d_tag field. */
+ #define DT_PPC64_GLINK (DT_LOPROC + 0)
+ #define DT_PPC64_OPD (DT_LOPROC + 1)
+ #define DT_PPC64_OPDSZ (DT_LOPROC + 2)
++#define DT_PPC64_OPT (DT_LOPROC + 3)
+ #define DT_PPC64_NUM 3
+
++/* PowerPC64 specific values for the DT_PPC64_OPT Dyn entry. */
++#define PPC64_OPT_TLS 1
++#define PPC64_OPT_MULTI_TOC 2
++
++/* PowerPC64 specific values for the Elf64_Sym st_other field. */
++#define STO_PPC64_LOCAL_BIT 5
++#define STO_PPC64_LOCAL_MASK (7 << STO_PPC64_LOCAL_BIT)
++#define PPC64_LOCAL_ENTRY_OFFSET(other) \
++ (((1 << (((other) & STO_PPC64_LOCAL_MASK) >> STO_PPC64_LOCAL_BIT)) >> 2) <<
2)
++
+
+ /* ARM specific declarations */
+
+--
+cgit v0.10.2
+
diff -Nru elfutils-0.159/debian/patches/series
elfutils-0.159/debian/patches/series
--- elfutils-0.159/debian/patches/series 2014-07-06 10:15:53.000000000
-0300
+++ elfutils-0.159/debian/patches/series 2014-07-14 08:34:40.000000000
-0300
@@ -13,3 +13,5 @@
non_linux.patch
unaligned.patch
aarch64-run-native-test-fix.patch
+ppc64el-elf.h-update.patch
+ppc64el-ELFv2-abi-support.patch