public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "John David Anglin" <dave@hiauly1.hia.nrc.ca>
To: dave@hiauly1.hia.nrc.ca (John David Anglin)
Cc: binutils@sourceware.org, nick.hudson@dsl.pipex.com, nickc@redhat.com
Subject: Re: hppa unwind entries
Date: Fri, 28 Dec 2007 23:47:00 -0000	[thread overview]
Message-ID: <200712282346.lBSNkVOn007249@hiauly1.hia.nrc.ca> (raw)
In-Reply-To: <no.id> from "John David Anglin" at Dec 28, 2007 12:55:39 pm

> Sorry, I should have chimed in when I saw Nick's message yesterday.  The
> same issue is present for 64-bit hppa targets.  See code in elf-hppa.h.

I have committed the enclosed change.  Tested on hppa64-hp-hpux11.00
and hppa-unknown-linux-gnu.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

2007-12-28  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>

	* elf-hppa.h (elf_hppa_osec_to_segment): New function.
	(elf_hppa_record_segment_addrs): Use elf_hppa_osec_to_segment.
	Remove ATTRIBUTE_UNUSED from abfd argument.
	* elf32-hppa.c (hppa_record_segment_addr): Likewise.

Index: elf32-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-hppa.c,v
retrieving revision 1.158
diff -u -3 -p -r1.158 elf32-hppa.c
--- elf32-hppa.c	28 Dec 2007 14:45:34 -0000	1.158
+++ elf32-hppa.c	28 Dec 2007 23:22:15 -0000
@@ -3256,7 +3256,7 @@ elf32_hppa_final_link (bfd *abfd, struct
 /* Record the lowest address for the data and text segments.  */
 
 static void
-hppa_record_segment_addr (bfd *abfd ATTRIBUTE_UNUSED,
+hppa_record_segment_addr (bfd *abfd,
 			  asection *section,
 			  void *data)
 {
@@ -3266,30 +3266,9 @@ hppa_record_segment_addr (bfd *abfd ATTR
 
   if ((section->flags & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD))
     {
-      bfd_vma value;
-      struct elf_segment_map *m;
-      Elf_Internal_Phdr *p;
-
-      /* Find the segment that contains the output_section for this section.  */
-      for (m = elf_tdata (abfd)->segment_map,
-	     p = elf_tdata (abfd)->phdr;
-	   m != NULL;
-	   m = m->next, p++)
-	{
-	  int i;
-
-	  for (i = m->count - 1; i >= 0; i--)
-	    if (m->sections[i] == section->output_section)
-	      break;
-	  if (i >= 0)
-	    break;
-	}
-
-      if (m == NULL)
-        return;
+      unsigned seg = elf_hppa_osec_to_segment (abfd, section->output_section);
+      bfd_vma value = elf_tdata (abfd)->phdr[seg].p_vaddr;
 
-      value = p->p_vaddr;
-      
       if ((section->flags & SEC_READONLY) != 0)
 	{
 	  if (value < htab->text_segment_base)
Index: elf-hppa.h
===================================================================
RCS file: /cvs/src/src/bfd/elf-hppa.h,v
retrieving revision 1.85
diff -u -3 -p -r1.85 elf-hppa.h
--- elf-hppa.h	3 Jul 2007 14:26:40 -0000	1.85
+++ elf-hppa.h	28 Dec 2007 23:22:15 -0000
@@ -1088,6 +1088,35 @@ elf_hppa_fake_sections (bfd *abfd, Elf_I
   return TRUE;
 }
 
+/* Find the segment number in which OSEC, and output section, is
+   located.  */
+
+static unsigned
+elf_hppa_osec_to_segment (bfd *output_bfd, asection *osec)
+{
+  struct elf_segment_map *m;
+  Elf_Internal_Phdr *p;
+
+  /* Find the segment that contains the output_section.  */
+  for (m = elf_tdata (output_bfd)->segment_map,
+	 p = elf_tdata (output_bfd)->phdr;
+       m != NULL;
+       m = m->next, p++)
+    {
+      int i;
+
+      for (i = m->count - 1; i >= 0; i--)
+	if (m->sections[i] == osec)
+	  break;
+
+      if (i >= 0)
+	break;
+    }
+
+  BFD_ASSERT (m);
+  return p - elf_tdata (output_bfd)->phdr;
+}
+
 static void
 elf_hppa_final_write_processing (bfd *abfd,
 				 bfd_boolean linker ATTRIBUTE_UNUSED)
@@ -1300,25 +1329,28 @@ elf_hppa_is_dynamic_loader_symbol (const
 
 /* Record the lowest address for the data and text segments.  */
 static void
-elf_hppa_record_segment_addrs (bfd *abfd ATTRIBUTE_UNUSED,
+elf_hppa_record_segment_addrs (bfd *abfd,
 			       asection *section,
 			       void *data)
 {
-  struct elf64_hppa_link_hash_table *hppa_info;
-  bfd_vma value;
-
-  hppa_info = data;
+  struct elf64_hppa_link_hash_table *hppa_info = data;
 
-  value = section->vma - section->filepos;
+  if ((section->flags & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD))
+    {
+      unsigned seg = elf_hppa_osec_to_segment (abfd, section->output_section);
+      bfd_vma value = elf_tdata (abfd)->phdr[seg].p_vaddr;
 
-  if (((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
-       == (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
-      && value < hppa_info->text_segment_base)
-    hppa_info->text_segment_base = value;
-  else if (((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
-	    == (SEC_ALLOC | SEC_LOAD))
-	   && value < hppa_info->data_segment_base)
-    hppa_info->data_segment_base = value;
+      if (section->flags & SEC_READONLY)
+	{
+	  if (value < hppa_info->text_segment_base)
+	    hppa_info->text_segment_base = value;
+	}
+      else
+	{
+	  if (value < hppa_info->data_segment_base)
+	    hppa_info->data_segment_base = value;
+	}
+    }
 }
 
 /* Called after we have seen all the input files/sections, but before

  parent reply	other threads:[~2007-12-28 23:47 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <no.id>
1999-07-01  0:00 ` Duplicate symbols in recent cvs source John David Anglin
1999-07-01  0:00   ` John David Anglin
1999-07-01  0:00 ` #error ELF_MAXPAGESIZE is not defined John David Anglin
2000-04-09 13:44 ` Errors compiling coff-tic54x.c from todays CVS source John David Anglin
2000-09-22 16:56 ` gas 2.10.91 from 20000920 cvs is broken under hpux 10.20 John David Anglin
2000-09-22 18:49   ` Alan Modra
2000-09-22 22:42   ` John David Anglin
2000-09-22 23:11     ` Alan Modra
2000-09-24 15:25 ` [Patch]: " John David Anglin
2000-09-26 10:03 ` [Patch]: Re: gas 2.10.91 from 20000920 cvs is broken under hpux John David Anglin
2000-09-26 13:24   ` John David Anglin
2000-09-26 18:16     ` Alan Modra
2000-09-26 20:54       ` John David Anglin
2000-09-28  1:42     ` Alan Modra
2001-03-14 15:52 ` vax quad.exp testsuite failure John David Anglin
2001-03-15  3:05   ` Alan Modra
2001-03-15  8:15     ` John David Anglin
2001-03-14 16:06 ` John David Anglin
2001-07-22 16:35 ` [patch] tc-*.[ch]: Fix formatting Alan Modra
2001-07-22 16:38 ` [patch] s390-dis.c: " Alan Modra
2001-07-23 17:10 ` [patch] *-dis.c: " Alan Modra
2001-07-23 19:22 ` [patch] *-dis.c: Fix formatting. (2nd set) Alan Modra
2001-07-24 17:33 ` [patch] d?0v-dis.c: Fix formatting Alan Modra
2001-07-28 20:48 ` [patch] i386-dis.c: " Alan Modra
2002-02-09 17:47 ` Special names tha ld needs to recognize for hppa64-hp-hpux11.X John David Anglin
2002-02-12 16:14 ` John David Anglin
2002-02-12 17:38   ` law
2002-02-26 15:20     ` John David Anglin
2002-02-26 21:58       ` Alan Modra
2002-02-27  0:32         ` John David Anglin
2002-03-05  9:57       ` law
2002-04-25  8:59 ` i386-pc-nto-qnx patch Graeme Peterson
2002-04-25  9:09   ` H . J . Lu
2002-04-25 10:04     ` gp
2002-04-25 23:40   ` J.T. Conklin
2002-05-09  8:20 ` Graeme Peterson
2002-05-10  6:31   ` Alan Modra
2002-05-10  7:55     ` Graeme Peterson
2002-05-13  8:42     ` Graeme Peterson
2002-05-10  9:57 ` Graeme Peterson
2002-06-05 23:05 ` Miscellaneous fixes for testsuite failures on hppa64-hp-hpux11.00 John David Anglin
2002-06-05 23:14   ` law
2002-06-22 23:12 ` PATCH: Re: hppa64-hp-hpux11.00: invalid string offset for section .dynstr John David Anglin
2002-06-23  2:07   ` Alan Modra
2002-06-27 10:33 ` hpux64-hp-hpux11.00: .rela.opd problems John David Anglin
2002-07-16 17:43 ` SIGSEGV in ld at elflink.h:5500 John David Anglin
2002-07-16 18:51   ` Alan Modra
2002-07-16 19:34     ` John David Anglin
2002-07-16 21:39       ` Alan Modra
2002-07-16 21:49     ` John David Anglin
2002-07-16 22:46       ` Alan Modra
2002-07-17  0:12         ` John David Anglin
2002-07-17 20:35         ` John David Anglin
2002-07-17 23:07           ` Alan Modra
2002-07-17 23:42             ` John David Anglin
2002-07-18  0:14               ` Alan Modra
2002-07-18  3:11                 ` John David Anglin
2002-10-18 13:43 ` QNX binutils targets Graeme Peterson
2002-10-24 19:42 ` K&R patch for binutils bfd directory John David Anglin
2002-12-03  8:31 ` Patch to config.guess (2002-07-03) to detect 64bit HPUX compiler John David Anglin
2002-12-03 16:51   ` John David Anglin
2002-12-04  1:53     ` Ben Elliston
2002-12-17  8:51 ` Setting LD tool default to ld breaks configure check for ld used by GCC John David Anglin
2002-12-20 17:56   ` John David Anglin
2003-05-21 18:07 ` [BFD PATCH] File truncation in objcopy for hppa2.0w-hp-hpux11.11 in binutils-2.13.1 John David Anglin
2003-05-21 20:00   ` [BFD PATCH] " Stuart F. Downing
2003-05-22  3:41   ` [BFD PATCH] " John David Anglin
2003-05-22 15:46     ` Daniel Jacobowitz
2003-05-22 15:59       ` John David Anglin
2003-05-23 15:06         ` Daniel Jacobowitz
2004-03-20 23:37 ` [committed] Add support for PCREL32 and PCREL64 relocations on PA John David Anglin
2004-06-11 17:54 ` [PATCH] Allow reduction of fake labels " John David Anglin
2005-06-16  3:32 ` hppa build broken John David Anglin
2006-03-04 22:15 ` [hppa] Fix disassembly of bb condition codes John David Anglin
2006-03-05  6:22   ` Randolph Chung
2009-08-14  7:43   ` Nick Hudson
2007-12-28 23:47 ` John David Anglin [this message]
2007-12-29  9:15   ` hppa unwind entries Nick Clifton
2007-12-29 15:52     ` Nick Clifton
2007-12-29 17:16       ` John David Anglin
2007-12-30 15:46         ` Nick Clifton
2007-12-30 17:13           ` John David Anglin
2007-12-31 11:01             ` Nick Clifton
2009-02-15 19:45 ` [committed] Ensure pc-relative calls can reach their target on hppa64 John David Anglin
2007-12-12 13:18 hppa unwind entries Nick Hudson
2007-12-28 14:46 ` Nick Clifton
2007-12-29 14:45   ` Nick Hudson
2007-12-28 17:56 John David Anglin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200712282346.lBSNkVOn007249@hiauly1.hia.nrc.ca \
    --to=dave@hiauly1.hia.nrc.ca \
    --cc=binutils@sourceware.org \
    --cc=nick.hudson@dsl.pipex.com \
    --cc=nickc@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).