From: Thomas Tanner Date: Tue, 1 Dec 1998 22:35:00 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: release-1-2d~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ce33a45f6bf561a7b3c093b0f5707569a362a6e;p=thirdparty%2Flibtool.git *** empty log message *** --- diff --git a/ChangeLog b/ChangeLog index 1b76c2d68..3e0deb3f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -84,7 +84,7 @@ 1998-11-24 Thomas Tanner * depdemo: added inter-library dependencies demo (doesn't work yet!) - * AUTHORS: added me to the list of maintainers + * AUTHORS: added myself to the list of maintainers 1998-11-22 Thomas Tanner diff --git a/doc/libtool.texi b/doc/libtool.texi index 6fc6b6899..7eeb58f4e 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -1144,9 +1144,10 @@ Allow symbols from @var{output-file} to be resolved with @code{dlsym} (@pxref{Dlopened modules}). @item -export-symbols @var{symfile} -Same as @samp{-export-dynamic}, except that it only exports symbols -that are listed in @var{symfile}. The symbol file should end in @samp{.sym} -and must contain the name of one symbol per line. +Tells the linker to export only the symbols listed in @var{symfile}. +The symbol file should end in @samp{.sym} and must contain the name of one +symbol per line. This option does not work for modules. +By default all symbols are exported. @item -L@var{libdir} Search @var{libdir} for required libraries that have already been @@ -2266,7 +2267,7 @@ On some operating systems, a program symbol must be specially declared in order to be dynamically resolved with the @code{dlsym} (or equivalent) function. -Libtool provides the @samp{-export-dynamic} and @samp{-export-symbols} link +Libtool provides the @samp{-export-dynamic} link flags (@pxref{Link mode}), which does this declaration. You need to use this flag if you are linking an application program that dlopens other modules or a libtool library that will also be dlopened. @@ -2328,7 +2329,7 @@ module, or the module is not found, then the application can recover without crashing. @end enumerate -Libtool emulates @samp{-export-dynamic} and @samp{-export-symbols} +Libtool emulates @samp{-export-dynamic} on static platforms by linking objects into the program at compile time, and creating data structures that represent the program's symbol table. @@ -2361,8 +2362,7 @@ in @var{dld_preloaded_symbols}. @cindex names of dynamic modules @cindex dynamic modules, names -After a library has been linked with @samp{-export-dynamic} or -@samp{-export-symbols}, it can be dlopened. +After a library has been linked with @samp{-export-dynamic}, it can be dlopened. Unfortunately, because of the variation in library names, your package needs to determine the correct file to dlopen. diff --git a/ltconfig.in b/ltconfig.in index 52029f227..22583653e 100755 --- a/ltconfig.in +++ b/ltconfig.in @@ -970,6 +970,7 @@ echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c allow_undefined_flag= no_undefined_flag= archive_cmds= +archive_sym_cmds= old_archive_from_new_cmds= export_dynamic_flag_spec= whole_archive_flag_spec= @@ -1032,8 +1033,15 @@ DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) } ' > ltdll.c archive_cmds='$CC -c '"`pwd`"'/ltdll.c~echo EXPORTS > $lib.exp~ - if test -z "$export_symbols"; then $DLLTOOL --export-all --output-def $lib.exp; - else cat "$export_symbols" > $lib.exp; fi~ + $DLLTOOL --export-all --output-def $lib.exp~ + $CC -Wl,--base-file,$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 $libobs ltdll.$objext~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib.exp --base-file $soname-base --output-exp $soname-exp~ + $CC -Wl,--base-file,$soname-base $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib.exp --base-file $soname-base --output-exp $soname-exp~ + $CC $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ + $rm ltdll.$objext $soname-base $soname-exp' + archive_sym_cmds='$CC -c '"`pwd`"'/ltdll.c~echo EXPORTS > $lib.exp~ + cat "$export_symbols" > $lib.exp~ $CC -Wl,--base-file,$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 $libobs ltdll.$objext~ $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib.exp --base-file $soname-base --output-exp $soname-exp~ $CC -Wl,--base-file,$soname-base $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ @@ -1064,6 +1072,7 @@ DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) *) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared ${wl}-soname $wl$soname -o $lib$libobjs$deplibs' + archive_sym_cmds='$CC -shared ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib$libobjs$deplibs' else ld_shlibs=no fi @@ -1081,8 +1090,10 @@ else case "$host_os" in aix3*) allow_undefined_flag=unsupported - archive_cmds='if test -z "$export_symbols"; then $NM$libobjs | $global_symbol_pipe | sed '\''s/.* //'\' | sort | uniq' > $lib.exp; - else cat "$export_symbols" > $lib.exp; fi~$LD -o $objdir/$soname$libobjs$deplibs -bE:$lib.exp -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname' + archive_cmds='$NM$libobjs | $global_symbol_pipe | sed '\''s/.* //'\' | sort | uniq' > $lib.exp~ + $LD -o $objdir/$soname$libobjs$deplibs -bE:$lib.exp -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname' + archive_sym_cmds='cat $export_symbols > $lib.exp~ + $LD -o $objdir/$soname$libobjs$deplibs -bE:$lib.exp -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname~$rm $lib.exp' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes @@ -1095,8 +1106,10 @@ else aix4*) allow_undefined_flag=unsupported - archive_cmds='if test -z "$export_symbols"; then $NM$libobjs | $global_symbol_pipe | sed '\''s/.* //'\' | sort | uniq' > $lib.exp; - else cat "$export_symbols" > $lib.exp; fi~ $CC -o $objdir/$soname$libobjs$deplibs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry~$AR cru $lib $objdir/$soname' + archive_cmds='$NM$libobjs | $global_symbol_pipe | sed '\''s/.* //'\' | sort | uniq' > $lib.exp else cat $export_symbols > $lib.exp~ + $CC -o $objdir/$soname$libobjs$deplibs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry~$AR cru $lib $objdir/$soname' + archive_sym_cmds='cat $export_symbols > $lib.exp~ + $CC -o $objdir/$soname$libobjs$deplibs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry~$AR cru $lib $objdir/$soname~$rm $lib.exp' hardcode_direct=yes hardcode_minus_L=yes ;; @@ -1134,8 +1147,15 @@ DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) } ' > ltdll.c archive_cmds='$CC -c '"`pwd`"'/ltdll.c~echo EXPORTS > $lib.exp~ - if test -z "$export_symbols"; then $DLLTOOL --export-all --output-def $lib.exp; - else cat "$export_symbols" >> $lib.exp; fi~ + $DLLTOOL --export-all --output-def $lib.exp~ + $CC -Wl,--base-file,$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 $libobs ltdll.$objext~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib.exp --base-file $soname-base --output-exp $soname-exp~ + $CC -Wl,--base-file,$soname-base $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib.exp --base-file $soname-base --output-exp $soname-exp~ + $CC $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ + $rm ltdll.$objext $soname-base $soname-exp' + archive_sym_cmds='$CC -c '"`pwd`"'/ltdll.c~echo EXPORTS > $lib.exp~ + cat "$export_symbols" > $lib.exp~ $CC -Wl,--base-file,$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 $libobs ltdll.$objext~ $DLLTOOL --as=$AS --dllname $soname --exclude-symbol=_cygwin_dll_entry@12 --def $lib.exp --base-file $soname-base --output-exp $soname-exp~ $CC -Wl,--base-file,$soname-base $soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $libobjs ltdll.$objext$deplibs~ @@ -1262,6 +1282,8 @@ DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) archive_cmds='$CC -shared ${wl}-h $wl$soname -o $lib$libobjs$deplibs' else archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib$libobjs$deplibs' + archive_sym_cmds='$echo "{ global:" > $lib.exp~sed $export_symbols -e "s/.*/\1;/" >> $lib.exp~$echo "local: * }" > $lib.exp~ + $LD -G${allow_undefined_flag} -M $export_symbols -h $soname -o $lib$libobjs$deplibs~$rm $lib.exp' fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no diff --git a/ltmain.in b/ltmain.in index 74cc8ff5d..3d54261a1 100644 --- a/ltmain.in +++ b/ltmain.in @@ -646,15 +646,6 @@ compiler." $echo "$modename: symbol file \`$arg' does not exist" exit 1 fi - if test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - else - arg= - fi - - # Add the symbol object into the linking commands. - compile_command="$compile_command @SYMFILE@" - finalize_command="$finalize_command @SYMFILE@" prev= ;; release) @@ -718,10 +709,6 @@ compiler." ;; -export-symbols) - if test "$export_dynamic" != no; then - $echo "$modename: cannot have both -export-dynamic and -export-symbols" - exit 1 - fi if test -n "$export_symbols"; then $echo "$modename: cannot have more than one -exported-symbols" exit 1 @@ -1075,6 +1062,11 @@ compiler." exit 1 fi + if test -n "$export_symbols" && test "$module" = yes; then + $echo "$modename: \`-export-symbols' is not supported for modules" + exit 1 + fi + oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` @@ -1112,6 +1104,10 @@ compiler." $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 fi + if test -n "$export_symbols"; then + $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 + fi + # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" @@ -1566,7 +1562,11 @@ EOF fi # Do each of the archive commands. - eval cmds=\"$archive_cmds\" + if test -n "$export_symbols" && test -n "$archive_sym_cmds"; then + eval cmds=\"$archive_sym_cmds\" + else + eval cmds=\"$archive_cmds\" + fi IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" @@ -1583,8 +1583,8 @@ EOF fi done - # If -export-dynamic/symbols was specified, set the dlname. - if test "$export_dynamic" = yes || test -n "$export_symbols"; then + # If -export-dynamic was specified, set the dlname. + if test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi @@ -1746,8 +1746,7 @@ EOF finalize_command=`$echo "X$finalize_command " | $Xsed -e "$los2o" -e 's/ $//'` fi - if { test "$export_dynamic" = yes || test "$export_dynamic" = yes; } && - test -n "$NM" && test -n "$global_symbol_pipe"; then + if test "$export_dynamic" = yes && test -n "$NM" && test -n "$global_symbol_pipe"; then dlsyms="${outputname}S.c" else dlsyms= @@ -1886,7 +1885,7 @@ dld_preloaded_symbols[] = exit 1 ;; esac - elif test "$export_dynamic" != yes && test -z "$export_symbols"; then + elif test "$export_dynamic" != yes; then test -n "$dlfiles$dlprefiles" && $echo "$modename: warning: \`-dlopen' and \`-dlpreopen' are ignored without \`-export-dynamic'" 1>&2 else # We keep going just in case the user didn't refer to diff --git a/mdemo/modules/Makefile.am b/mdemo/modules/Makefile.am index 87bb3f41c..0257a983c 100644 --- a/mdemo/modules/Makefile.am +++ b/mdemo/modules/Makefile.am @@ -10,9 +10,9 @@ INCLUDES = -I$(srcdir)/../../libltdl lib_LTLIBRARIES = libfoo1.la libfoo2.la libfoo1_la_SOURCES = foo1.c -libfoo1_la_LDFLAGS = -export-symbols $(srcdir)/libfoo1.sym -lm -module +libfoo1_la_LDFLAGS = -export-dynamic -lm -module libfoo2_la_SOURCES = foo2.c -libfoo2_la_LDFLAGS = -export-symbols $(srcdir)/libfoo2.sym -lm -module +libfoo2_la_LDFLAGS = -export-dynamic -lm -module include_HEADERS = foo.h diff --git a/mdemo/modules/libfoo1.sym b/mdemo/modules/libfoo1.sym deleted file mode 100644 index c3f2e67db..000000000 --- a/mdemo/modules/libfoo1.sym +++ /dev/null @@ -1,3 +0,0 @@ -libfoo1_LTX_nothing -libfoo1_LTX_foo1 -libfoo1_LTX_hello diff --git a/mdemo/modules/libfoo2.sym b/mdemo/modules/libfoo2.sym deleted file mode 100644 index a305fbe63..000000000 --- a/mdemo/modules/libfoo2.sym +++ /dev/null @@ -1,3 +0,0 @@ -libfoo2_LTX_nothing -libfoo2_LTX_foo2 -libfoo2_LTX_hello