This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libtool weirdness (was Re: Broken MPIR 2.6.0 on Cygwin64)


Hi all,

Here is my experience with a shared version of the library after taking 
Corinna's message into account, starting from a clean MPIR tarball (except 
for updating the FSF config.sub/guess) without autoreconfing, and using 
the Cygwin shipped yasm rather than the one included in MPIR (in case the 
Cygwin one has patches).

Le Fri, 21 Jun 2013 13:33:57 +0200, Corinna Vinschen a ÃcritÂ:
> Then I tried to build it.  Of course, cygport autoreconfs and our
> libtool version 2.4.2 is installed.  Configure runs fine.
> 
> When building, first it failed to build in the mpn subdir, because it
> accidentally calls yasm with the -f elf64 flag.  I fixed that locally by
> tweaking mpn/Makefile by setting OBJECT_FORMAT from -f elf64 to -f
The -f elf64 did not make the build fail, but as this suggests I changed 
it to -f win64...
> win64.  There's also the problem that libtool adds the -DPIC flag and
> this leads to using the wrong code path in mpn/modexact_1c_odd.as.
> Change lines 107ff to
> 
>   ;%ifdef PIC ;    mov      r9, [mod_table wrt rip wrt ..gotpcrel]
>   ;%else
>       lea      r9, [mod_table wrt rip]
>   ;%endif
> 
...what make compiling modexact_1c_odd.as fail (which it did not with -f 
elf64).
Same workaround solves the problem.
> effectively disabling the GOT table access, then it builds.
> 
> But that's just a minor inconvenience, the real problem comes in the
> final link stage.  When trying to link libmpir.la, something weird
> happens.
> The libtool command line is basically this:
> 
>   /bin/sh ./libtool --tag=CC    --mode=link gcc -std=gnu99  \
>   -ggdb -O2 -pipe -fdebug-prefix-map=[...] -fdebug-prefix-map=[...] \
>   -no-undefined -Wl,--export-all-symbols \
>   -Wl,--output-def,.libs/libmpir-3.dll.def \
>   -version-info 11:0 :5  \
>   -o libmpir.la -rpath \
>   [loooooong list of .lo files]
> 
> This gets converted by libtool into the following calls:
> 
>   libtool: link: /usr/x86_64-pc-cygwin/bin/ld.exe -r -o
>   .libs/libmpir.la-1.o \
>   [long list of .o files]
>   libtool: link: /usr/x86_64-pc-cygwin/bin/ld.exe -r -o
>   .libs/libmpir.la-2.o \
>   [second long list of .o files]
>   libtool: link: rm -f .libs/libmpir.la-1.o libtool: link: gcc
>   -std=gnu99 -shared .libs/libmpir.la-2.o   -O2 \
>   -Wl,--export-all-symbols -Wl,--output-def -Wl,.libs/libmpir-3.dll.def 
>    \ -o .libs/libmpir-11.dll \				# Problem 
2
>   -Wl,--enable-auto-image-base \
>   -Xlinker --out-implib -Xlinker .libs/libmpir-11.dll	# Problem 1
> 
As before I don't have these two problems (not autoreconf in my case) and 
get correct cygmpir.dll and libmpir.dll.a.

I also corrected elf64 to win64 in tests/Makefile as yasm is used there 
as well.

And the bad news is: tests still segfault.

I'll also check with the static library now.

I'll also check without assembly optimizations, or lowering gcc 
optimization level, etc.

Best and thanks for the help!
Hopefully you can come up with proper fixes to the build system (to use -f 
win64 and no -DPIC) and the rest will follow.

JP


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]