[comp.soft-sys.andrew] dynamic linking: sunos 4.0.3 + sun4 + PL8= broken

pst+@ir.Stanford.EDU (Paul Traina) (12/31/90)

Dynamic linking seems to be broken under SunOS 4.0.3 with Andrew PL8.
Executing console or messages causes an Illegal Instruction trap.

Has anyone encountered this besides me?  If so, let's correspond.  If not,
then I'll dig through it with gdb and submit a reasonable report.

We were compiling with:
        CDEBUGFLAGS=-g
        MAKEDOFLAGS=-g -d ${BASEDIR}/lib -b ${BASEDIR}/bin

And libc.so.* had the resolver patches placed in them.

Here's our site.h & site.mcr:

--- site.mcr ---
/* Empty site.mcr file.  Use this file to hold all */
/* your site's changes to allsys.mcr and system.mcr. */


#ifdef AFS_ENV
/* AFSBASEDIR should point to the top of an AFS installation. */
/* Thus, $(AFSBASEDIR)/lib/afs $(AFSBASEDIR)/include/afs should both exist. */
/* for historical reasons the default is set to /usr/andy; */
/* if you need to change this setting, you can do so in site.h . */
        AFSBASEDIR = /usr/afsws
#endif /* AFS_ENV */

/* XUTILDIR is for programs that have been installed in some place other */
/* than the standard location - the ITC uses it for 'makedepend' and 'imake' */
        XUTILDIR = /usr/bin/X11

#ifdef SUN_ENV
#ifdef sys_sun4_40
        CDEBUGFLAGS=-g
        MAKEDOFLAGS=-g -d ${BASEDIR}/lib -b ${BASEDIR}/bin
#else        
        CDEBUGFLAGS = -O -Bstatic
#endif

        RESOLVLIB = /usr/lib/libresolv.a

/* Sparc versions of /bin/sh core dump during the build */
        SHELL = /afs/ir/@sys/local/bin/bash
#endif

#ifdef	sys_pmax_3
	CDEBUGFLAGS = -O -traditional
	ACMIPSLIB   = /afs/ir.stanford.edu/pmax_ul3/local/lib/G0_libs
	XLIBDIR     = ${ACMIPSLIB}
	AFSBASEDIR  = /afs/transarc.com/usr/pat/Andrew.Tmp/pmax_ul3/andrew/afs_G0
	AFS2BASEDIR = /afs/transarc.com/usr/pat/Andrew.Tmp/pmax_ul3/andrew/afs_G0
	MIPSLIBC_G0 = ${ACMIPSLIB}/libc
	MIPSLIBM_G0 = ${ACMIPSLIB}/libm
	MAKEDOFLAGS = -L${ACMIPSLIB} ${MAKEDODEBUG} -d ${BASEDIR}/lib -b ${BASEDIR}/bin
	RESOLVLIB   = ${ACMIPSLIB}/res/libresolv.a
#endif

----- site.h -----
/* Empty site.h file.  Use this file to hold all */
/* your site's changes to allsys.h and system.h. */

/* Defined if building for use with the Andrew File System (Vice) */
#define AFS_ENV	1

/* Defined if you have version 3.0 of the Andrew File System, including
  the protection server */
#define AFS30_ENV 1

/* Defined if you have version 3.1 of the Andrew File System, which no
   longer supports the old bcrypt/scrypt stuff */
#define	AFS_SCRYPT 1

/* Defined if you want to build the Andrew Message System (AMS) */
#define AMS_ENV	1

/* Defined if building code to deal with AMDS (AMS Delivery System) anywhere */
#define AMS_DELIVERY_ENV	1

/* Defined if we expect to run AMDS (AMS Delivery System) at this site.  This option affects only the default option values in mail system configuration, in the files andrew/overhead/util/lib/svcconf.c and andrew/overhead/mail/lib/mailconf.c . */
#define RUN_AMDS_ENV	1

/* Defined for building with the White Pages */
#define WHITEPAGES_ENV	1

/* Defined if building for use with Snap (remote messageservers) */
#define SNAP_ENV    1

/* Defined if you are using the Andrew/CMU printing software */
#define ANDREW_PRINTING_ENV 1

/* Software Levels: (Set to highest number you want to build) */
/* ############ FIX COMMENTS HERE ############ */
#ifdef PMAX_ENV
#undef MK_BASIC_INSETS
#undef MK_BLD_BLKS
#undef MK_HELP
#undef MK_TEXT_EXT
#else
#undef MK_BLD_BLKS
#undef MK_TEXT_EXT
#define LEVEL_ENV 4
#define MK_BLD_BLKS	1
#define MK_BASIC_UTILS	1
#define MK_BASIC_INSETS	1
#define MK_HELP		1
#define MK_TEXT_EXT	1
#define MK_AUTHORING	1
#define MK_AUX_UTILS	1
#define MK_AUX_INSETS	1
#define MK_EXAMPLES	1
#endif
/* Defined if you have ditroff */
#undef DITROFF_ENV

/* Define this if you want to build the contributed software
   (in ./contrib/*). */
#define CONTRIB_ENV 1

/* Defined if you want to use links when installing the system */
#undef LINKINSTALL_ENV

/* Defined to be the default ``ANDREWDIR'' value, where users will see */
/* the final result of the Andrew installation. */
#undef	DEFAULT_ANDREWDIR_ENV
#define DEFAULT_ANDREWDIR_ENV /afs/ir.stanford.edu/@sys/local/andrew

/* this must have double quotes */
#define LOCAL_ANDREW_SETUP_ENV "/afs/ir.stanford.edu/common/etc/AndrewSetup"
--
    Toilers in the agro-industrial complex!
    Your patriotic duty is to fully provide the nation
	with food in a short period of time!

gk5g+@ANDREW.CMU.EDU (Gary Keim) (01/03/91)

Excerpts from misc: 30-Dec-90 dynamic linking: sunos 4.0... Paul
Traina@apple.com (4360)

> Dynamic linking seems to be broken under SunOS 4.0.3 with Andrew PL8.
> Executing console or messages causes an Illegal Instruction trap.

I believe this is another manifestation of the problems we've been
having with the Sun4 and the resolver library.  Thanks to Steve Cousins
at Wash. U. we have solved this problem and it will be out in a future
patch.

Excerpts from misc: 30-Dec-90 dynamic linking: sunos 4.0... Paul
Traina@apple.com (4360)

> And libc.so.* had the resolver patches placed in them.

Can you explain what you mean by this?

Gary Keim
ATK Group

pst+@ir.Stanford.EDU (Paul Traina) (01/08/91)

> And libc.so.* had the resolver patches placed in them.

What I mean by this is that we made a custom shared library with patched
versions of gethostbyname()/gethostbyaddr() that use the resolver code rather
than yp or /etc/host lookups.

I agree with you that the problem is related to the resolver code.  The
dynamic linker probably reads the size of the routines/modules when doing the
link against the libc.a module, and since the routine it is aquiring is actually
different (since shared are supposed to be plug-and-play), something is getting
overwritten.
--
    Toilers in the agro-industrial complex!
    Your patriotic duty is to completely provide the nation
	with food in a short period of time!
			-- yet another inspirational May Day slogan