NetBSD Problem Report #6935
Received: (qmail 19391 invoked from network); 3 Feb 1999 18:52:02 -0000
Message-Id: <199902031852.TAA13580@jdolecek.per4mance.cz>
Date: Wed, 3 Feb 1999 19:52:09 +0100 (MET)
From: Jaromir Dolecek <dolecek@ics.muni.cz>
Reply-To: dolecek@ics.muni.cz
To: gnats-bugs@gnats.netbsd.org
Subject: pkglibtool should include /usr/lib/c++rt0.o to shared libs
X-Send-Pr-Version: 3.95
>Number: 6935
>Category: pkg
>Synopsis: pkglibtool should include /usr/lib/c++rt0.o to shared libs
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: gnats-admin
>State: closed
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Wed Feb 03 11:05:01 +0000 1999
>Closed-Date: Sun Feb 14 22:32:23 +0000 1999
>Last-Modified: Sun Feb 14 22:33:29 +0000 1999
>Originator: Jaromir Dolecek
>Release: NetBSD-19990118 or so
>Organization:
Per4mance, Brno, Czech Republic
>Environment:
System: NetBSD jdolecek.per4mance.cz 1.3I NetBSD 1.3I (JDOLECEK) #0: Sun Jan 31 21:02:09 MET 1999 dolecek@jdolecek.per4mance.cz:/home/dolecek/tmp/kern-19990116/src/sys/arch/i386/compile/JDOLECEK i386
>Description:
Some C++ libraries uses static constructors. On a.out systems,
they require to link /usr/lib/c++rt0.o into the library
to actually run the constructors when the shared lib is mapped.
While it's possible to do it manually for each individual
package, it's much more convenient to link it in
automatically. It's only 500B or so big (i386 arch)
and doesn't hurt even when it's not needed, so it can be safely
linked into each library pkglibtool is creating. As we
are moving to ELF anyway, this solution is probly
better than modifying each and every C++ library around
to explicitely link in that c++rt0.o file on NetBSD a.out systems.
Wouldn't it be better if ld would link in the c++rt0.o
into each created shared library directly ? Maybe.
>How-To-Repeat:
>Fix:
This patch replaces patch-aa in current pkglibtool package.
The changed part pretty much makes the same as the code
for FreeBSD 2.2.X.
--- ltconfig.orig Fri Mar 20 09:00:29 1998
+++ ltconfig Wed Feb 3 19:28:46 1999
@@ -808,7 +808,17 @@
netbsd*)
# Tested with NetBSD 1.2 ld
- archive_cmds='$LD -Bshareable -o $lib$libobjs'
+ if $CC -E - -dM </dev/null | grep -q __ELF__; then
+ archive_cmds='$LD -shared -o $lib$libobjs' # ELF
+ else
+ archive_cmds='$LD -Bshareable -o $lib$libobjs' # a.out
+ if [ -f /usr/lib/c++rt0.o ]; then
+ # include c++rt0.o to get C++ constructor support; even for C libs, it
+ # doesn't break anything and help significantly (at cost of little
+ # extra space -- 523B on NetBSD 1.3I/i386)
+ archive_cmds="$archive_cmds /usr/lib/c++rt0.o"
+ fi
+ fi
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
hardcode_shlibpath_var=no
@@ -1181,8 +1191,15 @@
netbsd* | openbsd*)
version_type=sunos
- library_names_spec='${libname}${release}.so.$versuffix'
- finish_cmds='PATH="$PATH:/sbin" ldconfig -m $libdir'
+ if $CC -E - -dM </dev/null | grep -q __ELF__; then
+ library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major ${libname}${release}.so'
+ soname_spec='${libname}${release}.so.$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ else
+ library_names_spec='${libname}${release}.so.$versuffix'
+ finish_cmds='PATH="$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD/OpenBSD (a.out) ld.so'
+ fi
shlibpath_var=LD_LIBRARY_PATH
;;
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: tron
State-Changed-When: Sun Feb 14 14:32:23 PST 1999
State-Changed-Why:
"pkglibtool-1.2p1" has a new option "-cplusplus" to link shared libraries
with "/usr/lib/libc++rt0.o" on "a.out" systems.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.