This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: hpux64-hp-hpux11.00: .rela.opd problems


> I didn't make myself very clear.  I problem started because I have a
> fairly simple program which runs fine when the shared library is created
> with the HP linker but doesn't work (segfaults) when created with binutils
> 020624.

I built your sample program and library with my toolset.  The program
doesn't segfault.  Your binary appears to segfault in a stub just
after the return "bve,n (%r2)" in CreateImage.  I suggest rebuilding
binutils 020624 with the HP compiler as your gnu ld binary may be causing
the problem.

I recommend 020624 or 020625 since I believe the dwarf2.c patch
today introduces a new bug in ld.

I have the following patch installed to improve the sorting of relocs,
and to fix the calculation of DT_RELA when the rela.data section is
being stripped and sections are not being combined.

Hope this helps.

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

2002-06-26  John David Anglin  <dave@hiauly1.hia.nrc.ca>

	* elf64-hppa.c (elf64_hppa_reloc_type_class): New function.
	(elf64_hppa_finish_dynamic_sections): Check other_rel_sec, dlt_rel_sec
	and opd_rel_sec in order for starting rela section.  Check _raw_size.
	(elf_backend_reloc_type_class): Define.
	* emulparams/hppa64linux.sh (OTHER_GOT_RELOC_SECTIONS): Add rela.opd
	section.  Add ${RELOCATING-0}.

Index: bfd/elf64-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-hppa.c,v
retrieving revision 1.24
diff -u -3 -p -r1.24 elf64-hppa.c
--- bfd/elf64-hppa.c	23 Jun 2002 09:05:59 -0000	1.24
+++ bfd/elf64-hppa.c	26 Jun 2002 22:55:36 -0000
@@ -213,6 +213,9 @@ static int elf64_hppa_additional_program
 
 static boolean elf64_hppa_modify_segment_map PARAMS ((bfd *));
 
+static enum elf_reloc_type_class elf64_hppa_reloc_type_class
+  PARAMS ((const Elf_Internal_Rela *));
+
 static boolean elf64_hppa_finish_dynamic_sections
   PARAMS ((bfd *, struct bfd_link_info *));
 
@@ -2470,6 +2473,27 @@ elf64_hppa_finalize_dynreloc (dyn_h, dat
   return true;
 }
 
+/* Used to decide how to sort relocs in an optimal manner for the
+   dynamic linker, before writing them out.  */
+
+static enum elf_reloc_type_class
+elf64_hppa_reloc_type_class (rela)
+     const Elf_Internal_Rela *rela;
+{
+  if (ELF64_R_SYM (rela->r_info) == 0)
+    return reloc_class_relative;
+
+  switch ((int) ELF64_R_TYPE (rela->r_info))
+    {
+    case R_PARISC_IPLT:
+      return reloc_class_plt;
+    case R_PARISC_COPY:
+      return reloc_class_copy;
+    default:
+      return reloc_class_normal;
+    }
+}
+
 /* Finish up the dynamic sections.  */
 
 static boolean
@@ -2553,8 +2577,10 @@ elf64_hppa_finish_dynamic_sections (outp
 
 	    case DT_RELA:
 	      s = hppa_info->other_rel_sec;
-	      if (! s)
+	      if (! s || ! s->_raw_size)
 		s = hppa_info->dlt_rel_sec;
+	      if (! s || ! s->_raw_size)
+		s = hppa_info->opd_rel_sec;
 	      dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
 	      bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon);
 	      break;
@@ -2780,6 +2806,7 @@ const struct elf_size_info hppa64_elf_si
 #define elf_backend_plt_header_size     0
 #define elf_backend_type_change_ok true
 #define elf_backend_get_symbol_type	     elf64_hppa_elf_get_symbol_type
+#define elf_backend_reloc_type_class	     elf64_hppa_reloc_type_class
 
 #include "elf64-target.h"
 
Index: ld/emulparams/hppa64linux.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/hppa64linux.sh,v
retrieving revision 1.2
diff -u -3 -p -r1.2 hppa64linux.sh
--- ld/emulparams/hppa64linux.sh	22 Nov 2001 09:08:04 -0000	1.2
+++ ld/emulparams/hppa64linux.sh	26 Jun 2002 22:55:37 -0000
@@ -3,6 +3,7 @@
 
 SCRIPT_NAME=elf
 ELFSIZE=64
+# FIXME: this output format is for hpux.
 OUTPUT_FORMAT="elf64-hppa-linux"
 TEXT_START_ADDR=0x10000
 TARGET_PAGE_SIZE=0x10000
@@ -42,7 +43,9 @@ OTHER_BSS_END_SYMBOLS='
   PROVIDE (__TLS_PREALLOC_DTV_A = 0);'
 
 # HPs use .dlt where systems use .got.  Sigh.
-OTHER_GOT_RELOC_SECTIONS='.rela.dlt : { *(.rela.dlt) }'
+OTHER_GOT_RELOC_SECTIONS="
+  .rela.dlt     ${RELOCATING-0} : { *(.rela.dlt) }
+  .rela.opd     ${RELOCATING-0} : { *(.rela.opd) }"
 
 # We're not actually providing a symbol anymore (due to the inability to be
 # safe in regards to shared libraries). So we just allocate the hunk of space


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]