[gnu.g++] cross-compiling on SPARC architectures

otto%canon.uucp@NSFNET-RELAY.AC.UK (Paul Otto) (01/16/90)

Using g++ (version 1.35.1-) we found that programs compiled on
SUN-4/110's (running SunOS 4.0) would run OK on SparcStation-1's
(running SunOS 4.0.3c), but not vice versa.  In particular, programs
compiled on the SparcStations would crash with a segmentation violation
when we tried to run them on the 4/110's.


The reason for this (although I do not know exactly why!) is that
the SUN-4/110's use a system page size of 8192 bytes (in memory management etc),
and the SparcStation-1's use 4096 bytes.  As distributed, the GNU C++ linker
gets these numbers from the operating system at run time (using the getpagesize
system call), and uses them to align binaries appropriately.
This meant that binaries compiled on the 110's would work on the SparcStations
but the reverse wasn't always true.  If "newld.c" in the g++ source is hacked
so that the linker thinks that the page size is 8192 on SparcStations, this
problem appears to go away.  (BTW: SparcStation 4/370's have a page size of 8192.)

Paul
-----------
Paul Otto, Canon Research Centre Europe Ltd.,
19/20 Frederick Sanger Rd, Surrey Research Park, Guildford, Surrey, GU2 5YD, UK.
NRS: otto@uk.co.canon	ARPA: otto%uk.co.canon@nsfnet-relay.ac.uk
UUCP: otto@canon.uucp	PATH: ..!mcvax!ukc!uos-ee!canon!otto
Tel: +44 (0) 483 574325		Fax: +44 (0) 483 574360