Re: problem with libtool generated version script and underscores

2008-02-28 Thread Aleksey Demakov
Hi all,

Are there any comments on my patch? Is there anything wrong with it?

Regards,
Aleksey


___
http://lists.gnu.org/mailman/listinfo/libtool


Re: problem with libtool generated version script and underscores

2008-02-24 Thread Aleksey Demakov
On Thu, Feb 14, 2008 at 5:49 PM, Ralf Wildenhues [EMAIL PROTECTED] wrote:
  Can we see testsuite output for Libtool 2.1b (see README) for a system
  that needs a change here?  This failure should be exposed already.  Esp.
  the stresstest should expose most use cases here.

  I disagree with applying the patch unless you show that it improves
  testsuite results.  And also I want to know about other failures.
  So please show results before/after the patch.  Thanks.

The attached file libtool-results.orig contains the results before the patch
and the file libtool-results after it. The last attached file is the
diff against
libtool 2.1b file libltdl/m4/libtool.m4.

I have 3 failures before the patch and 2 failures after it.

Regards,
Aleksey


libtool-results.orig
Description: Binary data


libtool-results
Description: Binary data
--- libtool.m4.orig	2008-01-30 18:02:43.0 +0600
+++ libtool.m4	2008-02-24 19:30:37.0 +0600
@@ -4343,7 +4343,7 @@
 
 if test x$supports_anon_versioning = xyes; then
   _LT_TAGVAR(archive_expsym_cmds, $1)='echo { global:  $output_objdir/$libname.ver~
-	cat $export_symbols | sed -e s/\(.*\)/\1;/  $output_objdir/$libname.ver~
+	cat $export_symbols | sed -e s/\(.*\)/'$ac_symprfx'\1;/  $output_objdir/$libname.ver~
 	echo local: *; };  $output_objdir/$libname.ver~
 	$CC '$tmp_sharedflag$tmp_addflag' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
 fi
___
http://lists.gnu.org/mailman/listinfo/libtool


Re: problem with libtool generated version script and underscores

2008-02-14 Thread Aleksey Demakov
On Thu, Feb 7, 2008 at 2:23 AM, Ralf Wildenhues [EMAIL PROTECTED] wrote:
  Please take a look at AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE in libtool.m4.
  [...]

  That is while finding the correct global_symbol_pipe command it uses
   temporary variable $ac_symprfx. I think this variable could be just re-used
   to tell if the system requires underscore. There is no need for a separate
   test that relies on a gcc feature. The existing test goes through the
   entire chain compiler/linker/NM and therefore should be more reliable.

  I agree.


Um, may it be that simple? It works for me.

Regards,
Aleksey
diff -u libtool-1.5.26.orig/libtool.m4 libtool-1.5.26/libtool.m4
--- libtool-1.5.26.orig/libtool.m4	2008-02-01 22:26:47.0 +0600
+++ libtool-1.5.26/libtool.m4	2008-02-14 03:19:17.0 +0600
@@ -5782,7 +5782,7 @@
 
 	if test $supports_anon_versioning = yes; then
 	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo { global:  $output_objdir/$libname.ver~
-  cat $export_symbols | sed -e s/\(.*\)/\1;/  $output_objdir/$libname.ver~
+  cat $export_symbols | sed -e s/\(.*\)/'$ac_symprfx'\1;/  $output_objdir/$libname.ver~
   $echo local: *; };  $output_objdir/$libname.ver~
 	  $CC '$tmp_sharedflag$tmp_addflag' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
 	fi

___
http://lists.gnu.org/mailman/listinfo/libtool


Re: problem with libtool generated version script and underscores

2008-02-06 Thread Aleksey Demakov
On Feb 6, 2008 2:51 AM, Aleksey Demakov [EMAIL PROTECTED] wrote:
 I try to build a library (glib to be specific) with a cross-toolchain
 that prepends underscore to C names. The problem is that the
 symbols the library has to export do not get exported.


By the way my problem looks just the same as discussed here:

http://lists.gnu.org/archive/html/bug-libtool/2007-05/msg00051.html

Though I do not get from this discussion if it was somehow resolved.

Regards,
Aleksey


___
http://lists.gnu.org/mailman/listinfo/libtool


Re: problem with libtool generated version script and underscores

2008-02-06 Thread Aleksey Demakov
On Feb 6, 2008 9:18 PM, Peter O'Gorman [EMAIL PROTECTED] wrote:
 What is the host triplet for the system that you are building for?


Umm the canonical host name must be something like
bfin-unknown-linux.

 You need to set archive_expsym_cmds for that system to be similar to
 interix[[3-9]]* which has:

 _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed s,^,_, $export_symbols
 $output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs
 $compiler_flags ${wl}-h,$soname
 ${wl}--retain-symbols-file,$output_objdir/$soname.expsym
 ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280`
 -o $lib'

 As you can see, it takes the symbol list, prepends and underscore, and
 then uses that.


Okay, thanks for the hint.

 It is not required to change global_symbol_pipe etc.


The strange thing is that libtool checks if global_symbol_pipe
needs to handle underscore with a general check, not with
a host name check.

But this knowledge is not used for archive_expsym_cmds.
For blackfin the only difference is undescore, otherwise it
looks like regular linux. So special casing bfin-linux looks
excessive. But if this okay with libtool maintainers, I may
try to create a patch that does exactly that.

Regards,
Aleksey


___
http://lists.gnu.org/mailman/listinfo/libtool


problem with libtool generated version script and underscores

2008-02-05 Thread Aleksey Demakov
Hi all,

I try to build a library (glib to be specific) with a cross-toolchain
that prepends underscore to C names. The problem is that the
symbols the library has to export do not get exported.

The command used to build the library is provided by the end of
the message. Please note the option -export-symbols-regex ^g.*.

I found that the version script that is generated by libtool does
not contain any underscores -- that is it uses original C names.
I played a bit with the version script and found that my toolchain
properly exports the required symbols if I add the underscores
to it.

Analyzing how libtool works I found in my libtool file the following
bits that seem relevant:

# Take the output of nm and produce a listing of raw symbols and C names.
global_symbol_pipe=sed -n -e 's/^.*[
]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[   ][
]*_\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 _\\2 \\2/p'

# The commands to list exported symbols.
export_symbols_cmds=\$NM \$libobjs \$convenience |
\$global_symbol_pipe | \$SED 's/.* //' | sort | uniq 
\$export_symbols

So the global_symbol_pipe command produces output where a
column with underscored raw symbol is followed by a column with
a C name. Then $SED 's/.* //' leaves only the column with the
C-name which eventually gets into the version script.

I am confused about this. Is LD supposed to understand C-names
or raw symbol names in the version script? That is should I bug
the people who provided me with the toolchain or this is a libtool
problem?

By the way the option -export-symbols-regex ^g.* used in the
glib Makefile also selects names without underscores so if libtool
were to produce underscores I would have a problem again but
this should be easy to fix on my own.

Regards,
Aleksey


/bin/sh ../libtool --mode=link bfin-linux-uclibc-gcc  -D__UCLIBC__
-Wall  -L/home/avd/foo/local/sysroot/bfin-unknown-linux-gnu/lib
-L/home/avd/foo/local/sysroot/bfin-unknown-linux-gnu/usr/lib
-Wl,-rpath-link
-Wl,/home/avd/foo/local/sysroot/bfin-unknown-linux-gnu/usr/lib -o
libglib-2.0.la -rpath /usr/lib  -version-info 1400:1:1400
-export-dynamic  -export-symbols-regex ^g.* garray.lo gasyncqueue.lo
gatomic.lo gbacktrace.lo gbase64.lo gbookmarkfile.lo gcache.lo
gcompletion.lo gconvert.lo gdataset.lo gdate.lo gdir.lo gerror.lo
gfileutils.lo ghash.lo ghook.lo giochannel.lo gkeyfile.lo glist.lo
gmain.lo gmappedfile.lo gmarkup.lo gmem.lo gmessages.lo gnode.lo
goption.lo gpattern.lo gprimes.lo gqsort.lo gqueue.lo grel.lo grand.lo
gregex.lo gscanner.lo gsequence.lo gshell.lo gslice.lo gslist.lo
gstdio.lo gstrfuncs.lo gstring.lo gthread.lo gthreadpool.lo gtimer.lo
gtree.lo guniprop.lo gutf8.lo gunibreak.lo gunicollate.lo
gunidecomp.lo gutils.lo gprintf.lo libcharset/libcharset.la
gnulib/libgnulib.la giounix.lo gspawn.lo  -liconv  pcre/libpcre.la
-lintl
generating symbol list for `libglib-2.0.la'
bfin-linux-uclibc-nm  .libs/garray.o .libs/gasyncqueue.o
.libs/gatomic.o .libs/gbacktrace.o .libs/gbase64.o
.libs/gbookmarkfile.o .libs/gcache.o .libs/gcompletion.o
.libs/gconvert.o .libs/gdataset.o .libs/gdate.o .libs/gdir.o
.libs/gerror.o .libs/gfileutils.o .libs/ghash.o .libs/ghook.o
.libs/giochannel.o .libs/gkeyfile.o .libs/glist.o .libs/gmain.o
.libs/gmappedfile.o .libs/gmarkup.o .libs/gmem.o .libs/gmessages.o
.libs/gnode.o .libs/goption.o .libs/gpattern.o .libs/gprimes.o
.libs/gqsort.o .libs/gqueue.o .libs/grel.o .libs/grand.o
.libs/gregex.o .libs/gscanner.o .libs/gsequence.o .libs/gshell.o
.libs/gslice.o .libs/gslist.o .libs/gstdio.o .libs/gstrfuncs.o
.libs/gstring.o .libs/gthread.o .libs/gthreadpool.o .libs/gtimer.o
.libs/gtree.o .libs/guniprop.o .libs/gutf8.o .libs/gunibreak.o
.libs/gunicollate.o .libs/gunidecomp.o .libs/gutils.o .libs/gprintf.o
.libs/giounix.o .libs/gspawn.o  libcharset/.libs/libcharset.a
gnulib/.libs/libgnulib.a pcre/.libs/libpcre.a | sed -n -e 's/^.*[
]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][
]*_\([_A-Za-z][_A-Za-z0-9]*\)$/\1 _\2 \2/p' | /bin/sed 's/.* //' |
sort
| uniq  .libs/libglib-2.0.exp
/bin/grep -E -e ^g.* .libs/libglib-2.0.exp  .libs/libglib-2.0.expT
mv -f .libs/libglib-2.0.expT .libs/libglib-2.0.exp
echo { global:  .libs/libglib-2.0.ver
 cat .libs/libglib-2.0.exp | sed -e s/\(.*\)/\1;/  .libs/libglib-2.0.ver
 echo local: *; };  .libs/libglib-2.0.ver
 bfin-linux-uclibc-gcc -shared  .libs/garray.o .libs/gasyncqueue.o
.libs/gatomic.o .libs/gbacktrace.o .libs/gbase64.o
.libs/gbookmarkfile.o
.libs/gcache.o .libs/gcompletion.o .libs/gconvert.o .libs/gdataset.o
.libs/gdate.o .libs/gdir.o .libs/gerror.o .libs/gfileutils.o
.libs/ghash.o .libs/ghook.o .libs/giochannel.o .libs/gkeyfile.o
.libs/glist.o .libs/gmain.o .libs/gmappedfile.o .libs/gmarkup.o
.libs/gmem.o .libs/gmessages.o .libs/gnode.o .libs/goption.o
.libs/gpattern.o .libs/gprimes.o .libs/gqsort.o .libs/gqueue.o
.libs/grel.o .libs/grand.o .libs/gregex.o .libs/gscanner.o
.libs/gsequence.o .libs/gshell.o .libs/gslice.o .libs/gslist.o
.libs/gstdio.o .libs/gstrfuncs.o .libs/gstring.o .libs/gthread.o
.libs/gthreadpool.o