[parisc-linux] Re: new g++/exceptions problem

Alan Modra amodra@bigpond.net.au
Sun, 17 Jun 2001 15:13:36 +0930


On Fri, Jun 15, 2001 at 06:50:36PM -0600, Paul Bame wrote:
> 
> so it's inside the exception-handler frame.  My wild guess is the
> dynamic linker is trying to handle a new type of symbol which refers
> to the new exception stuff which is for some reason not 4-byte
> aligned

Yes, the new exception code puts R_PARISC_DIR32 relocs at unaligned
addresses.  "objdump -r libstdc++.so" reveals

Relocation section '.rela.eh_frame' at offset 0x37024 contains 1611 entries:
  Offset    Info  Type            Symbol's Value  Symbol's Name          Addend
  000c167e  4da01 R_PARISC_DIR32        00056914  __gxx_personality_v0      + 0
  000c1690  00d01 R_PARISC_DIR32        0003fe40  .text                     + 5114
  000c1699  01301 R_PARISC_DIR32        000cede4  .gcc_except_table         + 0
etc.

Seems like a change in the dynamic linker is needed to handle this
situation.  Something like the following should do it for you.

--- sysdeps/hppa/dl-machine.h~	Sun Jun 17 15:03:59 2001
+++ sysdeps/hppa/dl-machine.h	Sun Jun 17 15:05:11 2001
@@ -536,7 +536,16 @@
       if (map == &_dl_rtld_map)
 	return;
 #endif
-      /* Otherwise, nothing more to do here. */
+      /* .eh_frame can have unaligned relocs.  */
+      if (reloc_addr & 3)
+	{
+	  char *rel_addr = (char *) reloc_addr;
+	  rel_addr[0] = value >> 24;
+	  rel_addr[1] = value >> 16;
+	  rel_addr[2] = value >> 8;
+	  rel_addr[3] = value >> 0;
+	  return;
+	}
       break;
 
     case R_PARISC_PLABEL32: