public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [COMMITTED] ppc: ppc_check_special_symbol): Also allow _SDA_BASE_ in .data section.
@ 2015-10-16 11:12 Mark Wielaard
  0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2015-10-16 11:12 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 2017 bytes --]

The Small Data Area Base normally points to .sdata, in which case we
check it is at an offset of 0x8000.  It might however fall in the
.data section, in which case we cannot check the offset.  The size always
should be zero.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
 backends/ChangeLog    |  5 +++++
 backends/ppc_symbol.c | 11 ++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/backends/ChangeLog b/backends/ChangeLog
index e6f3763..6ea3dc4 100644
--- a/backends/ChangeLog
+++ b/backends/ChangeLog
@@ -1,3 +1,8 @@
+2015-10-16  Mark Wielaard  <mjw@redhat.com>
+
+	* ppc_symbol.c (ppc_check_special_symbol): Also allow _SDA_BASE_
+	in .data section.
+
 2015-10-05  Josh Stone  <jistone@redhat.com>
 
 	* Makefile.am (libebl_%.so): Add AM_V_at and AM_V_CCLD silencers.
diff --git a/backends/ppc_symbol.c b/backends/ppc_symbol.c
index 733114b..37d4918 100644
--- a/backends/ppc_symbol.c
+++ b/backends/ppc_symbol.c
@@ -1,5 +1,5 @@
 /* PPC specific symbolic name handling.
-   Copyright (C) 2004, 2005, 2007, 2014 Red Hat, Inc.
+   Copyright (C) 2004, 2005, 2007, 2014, 2015 Red Hat, Inc.
    This file is part of elfutils.
    Written by Ulrich Drepper <drepper@redhat.com>, 2004.
 
@@ -143,9 +143,14 @@ ppc_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, const GElf_Sym *sym,
   if (sname == NULL)
     return false;
 
+  /* Small data area.  Normally points to .sdata, in which case we
+     check it is at an offset of 0x8000.  It might however fall in the
+     .data section, in which case we cannot check the offset.  The
+     size always should be zero.  */
   if (strcmp (name, "_SDA_BASE_") == 0)
-    return (strcmp (sname, ".sdata") == 0
-	    && sym->st_value == destshdr->sh_addr + 0x8000
+    return (((strcmp (sname, ".sdata") == 0
+	      && sym->st_value == destshdr->sh_addr + 0x8000)
+	     || strcmp (sname, ".data") == 0)
 	    && sym->st_size == 0);
 
   if (strcmp (name, "_SDA2_BASE_") == 0)
-- 
2.4.3


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-10-16 11:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-16 11:12 [COMMITTED] ppc: ppc_check_special_symbol): Also allow _SDA_BASE_ in .data section Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).