mirror of
git://git.savannah.gnu.org/libtool.git
synced 2024-11-27 06:09:57 +08:00
* ltconfig.in: (global_symbol_pipe) extract symbol tag from the
output of NM too (global_symbol_to_cdecl): new variable; convert the output of global_symbol_pipe to valid C declarations; on HP/UX, convert text symbols to function declarations * libtool.m4: similar modifications * doc/libtool.texi: document new variable * ltmain.in: use global_symbol_to_cdecl to generate lt_dlpreopened symbols; avoid extracting symbol lists from dlpreopened files twice; do not filter symbols from dlpreopened libraries * TODO: fixed HP/UX dlpreopening problem
This commit is contained in:
parent
d3fefd9d6c
commit
d3d44b7803
12
ChangeLog
12
ChangeLog
@ -1,5 +1,17 @@
|
||||
1999-03-11 Alexandre Oliva <oliva@dcc.unicamp.br>
|
||||
|
||||
* ltconfig.in: (global_symbol_pipe) extract symbol tag from the
|
||||
output of NM too
|
||||
(global_symbol_to_cdecl): new variable; convert the output of
|
||||
global_symbol_pipe to valid C declarations; on HP/UX, convert
|
||||
text symbols to function declarations
|
||||
* libtool.m4: similar modifications
|
||||
* doc/libtool.texi: document new variable
|
||||
* ltmain.in: use global_symbol_to_cdecl to generate lt_dlpreopened
|
||||
symbols; avoid extracting symbol lists from dlpreopened files
|
||||
twice; do not filter symbols from dlpreopened libraries
|
||||
* TODO: fixed HP/UX dlpreopening problem
|
||||
|
||||
* ltmain.in (-static, -all-static): set dlopen_self to
|
||||
$dlopen_self_static regardless of link_static_flag or pic_flag
|
||||
|
||||
|
5
TODO
5
TODO
@ -6,11 +6,6 @@ with ltconfig/ltmain.sh
|
||||
|
||||
* check whether the "file" command is available
|
||||
|
||||
* Tom Lane adds that HP-UX's linker, at least (I've also found this on
|
||||
AIX 4), distinguishes between global function and global variable
|
||||
references. This means that we cannot declare every symbol as `extern
|
||||
char'. Find a workaround.
|
||||
|
||||
* Inter-library dependencies should be fully tracked by libtool
|
||||
and need to work for ltlibraries too. This requires looking up
|
||||
installed libtool libraries for transparent support.
|
||||
|
@ -3501,13 +3501,24 @@ A pipeline that takes the output of @var{NM}, and produces a listing of
|
||||
raw symbols followed by their C names. For example:
|
||||
|
||||
@example
|
||||
$ @kbd{$NM | $global_symbol_pipe}
|
||||
@var{symbol1} @var{C-symbol1}
|
||||
@var{symbol2} @var{C-symbol2}
|
||||
@var{symbol3} @var{C-symbol3}
|
||||
$ @kbd{eval "$NM progname | $global_symbol_pipe"}
|
||||
D @var{symbol1} @var{C-symbol1}
|
||||
T @var{symbol2} @var{C-symbol2}
|
||||
C @var{symbol3} @var{C-symbol3}
|
||||
@dots{}
|
||||
$
|
||||
@end example
|
||||
|
||||
The first column contains the symbol type (used to tell data from code
|
||||
on some platforms), but its meaning is system dependent.
|
||||
@end defvar
|
||||
|
||||
@defvar global_symbol_to_cdecl
|
||||
A pipeline that translates the output of @var{global_symbol_pipe} into
|
||||
proper C declarations. On platforms whose linkers differentiate code
|
||||
from data, such as HP/UX, data symbols will be declared as such, and
|
||||
code symbols will be declared as functions. On platforms that don't
|
||||
care, everything is assumed to be data.
|
||||
@end defvar
|
||||
|
||||
@defvar hardcode_action
|
||||
|
25
libtool.m4
vendored
25
libtool.m4
vendored
@ -21,7 +21,7 @@
|
||||
## configuration script generated by Autoconf, you may include it under
|
||||
## the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# serial 34 AC_PROG_LIBTOOL
|
||||
# serial 35 AC_PROG_LIBTOOL
|
||||
AC_DEFUN(AC_PROG_LIBTOOL,
|
||||
[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
|
||||
|
||||
@ -350,7 +350,7 @@ AC_MSG_RESULT([$NM])
|
||||
AC_SUBST(NM)
|
||||
])
|
||||
|
||||
# AC_SYS_NM_PARSE - Check for command ro grab the raw symbol name followed
|
||||
# AC_SYS_NM_PARSE - Check for command to grab the raw symbol name followed
|
||||
# by C symbol name from nm.
|
||||
AC_DEFUN(AC_SYS_NM_PARSE,
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
@ -369,7 +369,10 @@ ac_symcode='[BCDEGRST]'
|
||||
ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
|
||||
|
||||
# Transform the above into a raw symbol and a C symbol.
|
||||
ac_symxfrm='\1 \1'
|
||||
ac_symxfrm='\1 \2\3 \3'
|
||||
|
||||
# Transform an extracted symbol line into a proper C declaration
|
||||
ac_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
|
||||
|
||||
# Define system-specific variables.
|
||||
case "$host_os" in
|
||||
@ -379,6 +382,9 @@ aix*)
|
||||
cygwin* | mingw*)
|
||||
ac_symcode='[ABCDGISTW]'
|
||||
;;
|
||||
hpux*)
|
||||
ac_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
|
||||
;;
|
||||
irix*)
|
||||
ac_symcode='[BCDEGRST]'
|
||||
;;
|
||||
@ -396,10 +402,7 @@ changequote([,])dnl
|
||||
# Try without a prefix undercore, then with it.
|
||||
for ac_symprfx in "" "_"; do
|
||||
|
||||
# Write the raw and C identifiers.
|
||||
# Unlike in ltconfig.in, we need $ac_symprfx before $ac_symxfrm here,
|
||||
# otherwise AC_SYS_SYMBOL_UNDERSCORE will always be false
|
||||
ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]$ac_symcode[ ][ ]*$ac_symprfx$ac_sympat$/$ac_symprfx$ac_symxfrm/p'"
|
||||
ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($ac_symcode\)[ ][ ]*\($ac_symprfx\)$ac_sympat$/$ac_symxfrm/p'"
|
||||
|
||||
# Check to see that the pipe works correctly.
|
||||
ac_pipe_works=no
|
||||
@ -439,7 +442,7 @@ extern "C" {
|
||||
|
||||
EOF
|
||||
# Now generate the symbol file.
|
||||
sed 's/^.* \(.*\)$/extern char \1;/' < "$ac_nlist" >> conftest.c
|
||||
eval "$ac_global_symbol_to_cdecl"' < "$ac_nlist" >> conftest.c'
|
||||
|
||||
cat <<EOF >> conftest.c
|
||||
#if defined (__STDC__) && __STDC__
|
||||
@ -459,7 +462,7 @@ lt_preloaded_symbols[] =
|
||||
changequote([,])dnl
|
||||
{
|
||||
EOF
|
||||
sed 's/^\(.*\) \(.*\)$/ {"\1", (lt_ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c
|
||||
sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c
|
||||
cat <<\EOF >> conftest.c
|
||||
{0, (lt_ptr_t) 0}
|
||||
};
|
||||
@ -541,10 +544,10 @@ if AC_TRY_EVAL(ac_compile); then
|
||||
ac_nlist=conftest.nm
|
||||
if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
|
||||
# See whether the symbols have a leading underscore.
|
||||
if egrep '^_nm_test_func' "$ac_nlist" >/dev/null; then
|
||||
if egrep '^. _nm_test_func' "$ac_nlist" >/dev/null; then
|
||||
ac_cv_sys_symbol_underscore=yes
|
||||
else
|
||||
if egrep '^nm_test_func ' "$ac_nlist" >/dev/null; then
|
||||
if egrep '^. nm_test_func ' "$ac_nlist" >/dev/null; then
|
||||
:
|
||||
else
|
||||
echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
|
||||
|
25
ltconfig.in
25
ltconfig.in
@ -1012,7 +1012,7 @@ export_symbols_cmds='$NM $libobjs | $global_symbol_pipe | sed '\''s/.* //'\'' |
|
||||
# included in the symbol list
|
||||
include_expsyms=
|
||||
# exclude_expsyms can be an egrep regular expression of symbols to exclude
|
||||
# it will be wrapped by `^(' and `) ', so one must not match beginning or
|
||||
# it will be wrapped by ` (' and `)$', so one must not match beginning or
|
||||
# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
|
||||
# as well as any symbol that contains `d'.
|
||||
exclude_expsyms=
|
||||
@ -1385,7 +1385,10 @@ symcode='[BCDEGRST]'
|
||||
sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
|
||||
|
||||
# Transform the above into a raw symbol and a C symbol.
|
||||
symxfrm='\1 \1'
|
||||
symxfrm='\1 \2\3 \3'
|
||||
|
||||
# Transform an extracted symbol line into a proper C declaration
|
||||
global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
|
||||
|
||||
# Define system-specific variables.
|
||||
case "$host_os" in
|
||||
@ -1395,6 +1398,9 @@ aix*)
|
||||
cygwin* | mingw*)
|
||||
symcode='[ABCDGISTW]'
|
||||
;;
|
||||
hpux*) # Its linker distinguishes data from code symbols
|
||||
global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
|
||||
;;
|
||||
irix*)
|
||||
symcode='[BCDEGRST]'
|
||||
;;
|
||||
@ -1412,7 +1418,7 @@ fi
|
||||
for ac_symprfx in "" "_"; do
|
||||
|
||||
# Write the raw and C identifiers.
|
||||
global_symbol_pipe="sed -n -e 's/^.*[ ]$symcode[ ][ ]*$ac_symprfx$sympat$/$symxfrm/p'"
|
||||
global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode\)[ ][ ]*\($ac_symprfx\)$sympat$/$symxfrm/p'"
|
||||
|
||||
# Check to see that the pipe works correctly.
|
||||
pipe_works=no
|
||||
@ -1452,7 +1458,7 @@ extern "C" {
|
||||
|
||||
EOF
|
||||
# Now generate the symbol file.
|
||||
sed 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> conftest.c
|
||||
eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.c'
|
||||
|
||||
cat <<EOF >> conftest.c
|
||||
#if defined (__STDC__) && __STDC__
|
||||
@ -1470,7 +1476,7 @@ const struct {
|
||||
lt_preloaded_symbols[] =
|
||||
{
|
||||
EOF
|
||||
sed 's/^\(.*\) \(.*\)$/ {"\1", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c
|
||||
sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c
|
||||
cat <<\EOF >> conftest.c
|
||||
{0, (lt_ptr_t) 0}
|
||||
};
|
||||
@ -1512,6 +1518,7 @@ EOF
|
||||
break
|
||||
else
|
||||
global_symbol_pipe=
|
||||
global_symbol_to_cdecl=
|
||||
fi
|
||||
done
|
||||
echo "$ac_t$pipe_works" 1>&6
|
||||
@ -2355,8 +2362,9 @@ case "$ltmain" in
|
||||
RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
|
||||
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 hardcode_libdir_flag_spec \
|
||||
hardcode_libdir_separator sys_lib_search_path_spec \
|
||||
finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \
|
||||
hardcode_libdir_flag_spec hardcode_libdir_separator \
|
||||
sys_lib_search_path_spec \
|
||||
compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do
|
||||
|
||||
case "$var" in
|
||||
@ -2605,6 +2613,9 @@ finish_eval=$finish_eval
|
||||
# Take the output of nm and produce a listing of raw symbols and C names.
|
||||
global_symbol_pipe=$global_symbol_pipe
|
||||
|
||||
# Transform the output of nm in a proper C declaration
|
||||
global_symbol_to_cdecl=$global_symbol_to_cdecl
|
||||
|
||||
# This is the shared library runtime path variable.
|
||||
runpath_var=$runpath_var
|
||||
|
||||
|
66
ltmain.in
66
ltmain.in
@ -2291,8 +2291,8 @@ EOF
|
||||
nlist="$objdir/${output}.nm"
|
||||
|
||||
if test -d $objdir; then
|
||||
$show "$rm $nlist ${nlist}T"
|
||||
$run $rm "$nlist" "${nlist}T"
|
||||
$show "$rm $nlist ${nlist}S ${nlist}T"
|
||||
$run $rm "$nlist" "${nlist}S" "${nlist}T"
|
||||
else
|
||||
$show "$mkdir $objdir"
|
||||
$run $mkdir $objdir
|
||||
@ -2322,6 +2322,8 @@ extern \"C\" {
|
||||
if test "$dlself" = yes; then
|
||||
$show "generating symbol list for \`$output'"
|
||||
|
||||
echo ': @PROGRAM@ ' > "$nlist"
|
||||
|
||||
# Add our own program objects to the symbol list.
|
||||
progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
|
||||
for arg in $progfiles; do
|
||||
@ -2330,14 +2332,12 @@ extern \"C\" {
|
||||
done
|
||||
|
||||
if test -n "$exclude_expsyms"; then
|
||||
$run eval 'egrep -v "^($exclude_expsyms)" "$nlist" > "$nlist"T'
|
||||
$run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
|
||||
$run eval '$mv "$nlist"T "$nlist"'
|
||||
fi
|
||||
|
||||
if test -n "$export_symbols_regex"; then
|
||||
$show "egrep -e \"$export_symbols_regex\" \"$nlist\" > \"$nlist\"T"
|
||||
$run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
|
||||
$show "$mv \"$nlist\"T \"$nlist\""
|
||||
$run eval '$mv "$nlist"T "$nlist"'
|
||||
fi
|
||||
|
||||
@ -2345,13 +2345,19 @@ extern \"C\" {
|
||||
if test -z "$export_symbols"; then
|
||||
export_symbols="$objdir/$output.exp"
|
||||
$run $rm $export_symbols
|
||||
$run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
|
||||
else
|
||||
$run $rm $export_symbols
|
||||
$run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$objdir/$output.exp"'
|
||||
$run eval 'grep -f "$objdir/$output.exp" < "$nlist" > "$nlist"T'
|
||||
$run eval 'mv "$nlist"T "$nlist"'
|
||||
fi
|
||||
|
||||
sed -e 's/^.* \(.*\)$/\1/' < "$nlist" > "$export_symbols"
|
||||
fi
|
||||
|
||||
for arg in $dlprefiles; do
|
||||
$show "extracting global C symbols from \`$arg'"
|
||||
name=`echo "$arg" | sed -e 's%^.*/%%'`
|
||||
$run eval 'echo ": $name " >> "$nlist"'
|
||||
$run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
|
||||
done
|
||||
|
||||
@ -2359,25 +2365,20 @@ extern \"C\" {
|
||||
# Make sure we have at least an empty file.
|
||||
test -f "$nlist" || : > "$nlist"
|
||||
|
||||
if test -n "$exclude_expsyms"; then
|
||||
$run eval 'egrep -v "^($exclude_expsyms)" "$nlist" > "$nlist"T'
|
||||
$run eval '$mv "$nlist"T "$nlist"'
|
||||
fi
|
||||
|
||||
# Try sorting and uniquifying the output.
|
||||
if sort "$nlist" | uniq > "$nlist"T; then
|
||||
$mv "$nlist"T "$nlist"
|
||||
if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
|
||||
:
|
||||
else
|
||||
$rm "$nlist"T
|
||||
grep -v "^: " < "$nlist" > "$nlist"S
|
||||
fi
|
||||
|
||||
if test -n "$exclude_expsyms"; then
|
||||
egrep -v "^($exclude_expsyms) " "$nlist" > "$nlist"T
|
||||
$mv "$nlist"T "$nlist"
|
||||
egrep -v " ($exclude_expsyms)$" "$nlist"S > "$nlist"T
|
||||
$mv "$nlist"T "$nlist"S
|
||||
fi
|
||||
|
||||
if test -f "$nlist"; then
|
||||
sed -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$output_objdir/$dlsyms"
|
||||
if test -f "$nlist"S; then
|
||||
eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
|
||||
else
|
||||
echo '/* NONE */' >> "$output_objdir/$dlsyms"
|
||||
fi
|
||||
@ -2402,30 +2403,9 @@ lt_preloaded_symbols[] =
|
||||
{\
|
||||
"
|
||||
|
||||
if test "$dlself" = yes; then
|
||||
# First entry is the program itself
|
||||
echo >> "$output_objdir/$dlsyms" "\
|
||||
{\"@PROGRAM@\", (lt_ptr_t) 0},"
|
||||
sed 's/^\(.*\)/ {"\1", (lt_ptr_t) \&\1},/' < "$export_symbols" >> "$output_objdir/$dlsyms"
|
||||
fi
|
||||
|
||||
for arg in $dlprefiles; do
|
||||
name=`echo "$arg" | sed -e 's%^.*/%%'`
|
||||
echo >> "$output_objdir/$dlsyms" "\
|
||||
{\"$name\", (lt_ptr_t) 0},"
|
||||
eval "$NM $arg | $global_symbol_pipe > '$nlist'"
|
||||
|
||||
if test -f "$nlist"; then
|
||||
if test -n "$exclude_expsyms"; then
|
||||
egrep -v "^($exclude_expsyms) " "$nlist" > "$nlist"T
|
||||
$mv "$nlist"T "$nlist"
|
||||
fi
|
||||
|
||||
sed 's/^\(.*\) \(.*\)$/ {"\1", (lt_ptr_t) \&\2},/' < "$nlist" >> "$output_objdir/$dlsyms"
|
||||
else
|
||||
echo '/* NONE */' >> "$output_objdir/$dlsyms"
|
||||
fi
|
||||
done
|
||||
sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \
|
||||
-e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \
|
||||
< "$nlist" >> "$output_objdir/$dlsyms"
|
||||
|
||||
$echo >> "$output_objdir/$dlsyms" "\
|
||||
{0, (lt_ptr_t) 0}
|
||||
|
Loading…
Reference in New Issue
Block a user