Subject: bin/2103: programs using shared c++ libraries always dump core on ns32k systems
To: None <gnats-bugs@NetBSD.ORG>
From: None <ra!>
List: netbsd-bugs
Date: 02/19/1996 09:07:48
>Number:         2103
>Category:       bin
>Synopsis:       programs using shared c++ libraries always dump core on ns32k systems
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 21 04:50:01 1996
>Originator:     Matthias Pfaller
>Organization:			in real life: Matthias Pfaller
marco GmbH, 85221 Dachau, Germany	tel: +49 8131 516142
>Release:        960209
	<machine, os, target, libraries (multiple lines)>
System: NetBSD klondike 1.1A NetBSD 1.1A (KLONDIKE) #48: Sun Feb 18 13:12:42 MET 1996 leo@klondike:/usr/src/sys/arch/pc532/compile/KLONDIKE pc532

	The ns32k series cpus use three different methods to store constants.
	- Constants in data memory are stored in little endian byte order.
	- Immediate constants in the instruction stream are stored in
	  big endian byte order.
	- Immediate addresses in the instruction stream are stored rll
	  encoded in big endian byte order.

	The ns32k relocation records encode this in the r_disp field.
	gas/ns32k sets this field correctly. But relocation records
	for vector fields created by ld have not set this field correctly.
	Due to this entries in the global destructor/constructor table are
	stored in the wrong byte order.

	Try to run a program that uses libg++.
	Apply the following patch to ld. I hope RELOC_INIT_SEGMENT_RELOC
	is intended for this purpose.

--- src/gnu/usr.bin/ld/ld.h.orig	Sun Feb 11 11:44:25 1996
+++ src/gnu/usr.bin/ld/ld.h	Sun Feb 11 11:44:49 1996
@@ -157,7 +157,9 @@
 #define RELOC_PIC_TYPE(r)		((r)->r_baserel? \
--- src/gnu/usr.bin/ld/ns32k/md.h.orig	Sun Feb 11 11:44:16 1996
+++ src/gnu/usr.bin/ld/ns32k/md.h	Sun Feb 11 11:44:10 1996
@@ -29,6 +29,7 @@
+#define RELOC_INIT_SEGMENT_RELOC(r)	((r)->r_disp = 2)
 #define md_got_reloc(r)			(0)