1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
$NetBSD: patch-aa,v 1.20 2001/01/09 18:37:46 bad Exp $
--- ltconfig.in.orig Sat May 27 03:58:57 2000
+++ ltconfig.in Tue Jan 9 19:21:16 2001
@@ -1095,6 +1095,13 @@
# the symbol is explicitly referenced. Since portable code cannot
# rely on this symbol name, it's probably fine to never include it in
# preloaded symbol tables.
+cpprt0=
+# C++ startup code.
+cppopts=
+# option to archive_cmds that causes cpprt0 to be linked in
+ctor_check_cmd='$NM $libobjs | grep '\''___[CD]TOR_LIST__'\'' >/dev/null 2>&1'
+
+
case "$host_os" in
cygwin* | mingw*)
@@ -1194,11 +1201,17 @@
netbsd*)
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
- archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
- archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ archive_cmds='$LD -Bshareable -o $lib $cppopts $libobjs $deplibs $linkopts'
+ wlarc=
+ # Add in C++ constructor/destructor support
+ if test -f ${PREFIX}/lib/c++rt0/c++rt0.o.PIC; then
+ cpprt0="${PREFIX}/lib/c++rt0/c++rt0.o.PIC"
+ elif test -f /usr/lib/c++rt0.o; then
+ cpprt0="/usr/lib/c++rt0.o"
+ fi
else
- archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib'
- # can we support soname and/or expsyms with a.out? -oliva
+ archive_cmds='$CC -shared $libobjs $wllinkopts $deplibs ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $wllinkopts $deplibs ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
fi
;;
@@ -1392,11 +1405,19 @@
netbsd*)
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
- archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' # a.out
+ archive_cmds='$LD -Bshareable -o $lib $cppopts $libobjs $deplibs $linkopts'
+ # Add in C++ constructor/destructor support
+ if test -f ${PREFIX}/lib/c++rt0/c++rt0.o.PIC; then
+ cpprt0="${PREFIX}/lib/c++rt0/c++rt0.o.PIC"
+ elif test -f /usr/lib/c++rt0.o; then
+ cpprt0="/usr/lib/c++rt0.o"
+ fi
else
+ # I don't think there are any ELF toolchains with non-gnu ld.
+ # I'm not touching this just in case!
archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts' # ELF
fi
- hardcode_libdir_flag_spec='${wl}-R$libdir'
+ hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
hardcode_shlibpath_var=no
;;
@@ -2007,14 +2028,23 @@
netbsd*)
version_type=sunos
+ need_lib_prefix=no
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ deplibs_check_method='file_magic NetBSD/[a-z0-9]* demand paged shared library'
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=`echo /usr/lib/libc.so*`
library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
dynamic_linker='NetBSD (a.out) ld.so'
+ need_version=yes
else
+ deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
+ file_magic_cmd=/usr/bin/file
+ file_magic_test_file=`echo /usr/lib/libc.so*`
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so'
soname_spec='${libname}${release}.so$major'
dynamic_linker='NetBSD ld.elf_so'
+ need_version=no
fi
shlibpath_var=LD_LIBRARY_PATH
;;
@@ -2069,7 +2099,7 @@
;;
solaris*)
- version_type=linux
+ version_type=sunos
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
@@ -2706,6 +2736,7 @@
old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds postuninstall_cmds \
file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \
finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \
+ ctor_check_cmd \
hardcode_libdir_flag_spec hardcode_libdir_separator \
sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do
@@ -2715,6 +2746,7 @@
old_postinstall_cmds | old_postuninstall_cmds | \
export_symbols_cmds | archive_cmds | archive_expsym_cmds | \
postinstall_cmds | postuninstall_cmds | \
+ ctor_check_cmd | \
finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
# Double-quote double-evaled strings.
eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
@@ -3017,6 +3049,11 @@
# Symbols that must always be exported.
include_expsyms=$include_expsyms
+
+# C++ startup code
+cpprt0="$cpprt0"
+cppopts=
+ctor_check_cmd=$ctor_check_cmd
EOF
|