Subject: Add library dependencies to Xt and friends on a.out
To: None <tech-x11@netbsd.org>
From: Frederick Bruckman <fb@enteract.com>
List: tech-x11
Date: 09/21/2000 08:25:10
Is there any reason not to give libraries the same treatment under
a.out as under ELF? The following seems to work fine under 1.4.3, and
what's more, binaries linked only against "Xt" show the proper
dependency on "SM" and "ICE" (but only if libXt built with this patch
is installed).

E.g. I built an "xmmix" binary package on handy after updating and
building xsrc with the dependencies goo for a.out, and also installed
it on 1ton. Both 1ton and handy are running 1.4.3_ALPHA:

fredb@handy-> ssh 1ton ldd /usr/X11R6/bin/xmmix
/usr/X11R6/bin/xmmix:
        -lXm.2 => /usr/X11R6/lib/libXm.so.2.0 (0x40021000)
        -lXt.6 => /usr/X11R6/lib/libXt.so.6.0 (0x40124000)
        -lX11.6 => /usr/X11R6/lib/libX11.so.6.1 (0x40161000)
        -lossaudio.0 => /usr/lib/libossaudio.so.0.0 (0x401ff000)
        -lgnumalloc.0 => /usr/lib/libgnumalloc.so.0.0 (0x40202000)
        -lc.12 => /usr/lib/libc.so.12.40.1 (0x40206000)
fredb@handy-> ldd /usr/X11R6/bin/xmmix
/usr/X11R6/bin/xmmix:
        -lXm.2 => /usr/X11R6/lib/libXm.so.2.0 (0x40022000)
        -lXt.6 => /usr/X11R6/lib/libXt.so.6.0 (0x40125000)
        -lX11.6 => /usr/X11R6/lib/libX11.so.6.1 (0x40162000)
        -lossaudio.0 => /usr/lib/libossaudio.so.0.0 (0x40200000)
        -lgnumalloc.0 => /usr/lib/libgnumalloc.so.0.0 (0x40203000)
        -lc.12 => /usr/lib/libc.so.12.40.1 (0x40207000)
        -lSM.6 => /usr/X11R6/lib/libSM.so.6.0 (0x40280000)
        -lICE.6 => /usr/X11R6/lib/libICE.so.6.3 (0x40288000)

Why this runs on 1ton without complaining about missing symbols is
another mystery. (Actually, this binary doesn't quite run on 1ton, it
has a problem with the audio device.)

The chief benefit of this change should be seen on m68k, which _does_
complain about missing symbols if a naked -lXt is linked in. For this
reason, I'd like to get this in before the 1.4.3 tag goes on xsrc,
barring objections.


Index: bsdLib.tmpl
===================================================================
RCS file: /cvsroot/xsrc/xc/config/cf/bsdLib.tmpl,v
retrieving revision 1.5
diff -c -r1.5 bsdLib.tmpl
*** bsdLib.tmpl	2000/01/10 23:50:33	1.5
--- bsdLib.tmpl	2000/09/21 13:24:09
***************
*** 3,37 ****
  
  /*
   * NetBSD/FreeBSD/OpenBSD shared library template
-  */
- 
- #if !UseElfFormat
- 
- #ifndef FixupLibReferences
- #define FixupLibReferences()						@@\
- XMULIBONLY = -lXmu							@@\
- XMULIB = $(XMULIBONLY) $(XTOOLLIB) $(XLIB)
- #endif
- 
- #ifndef SharedXtReqs
- #define SharedXtReqs /**/
- #endif
- #ifndef SharedXawReqs
- #define SharedXawReqs /**/
- #endif
- #ifndef SharedXmuReqs
- # if !defined(Mc68020Architecture) || !defined(OpenBSDArchitecture)
- #  define SharedXmuReqs $(LDPRELIBS) $(XTOOLONLYLIB) $(XONLYLIB)
- # else
-    /* At least the hp300 and the sun3 OpenBSD ports need that */
- #  define SharedXmuReqs $(LDPRELIBS) $(XTOOLLIB) $(EXTENSIONLIB) $(XONLYLIB)
- # endif
- #endif
- 
- #else /* UseElfFormat */
- 
- /*
-  * NetBSD/FreeBSD (ELF) shared library template
   * Cloned from Linux ELF rules, but with a minor number.
   */
  
--- 3,8 ----
***************
*** 62,68 ****
  #define SharedOldXReqs	$(LDPRELIBS) $(XLIBONLY)
  #define SharedXtReqs	$(LDPRELIBS) $(XLIBONLY) $(SMLIB) $(ICELIB) SharedThreadReqs
  #define SharedXawReqs	$(LDPRELIBS) $(XMULIB) $(XTOOLLIB) $(XLIB)
! #define SharedXmuReqs	$(LDPRELIBS) $(XTOOLLIB) $(XLIB)
  #define SharedXextReqs	$(LDPRELIBS) $(XLIBONLY)
  #define SharedXiReqs	$(LDPRELIBS) $(XLIB)
  #define SharedPexReqs	$(LDPRELIBS) $(XLIBONLY) MathLibrary
--- 33,44 ----
  #define SharedOldXReqs	$(LDPRELIBS) $(XLIBONLY)
  #define SharedXtReqs	$(LDPRELIBS) $(XLIBONLY) $(SMLIB) $(ICELIB) SharedThreadReqs
  #define SharedXawReqs	$(LDPRELIBS) $(XMULIB) $(XTOOLLIB) $(XLIB)
! #if defined(OpenBSDArchitecture) && defined(Mc68020Architecture) && !UseElfFormat 
!    /* At least the hp300 and the sun3 OpenBSD ports need that */
! # define SharedXmuReqs $(LDPRELIBS) $(XTOOLLIB) $(EXTENSIONLIB) $(XONLYLIB)
! #else
! # define SharedXmuReqs	$(LDPRELIBS) $(XTOOLLIB) $(XLIB)
! #endif /* OpenBSD-mc68020-a.out */
  #define SharedXextReqs	$(LDPRELIBS) $(XLIBONLY)
  #define SharedXiReqs	$(LDPRELIBS) $(XLIB)
  #define SharedPexReqs	$(LDPRELIBS) $(XLIBONLY) MathLibrary
***************
*** 71,75 ****
  #define SharedSMReqs	$(LDPRELIBS) $(ICELIB)
  #define SharedFrescoReqs	$(LDPRELIBS) $(XLIBONLY) FrescoSysLibs
  #define SharedXtfReqs	$(LDPRELIBS) $(FRESCOLIB) $(XTOOLLIB) $(XLIB) FrescoSysLibs
- 
- #endif /* UseElfFormat */
--- 47,49 ----