public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* RFC patch: Add libquadmath - and use it in gfortran (round two)
@ 2010-11-08 20:57 Tobias Burnus
  2010-11-08 21:20 ` Jack Howarth
                   ` (3 more replies)
  0 siblings, 4 replies; 29+ messages in thread
From: Tobias Burnus @ 2010-11-08 20:57 UTC (permalink / raw)
  To: gcc patches

[-- Attachment #1: Type: text/plain, Size: 3991 bytes --]

Hi all,

that's an updated version of my patch at 
http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00653.html
which is in turn based on FX's patch at 
http://gcc.gnu.org/ml/gcc-patches/2010-10/msg02388.html

The patch contains:

a) libquadmath(.tar.bz2): __float128 math library. It exports all math 
functions with the suffix "q" ("tanq", "jnq" etc.); it also exports two 
I/O related functions with the prefix quadmath_. The library is used 
from libgfortran but can also be used from C/C++. However, there is no 
printf hook thus doing I/O from C/C++ is a bit more effort. The library 
is automatically build if language=fortran is enabled, but on systems 
without __float128 it is a no op.

b) quad.diff: The changes to the toplevel Makefile.def/configure.ac to 
build libquad with language=fortran; changes to gcc/fortran to use 
__float128; changes to libgfortran to use libquadmath.
Libgfortran automatically links libquadmath if it is available; if 
-static-libgfortran is used, the (dynamically linked) libquadmath is 
surounded by --as-needed/--no-as-needed.

c) quad_gen.diff: Due to popular request, the generated files.

Changes to previous patch:

- Fixed several issues regarding configure. I hope that it now builds on 
Darwin and creates a DLL under Cygwin/MinGW(.org/64)*
- It does no longer use weakrefs for the math functions
- It uses a weakref for I/O (write_float etc.), but
- There is now a transfer_{complex,real}{,write}128 function, whose only 
purpose is to drag in the libquadmath I/O function.

(* I got some feedback from Kai that with a stupid configure fix it now 
should work on Cygwin.)

Comments?

Tobias

$ diffstat quad.diff
   b/Makefile.def                             |    3 +
   b/configure.ac                             |    1
   b/gcc/fortran/gfortranspec.c               |   38 +++++++++++++++++++
   b/gcc/fortran/trans-io.c                   |   49 
+++++++++++++++++++++++--
   b/gcc/fortran/trans-types.c                |    8 +++-
   b/libgfortran/Makefile.am                  |    6 ++-
   b/libgfortran/acinclude.m4                 |   51 
++++++++++++++++++++++++++
   b/libgfortran/configure.ac                 |   13 +++++-
   b/libgfortran/gfortran.map                 |    5 ++
   b/libgfortran/intrinsics/cshift0.c         |   28 +++++++++++---
   b/libgfortran/intrinsics/erfc_scaled_inc.c |   11 +++++
   b/libgfortran/intrinsics/pack_generic.c    |   28 +++++++++++---
   b/libgfortran/intrinsics/spread_generic.c  |   56 
++++++++++++++++++++++-------
   b/libgfortran/intrinsics/unpack_generic.c  |   56 
++++++++++++++++++++++-------
   b/libgfortran/io/read.c                    |    8 +++-
   b/libgfortran/io/transfer.c                |   56 
++++++++++++++++++++++++++++-
   b/libgfortran/io/write.c                   |    1
   b/libgfortran/io/write_float.def           |   11 +++++
   b/libgfortran/libgfortran.h                |   18 ++++++++-
   b/libgfortran/m4/mtype.m4                  |    2 -
   b/libgfortran/mk-kinds-h.sh                |   39 +++++++++++++-------
   b/libgfortran/runtime/in_pack_generic.c    |   29 +++++++++++----
   b/libgfortran/runtime/in_unpack_generic.c  |   31 ++++++++++++----
   gcc/libgfortran/kinds-override.h           |   46 +++++++++++++++++++++++
   gcc/libgfortran/libgfortran.spec.in        |    8 ++++
   25 files changed, 524 insertions(+), 78 deletions(-)

$ diffstat quad-gen.diff
   b/Makefile.in                          |  467 +
   b/configure                            |    1
   b/libgfortran/Makefile.in              |   74
   b/libgfortran/config.h.in              |    3
   b/libgfortran/configure                |  139
   gcc/libgfortran/generated/pow_r16_i4.c |   75
   gcc/libquadmath/Makefile.in            | 1219 +++
   gcc/libquadmath/aclocal.m4             |  979 ++
   gcc/libquadmath/config.h.in            |   68
   gcc/libquadmath/configure              |13288 
+++++++++++++++++++++++++++++++++
   10 files changed, 16289 insertions(+), 24 deletions(-)


[-- Attachment #2: libquadmath.tar.bz2 --]
[-- Type: application/x-bzip, Size: 183482 bytes --]

[-- Attachment #3: quad.diff.bz2 --]
[-- Type: application/x-bzip, Size: 9372 bytes --]

[-- Attachment #4: quad-gen.diff.bz2 --]
[-- Type: application/x-bzip, Size: 95526 bytes --]

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: RFC patch: Add libquadmath - and use it in gfortran (round two)
  2010-11-08 20:57 RFC patch: Add libquadmath - and use it in gfortran (round two) Tobias Burnus
@ 2010-11-08 21:20 ` Jack Howarth
  2010-11-08 21:23   ` Ralf Wildenhues
  2010-11-08 23:43 ` Jack Howarth
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 29+ messages in thread
From: Jack Howarth @ 2010-11-08 21:20 UTC (permalink / raw)
  To: gfortran, gcc patches

On Mon, Nov 08, 2010 at 09:33:21PM +0100, Tobias Burnus wrote:
> Hi all,
>
> that's an updated version of my patch at  
> http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00653.html
> which is in turn based on FX's patch at  
> http://gcc.gnu.org/ml/gcc-patches/2010-10/msg02388.html
>
> The patch contains:
>
> a) libquadmath(.tar.bz2): __float128 math library. It exports all math  
> functions with the suffix "q" ("tanq", "jnq" etc.); it also exports two  
> I/O related functions with the prefix quadmath_. The library is used  
> from libgfortran but can also be used from C/C++. However, there is no  
> printf hook thus doing I/O from C/C++ is a bit more effort. The library  
> is automatically build if language=fortran is enabled, but on systems  
> without __float128 it is a no op.
>
> b) quad.diff: The changes to the toplevel Makefile.def/configure.ac to  
> build libquad with language=fortran; changes to gcc/fortran to use  
> __float128; changes to libgfortran to use libquadmath.
> Libgfortran automatically links libquadmath if it is available; if  
> -static-libgfortran is used, the (dynamically linked) libquadmath is  
> surounded by --as-needed/--no-as-needed.
>
> c) quad_gen.diff: Due to popular request, the generated files.
>
> Changes to previous patch:
>
> - Fixed several issues regarding configure. I hope that it now builds on  
> Darwin and creates a DLL under Cygwin/MinGW(.org/64)*
> - It does no longer use weakrefs for the math functions
> - It uses a weakref for I/O (write_float etc.), but
> - There is now a transfer_{complex,real}{,write}128 function, whose only  
> purpose is to drag in the libquadmath I/O function.
>
> (* I got some feedback from Kai that with a stupid configure fix it now  
> should work on Cygwin.)

This still fails on x86_64-apple-darwin10. The linkage...

libtool: compile:  /Users/howarth/work/./gcc/gfortran -B/Users/howarth/work/./gcc/ -B/Users/howarth/dist/x86_64-apple-darwin10.5.0/bin/ -B/Users/howarth/dist/x86_64-apple-darwin10.5.0/lib/ -isystem /Users/howarth/dist/x86_64-apple-darwin10.5.0/include -isystem /Users/howarth/dist/x86_64-apple-darwin10.5.0/sys-include -m32 -DHAVE_CONFIG_H -I. -I../../../../gcc-4.6-20101108/libgfortran -iquote../../../../gcc-4.6-20101108/libgfortran/io -I../../../../gcc-4.6-20101108/libgfortran/../gcc -I../../../../gcc-4.6-20101108/libgfortran/../gcc/config -I../../.././gcc -D_GNU_SOURCE -I . -Wall -Werror -fimplicit-none -fno-repack-arrays -fno-underscoring -fallow-leading-underscore -g -O2 -m32 -c ../../../../gcc-4.6-20101108/libgfortran/intrinsics/f2c_specifics.F90 >/dev/null 2>&1
/bin/sh ./libtool --tag=CC   --mode=link /Users/howarth/work/./gcc/xgcc -B/Users/howarth/work/./gcc/ -B/Users/howarth/dist/x86_64-apple-darwin10.5.0/bin/ -B/Users/howarth/dist/x86_64-apple-darwin10.5.0/lib/ -isystem /Users/howarth/dist/x86_64-apple-darwin10.5.0/include -isystem /Users/howarth/dist/x86_64-apple-darwin10.5.0/sys-include    -std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -fcx-fortran-rules -ffunction-sections -fdata-sections  -g -O2  -m32  -m32 -o libgfortran.la -version-info `grep -v '^#' ../../../../gcc-4.6-20101108/libgfortran/libtool-version`  '-m32' -no-undefined -bindir "/Users/howarth/dist/bin" -L../../../../gcc-4.6-20101108/libgfortran/../libquadmath LIBQUADLIB -lm -Wl,-single_module  -rpath /Users/howarth/dist/lib/i386 backtrace.lo bounds.lo compile_options.lo convert_char.lo environ.lo error.lo fpu.lo main.lo memory.lo pause.lo stop.lo string.lo select.lo all_l1.lo all_l2.lo all_l4.lo all_l8.lo all_l16.lo any_l1.lo any_l2.lo any_l4.lo any_l8.lo any_l16.lo count_1_l.lo count_2_l.lo count_4_l.lo count_8_l.lo count_16_l.lo maxloc0_4_i1.lo maxloc0_8_i1.lo maxloc0_16_i1.lo maxloc0_4_i2.lo maxloc0_8_i2.lo maxloc0_16_i2.lo maxloc0_4_i4.lo maxloc0_8_i4.lo maxloc0_16_i4.lo maxloc0_4_i8.lo maxloc0_8_i8.lo maxloc0_16_i8.lo maxloc0_4_i16.lo maxloc0_8_i16.lo maxloc0_16_i16.lo maxloc0_4_r4.lo maxloc0_8_r4.lo maxloc0_16_r4.lo maxloc0_4_r8.lo maxloc0_8_r8.lo maxloc0_16_r8.lo maxloc0_4_r10.lo maxloc0_8_r10.lo maxloc0_16_r10.lo maxloc0_4_r16.lo maxloc0_8_r16.lo maxloc0_16_r16.lo maxloc1_4_i1.lo maxloc1_8_i1.lo maxloc1_16_i1.lo maxloc1_4_i2.lo maxloc1_8_i2.lo maxloc1_16_i2.lo maxloc1_4_i4.lo maxloc1_8_i4.lo maxloc1_16_i4.lo maxloc1_4_i8.lo maxloc1_8_i8.lo maxloc1_16_i8.lo maxloc1_4_i16.lo maxloc1_8_i16.lo maxloc1_16_i16.lo maxloc1_4_r4.lo maxloc1_8_r4.lo maxloc1_16_r4.lo maxloc1_4_r8.lo maxloc1_8_r8.lo maxloc1_16_r8.lo maxloc1_4_r10.lo maxloc1_8_r10.lo maxloc1_16_r10.lo maxloc1_4_r16.lo maxloc1_8_r16.lo maxloc1_16_r16.lo maxval_i1.lo maxval_i2.lo maxval_i4.lo maxval_i8.lo maxval_i16.lo maxval_r4.lo maxval_r8.lo maxval_r10.lo maxval_r16.lo minloc0_4_i1.lo minloc0_8_i1.lo minloc0_16_i1.lo minloc0_4_i2.lo minloc0_8_i2.lo minloc0_16_i2.lo minloc0_4_i4.lo minloc0_8_i4.lo minloc0_16_i4.lo minloc0_4_i8.lo minloc0_8_i8.lo minloc0_16_i8.lo minloc0_4_i16.lo minloc0_8_i16.lo minloc0_16_i16.lo minloc0_4_r4.lo minloc0_8_r4.lo minloc0_16_r4.lo minloc0_4_r8.lo minloc0_8_r8.lo minloc0_16_r8.lo minloc0_4_r10.lo minloc0_8_r10.lo minloc0_16_r10.lo minloc0_4_r16.lo minloc0_8_r16.lo minloc0_16_r16.lo minloc1_4_i1.lo minloc1_8_i1.lo minloc1_16_i1.lo minloc1_4_i2.lo minloc1_8_i2.lo minloc1_16_i2.lo minloc1_4_i4.lo minloc1_8_i4.lo minloc1_16_i4.lo minloc1_4_i8.lo minloc1_8_i8.lo minloc1_16_i8.lo minloc1_4_i16.lo minloc1_8_i16.lo minloc1_16_i16.lo minloc1_4_r4.lo minloc1_8_r4.lo minloc1_16_r4.lo minloc1_4_r8.lo minloc1_8_r8.lo minloc1_16_r8.lo minloc1_4_r10.lo minloc1_8_r10.lo minloc1_16_r10.lo minloc1_4_r16.lo minloc1_8_r16.lo minloc1_16_r16.lo minval_i1.lo minval_i2.lo minval_i4.lo minval_i8.lo minval_i16.lo minval_r4.lo minval_r8.lo minval_r10.lo minval_r16.lo product_i1.lo product_i2.lo product_i4.lo product_i8.lo product_i16.lo product_r4.lo product_r8.lo product_r10.lo product_r16.lo product_c4.lo product_c8.lo product_c10.lo product_c16.lo sum_i1.lo sum_i2.lo sum_i4.lo sum_i8.lo sum_i16.lo sum_r4.lo sum_r8.lo sum_r10.lo sum_r16.lo sum_c4.lo sum_c8.lo sum_c10.lo sum_c16.lo bessel_r4.lo bessel_r8.lo bessel_r10.lo bessel_r16.lo iall_i1.lo iall_i2.lo iall_i4.lo iall_i8.lo iall_i16.lo iany_i1.lo iany_i2.lo iany_i4.lo iany_i8.lo iany_i16.lo iparity_i1.lo iparity_i2.lo iparity_i4.lo iparity_i8.lo iparity_i16.lo norm2_r4.lo norm2_r8.lo norm2_r10.lo norm2_r16.lo parity_l1.lo parity_l2.lo parity_l4.lo parity_l8.lo parity_l16.lo matmul_i1.lo matmul_i2.lo matmul_i4.lo matmul_i8.lo matmul_i16.lo matmul_r4.lo matmul_r8.lo matmul_r10.lo matmul_r16.lo matmul_c4.lo matmul_c8.lo matmul_c10.lo matmul_c16.lo matmul_l4.lo matmul_l8.lo matmul_l16.lo transpose_i4.lo transpose_i8.lo transpose_i16.lo transpose_r4.lo transpose_r8.lo transpose_r10.lo transpose_r16.lo transpose_c4.lo transpose_c8.lo transpose_c10.lo transpose_c16.lo shape_i4.lo shape_i8.lo shape_i16.lo eoshift1_4.lo eoshift1_8.lo eoshift1_16.lo eoshift3_4.lo eoshift3_8.lo eoshift3_16.lo cshift1_4.lo cshift1_8.lo cshift1_16.lo reshape_i4.lo reshape_i8.lo reshape_i16.lo reshape_r4.lo reshape_r8.lo reshape_r10.lo reshape_r16.lo reshape_c4.lo reshape_c8.lo reshape_c10.lo reshape_c16.lo in_pack_i1.lo in_pack_i2.lo in_pack_i4.lo in_pack_i8.lo in_pack_i16.lo in_pack_r4.lo in_pack_r8.lo in_pack_r10.lo in_pack_r16.lo in_pack_c4.lo in_pack_c8.lo in_pack_c10.lo in_pack_c16.lo in_unpack_i1.lo in_unpack_i2.lo in_unpack_i4.lo in_unpack_i8.lo in_unpack_i16.lo in_unpack_r4.lo in_unpack_r8.lo in_unpack_r10.lo in_unpack_r16.lo in_unpack_c4.lo in_unpack_c8.lo in_unpack_c10.lo in_unpack_c16.lo exponent_r4.lo exponent_r8.lo exponent_r10.lo exponent_r16.lo fraction_r4.lo fraction_r8.lo fraction_r10.lo fraction_r16.lo nearest_r4.lo nearest_r8.lo nearest_r10.lo nearest_r16.lo set_exponent_r4.lo set_exponent_r8.lo set_exponent_r10.lo set_exponent_r16.lo pow_i4_i4.lo pow_i8_i4.lo pow_i16_i4.lo pow_r16_i4.lo pow_c4_i4.lo pow_c8_i4.lo pow_c10_i4.lo pow_c16_i4.lo pow_i4_i8.lo pow_i8_i8.lo pow_i16_i8.lo pow_r4_i8.lo pow_r8_i8.lo pow_r10_i8.lo pow_r16_i8.lo pow_c4_i8.lo pow_c8_i8.lo pow_c10_i8.lo pow_c16_i8.lo pow_i4_i16.lo pow_i8_i16.lo pow_i16_i16.lo pow_r4_i16.lo pow_r8_i16.lo pow_r10_i16.lo pow_r16_i16.lo pow_c4_i16.lo pow_c8_i16.lo pow_c10_i16.lo pow_c16_i16.lo rrspacing_r4.lo rrspacing_r8.lo rrspacing_r10.lo rrspacing_r16.lo spacing_r4.lo spacing_r8.lo spacing_r10.lo spacing_r16.lo pack_i1.lo pack_i2.lo pack_i4.lo pack_i8.lo pack_i16.lo pack_r4.lo pack_r8.lo pack_r10.lo pack_r16.lo pack_c4.lo pack_c8.lo pack_c10.lo pack_c16.lo unpack_i1.lo unpack_i2.lo unpack_i4.lo unpack_i8.lo unpack_i16.lo unpack_r4.lo unpack_r8.lo unpack_r10.lo unpack_r16.lo unpack_c4.lo unpack_c8.lo unpack_c10.lo unpack_c16.lo spread_i1.lo spread_i2.lo spread_i4.lo spread_i8.lo spread_i16.lo spread_r4.lo spread_r8.lo spread_r10.lo spread_r16.lo spread_c4.lo spread_c8.lo spread_c10.lo spread_c16.lo cshift0_i1.lo cshift0_i2.lo cshift0_i4.lo cshift0_i8.lo cshift0_i16.lo cshift0_r4.lo cshift0_r8.lo cshift0_r10.lo cshift0_r16.lo cshift0_c4.lo cshift0_c8.lo cshift0_c10.lo cshift0_c16.lo close.lo file_pos.lo format.lo inquire.lo intrinsics.lo list_read.lo lock.lo open.lo read.lo size_from_kind.lo transfer.lo unit.lo unix.lo write.lo fbuf.lo associated.lo abort.lo access.lo args.lo bit_intrinsics.lo c99_functions.lo chdir.lo chmod.lo clock.lo cpu_time.lo cshift0.lo ctime.lo date_and_time.lo dtime.lo env.lo eoshift0.lo eoshift2.lo erfc_scaled.lo etime.lo execute_command_line.lo exit.lo extends_type_of.lo fnum.lo gerror.lo getcwd.lo getlog.lo getXid.lo hostnm.lo ierrno.lo ishftc.lo iso_c_generated_procs.lo iso_c_binding.lo kill.lo link.lo malloc.lo mvbits.lo move_alloc.lo pack_generic.lo perror.lo selected_char_kind.lo signal.lo size.lo sleep.lo spread_generic.lo string_intrinsics.lo system.lo rand.lo random.lo rename.lo reshape_generic.lo reshape_packed.lo selected_int_kind.lo selected_real_kind.lo stat.lo symlnk.lo system_clock.lo time.lo transpose_generic.lo umask.lo unlink.lo unpack_generic.lo in_pack_generic.lo in_unpack_generic.lo  _abs_c4.lo _abs_c8.lo _abs_c10.lo _abs_c16.lo _abs_i4.lo _abs_i8.lo _abs_i16.lo _abs_r4.lo _abs_r8.lo _abs_r10.lo _abs_r16.lo _aimag_c4.lo _aimag_c8.lo _aimag_c10.lo _aimag_c16.lo _exp_r4.lo _exp_r8.lo _exp_r10.lo _exp_r16.lo _exp_c4.lo _exp_c8.lo _exp_c10.lo _exp_c16.lo _log_r4.lo _log_r8.lo _log_r10.lo _log_r16.lo _log_c4.lo _log_c8.lo _log_c10.lo _log_c16.lo _log10_r4.lo _log10_r8.lo _log10_r10.lo _log10_r16.lo _sqrt_r4.lo _sqrt_r8.lo _sqrt_r10.lo _sqrt_r16.lo _sqrt_c4.lo _sqrt_c8.lo _sqrt_c10.lo _sqrt_c16.lo _asin_r4.lo _asin_r8.lo _asin_r10.lo _asin_r16.lo _asinh_r4.lo _asinh_r8.lo _asinh_r10.lo _asinh_r16.lo _acos_r4.lo _acos_r8.lo _acos_r10.lo _acos_r16.lo _acosh_r4.lo _acosh_r8.lo _acosh_r10.lo _acosh_r16.lo _atan_r4.lo _atan_r8.lo _atan_r10.lo _atan_r16.lo _atanh_r4.lo _atanh_r8.lo _atanh_r10.lo _atanh_r16.lo _sin_r4.lo _sin_r8.lo _sin_r10.lo _sin_r16.lo _sin_c4.lo _sin_c8.lo _sin_c10.lo _sin_c16.lo _cos_r4.lo _cos_r8.lo _cos_r10.lo _cos_r16.lo _cos_c4.lo _cos_c8.lo _cos_c10.lo _cos_c16.lo _tan_r4.lo _tan_r8.lo _tan_r10.lo _tan_r16.lo _sinh_r4.lo _sinh_r8.lo _sinh_r10.lo _sinh_r16.lo _cosh_r4.lo _cosh_r8.lo _cosh_r10.lo _cosh_r16.lo _tanh_r4.lo _tanh_r8.lo _tanh_r10.lo _tanh_r16.lo _conjg_c4.lo _conjg_c8.lo _conjg_c10.lo _conjg_c16.lo _aint_r4.lo _aint_r8.lo _aint_r10.lo _aint_r16.lo _anint_r4.lo _anint_r8.lo _anint_r10.lo _anint_r16.lo _sign_i4.lo _sign_i8.lo _sign_i16.lo _sign_r4.lo _sign_r8.lo _sign_r10.lo _sign_r16.lo _dim_i4.lo _dim_i8.lo _dim_i16.lo _dim_r4.lo _dim_r8.lo _dim_r10.lo _dim_r16.lo _atan2_r4.lo _atan2_r8.lo _atan2_r10.lo _atan2_r16.lo _mod_i4.lo _mod_i8.lo _mod_i16.lo _mod_r4.lo _mod_r8.lo _mod_r10.lo _mod_r16.lo misc_specifics.lo dprod_r8.lo f2c_specifics.lo  
libtool: link: /Users/howarth/work/./gcc/xgcc -B/Users/howarth/work/./gcc/ -B/Users/howarth/dist/x86_64-apple-darwin10.5.0/bin/ -B/Users/howarth/dist/x86_64-apple-darwin10.5.0/lib/ -isystem /Users/howarth/dist/x86_64-apple-darwin10.5.0/include -isystem /Users/howarth/dist/x86_64-apple-darwin10.5.0/sys-include  -m32 -dynamiclib  -o .libs/libgfortran.3.dylib  .libs/backtrace.o .libs/bounds.o .libs/compile_options.o .libs/convert_char.o .libs/environ.o .libs/error.o .libs/fpu.o .libs/main.o .libs/memory.o .libs/pause.o .libs/stop.o .libs/string.o .libs/select.o .libs/all_l1.o .libs/all_l2.o .libs/all_l4.o .libs/all_l8.o .libs/all_l16.o .libs/any_l1.o .libs/any_l2.o .libs/any_l4.o .libs/any_l8.o .libs/any_l16.o .libs/count_1_l.o .libs/count_2_l.o .libs/count_4_l.o .libs/count_8_l.o .libs/count_16_l.o .libs/maxloc0_4_i1.o .libs/maxloc0_8_i1.o .libs/maxloc0_16_i1.o .libs/maxloc0_4_i2.o .libs/maxloc0_8_i2.o .libs/maxloc0_16_i2.o .libs/maxloc0_4_i4.o .libs/maxloc0_8_i4.o .libs/maxloc0_16_i4.o .libs/maxloc0_4_i8.o .libs/maxloc0_8_i8.o .libs/maxloc0_16_i8.o .libs/maxloc0_4_i16.o .libs/maxloc0_8_i16.o .libs/maxloc0_16_i16.o .libs/maxloc0_4_r4.o .libs/maxloc0_8_r4.o .libs/maxloc0_16_r4.o .libs/maxloc0_4_r8.o .libs/maxloc0_8_r8.o .libs/maxloc0_16_r8.o .libs/maxloc0_4_r10.o .libs/maxloc0_8_r10.o .libs/maxloc0_16_r10.o .libs/maxloc0_4_r16.o .libs/maxloc0_8_r16.o .libs/maxloc0_16_r16.o .libs/maxloc1_4_i1.o .libs/maxloc1_8_i1.o .libs/maxloc1_16_i1.o .libs/maxloc1_4_i2.o .libs/maxloc1_8_i2.o .libs/maxloc1_16_i2.o .libs/maxloc1_4_i4.o .libs/maxloc1_8_i4.o .libs/maxloc1_16_i4.o .libs/maxloc1_4_i8.o .libs/maxloc1_8_i8.o .libs/maxloc1_16_i8.o .libs/maxloc1_4_i16.o .libs/maxloc1_8_i16.o .libs/maxloc1_16_i16.o .libs/maxloc1_4_r4.o .libs/maxloc1_8_r4.o .libs/maxloc1_16_r4.o .libs/maxloc1_4_r8.o .libs/maxloc1_8_r8.o .libs/maxloc1_16_r8.o .libs/maxloc1_4_r10.o .libs/maxloc1_8_r10.o .libs/maxloc1_16_r10.o .libs/maxloc1_4_r16.o .libs/maxloc1_8_r16.o .libs/maxloc1_16_r16.o .libs/maxval_i1.o .libs/maxval_i2.o .libs/maxval_i4.o .libs/maxval_i8.o .libs/maxval_i16.o .libs/maxval_r4.o .libs/maxval_r8.o .libs/maxval_r10.o .libs/maxval_r16.o .libs/minloc0_4_i1.o .libs/minloc0_8_i1.o .libs/minloc0_16_i1.o .libs/minloc0_4_i2.o .libs/minloc0_8_i2.o .libs/minloc0_16_i2.o .libs/minloc0_4_i4.o .libs/minloc0_8_i4.o .libs/minloc0_16_i4.o .libs/minloc0_4_i8.o .libs/minloc0_8_i8.o .libs/minloc0_16_i8.o .libs/minloc0_4_i16.o .libs/minloc0_8_i16.o .libs/minloc0_16_i16.o .libs/minloc0_4_r4.o .libs/minloc0_8_r4.o .libs/minloc0_16_r4.o .libs/minloc0_4_r8.o .libs/minloc0_8_r8.o .libs/minloc0_16_r8.o .libs/minloc0_4_r10.o .libs/minloc0_8_r10.o .libs/minloc0_16_r10.o .libs/minloc0_4_r16.o .libs/minloc0_8_r16.o .libs/minloc0_16_r16.o .libs/minloc1_4_i1.o .libs/minloc1_8_i1.o .libs/minloc1_16_i1.o .libs/minloc1_4_i2.o .libs/minloc1_8_i2.o .libs/minloc1_16_i2.o .libs/minloc1_4_i4.o .libs/minloc1_8_i4.o .libs/minloc1_16_i4.o .libs/minloc1_4_i8.o .libs/minloc1_8_i8.o .libs/minloc1_16_i8.o .libs/minloc1_4_i16.o .libs/minloc1_8_i16.o .libs/minloc1_16_i16.o .libs/minloc1_4_r4.o .libs/minloc1_8_r4.o .libs/minloc1_16_r4.o .libs/minloc1_4_r8.o .libs/minloc1_8_r8.o .libs/minloc1_16_r8.o .libs/minloc1_4_r10.o .libs/minloc1_8_r10.o .libs/minloc1_16_r10.o .libs/minloc1_4_r16.o .libs/minloc1_8_r16.o .libs/minloc1_16_r16.o .libs/minval_i1.o .libs/minval_i2.o .libs/minval_i4.o .libs/minval_i8.o .libs/minval_i16.o .libs/minval_r4.o .libs/minval_r8.o .libs/minval_r10.o .libs/minval_r16.o .libs/product_i1.o .libs/product_i2.o .libs/product_i4.o .libs/product_i8.o .libs/product_i16.o .libs/product_r4.o .libs/product_r8.o .libs/product_r10.o .libs/product_r16.o .libs/product_c4.o .libs/product_c8.o .libs/product_c10.o .libs/product_c16.o .libs/sum_i1.o .libs/sum_i2.o .libs/sum_i4.o .libs/sum_i8.o .libs/sum_i16.o .libs/sum_r4.o .libs/sum_r8.o .libs/sum_r10.o .libs/sum_r16.o .libs/sum_c4.o .libs/sum_c8.o .libs/sum_c10.o .libs/sum_c16.o .libs/bessel_r4.o .libs/bessel_r8.o .libs/bessel_r10.o .libs/bessel_r16.o .libs/iall_i1.o .libs/iall_i2.o .libs/iall_i4.o .libs/iall_i8.o .libs/iall_i16.o .libs/iany_i1.o .libs/iany_i2.o .libs/iany_i4.o .libs/iany_i8.o .libs/iany_i16.o .libs/iparity_i1.o .libs/iparity_i2.o .libs/iparity_i4.o .libs/iparity_i8.o .libs/iparity_i16.o .libs/norm2_r4.o .libs/norm2_r8.o .libs/norm2_r10.o .libs/norm2_r16.o .libs/parity_l1.o .libs/parity_l2.o .libs/parity_l4.o .libs/parity_l8.o .libs/parity_l16.o .libs/matmul_i1.o .libs/matmul_i2.o .libs/matmul_i4.o .libs/matmul_i8.o .libs/matmul_i16.o .libs/matmul_r4.o .libs/matmul_r8.o .libs/matmul_r10.o .libs/matmul_r16.o .libs/matmul_c4.o .libs/matmul_c8.o .libs/matmul_c10.o .libs/matmul_c16.o .libs/matmul_l4.o .libs/matmul_l8.o .libs/matmul_l16.o .libs/transpose_i4.o .libs/transpose_i8.o .libs/transpose_i16.o .libs/transpose_r4.o .libs/transpose_r8.o .libs/transpose_r10.o .libs/transpose_r16.o .libs/transpose_c4.o .libs/transpose_c8.o .libs/transpose_c10.o .libs/transpose_c16.o .libs/shape_i4.o .libs/shape_i8.o .libs/shape_i16.o .libs/eoshift1_4.o .libs/eoshift1_8.o .libs/eoshift1_16.o .libs/eoshift3_4.o .libs/eoshift3_8.o .libs/eoshift3_16.o .libs/cshift1_4.o .libs/cshift1_8.o .libs/cshift1_16.o .libs/reshape_i4.o .libs/reshape_i8.o .libs/reshape_i16.o .libs/reshape_r4.o .libs/reshape_r8.o .libs/reshape_r10.o .libs/reshape_r16.o .libs/reshape_c4.o .libs/reshape_c8.o .libs/reshape_c10.o .libs/reshape_c16.o .libs/in_pack_i1.o .libs/in_pack_i2.o .libs/in_pack_i4.o .libs/in_pack_i8.o .libs/in_pack_i16.o .libs/in_pack_r4.o .libs/in_pack_r8.o .libs/in_pack_r10.o .libs/in_pack_r16.o .libs/in_pack_c4.o .libs/in_pack_c8.o .libs/in_pack_c10.o .libs/in_pack_c16.o .libs/in_unpack_i1.o .libs/in_unpack_i2.o .libs/in_unpack_i4.o .libs/in_unpack_i8.o .libs/in_unpack_i16.o .libs/in_unpack_r4.o .libs/in_unpack_r8.o .libs/in_unpack_r10.o .libs/in_unpack_r16.o .libs/in_unpack_c4.o .libs/in_unpack_c8.o .libs/in_unpack_c10.o .libs/in_unpack_c16.o .libs/exponent_r4.o .libs/exponent_r8.o .libs/exponent_r10.o .libs/exponent_r16.o .libs/fraction_r4.o .libs/fraction_r8.o .libs/fraction_r10.o .libs/fraction_r16.o .libs/nearest_r4.o .libs/nearest_r8.o .libs/nearest_r10.o .libs/nearest_r16.o .libs/set_exponent_r4.o .libs/set_exponent_r8.o .libs/set_exponent_r10.o .libs/set_exponent_r16.o .libs/pow_i4_i4.o .libs/pow_i8_i4.o .libs/pow_i16_i4.o .libs/pow_r16_i4.o .libs/pow_c4_i4.o .libs/pow_c8_i4.o .libs/pow_c10_i4.o .libs/pow_c16_i4.o .libs/pow_i4_i8.o .libs/pow_i8_i8.o .libs/pow_i16_i8.o .libs/pow_r4_i8.o .libs/pow_r8_i8.o .libs/pow_r10_i8.o .libs/pow_r16_i8.o .libs/pow_c4_i8.o .libs/pow_c8_i8.o .libs/pow_c10_i8.o .libs/pow_c16_i8.o .libs/pow_i4_i16.o .libs/pow_i8_i16.o .libs/pow_i16_i16.o .libs/pow_r4_i16.o .libs/pow_r8_i16.o .libs/pow_r10_i16.o .libs/pow_r16_i16.o .libs/pow_c4_i16.o .libs/pow_c8_i16.o .libs/pow_c10_i16.o .libs/pow_c16_i16.o .libs/rrspacing_r4.o .libs/rrspacing_r8.o .libs/rrspacing_r10.o .libs/rrspacing_r16.o .libs/spacing_r4.o .libs/spacing_r8.o .libs/spacing_r10.o .libs/spacing_r16.o .libs/pack_i1.o .libs/pack_i2.o .libs/pack_i4.o .libs/pack_i8.o .libs/pack_i16.o .libs/pack_r4.o .libs/pack_r8.o .libs/pack_r10.o .libs/pack_r16.o .libs/pack_c4.o .libs/pack_c8.o .libs/pack_c10.o .libs/pack_c16.o .libs/unpack_i1.o .libs/unpack_i2.o .libs/unpack_i4.o .libs/unpack_i8.o .libs/unpack_i16.o .libs/unpack_r4.o .libs/unpack_r8.o .libs/unpack_r10.o .libs/unpack_r16.o .libs/unpack_c4.o .libs/unpack_c8.o .libs/unpack_c10.o .libs/unpack_c16.o .libs/spread_i1.o .libs/spread_i2.o .libs/spread_i4.o .libs/spread_i8.o .libs/spread_i16.o .libs/spread_r4.o .libs/spread_r8.o .libs/spread_r10.o .libs/spread_r16.o .libs/spread_c4.o .libs/spread_c8.o .libs/spread_c10.o .libs/spread_c16.o .libs/cshift0_i1.o .libs/cshift0_i2.o .libs/cshift0_i4.o .libs/cshift0_i8.o .libs/cshift0_i16.o .libs/cshift0_r4.o .libs/cshift0_r8.o .libs/cshift0_r10.o .libs/cshift0_r16.o .libs/cshift0_c4.o .libs/cshift0_c8.o .libs/cshift0_c10.o .libs/cshift0_c16.o .libs/close.o .libs/file_pos.o .libs/format.o .libs/inquire.o .libs/intrinsics.o .libs/list_read.o .libs/lock.o .libs/open.o .libs/read.o .libs/size_from_kind.o .libs/transfer.o .libs/unit.o .libs/unix.o .libs/write.o .libs/fbuf.o .libs/associated.o .libs/abort.o .libs/access.o .libs/args.o .libs/bit_intrinsics.o .libs/c99_functions.o .libs/chdir.o .libs/chmod.o .libs/clock.o .libs/cpu_time.o .libs/cshift0.o .libs/ctime.o .libs/date_and_time.o .libs/dtime.o .libs/env.o .libs/eoshift0.o .libs/eoshift2.o .libs/erfc_scaled.o .libs/etime.o .libs/execute_command_line.o .libs/exit.o .libs/extends_type_of.o .libs/fnum.o .libs/gerror.o .libs/getcwd.o .libs/getlog.o .libs/getXid.o .libs/hostnm.o .libs/ierrno.o .libs/ishftc.o .libs/iso_c_generated_procs.o .libs/iso_c_binding.o .libs/kill.o .libs/link.o .libs/malloc.o .libs/mvbits.o .libs/move_alloc.o .libs/pack_generic.o .libs/perror.o .libs/selected_char_kind.o .libs/signal.o .libs/size.o .libs/sleep.o .libs/spread_generic.o .libs/string_intrinsics.o .libs/system.o .libs/rand.o .libs/random.o .libs/rename.o .libs/reshape_generic.o .libs/reshape_packed.o .libs/selected_int_kind.o .libs/selected_real_kind.o .libs/stat.o .libs/symlnk.o .libs/system_clock.o .libs/time.o .libs/transpose_generic.o .libs/umask.o .libs/unlink.o .libs/unpack_generic.o .libs/in_pack_generic.o .libs/in_unpack_generic.o .libs/_abs_c4.o .libs/_abs_c8.o .libs/_abs_c10.o .libs/_abs_c16.o .libs/_abs_i4.o .libs/_abs_i8.o .libs/_abs_i16.o .libs/_abs_r4.o .libs/_abs_r8.o .libs/_abs_r10.o .libs/_abs_r16.o .libs/_aimag_c4.o .libs/_aimag_c8.o .libs/_aimag_c10.o .libs/_aimag_c16.o .libs/_exp_r4.o .libs/_exp_r8.o .libs/_exp_r10.o .libs/_exp_r16.o .libs/_exp_c4.o .libs/_exp_c8.o .libs/_exp_c10.o .libs/_exp_c16.o .libs/_log_r4.o .libs/_log_r8.o .libs/_log_r10.o .libs/_log_r16.o .libs/_log_c4.o .libs/_log_c8.o .libs/_log_c10.o .libs/_log_c16.o .libs/_log10_r4.o .libs/_log10_r8.o .libs/_log10_r10.o .libs/_log10_r16.o .libs/_sqrt_r4.o .libs/_sqrt_r8.o .libs/_sqrt_r10.o .libs/_sqrt_r16.o .libs/_sqrt_c4.o .libs/_sqrt_c8.o .libs/_sqrt_c10.o .libs/_sqrt_c16.o .libs/_asin_r4.o .libs/_asin_r8.o .libs/_asin_r10.o .libs/_asin_r16.o .libs/_asinh_r4.o .libs/_asinh_r8.o .libs/_asinh_r10.o .libs/_asinh_r16.o .libs/_acos_r4.o .libs/_acos_r8.o .libs/_acos_r10.o .libs/_acos_r16.o .libs/_acosh_r4.o .libs/_acosh_r8.o .libs/_acosh_r10.o .libs/_acosh_r16.o .libs/_atan_r4.o .libs/_atan_r8.o .libs/_atan_r10.o .libs/_atan_r16.o .libs/_atanh_r4.o .libs/_atanh_r8.o .libs/_atanh_r10.o .libs/_atanh_r16.o .libs/_sin_r4.o .libs/_sin_r8.o .libs/_sin_r10.o .libs/_sin_r16.o .libs/_sin_c4.o .libs/_sin_c8.o .libs/_sin_c10.o .libs/_sin_c16.o .libs/_cos_r4.o .libs/_cos_r8.o .libs/_cos_r10.o .libs/_cos_r16.o .libs/_cos_c4.o .libs/_cos_c8.o .libs/_cos_c10.o .libs/_cos_c16.o .libs/_tan_r4.o .libs/_tan_r8.o .libs/_tan_r10.o .libs/_tan_r16.o .libs/_sinh_r4.o .libs/_sinh_r8.o .libs/_sinh_r10.o .libs/_sinh_r16.o .libs/_cosh_r4.o .libs/_cosh_r8.o .libs/_cosh_r10.o .libs/_cosh_r16.o .libs/_tanh_r4.o .libs/_tanh_r8.o .libs/_tanh_r10.o .libs/_tanh_r16.o .libs/_conjg_c4.o .libs/_conjg_c8.o .libs/_conjg_c10.o .libs/_conjg_c16.o .libs/_aint_r4.o .libs/_aint_r8.o .libs/_aint_r10.o .libs/_aint_r16.o .libs/_anint_r4.o .libs/_anint_r8.o .libs/_anint_r10.o .libs/_anint_r16.o .libs/_sign_i4.o .libs/_sign_i8.o .libs/_sign_i16.o .libs/_sign_r4.o .libs/_sign_r8.o .libs/_sign_r10.o .libs/_sign_r16.o .libs/_dim_i4.o .libs/_dim_i8.o .libs/_dim_i16.o .libs/_dim_r4.o .libs/_dim_r8.o .libs/_dim_r10.o .libs/_dim_r16.o .libs/_atan2_r4.o .libs/_atan2_r8.o .libs/_atan2_r10.o .libs/_atan2_r16.o .libs/_mod_i4.o .libs/_mod_i8.o .libs/_mod_i16.o .libs/_mod_r4.o .libs/_mod_r8.o .libs/_mod_r10.o .libs/_mod_r16.o .libs/misc_specifics.o .libs/dprod_r8.o .libs/f2c_specifics.o   -L/Users/howarth/gcc-4.6-20101108/libquadmath -lm  -m32 -m32 -m32 -Wl,-single_module   -install_name  /Users/howarth/dist/lib/i386/libgfortran.3.dylib -compatibility_version 4 -current_version 4.0 -Wl,-single_module
Undefined symbols:
  "_tanhq", referenced from:
      __gfortran_specific__tanh_r16 in _tanh_r16.o
  "_clogq", referenced from:
      __gfortran_specific__log_c16 in _log_c16.o

...is still passing...

 -L/Users/howarth/gcc-4.6-20101108/libquadmath

which should be...

 -L/Users/howarth/work/x86_64-apple-darwin10.5.0/i386/libquadmath/.libs

for the i386 multilib build and 

 -L/Users/howarth/work/x86_64-apple-darwin10.5.0/libquadmath/.libs

for the -m64 multilib build. We need to figure out what construction
of variables will provide those properly in each case during the mulilib
build of libgfortran.
            Jack

>
> Comments?
>
> Tobias
>
> $ diffstat quad.diff
>   b/Makefile.def                             |    3 +
>   b/configure.ac                             |    1
>   b/gcc/fortran/gfortranspec.c               |   38 +++++++++++++++++++
>   b/gcc/fortran/trans-io.c                   |   49  
> +++++++++++++++++++++++--
>   b/gcc/fortran/trans-types.c                |    8 +++-
>   b/libgfortran/Makefile.am                  |    6 ++-
>   b/libgfortran/acinclude.m4                 |   51  
> ++++++++++++++++++++++++++
>   b/libgfortran/configure.ac                 |   13 +++++-
>   b/libgfortran/gfortran.map                 |    5 ++
>   b/libgfortran/intrinsics/cshift0.c         |   28 +++++++++++---
>   b/libgfortran/intrinsics/erfc_scaled_inc.c |   11 +++++
>   b/libgfortran/intrinsics/pack_generic.c    |   28 +++++++++++---
>   b/libgfortran/intrinsics/spread_generic.c  |   56  
> ++++++++++++++++++++++-------
>   b/libgfortran/intrinsics/unpack_generic.c  |   56  
> ++++++++++++++++++++++-------
>   b/libgfortran/io/read.c                    |    8 +++-
>   b/libgfortran/io/transfer.c                |   56  
> ++++++++++++++++++++++++++++-
>   b/libgfortran/io/write.c                   |    1
>   b/libgfortran/io/write_float.def           |   11 +++++
>   b/libgfortran/libgfortran.h                |   18 ++++++++-
>   b/libgfortran/m4/mtype.m4                  |    2 -
>   b/libgfortran/mk-kinds-h.sh                |   39 +++++++++++++-------
>   b/libgfortran/runtime/in_pack_generic.c    |   29 +++++++++++----
>   b/libgfortran/runtime/in_unpack_generic.c  |   31 ++++++++++++----
>   gcc/libgfortran/kinds-override.h           |   46 +++++++++++++++++++++++
>   gcc/libgfortran/libgfortran.spec.in        |    8 ++++
>   25 files changed, 524 insertions(+), 78 deletions(-)
>
> $ diffstat quad-gen.diff
>   b/Makefile.in                          |  467 +
>   b/configure                            |    1
>   b/libgfortran/Makefile.in              |   74
>   b/libgfortran/config.h.in              |    3
>   b/libgfortran/configure                |  139
>   gcc/libgfortran/generated/pow_r16_i4.c |   75
>   gcc/libquadmath/Makefile.in            | 1219 +++
>   gcc/libquadmath/aclocal.m4             |  979 ++
>   gcc/libquadmath/config.h.in            |   68
>   gcc/libquadmath/configure              |13288  
> +++++++++++++++++++++++++++++++++
>   10 files changed, 16289 insertions(+), 24 deletions(-)
>




^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: RFC patch: Add libquadmath - and use it in gfortran (round two)
  2010-11-08 21:20 ` Jack Howarth
@ 2010-11-08 21:23   ` Ralf Wildenhues
  2010-11-08 21:30     ` Jack Howarth
  0 siblings, 1 reply; 29+ messages in thread
From: Ralf Wildenhues @ 2010-11-08 21:23 UTC (permalink / raw)
  To: Jack Howarth; +Cc: gfortran, gcc patches

Hello,

* Jack Howarth wrote on Mon, Nov 08, 2010 at 10:14:14PM CET:
> ...is still passing...
> 
>  -L/Users/howarth/gcc-4.6-20101108/libquadmath
> 
> which should be...
> 
>  -L/Users/howarth/work/x86_64-apple-darwin10.5.0/i386/libquadmath/.libs
> 
> for the i386 multilib build and 
> 
>  -L/Users/howarth/work/x86_64-apple-darwin10.5.0/libquadmath/.libs
> 
> for the -m64 multilib build. We need to figure out what construction
> of variables will provide those properly in each case during the mulilib
> build of libgfortran.

The key with libtool is usually to *not* pass
  -L../foo/.libs -lfoo

but to pass
  ../foo/libfoo.la

in libbar_la_LIBADD.  That will set the paths for linking against
uninstalled libraries right, and also do TRT when optionally relinking
at 'make install' time.

Hope that helps, I didn't check for any further details.  ;-)

Cheers,
Ralf

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: RFC patch: Add libquadmath - and use it in gfortran (round two)
  2010-11-08 21:23   ` Ralf Wildenhues
@ 2010-11-08 21:30     ` Jack Howarth
  2010-11-08 22:04       ` Jack Howarth
  0 siblings, 1 reply; 29+ messages in thread
From: Jack Howarth @ 2010-11-08 21:30 UTC (permalink / raw)
  To: Ralf Wildenhues, gfortran, gcc patches

On Mon, Nov 08, 2010 at 10:20:42PM +0100, Ralf Wildenhues wrote:
> Hello,
> 
> * Jack Howarth wrote on Mon, Nov 08, 2010 at 10:14:14PM CET:
> > ...is still passing...
> > 
> >  -L/Users/howarth/gcc-4.6-20101108/libquadmath
> > 
> > which should be...
> > 
> >  -L/Users/howarth/work/x86_64-apple-darwin10.5.0/i386/libquadmath/.libs
> > 
> > for the i386 multilib build and 
> > 
> >  -L/Users/howarth/work/x86_64-apple-darwin10.5.0/libquadmath/.libs
> > 
> > for the -m64 multilib build. We need to figure out what construction
> > of variables will provide those properly in each case during the mulilib
> > build of libgfortran.
> 
> The key with libtool is usually to *not* pass
>   -L../foo/.libs -lfoo
> 
> but to pass
>   ../foo/libfoo.la
> 
> in libbar_la_LIBADD.  That will set the paths for linking against
> uninstalled libraries right, and also do TRT when optionally relinking
> at 'make install' time.
> 
> Hope that helps, I didn't check for any further details.  ;-)

Manually changing the Makefile in /Users/howarth/work/x86_64-apple-darwin10.5.0/libgfortran
and /Users/howarth/work/x86_64-apple-darwin10.5.0/i386/libgfortran from...

libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) -L$(top_srcdir)/../libquadmath LIBQUADLIB -lm $(extra_ldflags_libgfortran) $(version_arg)

to

libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) ../libquadmath/libquadmath.la -lm $(extra_ldflags_libgfortran) $(version_arg)

solves the linkage problems in both cases. Thanks.
                       Jack

> 
> Cheers,
> Ralf

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: RFC patch: Add libquadmath - and use it in gfortran (round two)
  2010-11-08 21:30     ` Jack Howarth
@ 2010-11-08 22:04       ` Jack Howarth
  0 siblings, 0 replies; 29+ messages in thread
From: Jack Howarth @ 2010-11-08 22:04 UTC (permalink / raw)
  To: Ralf Wildenhues, gfortran, gcc patches

On Mon, Nov 08, 2010 at 04:29:22PM -0500, Jack Howarth wrote:
> On Mon, Nov 08, 2010 at 10:20:42PM +0100, Ralf Wildenhues wrote:
> > Hello,
> > 
> > * Jack Howarth wrote on Mon, Nov 08, 2010 at 10:14:14PM CET:
> > > ...is still passing...
> > > 
> > >  -L/Users/howarth/gcc-4.6-20101108/libquadmath
> > > 
> > > which should be...
> > > 
> > >  -L/Users/howarth/work/x86_64-apple-darwin10.5.0/i386/libquadmath/.libs
> > > 
> > > for the i386 multilib build and 
> > > 
> > >  -L/Users/howarth/work/x86_64-apple-darwin10.5.0/libquadmath/.libs
> > > 
> > > for the -m64 multilib build. We need to figure out what construction
> > > of variables will provide those properly in each case during the mulilib
> > > build of libgfortran.
> > 
> > The key with libtool is usually to *not* pass
> >   -L../foo/.libs -lfoo
> > 
> > but to pass
> >   ../foo/libfoo.la
> > 
> > in libbar_la_LIBADD.  That will set the paths for linking against
> > uninstalled libraries right, and also do TRT when optionally relinking
> > at 'make install' time.
> > 
> > Hope that helps, I didn't check for any further details.  ;-)
> 
> Manually changing the Makefile in /Users/howarth/work/x86_64-apple-darwin10.5.0/libgfortran
> and /Users/howarth/work/x86_64-apple-darwin10.5.0/i386/libgfortran from...
> 
> libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) -L$(top_srcdir)/../libquadmath LIBQUADLIB -lm $(extra_ldflags_libgfortran) $(version_arg)
> 
> to
> 
> libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) ../libquadmath/libquadmath.la -lm $(extra_ldflags_libgfortran) $(version_arg)
> 
> solves the linkage problems in both cases. Thanks.
>                        Jack

I am finding that while 'make install' succeeds on x86_64-apple-darwin10, that the testcode...

$ cat test_qp.f90
program test_qp
  implicit none
  integer, parameter :: QP = 16
  real(QP), parameter :: Z1 = 1,HALF_PI = asin(Z1),PI = HALF_PI+HALF_PI
  real(QP) :: x = 0.124_QP
  print *, x
  print *, PI
  print *, 16*atan(0.2_QP)-4*atan(Z1/239)
  print *, sin(PI)
  print *, cos(HALF_PI)
  print *, asinh(PI)
  print *, erfc(Z1)
  print *, epsilon(x)
  print *, precision(x)
  print *, digits(x)
end program test_qp

produces...

[MacPro:~] howarth% dist/bin/gfortran test_qp.f90 -o test_qp
Undefined symbols:
  "__gfortran_transfer_real_write128", referenced from:
      _MAIN__ in cciK5SKB.o
      _MAIN__ in cciK5SKB.o
      _MAIN__ in cciK5SKB.o
      _MAIN__ in cciK5SKB.o
      _MAIN__ in cciK5SKB.o
      _MAIN__ in cciK5SKB.o
      _MAIN__ in cciK5SKB.o
      _MAIN__ in cciK5SKB.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

and attempting to link statically fails with the error...

dist/bin/gfortran -static-libgfortran test_qp.f90 -o test_qp
ld: unknown option: --as-needed
collect2: ld returned 1 exit status

These patches seem to break -static-libgfortran in general on darwin
as a simple hello.f90 fails to link as well whereas stock gcc trunk
accepts this flag without complaint.
          Jack

> 
> > 
> > Cheers,
> > Ralf

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: RFC patch: Add libquadmath - and use it in gfortran (round two)
  2010-11-08 20:57 RFC patch: Add libquadmath - and use it in gfortran (round two) Tobias Burnus
  2010-11-08 21:20 ` Jack Howarth
@ 2010-11-08 23:43 ` Jack Howarth
  2010-11-09  0:50   ` Steve Kargl
  2010-11-09 17:23 ` RFC patch: Add libquadmath - and use it in gfortran (round THREE) Tobias Burnus
  2010-11-14 16:00 ` RFC patch: Add libquadmath - and use it in gfortran (round two) Ralf Wildenhues
  3 siblings, 1 reply; 29+ messages in thread
From: Jack Howarth @ 2010-11-08 23:43 UTC (permalink / raw)
  To: gfortran, gcc patches

On Mon, Nov 08, 2010 at 09:33:21PM +0100, Tobias Burnus wrote:
> Hi all,
>
> that's an updated version of my patch at  
> http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00653.html
> which is in turn based on FX's patch at  
> http://gcc.gnu.org/ml/gcc-patches/2010-10/msg02388.html
>
> The patch contains:
>
> a) libquadmath(.tar.bz2): __float128 math library. It exports all math  
> functions with the suffix "q" ("tanq", "jnq" etc.); it also exports two  
> I/O related functions with the prefix quadmath_. The library is used  
> from libgfortran but can also be used from C/C++. However, there is no  
> printf hook thus doing I/O from C/C++ is a bit more effort. The library  
> is automatically build if language=fortran is enabled, but on systems  
> without __float128 it is a no op.
>
> b) quad.diff: The changes to the toplevel Makefile.def/configure.ac to  
> build libquad with language=fortran; changes to gcc/fortran to use  
> __float128; changes to libgfortran to use libquadmath.
> Libgfortran automatically links libquadmath if it is available; if  
> -static-libgfortran is used, the (dynamically linked) libquadmath is  
> surounded by --as-needed/--no-as-needed.
>
> c) quad_gen.diff: Due to popular request, the generated files.
>
> Changes to previous patch:
>
> - Fixed several issues regarding configure. I hope that it now builds on  
> Darwin and creates a DLL under Cygwin/MinGW(.org/64)*
> - It does no longer use weakrefs for the math functions
> - It uses a weakref for I/O (write_float etc.), but
> - There is now a transfer_{complex,real}{,write}128 function, whose only  
> purpose is to drag in the libquadmath I/O function.
> Comments?
>

Tobias,
    Where is __gfortran_transfer_real_write128 supposed to reside? I see...

[MacPro:~/gcc-4.6-20101108/libgfortran] howarth% grep gfortran_transfer_real_write128 *
gfortran.map:    _gfortran_transfer_real_write128;

but there doesn't seem to be any actual code generated for that subroutine.
           Jack

> Tobias
>
> $ diffstat quad.diff
>   b/Makefile.def                             |    3 +
>   b/configure.ac                             |    1
>   b/gcc/fortran/gfortranspec.c               |   38 +++++++++++++++++++
>   b/gcc/fortran/trans-io.c                   |   49  
> +++++++++++++++++++++++--
>   b/gcc/fortran/trans-types.c                |    8 +++-
>   b/libgfortran/Makefile.am                  |    6 ++-
>   b/libgfortran/acinclude.m4                 |   51  
> ++++++++++++++++++++++++++
>   b/libgfortran/configure.ac                 |   13 +++++-
>   b/libgfortran/gfortran.map                 |    5 ++
>   b/libgfortran/intrinsics/cshift0.c         |   28 +++++++++++---
>   b/libgfortran/intrinsics/erfc_scaled_inc.c |   11 +++++
>   b/libgfortran/intrinsics/pack_generic.c    |   28 +++++++++++---
>   b/libgfortran/intrinsics/spread_generic.c  |   56  
> ++++++++++++++++++++++-------
>   b/libgfortran/intrinsics/unpack_generic.c  |   56  
> ++++++++++++++++++++++-------
>   b/libgfortran/io/read.c                    |    8 +++-
>   b/libgfortran/io/transfer.c                |   56  
> ++++++++++++++++++++++++++++-
>   b/libgfortran/io/write.c                   |    1
>   b/libgfortran/io/write_float.def           |   11 +++++
>   b/libgfortran/libgfortran.h                |   18 ++++++++-
>   b/libgfortran/m4/mtype.m4                  |    2 -
>   b/libgfortran/mk-kinds-h.sh                |   39 +++++++++++++-------
>   b/libgfortran/runtime/in_pack_generic.c    |   29 +++++++++++----
>   b/libgfortran/runtime/in_unpack_generic.c  |   31 ++++++++++++----
>   gcc/libgfortran/kinds-override.h           |   46 +++++++++++++++++++++++
>   gcc/libgfortran/libgfortran.spec.in        |    8 ++++
>   25 files changed, 524 insertions(+), 78 deletions(-)
>
> $ diffstat quad-gen.diff
>   b/Makefile.in                          |  467 +
>   b/configure                            |    1
>   b/libgfortran/Makefile.in              |   74
>   b/libgfortran/config.h.in              |    3
>   b/libgfortran/configure                |  139
>   gcc/libgfortran/generated/pow_r16_i4.c |   75
>   gcc/libquadmath/Makefile.in            | 1219 +++
>   gcc/libquadmath/aclocal.m4             |  979 ++
>   gcc/libquadmath/config.h.in            |   68
>   gcc/libquadmath/configure              |13288  
> +++++++++++++++++++++++++++++++++
>   10 files changed, 16289 insertions(+), 24 deletions(-)
>




^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: RFC patch: Add libquadmath - and use it in gfortran (round two)
  2010-11-08 23:43 ` Jack Howarth
@ 2010-11-09  0:50   ` Steve Kargl
  2010-11-09  1:08     ` Jack Howarth
  0 siblings, 1 reply; 29+ messages in thread
From: Steve Kargl @ 2010-11-09  0:50 UTC (permalink / raw)
  To: Jack Howarth; +Cc: gfortran, gcc patches

On Mon, Nov 08, 2010 at 06:33:15PM -0500, Jack Howarth wrote:
> 
> [MacPro:~/gcc-4.6-20101108/libgfortran] howarth% grep gfortran_transfer_real_write128 *
> gfortran.map:    _gfortran_transfer_real_write128;
> 

Try 'grep real_write128'.

The _gfortran_ prefix comes from a C macro with
the clever name PREFIX.

-- 
Steve

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: RFC patch: Add libquadmath - and use it in gfortran (round two)
  2010-11-09  0:50   ` Steve Kargl
@ 2010-11-09  1:08     ` Jack Howarth
  2010-11-09  1:37       ` Steve Kargl
  0 siblings, 1 reply; 29+ messages in thread
From: Jack Howarth @ 2010-11-09  1:08 UTC (permalink / raw)
  To: Steve Kargl; +Cc: gfortran, gcc patches

On Mon, Nov 08, 2010 at 04:19:21PM -0800, Steve Kargl wrote:
> On Mon, Nov 08, 2010 at 06:33:15PM -0500, Jack Howarth wrote:
> > 
> > [MacPro:~/gcc-4.6-20101108/libgfortran] howarth% grep gfortran_transfer_real_write128 *
> > gfortran.map:    _gfortran_transfer_real_write128;
> > 
> 
> Try 'grep real_write128'.
> 
> The _gfortran_ prefix comes from a C macro with
> the clever name PREFIX.
> 
> -- 
> Steve

Steve,
   The current patches on x86_64-apple-darwin10 don't seem to be applying
the prefix. I have...

[MacPro:x86_64-apple-darwin10.5.0/libgfortran/.libs] howarth% nm libgfortran.a | grep write128
0000000000000dd0 T _transfer_complex_write128
0000000000000c10 T _transfer_real_write128

and

[MacPro:x86_64-apple-darwin10.5.0/libgfortran/.libs] howarth% nm libgfortran.dylib | grep write128
00000000000c0870 T _transfer_complex_write128
00000000000c06b0 T _transfer_real_write128

whereas the other symbols are properly prefixed...

[MacPro:x86_64-apple-darwin10.5.0/libgfortran/.libs] howarth% nm libgfortran.dylib | grep eoshift2_8
00000000000cfdc0 T __gfortran_eoshift2_8
00000000000cfdf0 T __gfortran_eoshift2_8_char
00000000000cfe20 T __gfortran_eoshift2_8_char4

           Jack

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: RFC patch: Add libquadmath - and use it in gfortran (round two)
  2010-11-09  1:08     ` Jack Howarth
@ 2010-11-09  1:37       ` Steve Kargl
  2010-11-09  1:42         ` Jack Howarth
  0 siblings, 1 reply; 29+ messages in thread
From: Steve Kargl @ 2010-11-09  1:37 UTC (permalink / raw)
  To: Jack Howarth; +Cc: gfortran, gcc patches

On Mon, Nov 08, 2010 at 07:50:35PM -0500, Jack Howarth wrote:
> On Mon, Nov 08, 2010 at 04:19:21PM -0800, Steve Kargl wrote:
> > On Mon, Nov 08, 2010 at 06:33:15PM -0500, Jack Howarth wrote:
> > > 
> > > [MacPro:~/gcc-4.6-20101108/libgfortran] howarth% grep gfortran_transfer_real_write128 *
> > > gfortran.map:    _gfortran_transfer_real_write128;
> > > 
> > 
> > Try 'grep real_write128'.
> > 
> > The _gfortran_ prefix comes from a C macro with
> > the clever name PREFIX.
> > 
> > -- 
> > Steve
> 
> Steve,
>    The current patches on x86_64-apple-darwin10 don't seem to be applying
> the prefix. I have...
> 
> [MacPro:x86_64-apple-darwin10.5.0/libgfortran/.libs] howarth% nm libgfortran.a | grep write128
> 0000000000000dd0 T _transfer_complex_write128
> 0000000000000c10 T _transfer_real_write128
> 

Grep for _write128 in the patched libgfortran source code.
I suspect Tobias may have forgotten to write, e.g.,
PREFIX(transfer_real_write128).  I haven't has time to
look over the newest patches.

-- 
Steve

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: RFC patch: Add libquadmath - and use it in gfortran (round two)
  2010-11-09  1:37       ` Steve Kargl
@ 2010-11-09  1:42         ` Jack Howarth
  2010-11-09  2:36           ` Jerry DeLisle
  0 siblings, 1 reply; 29+ messages in thread
From: Jack Howarth @ 2010-11-09  1:42 UTC (permalink / raw)
  To: Steve Kargl; +Cc: gfortran, gcc patches

On Mon, Nov 08, 2010 at 05:32:39PM -0800, Steve Kargl wrote:
> On Mon, Nov 08, 2010 at 07:50:35PM -0500, Jack Howarth wrote:
> > On Mon, Nov 08, 2010 at 04:19:21PM -0800, Steve Kargl wrote:
> > > On Mon, Nov 08, 2010 at 06:33:15PM -0500, Jack Howarth wrote:
> > > > 
> > > > [MacPro:~/gcc-4.6-20101108/libgfortran] howarth% grep gfortran_transfer_real_write128 *
> > > > gfortran.map:    _gfortran_transfer_real_write128;
> > > > 
> > > 
> > > Try 'grep real_write128'.
> > > 
> > > The _gfortran_ prefix comes from a C macro with
> > > the clever name PREFIX.
> > > 
> > > -- 
> > > Steve
> > 
> > Steve,
> >    The current patches on x86_64-apple-darwin10 don't seem to be applying
> > the prefix. I have...
> > 
> > [MacPro:x86_64-apple-darwin10.5.0/libgfortran/.libs] howarth% nm libgfortran.a | grep write128
> > 0000000000000dd0 T _transfer_complex_write128
> > 0000000000000c10 T _transfer_real_write128
> > 
> 
> Grep for _write128 in the patched libgfortran source code.
> I suspect Tobias may have forgotten to write, e.g.,
> PREFIX(transfer_real_write128).  I haven't has time to
> look over the newest patches.

Steve,
   The current extern statements are rather confused in the patch. Some of the ones
wrapppered with

#if defined(GFC_REAL_16_IS_FLOAT128)

are misnamed (ie don't have 128 suffixed onto the call) and others like transfer_real_write have
no extern. I believe fixing transfer.c to have...

extern void transfer_real (st_parameter_dt *, void *, int);
export_proto(transfer_real);

#if defined(GFC_REAL_16_IS_FLOAT128)

extern void transfer_real128 (st_parameter_dt *, void *, int);
export_proto(transfer_real128);

#endif

extern void transfer_real_write (st_parameter_dt *, void *, int);
export_proto(transfer_real_write);

#if defined(GFC_REAL_16_IS_FLOAT128)

extern void transfer_real_write128 (st_parameter_dt *, void *, int);
export_proto(transfer_real_write128);

#endif

and

extern void transfer_complex (st_parameter_dt *, void *, int);
export_proto(transfer_complex);

#if defined(GFC_REAL_16_IS_FLOAT128)

extern void transfer_complex128 (st_parameter_dt *, void *, int);
export_proto(transfer_complex128);

#endif

extern void transfer_complex_write (st_parameter_dt *, void *, int);
export_proto(transfer_complex_write);

#if defined(GFC_REAL_16_IS_FLOAT128)

extern void transfer_complex_write128 (st_parameter_dt *, void *, int);
export_proto(transfer_complex_write128);

#endif

may be sufficient. Currently testing those changes.
          Jack

> 
> -- 
> Steve

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: RFC patch: Add libquadmath - and use it in gfortran (round two)
  2010-11-09  1:42         ` Jack Howarth
@ 2010-11-09  2:36           ` Jerry DeLisle
  2010-11-09  3:18             ` Jack Howarth
  2010-11-09  7:10             ` Tobias Burnus
  0 siblings, 2 replies; 29+ messages in thread
From: Jerry DeLisle @ 2010-11-09  2:36 UTC (permalink / raw)
  To: Tobias Burnus; +Cc: gfortran, gcc patches

I am currently bootstrapping the patches.  I am curious what these tmp1 and tmp2 
are about? Also see them on the real128 versions as well.

#if defined(GFC_REAL_16_IS_FLOAT128)
void
transfer_complex128 (st_parameter_dt *dtp, void *p, int kind)
{
   static void *tmp1 = quadmath_strtopQ;
   static void *tmp2 = quadmath_dtoaq;

   transfer_complex (dtp, p, kind);
}


void
transfer_complex_write128 (st_parameter_dt *dtp, void *p, int kind)
{
   static void *tmp1 = quadmath_strtopQ;
   static void *tmp2 = quadmath_dtoaq;

   transfer_complex (dtp, p, kind);
}
#endif


Jerry

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: RFC patch: Add libquadmath - and use it in gfortran (round two)
  2010-11-09  2:36           ` Jerry DeLisle
@ 2010-11-09  3:18             ` Jack Howarth
  2010-11-09  3:47               ` Jerry DeLisle
  2010-11-09  7:10             ` Tobias Burnus
  1 sibling, 1 reply; 29+ messages in thread
From: Jack Howarth @ 2010-11-09  3:18 UTC (permalink / raw)
  To: Jerry DeLisle; +Cc: Tobias Burnus, gfortran, gcc patches

On Mon, Nov 08, 2010 at 06:20:41PM -0800, Jerry DeLisle wrote:
> I am currently bootstrapping the patches.  I am curious what these tmp1 
> and tmp2 are about? Also see them on the real128 versions as well.
>
> #if defined(GFC_REAL_16_IS_FLOAT128)
> void
> transfer_complex128 (st_parameter_dt *dtp, void *p, int kind)
> {
>   static void *tmp1 = quadmath_strtopQ;
>   static void *tmp2 = quadmath_dtoaq;
>
>   transfer_complex (dtp, p, kind);
> }
>
>
> void
> transfer_complex_write128 (st_parameter_dt *dtp, void *p, int kind)
> {
>   static void *tmp1 = quadmath_strtopQ;
>   static void *tmp2 = quadmath_dtoaq;
>
>   transfer_complex (dtp, p, kind);
> }
> #endif
>
>
> Jerry

Jerry,
   With the corrections to libgfortran/transfer.c that I mentioned in...

http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00830.html

the example...

program test_qp
  implicit none
  integer, parameter :: QP = 16
  real(QP), parameter :: Z1 = 1,HALF_PI = asin(Z1),PI = HALF_PI+HALF_PI
  real(QP) :: x = 0.124_QP
  print *, x
  print *, PI
  print *, 16*atan(0.2_QP)-4*atan(Z1/239)
  print *, sin(PI)
  print *, cos(HALF_PI)
  print *, asinh(PI)
  print *, erfc(Z1)
  print *, epsilon(x)
  print *, precision(x)
  print *, digits(x)
end program test_qp

compiles without error and the resulting binary on x86_64-apple-darwin10
produces the output...

  0.12399999999999999999999999999999999      
   3.1415926535897932384626433832795028      
   3.1415926535897932384626433832795032      
  8.67181013012378102479704402604335225E-0035
  4.33590506506189051239852201302167613E-0035
   1.8622957433108482198883613251826206      
  0.15729920705028513065877936491739074      
  1.92592994438723585305597794258492732E-0034
          33
         113

             Jack

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: RFC patch: Add libquadmath - and use it in gfortran (round two)
  2010-11-09  3:18             ` Jack Howarth
@ 2010-11-09  3:47               ` Jerry DeLisle
  2010-11-09 16:17                 ` Jack Howarth
  0 siblings, 1 reply; 29+ messages in thread
From: Jerry DeLisle @ 2010-11-09  3:47 UTC (permalink / raw)
  To: Jack Howarth; +Cc: Tobias Burnus, gfortran, gcc patches

[-- Attachment #1: Type: text/plain, Size: 2580 bytes --]

On 11/08/2010 06:36 PM, Jack Howarth wrote:
> On Mon, Nov 08, 2010 at 06:20:41PM -0800, Jerry DeLisle wrote:
>> I am currently bootstrapping the patches.  I am curious what these tmp1
>> and tmp2 are about? Also see them on the real128 versions as well.
>>
>> #if defined(GFC_REAL_16_IS_FLOAT128)
>> void
>> transfer_complex128 (st_parameter_dt *dtp, void *p, int kind)
>> {
>>    static void *tmp1 = quadmath_strtopQ;
>>    static void *tmp2 = quadmath_dtoaq;
>>
>>    transfer_complex (dtp, p, kind);
>> }
>>
>>
>> void
>> transfer_complex_write128 (st_parameter_dt *dtp, void *p, int kind)
>> {
>>    static void *tmp1 = quadmath_strtopQ;
>>    static void *tmp2 = quadmath_dtoaq;
>>
>>    transfer_complex (dtp, p, kind);
>> }
>> #endif
>>
>>
>> Jerry
>
> Jerry,
>     With the corrections to libgfortran/transfer.c that I mentioned in...
>
> http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00830.html
>
> the example...
>
> program test_qp
>    implicit none
>    integer, parameter :: QP = 16
>    real(QP), parameter :: Z1 = 1,HALF_PI = asin(Z1),PI = HALF_PI+HALF_PI
>    real(QP) :: x = 0.124_QP
>    print *, x
>    print *, PI
>    print *, 16*atan(0.2_QP)-4*atan(Z1/239)
>    print *, sin(PI)
>    print *, cos(HALF_PI)
>    print *, asinh(PI)
>    print *, erfc(Z1)
>    print *, epsilon(x)
>    print *, precision(x)
>    print *, digits(x)
> end program test_qp
>
> compiles without error and the resulting binary on x86_64-apple-darwin10
> produces the output...
>
>    0.12399999999999999999999999999999999
>     3.1415926535897932384626433832795028
>     3.1415926535897932384626433832795032
>    8.67181013012378102479704402604335225E-0035
>    4.33590506506189051239852201302167613E-0035
>     1.8622957433108482198883613251826206
>    0.15729920705028513065877936491739074
>    1.92592994438723585305597794258492732E-0034
>            33
>           113
>
>               Jack
>

I get this as well:

$ gfc test-qp.f90
$ ./a.out
   0.12399999999999999999999999999999999
    3.1415926535897932384626433832795028
    3.1415926535897932384626433832795032
   8.67181013012378102479704402604335225E-0035
   4.33590506506189051239852201302167613E-0035
    1.8622957433108482198883613251826206
   0.15729920705028513065877936491739074
   1.92592994438723585305597794258492732E-0034
           33
          113

I ended up with the attached diff for transfer.c.

(diff against trunk) Tobias, revert your local transfer.c and apply this one. I 
also tested with some other programs I had done previously and all looks OK. 
Regression testing is on going.

Regards,

Jerry

[-- Attachment #2: transfer.diff --]
[-- Type: text/x-patch, Size: 2722 bytes --]

Index: transfer.c
===================================================================
--- transfer.c	(revision 166460)
+++ transfer.c	(working copy)
@@ -56,6 +56,8 @@ see the files COPYING3 and COPYING.RUNTIME respect
       transfer_character_wide
       transfer_real
       transfer_complex
+      transfer_real128
+      transfer_complex128
 
     These subroutines do not return status.
 
@@ -76,6 +78,14 @@ export_proto(transfer_real);
 extern void transfer_real_write (st_parameter_dt *, void *, int);
 export_proto(transfer_real_write);
 
+#if defined(GFC_REAL_16_IS_FLOAT128)
+extern void transfer_real128 (st_parameter_dt *, void *, int);
+export_proto(transfer_real128);
+
+extern void transfer_real_write128 (st_parameter_dt *, void *, int);
+export_proto(transfer_real_write128);
+#endif
+
 extern void transfer_logical (st_parameter_dt *, void *, int);
 export_proto(transfer_logical);
 
@@ -98,6 +108,14 @@ export_proto(transfer_character_wide_write);
 extern void transfer_complex (st_parameter_dt *, void *, int);
 export_proto(transfer_complex);
 
+#if defined(GFC_REAL_16_IS_FLOAT128)
+extern void transfer_complex128 (st_parameter_dt *, void *, int);
+export_proto(transfer_complex128);
+
+extern void transfer_complex_write128 (st_parameter_dt *, void *, int);
+export_proto(transfer_complex_write128);
+#endif
+
 extern void transfer_complex_write (st_parameter_dt *, void *, int);
 export_proto(transfer_complex_write);
 
@@ -1892,7 +1910,25 @@ transfer_real_write (st_parameter_dt *dtp, void *p
   transfer_real (dtp, p, kind);
 }
 
+/* Make sure that libquadmath is pulled in.  */
+
+#if defined(GFC_REAL_16_IS_FLOAT128)
 void
+transfer_real128 (st_parameter_dt *dtp, void *p, int kind)
+{
+  transfer_real (dtp, p, kind);
+}
+
+
+void
+transfer_real_write128 (st_parameter_dt *dtp, void *p, int kind)
+{
+  transfer_real (dtp, p, kind);
+}
+#endif
+
+
+void
 transfer_logical (st_parameter_dt *dtp, void *p, int kind)
 {
   if ((dtp->common.flags & IOPARM_LIBRETURN_MASK) != IOPARM_LIBRETURN_OK)
@@ -1964,13 +2000,33 @@ transfer_complex (st_parameter_dt *dtp, void *p, i
   dtp->u.p.transfer (dtp, BT_COMPLEX, p, kind, size, 1);
 }
 
+
 void
 transfer_complex_write (st_parameter_dt *dtp, void *p, int kind)
 {
   transfer_complex (dtp, p, kind);
 }
 
+
+/* Make sure that libquadmath is pulled in.  */
+
+#if defined(GFC_REAL_16_IS_FLOAT128)
 void
+transfer_complex128 (st_parameter_dt *dtp, void *p, int kind)
+{
+  transfer_complex (dtp, p, kind);
+}
+
+
+void
+transfer_complex_write128 (st_parameter_dt *dtp, void *p, int kind)
+{
+  transfer_complex (dtp, p, kind);
+}
+#endif
+
+
+void
 transfer_array (st_parameter_dt *dtp, gfc_array_char *desc, int kind,
 		gfc_charlen_type charlen)
 {

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: RFC patch: Add libquadmath - and use it in gfortran (round two)
  2010-11-09  2:36           ` Jerry DeLisle
  2010-11-09  3:18             ` Jack Howarth
@ 2010-11-09  7:10             ` Tobias Burnus
  2010-11-09  7:52               ` Ralf Wildenhues
  1 sibling, 1 reply; 29+ messages in thread
From: Tobias Burnus @ 2010-11-09  7:10 UTC (permalink / raw)
  To: Jerry DeLisle; +Cc: gfortran, gcc patches

First, I should not write/submit patches when I am tired - that results 
in not-well tested patches. However, we seemingly have nailed the Darwin 
linkage issue.

The only issue which remains is the --as-needed issue on Darwin. Somehow 
the configure check whether "ld" supports --as-needed does not seem to 
work. (Cf. acinclude.m4.) Any idea why?

Jerry DeLisle wrote:
> I am currently bootstrapping the patches.  I am curious what these 
> tmp1 and tmp2 are about? Also see them on the real128 versions as well.
>
> transfer_complex128 (st_parameter_dt *dtp, void *p, int kind)
> {
>   static void *tmp1 = quadmath_strtopQ;
>   static void *tmp2 = quadmath_dtoaq;

Those where suggested by Jakub. If one uses in the Fortran program a 
REAL(16) function, e.g.
   r16 = acos(r16)
one adds a dependency on acosq and thus on libquadmath. While when using
   write(*,*) 16.45
calls write_float, which would pull in libquad - even if not needed. 
Thus, one uses a weakref in write_float. However, to make sure that a 
program has a hard dependence on libquad, one uses the symbols in 
transfer_*128: By referencing the libquad functions, one makes sure that 
there is a dependency on libquad. Without dependency and weak symbols, 
one has the problem that with a static libquadmath (for instance via 
"-static") the symbols are not pulled and the program segfaults.

However, I have forgotten to add " __attribute__((used))" to make sure 
those symbols are indeed emitted. One could also add a check (e.g. in 
write_float) that the weakref symbol is indeed not-NULL and issue 
otherwise a run-time error, but that is probably not needed.

Tobias

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: RFC patch: Add libquadmath - and use it in gfortran (round two)
  2010-11-09  7:10             ` Tobias Burnus
@ 2010-11-09  7:52               ` Ralf Wildenhues
  2010-11-09  9:18                 ` Rainer Orth
  0 siblings, 1 reply; 29+ messages in thread
From: Ralf Wildenhues @ 2010-11-09  7:52 UTC (permalink / raw)
  To: Tobias Burnus; +Cc: Jerry DeLisle, gfortran, gcc patches

* Tobias Burnus wrote on Tue, Nov 09, 2010 at 08:09:26AM CET:
> The only issue which remains is the --as-needed issue on Darwin.
> Somehow the configure check whether "ld" supports --as-needed does
> not seem to work. (Cf. acinclude.m4.) Any idea why?

Well, AC_CHECK_LIB([m], [func], ...) will check (and cache!) whether it
works to link against -lm when func is an unresolved symbol.  It does
not make sense to also add -lm in the OTHER-LIBRARIES argument of
AC_CHECK_LIB here, linking libm against libm is not needed.

AC_LINK_IFELSE with LIBS overridden will work better.  I'm not quite
sure ATM whether there are linkers that will only warn but not fail when
you pass -Wl,-unknown-flag to the compiler driver, I guess we'll find
out.  Of course the test then still doesn't ensure that -Wl,--as-needed
actually does what it should.

Another related issue is that libtool will have problems with this (this
is only relevant for users of GCC not GCC itself) as it doesn't keep the
ordering of the -Wl, flags.  Guess we need to fix that next then ...

Cheers,
Ralf

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: RFC patch: Add libquadmath - and use it in gfortran (round two)
  2010-11-09  7:52               ` Ralf Wildenhues
@ 2010-11-09  9:18                 ` Rainer Orth
  0 siblings, 0 replies; 29+ messages in thread
From: Rainer Orth @ 2010-11-09  9:18 UTC (permalink / raw)
  To: Ralf Wildenhues; +Cc: Tobias Burnus, Jerry DeLisle, gfortran, gcc patches

Ralf Wildenhues <Ralf.Wildenhues@gmx.de> writes:

> AC_LINK_IFELSE with LIBS overridden will work better.  I'm not quite
> sure ATM whether there are linkers that will only warn but not fail when
> you pass -Wl,-unknown-flag to the compiler driver, I guess we'll find

There are, as I've found the hard way:

	[build, libjava] Ignore IRIX 6.5 ld warning for --no-merge-exidx-entries (PR libgcj/44216)
	http://gcc.gnu.org/ml/gcc-patches/2010-05/msg01889.html

Thanks.
	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: RFC patch: Add libquadmath - and use it in gfortran (round two)
  2010-11-09  3:47               ` Jerry DeLisle
@ 2010-11-09 16:17                 ` Jack Howarth
  2010-11-09 16:22                   ` Jerry DeLisle
  0 siblings, 1 reply; 29+ messages in thread
From: Jack Howarth @ 2010-11-09 16:17 UTC (permalink / raw)
  To: Jerry DeLisle; +Cc: Tobias Burnus, gfortran, gcc patches

   Is anyone else having trouble getting...

make -k check-gfortran RUNTESTFLAGS="--target_board=unix'{-m32,-m64}'"

to work with the libquadmath support? I am finding that while gfortran
can find the libgfortran.spec to compile the test_qp.f90 testcase, the
testsuite run for check-gfortran fails with...

Native configuration is x86_64-apple-darwin10.5.0

		=== gfortran tests ===

Schedule of variations:
    unix/-m32
    unix/-m64

Running target unix/-m32
Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /sw/share/dejagnu/config/unix.exp as generic interface file for target.
Using /sw/src/fink.build/gcc46-4.6.0-1000/gcc-4.6-20101109/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /sw/src/fink.build/gcc46-4.6.0-1000/gcc-4.6-20101109/gcc/testsuite/gfortran.dg/debug/debug.exp ...
gfortran: error: libgfortran.spec: No such file or directory
    while executing
"exec $compiler --print-multi-lib"
    (procedure "gcc-set-multilib-library-path" line 14)
    invoked from within
"gcc-set-multilib-library-path $GFORTRAN_UNDER_TEST"
    (procedure "gfortran_link_flags" line 32)
    invoked from within
"gfortran_link_flags [get_multilibs] "
    invoked from within
"if [info exists TOOL_OPTIONS] {
	    lappend ALWAYS_GFORTRANFLAGS "ldflags=[gfortran_link_flags [get_multilibs ${TOOL_OPTIONS}] ]"
	} else {
	    lapp..."
    invoked from within
"if ![is_remote host] {
	if [info exists TOOL_OPTIONS] {
	    lappend ALWAYS_GFORTRANFLAGS "ldflags=[gfortran_link_flags [get_multilibs ${TOOL_OPTIONS}..."
    (procedure "gfortran_init" line 55)
    invoked from within
"${tool}_init $test_file_name"
    invoked from within
"if [info exists tool] {
	    if { [info procs "${tool}_init"] != "" } {
		${tool}_init $test_file_name
	    }
	}"
    invoked from within
"if [file exists $te
make[1]: [check-parallel-gfortran] Error 1 (ignored)

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: RFC patch: Add libquadmath - and use it in gfortran (round two)
  2010-11-09 16:17                 ` Jack Howarth
@ 2010-11-09 16:22                   ` Jerry DeLisle
  0 siblings, 0 replies; 29+ messages in thread
From: Jerry DeLisle @ 2010-11-09 16:22 UTC (permalink / raw)
  To: Jack Howarth; +Cc: Tobias Burnus, gfortran, gcc patches

On 11/09/2010 08:04 AM, Jack Howarth wrote:
>     Is anyone else having trouble getting...
>
> make -k check-gfortran RUNTESTFLAGS="--target_board=unix'{-m32,-m64}'"
>
> to work with the libquadmath support? I am finding that while gfortran
> can find the libgfortran.spec to compile the test_qp.f90 testcase, the
> testsuite run for check-gfortran fails with...
>
> Native configuration is x86_64-apple-darwin10.5.0
>
> 		=== gfortran tests ===
>
> Schedule of variations:
>      unix/-m32
>      unix/-m64
>
> Running target unix/-m32
> Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target.
> Using /sw/share/dejagnu/config/unix.exp as generic interface file for target.
> Using /sw/src/fink.build/gcc46-4.6.0-1000/gcc-4.6-20101109/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
> Running /sw/src/fink.build/gcc46-4.6.0-1000/gcc-4.6-20101109/gcc/testsuite/gfortran.dg/debug/debug.exp ...
> gfortran: error: libgfortran.spec: No such file or directory
>      while executing
> "exec $compiler --print-multi-lib"
>      (procedure "gcc-set-multilib-library-path" line 14)
>      invoked from within
> "gcc-set-multilib-library-path $GFORTRAN_UNDER_TEST"
>      (procedure "gfortran_link_flags" line 32)
>      invoked from within
> "gfortran_link_flags [get_multilibs]"
>      invoked from within
> "if [info exists TOOL_OPTIONS] {
> 	    lappend ALWAYS_GFORTRANFLAGS "ldflags=[gfortran_link_flags [get_multilibs ${TOOL_OPTIONS}] ]"
> 	} else {
> 	    lapp..."
>      invoked from within
> "if ![is_remote host] {
> 	if [info exists TOOL_OPTIONS] {
> 	    lappend ALWAYS_GFORTRANFLAGS "ldflags=[gfortran_link_flags [get_multilibs ${TOOL_OPTIONS}..."
>      (procedure "gfortran_init" line 55)
>      invoked from within
> "${tool}_init $test_file_name"
>      invoked from within
> "if [info exists tool] {
> 	    if { [info procs "${tool}_init"] != "" } {
> 		${tool}_init $test_file_name
> 	    }
> 	}"
>      invoked from within
> "if [file exists $te
> make[1]: [check-parallel-gfortran] Error 1 (ignored)
>
>
Yes, Tobias is already on it.

Jerry

^ permalink raw reply	[flat|nested] 29+ messages in thread

* RFC patch: Add libquadmath - and use it in gfortran (round THREE)
  2010-11-08 20:57 RFC patch: Add libquadmath - and use it in gfortran (round two) Tobias Burnus
  2010-11-08 21:20 ` Jack Howarth
  2010-11-08 23:43 ` Jack Howarth
@ 2010-11-09 17:23 ` Tobias Burnus
  2010-11-09 23:37   ` Tobias Burnus
  2010-11-12 19:38   ` RFC patch: Add libquadmath - and use it in gfortran (round THREE) Ralf Wildenhues
  2010-11-14 16:00 ` RFC patch: Add libquadmath - and use it in gfortran (round two) Ralf Wildenhues
  3 siblings, 2 replies; 29+ messages in thread
From: Tobias Burnus @ 2010-11-09 17:23 UTC (permalink / raw)
  To: gfortran, gcc patches

[-- Attachment #1: Type: text/plain, Size: 4608 bytes --]

Hi all,

this patch is an updated version of the one posted at 
http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00790.html

As libquadmath remained unchanged, I did not include the 180K file but I 
just refer to 
http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00790/libquadmath.tar.bz2

TODO: Fix using gfortran in libgomp. Currently, no .mod files are 
generated. It works if one manually runs "make omp_lib.mod" but it won't 
happen automatically.

General remark: Finding the libgfortran.spec makes huge troubles; I 
wonder whether using a spec file is really needed.

Changes:
- Fixed the complete nonsense in transfer.c (thanks Jack, Jerry et al.)
- Moved 128 functions into a separate translation unit (thanks Jakub)  
and added a comment
- Fixed -Wl,--as-needed detection (thanks to Rainer and Ralf)
- Fixed linkage of libquad during build (should help for Darwin, thanks 
to Ralf and Jack)
- Fixed testsuite (thanks to Jerry)

The weakref seems to work, though I still get a dependence on libquad 
with -static-libgfortran. The a.out then only contains a weakref ("w") 
while with a REAL(16) WRITE it contains a hardref ("U"). I thus assume 
it works.


The following description still applies:

On 11/08/2010 09:33 PM, Tobias Burnus wrote:
> The patch contains:
>
> a) libquadmath(.tar.bz2): __float128 math library. It exports all math 
> functions with the suffix "q" ("tanq", "jnq" etc.); it also exports 
> two I/O related functions with the prefix quadmath_. The library is 
> used from libgfortran but can also be used from C/C++. However, there 
> is no printf hook thus doing I/O from C/C++ is a bit more effort. The 
> library is automatically build if language=fortran is enabled, but on 
> systems without __float128 it is a no op.
>
> b) quad.diff: The changes to the toplevel Makefile.def/configure.ac to 
> build libquad with language=fortran; changes to gcc/fortran to use 
> __float128; changes to libgfortran to use libquadmath.
> Libgfortran automatically links libquadmath if it is available; if 
> -static-libgfortran is used, the (dynamically linked) libquadmath is 
> surounded by --as-needed/--no-as-needed.
>
> c) quad_gen.diff: Due to popular request, the generated files.

Tobias

Current diffstat:

$ diffstat quad.diff
  b/Makefile.def                             |    3
  b/configure.ac                             |    1
  b/gcc/fortran/gfortranspec.c               |   38 ++++++++++
  b/gcc/fortran/trans-io.c                   |   49 ++++++++++++-
  b/gcc/fortran/trans-types.c                |    8 +-
  b/gcc/testsuite/lib/gcc-defs.exp           |    3
  b/gcc/testsuite/lib/gfortran.exp           |   14 +++
  b/libgfortran/Makefile.am                  |    7 +
  b/libgfortran/acinclude.m4                 |   62 ++++++++++++++++
  b/libgfortran/configure.ac                 |   13 ++-
  b/libgfortran/gfortran.map                 |    5 +
  b/libgfortran/intrinsics/cshift0.c         |   28 +++++--
  b/libgfortran/intrinsics/erfc_scaled_inc.c |   11 ++
  b/libgfortran/intrinsics/pack_generic.c    |   28 +++++--
  b/libgfortran/intrinsics/spread_generic.c  |   56 +++++++++++----
  b/libgfortran/intrinsics/unpack_generic.c  |   56 +++++++++++----
  b/libgfortran/io/read.c                    |    8 +-
  b/libgfortran/io/transfer.c                |   20 ++++-
  b/libgfortran/io/write.c                   |    1
  b/libgfortran/io/write_float.def           |   11 ++
  b/libgfortran/libgfortran.h                |   18 ++++
  b/libgfortran/m4/mtype.m4                  |    2
  b/libgfortran/runtime/in_pack_generic.c    |   29 ++++++-
  b/libgfortran/runtime/in_unpack_generic.c  |   31 ++++++--
  b/libgomp/configure.ac                     |    6 +
  gcc/libgfortran/io/transfer128.c           |  108 
+++++++++++++++++++++++++++++
  gcc/libgfortran/kinds-override.h           |   46 ++++++++++++
  gcc/libgfortran/libgfortran.spec.in        |    8 ++
  28 files changed, 599 insertions(+), 71 deletions(-)

$ diffstat quad-gen.diff
  b/Makefile.in                          |  467 +
  b/configure                            |    1
  b/libgfortran/Makefile.in              |   86
  b/libgfortran/config.h.in              |    3
  b/libgfortran/configure                |  119
  b/libgomp/configure                    |    6
  gcc/libgfortran/generated/pow_r16_i4.c |   75
  gcc/libquadmath/Makefile.in            | 1219 +++
  gcc/libquadmath/aclocal.m4             |  979 ++
  gcc/libquadmath/config.h.in            |   68
  gcc/libquadmath/configure              |13288 
+++++++++++++++++++++++++++++++++
  11 files changed, 16284 insertions(+), 27 deletions(-)

[-- Attachment #2: quad.diff.bz2 --]
[-- Type: application/x-bzip, Size: 10225 bytes --]

[-- Attachment #3: quad-gen.diff.bz2 --]
[-- Type: application/x-bzip, Size: 96248 bytes --]

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: RFC patch: Add libquadmath - and use it in gfortran (round THREE)
  2010-11-09 17:23 ` RFC patch: Add libquadmath - and use it in gfortran (round THREE) Tobias Burnus
@ 2010-11-09 23:37   ` Tobias Burnus
  2010-11-10  2:05     ` Jack Howarth
  2010-11-12 19:38   ` RFC patch: Add libquadmath - and use it in gfortran (round THREE) Ralf Wildenhues
  1 sibling, 1 reply; 29+ messages in thread
From: Tobias Burnus @ 2010-11-09 23:37 UTC (permalink / raw)
  To: gfortran, gcc patches

Tobias Burnus wrote:
> this patch is an updated version of the one posted at 
> http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00790.html
>
> As libquadmath remained unchanged, I did not include the 180K file but 
> I just refer to 
> http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00790/libquadmath.tar.bz2

The other patches can be found at 
http://gcc.gnu.org/ml/fortran/2010-11/msg00173.html

> TODO: Fix using gfortran in libgomp. Currently, no .mod files are 
> generated. It works if one manually runs "make omp_lib.mod" but it 
> won't happen automatically.

The solution it trivial - even though it took me quite some time to find 
out. Please apply the following patch after the other ones.

 From my side, everything should work now. Though, I have not yet 
bootstrapped and regtested (check-gfortran + libgomp check).

Remains to do:
- Get report from other platforms whether it works
- Find out why for Angelo on Cygwin there is no quadmath .DLL and no 
functions from libgfortran/transfer128.c
- Fix review comments (hint!)


diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index 85945c7..45723a5 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -140,6 +140,10 @@ AC_SUBST(enable_static)

  AM_MAINTAINER_MODE

+# Create a spec file, so that compile/link tests don't fail
+test -f libgfortran.spec || touch libgfortran.spec
+FCFLAGS="$FCFLAGS -L."
+
  # We need gfortran to compile parts of the library
  # We can't use AC_PROG_FC because it expects a fully working gfortran.
  #AC_PROG_FC(gfortran)

diff --git a/libgomp/configure b/libgomp/configure
index 9dd8323..423690f 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -11459,6 +11459,10 @@ fi



+# Create a spec file, so that compile/link tests don't fail
+test -f libgfortran.spec || touch libgfortran.spec
+FCFLAGS="$FCFLAGS -L."
+
  # We need gfortran to compile parts of the library
  # We can't use AC_PROG_FC because it expects a fully working gfortran.
  #AC_PROG_FC(gfortran)


Tobias

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: RFC patch: Add libquadmath - and use it in gfortran (round THREE)
  2010-11-09 23:37   ` Tobias Burnus
@ 2010-11-10  2:05     ` Jack Howarth
  2010-11-10  7:55       ` RFC patch: Add libquadmath - and use it in gfortran (round FOUR) Tobias Burnus
  0 siblings, 1 reply; 29+ messages in thread
From: Jack Howarth @ 2010-11-10  2:05 UTC (permalink / raw)
  To: Tobias Burnus; +Cc: gfortran, gcc patches

On Wed, Nov 10, 2010 at 12:34:08AM +0100, Tobias Burnus wrote:
> Tobias Burnus wrote:
>> this patch is an updated version of the one posted at  
>> http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00790.html
>>
>> As libquadmath remained unchanged, I did not include the 180K file but  
>> I just refer to  
>> http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00790/libquadmath.tar.bz2
>
> The other patches can be found at  
> http://gcc.gnu.org/ml/fortran/2010-11/msg00173.html
>
>> TODO: Fix using gfortran in libgomp. Currently, no .mod files are  
>> generated. It works if one manually runs "make omp_lib.mod" but it  
>> won't happen automatically.
>
> The solution it trivial - even though it took me quite some time to find  
> out. Please apply the following patch after the other ones.
>
> From my side, everything should work now. Though, I have not yet  
> bootstrapped and regtested (check-gfortran + libgomp check).
>
> Remains to do:
> - Get report from other platforms whether it works
> - Find out why for Angelo on Cygwin there is no quadmath .DLL and no  
> functions from libgfortran/transfer128.c
> - Fix review comments (hint!)
>
>
> diff --git a/libgomp/configure.ac b/libgomp/configure.ac
> index 85945c7..45723a5 100644
> --- a/libgomp/configure.ac
> +++ b/libgomp/configure.ac
> @@ -140,6 +140,10 @@ AC_SUBST(enable_static)
>
>  AM_MAINTAINER_MODE
>
> +# Create a spec file, so that compile/link tests don't fail
> +test -f libgfortran.spec || touch libgfortran.spec
> +FCFLAGS="$FCFLAGS -L."
> +
>  # We need gfortran to compile parts of the library
>  # We can't use AC_PROG_FC because it expects a fully working gfortran.
>  #AC_PROG_FC(gfortran)
>
> diff --git a/libgomp/configure b/libgomp/configure
> index 9dd8323..423690f 100755
> --- a/libgomp/configure
> +++ b/libgomp/configure
> @@ -11459,6 +11459,10 @@ fi
>
>
>
> +# Create a spec file, so that compile/link tests don't fail
> +test -f libgfortran.spec || touch libgfortran.spec
> +FCFLAGS="$FCFLAGS -L."
> +
>  # We need gfortran to compile parts of the library
>  # We can't use AC_PROG_FC because it expects a fully working gfortran.
>  #AC_PROG_FC(gfortran)
>
>
> Tobias

Tobias,
   These patches aren't working properly on x86_64-apple-darwin10. The resulting
transfer128.o contains no symbols according to nm and the test_qp.f90 testcase
fails to compile with...

gfortran test_qp.f90
Undefined symbols:
  "__gfortran_transfer_real128_write", referenced from:
      _MAIN__ in ccUAfKvc.o
      _MAIN__ in ccUAfKvc.o
      _MAIN__ in ccUAfKvc.o
      _MAIN__ in ccUAfKvc.o
      _MAIN__ in ccUAfKvc.o
      _MAIN__ in ccUAfKvc.o
      _MAIN__ in ccUAfKvc.o
      _MAIN__ in ccUAfKvc.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

I believe the problem is that the current patches are no longer including
kinds-override.h in mk-kinds-h.sh as was the case in the previous patches.

# After this, we include a header that can override some of the 
# autodetected settings.
echo '#include "kinds-override.h"'

       Jack

^ permalink raw reply	[flat|nested] 29+ messages in thread

* RFC patch: Add libquadmath - and use it in gfortran (round FOUR)
  2010-11-10  2:05     ` Jack Howarth
@ 2010-11-10  7:55       ` Tobias Burnus
  2010-11-10 13:51         ` Jack Howarth
  0 siblings, 1 reply; 29+ messages in thread
From: Tobias Burnus @ 2010-11-10  7:55 UTC (permalink / raw)
  To: Jack Howarth; +Cc: gfortran, gcc patches

[-- Attachment #1: Type: text/plain, Size: 1785 bytes --]

Attached a new version of the patch.

Changes compared to http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00932.html
- Fixed libgomp's configure{,.ac}  (cf. last email)
- Included (again!) missing kinds-override.h

The libquadmath itself is in: 
http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00790/libquadmath.tar.bz2

The patch was bootstrapped and libgomp-regtested on x86-64-linux and is 
currently check-gfortran regtesting.

TODO:
- Ensure that on Cygwin a .DLL is build - allegedly that's still not the 
case.


Jack Howarth wrote:
> These patches aren't working properly on x86_64-apple-darwin10. The 
> resulting transfer128.o contains no symbols according to nm and the 
> test_qp.f90 testcase fails to compile with...
>    "__gfortran_transfer_real128_write", referenced from:
> I believe the problem is that the current patches are no longer including
> kinds-override.h in mk-kinds-h.sh as was the case in the previous patches.

That sounds very reasonable - and indeed I had forgotten to add that 
file to the patch for the non-generated files; there are simply too many 
files :-(

Thanks for spotting this!


Jerry DeLisle wrote:
> I did see that there are some mixups in declarations in transfer.c. I 
> tried fixing those and no luck,  Things like:
>
> transfer_real128_write vs transfer_real_write128, the former I believe 
> is correct.

I tried to find *write128 - but I could not. Neither in my local tree 
nor in the patch.

> libtool: install: warning: relinking `libgfortran.la'
> ldconfig: /home/jerry/gcc/usr/lib/../lib/libstdc++.so.6.0.15-gdb.py is 
> not an ELF file - it has the wrong magic bytes at the start.

I think that's kind of OK. That file is a helper file for GDB which 
offers some macros. As it is written in Python, it cannot be relinked.

Tobias

[-- Attachment #2: quad.diff.bz2 --]
[-- Type: application/x-bzip, Size: 10861 bytes --]

[-- Attachment #3: quad-gen.diff.bz2 --]
[-- Type: application/x-bzip, Size: 97305 bytes --]

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: RFC patch: Add libquadmath - and use it in gfortran (round FOUR)
  2010-11-10  7:55       ` RFC patch: Add libquadmath - and use it in gfortran (round FOUR) Tobias Burnus
@ 2010-11-10 13:51         ` Jack Howarth
  2010-11-10 14:37           ` Tobias Burnus
  0 siblings, 1 reply; 29+ messages in thread
From: Jack Howarth @ 2010-11-10 13:51 UTC (permalink / raw)
  To: Tobias Burnus; +Cc: gfortran, gcc patches

On Wed, Nov 10, 2010 at 08:32:40AM +0100, Tobias Burnus wrote:
> Attached a new version of the patch.
>
> Changes compared to http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00932.html
> - Fixed libgomp's configure{,.ac}  (cf. last email)
> - Included (again!) missing kinds-override.h
>
> The libquadmath itself is in:  
> http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00790/libquadmath.tar.bz2
>
> The patch was bootstrapped and libgomp-regtested on x86-64-linux and is  
> currently check-gfortran regtesting.
>
> TODO:
> - Ensure that on Cygwin a .DLL is build - allegedly that's still not the  
> case.
>
>
> Jack Howarth wrote:
>> These patches aren't working properly on x86_64-apple-darwin10. The  
>> resulting transfer128.o contains no symbols according to nm and the  
>> test_qp.f90 testcase fails to compile with...
>>    "__gfortran_transfer_real128_write", referenced from:
>> I believe the problem is that the current patches are no longer including
>> kinds-override.h in mk-kinds-h.sh as was the case in the previous patches.
>
> That sounds very reasonable - and indeed I had forgotten to add that  
> file to the patch for the non-generated files; there are simply too many  
> files :-(
>
> Thanks for spotting this!
>
>
> Jerry DeLisle wrote:
>> I did see that there are some mixups in declarations in transfer.c. I  
>> tried fixing those and no luck,  Things like:
>>
>> transfer_real128_write vs transfer_real_write128, the former I believe  
>> is correct.
>
> I tried to find *write128 - but I could not. Neither in my local tree  
> nor in the patch.

Tobias,
   Are you testing the resulting gfortran compiler from these patches against
the simple testcase...

program test_qp
  implicit none
  integer, parameter :: QP = 16
  real(QP), parameter :: Z1 = 1,HALF_PI = asin(Z1),PI = HALF_PI+HALF_PI
  real(QP) :: x = 0.124_QP
  print *, x
  print *, PI
  print *, 16*atan(0.2_QP)-4*atan(Z1/239)
  print *, sin(PI)
  print *, cos(HALF_PI)
  print *, asinh(PI)
  print *, erfc(Z1)
  print *, epsilon(x)
  print *, precision(x)
  print *, digits(x)
end program test_qp

before posting?
            Jack
>
>> libtool: install: warning: relinking `libgfortran.la'
>> ldconfig: /home/jerry/gcc/usr/lib/../lib/libstdc++.so.6.0.15-gdb.py is  
>> not an ELF file - it has the wrong magic bytes at the start.
>
> I think that's kind of OK. That file is a helper file for GDB which  
> offers some macros. As it is written in Python, it cannot be relinked.
>
> Tobias



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: RFC patch: Add libquadmath - and use it in gfortran (round FOUR)
  2010-11-10 13:51         ` Jack Howarth
@ 2010-11-10 14:37           ` Tobias Burnus
  2010-11-10 16:54             ` Jack Howarth
  0 siblings, 1 reply; 29+ messages in thread
From: Tobias Burnus @ 2010-11-10 14:37 UTC (permalink / raw)
  To: Jack Howarth; +Cc: gfortran, gcc patches

On 11/10/2010 02:22 PM, Jack Howarth wrote:
> Tobias,
>     Are you testing the resulting gfortran compiler from these patches against
> the simple testcase...
>
> program test_qp
>    implicit none
>    integer, parameter :: QP = 16
>    real(QP), parameter :: Z1 = 1,HALF_PI = asin(Z1),PI = HALF_PI+HALF_PI
>    real(QP) :: x = 0.124_QP
>    print *, x
>    print *, PI
>    print *, 16*atan(0.2_QP)-4*atan(Z1/239)
>    print *, sin(PI)
>    print *, cos(HALF_PI)
>    print *, asinh(PI)
>    print *, erfc(Z1)
>    print *, epsilon(x)
>    print *, precision(x)
>    print *, digits(x)
> end program test_qp

Kind of. I test against my tree. I do not re-test the posted patches, 
which means that I might miss files. I try very hard not to do so, but 
it might happen. I probably should apply the patches to a clean tree and 
bootstrap - but that costs me at least two three due to my slow 
computer. Your test case looks like:

$ gfortran hgjff.f90
$ ./a.out
   0.12399999999999999999999999999999999
    3.1415926535897932384626433832795028
    3.1415926535897932384626433832795032
   8.67181013012378102479704402604335225E-0035
   4.33590506506189051239852201302167613E-0035
    1.8622957433108482198883613251826206
   0.15729920705028513065877936491739074
   1.92592994438723585305597794258492732E-0034
           33
          113

I assume you get the same as you do not post an error message ;-)

Tobias

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: RFC patch: Add libquadmath - and use it in gfortran (round FOUR)
  2010-11-10 14:37           ` Tobias Burnus
@ 2010-11-10 16:54             ` Jack Howarth
  0 siblings, 0 replies; 29+ messages in thread
From: Jack Howarth @ 2010-11-10 16:54 UTC (permalink / raw)
  To: Tobias Burnus; +Cc: gfortran, gcc patches

On Wed, Nov 10, 2010 at 03:19:25PM +0100, Tobias Burnus wrote:
> On 11/10/2010 02:22 PM, Jack Howarth wrote:
>> Tobias,
>>     Are you testing the resulting gfortran compiler from these patches against
>> the simple testcase...
>>
>> program test_qp
>>    implicit none
>>    integer, parameter :: QP = 16
>>    real(QP), parameter :: Z1 = 1,HALF_PI = asin(Z1),PI = HALF_PI+HALF_PI
>>    real(QP) :: x = 0.124_QP
>>    print *, x
>>    print *, PI
>>    print *, 16*atan(0.2_QP)-4*atan(Z1/239)
>>    print *, sin(PI)
>>    print *, cos(HALF_PI)
>>    print *, asinh(PI)
>>    print *, erfc(Z1)
>>    print *, epsilon(x)
>>    print *, precision(x)
>>    print *, digits(x)
>> end program test_qp
>
> Kind of. I test against my tree. I do not re-test the posted patches,  
> which means that I might miss files. I try very hard not to do so, but  
> it might happen. I probably should apply the patches to a clean tree and  
> bootstrap - but that costs me at least two three due to my slow  
> computer. Your test case looks like:
>
> $ gfortran hgjff.f90
> $ ./a.out
>   0.12399999999999999999999999999999999
>    3.1415926535897932384626433832795028
>    3.1415926535897932384626433832795032
>   8.67181013012378102479704402604335225E-0035
>   4.33590506506189051239852201302167613E-0035
>    1.8622957433108482198883613251826206
>   0.15729920705028513065877936491739074
>   1.92592994438723585305597794258492732E-0034
>           33
>          113
>
> I assume you get the same as you do not post an error message ;-)

Tobias,
   I downloaded the two patches again and restarted from a fresh tree. Now
the problem seems to have disappeared and the test_qp.f90 testcase can
find all of the required symbols in libgfortran. Also I can now compile
with...

gfortran -static-libgfortran test_qp.f90

on x86_64-apple-darwin10 with libgfortran.a being properly linked in.
              Jack
ps Do you plan to implement -static-libquad as a gfortran option so
that the user can execute...

gfortran -static-libgfortran -static-libquad test_qp.f90

as well?

>
> Tobias

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: RFC patch: Add libquadmath - and use it in gfortran (round THREE)
  2010-11-12 19:38   ` RFC patch: Add libquadmath - and use it in gfortran (round THREE) Ralf Wildenhues
@ 2010-11-12 19:38     ` Jack Howarth
  2010-11-12 19:40       ` Ralf Wildenhues
  0 siblings, 1 reply; 29+ messages in thread
From: Jack Howarth @ 2010-11-12 19:38 UTC (permalink / raw)
  To: Ralf Wildenhues, Tobias Burnus, gfortran, gcc patches

On Fri, Nov 12, 2010 at 08:11:42PM +0100, Ralf Wildenhues wrote:
> Hello,
> 
> * Tobias Burnus wrote on Tue, Nov 09, 2010 at 06:20:16PM CET:
> > this patch is an updated version of the one posted at
> > http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00790.html
> 
> > TODO: Fix using gfortran in libgomp. Currently, no .mod files are generated.
> > It works if one manually runs "make omp_lib.mod" but it won't happen
> 
> I hope this is the most recent version of the patch I'm looking at.
> This is a rough review of the build bits, I haven't actually tested
> the code.

The current copy for review is...

http://gcc.gnu.org/ml/gcc-patches/2010-11/msg01058.html

> 
> > --- a/Makefile.def
> > +++ b/Makefile.def
> > @@ -155,6 +155,7 @@ target_modules = { module= libmudflap; lib_path=.libs; };
> >  target_modules = { module= libssp; lib_path=.libs; };
> >  target_modules = { module= newlib; };
> >  target_modules = { module= libgcc; bootstrap=true; no_check=true; };
> > +target_modules = { module= libquadmath; };
> >  target_modules = { module= libgfortran; };
> >  target_modules = { module= libobjc; };
> >  target_modules = { module= libtermcap; no_check=true;
> > @@ -571,11 +572,13 @@ dependencies = { module=configure-target-libiberty; on=all-binutils; };
> >  dependencies = { module=configure-target-libiberty; on=all-ld; };
> >  dependencies = { module=configure-target-newlib; on=all-binutils; };
> >  dependencies = { module=configure-target-newlib; on=all-ld; };
> > +dependencies = { module=configure-target-libgfortran; on=all-target-libquadmath; };
> >  
> >  languages = { language=c;	gcc-check-target=check-gcc; };
> >  languages = { language=c++;	gcc-check-target=check-c++;
> >  				lib-check-target=check-target-libstdc++-v3; };
> >  languages = { language=fortran;	gcc-check-target=check-fortran;
> > +				lib-check-target=check-target-libquadmath;
> >  				lib-check-target=check-target-libgfortran; };
> 
> This won't work; the current machinery in Makefile.tpl recognizes only
> the first lib-check-target entry, thus will now ignore
> check-target-libgfortran.  What you can do however is change in
> Makefile.tpl the line
> 
> check-[+language+]: check-gcc-[+language+][+ IF lib-check-target +] [+ lib-check-target +][+ ENDIF lib-check-target +]
> 
> into:
> 
> check-[+language+]: check-gcc-[+language+][+ FOR lib-check-target +] [+ lib-check-target +][+ ENDFOR lib-check-target +]
> 
> 
> >  languages = { language=java;	gcc-check-target=check-java;
> >  				lib-check-target=check-target-libjava; };
> 
> > --- a/gcc/testsuite/lib/gcc-defs.exp
> > +++ b/gcc/testsuite/lib/gcc-defs.exp
> > @@ -251,8 +251,9 @@ proc gcc-set-multilib-library-path { compiler } {
> >  
> >      set libpath ":${rootme}"
> >      set compiler [lindex $compiler 0]
> > +    set options [lrange $compiler 1 end]
> 
> Erm, I'm still not tcl-fluent, but wouldn't this line need to come
> _before_ the previous one, so $compiler isn't actually overwritten yet?
> 
> >      if { [is_remote host] == 0 && [which $compiler] != 0 } {
> > -	foreach i "[exec $compiler --print-multi-lib]" {
> > +	foreach i "[exec $compiler $options --print-multi-lib]" {
> >  	    set mldir ""
> >  	    regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir
> >  	    set mldir [string trimright $mldir "\;@"]
> 
> > --- a/gcc/testsuite/lib/gfortran.exp
> > +++ b/gcc/testsuite/lib/gfortran.exp
> > @@ -103,11 +103,23 @@ proc gfortran_link_flags { paths } {
> >        if [file exists "${gccpath}/libgfortran/libgforbegin.a"] {
> >            append flags "-L${gccpath}/libgfortran "
> >        }
> > +      if [file exists "${gccpath}/libquadmath/.libs/libquadmath.a"] {
> > +          # Some targets use libquadmath.a%s in their specs, so they need a -B option
> > +          # for uninstalled testing.
> > +          append flags "-B${gccpath}/libquadmath/.libs "
> > +          append flags "-L${gccpath}/libquadmath/.libs "
> > +          append ld_library_path ":${gccpath}/libquadmath/.libs"
> > +      }
> > +      if [file exists "${gccpath}/libquadmath/.libs/libquadmath.${shlib_ext}"] {
> > +	  append flags "-L${gccpath}/libquadmath/.libs "
> > +	  append ld_library_path ":${gccpath}/libquadmath/.libs"
> > +      }
> >        if [file exists "${gccpath}/libiberty/libiberty.a"] {
> >            append flags "-L${gccpath}/libiberty "
> >        }
> > +      # Add ${gccpath}/libgfortran to make sure that the libgfortran.spec file is found
> >        append ld_library_path \
> > -	[gcc-set-multilib-library-path $GFORTRAN_UNDER_TEST]
> > +	[gcc-set-multilib-library-path { ${GFORTRAN_UNDER_TEST} -L${gccpath}/libgfortran } ]
> >      }
> >  
> >      set_ld_library_path_env_vars
> 
> > --- a/libgfortran/Makefile.am
> > +++ b/libgfortran/Makefile.am
> > @@ -34,9 +34,10 @@ LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) \
> >  	    -no-undefined -bindir "$(bindir)"
> >  
> >  toolexeclib_LTLIBRARIES = libgfortran.la
> > +toolexeclib_DATA = libgfortran.spec
> >  libgfortran_la_LINK = $(LINK) $(libgfortran_la_LDFLAGS)
> > -libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) -lm $(extra_ldflags_libgfortran) $(version_arg)
> > -libgfortran_la_DEPENDENCIES = $(version_dep)
> > +libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(LIBQUADLIB) -lm $(extra_ldflags_libgfortran) $(version_arg)
> > +libgfortran_la_DEPENDENCIES = $(version_dep) libgfortran.spec
> 
> Not a dependency on a $(LIBQUADLIB_DEP) variable, that expands to
> .../libquadlib.la if that happens to be in-tree (and empty if LIBQUADLIB
> is -lquadlib)?
> 
> >  myexeclib_LTLIBRARIES = libgfortranbegin.la
> >  myexeclibdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)$(MULTISUBDIR)
> 
> > --- a/libgfortran/acinclude.m4
> > +++ b/libgfortran/acinclude.m4
> > @@ -275,3 +275,65 @@ esac])
> >      AC_DEFINE(HAVE_BROKEN_POWF, 1, [Define if powf is broken.])
> >    fi
> >  ])
> > +
> > +dnl Check whether we have a __float128 type
> > +AC_DEFUN([LIBGFOR_CHECK_FLOAT128], [
> > +  LIBQUADSPEC=
> > +  AC_CACHE_CHECK([whether we have a usable __float128 type],
> > +                 libgfor_cv_have_float128, [
> > +    AC_TRY_LINK([
> > +/* no header */
> > +],[
> > +  typedef _Complex float __attribute__((mode(TC))) __complex128;
> > +
> > +  __float128 x;
> > +  x = __builtin_huge_valq() - 2.e1000Q;
> > +
> > +  __complex128 z1, z2;
> > +  z1 = x;
> > +  z2 = 2.Q;
> > +
> > +  z1 /= z2;
> > +  z1 /= 7.Q;
> > +],
> > +    eval "libgfor_cv_have_float128=yes",
> > +    eval "libgfor_cv_have_float128=no")
> 
> No need for eval and double-quotes in these two lines.
> 
> > +  ])
> > +
> > +  if test "x$libgfor_cv_have_float128" = xyes; then
> > +    dnl Check whether -Wl,--as-needed is supported
> > +    dnl 
> > +    dnl Turn warnings into error to avoid testsuite breakage.  So enable
> > +    dnl AC_LANG_WERROR, but there's currently (autoconf 2.64) no way to turn
> > +    dnl it off again.  As a workaround, save and restore werror flag like
> > +    dnl AC_PATH_XTRA.
> > +    dnl Cf. http://gcc.gnu.org/ml/gcc-patches/2010-05/msg01889.html
> > +    ac_xsave_[]_AC_LANG_ABBREV[]_werror_flag=$ac_[]_AC_LANG_ABBREV[]_werror_flag
> 
> The test that follows lacks commands for stdout output (so the user
> knows what's being tested) and caching (so the user may override a test
> that is broken).  I assume that is also the case in the place where you
> copied it from.  Anyway, way to go is to wrap the actual test:
> 
>        AC_CACHE_CHECK([whether --as-needed works],
>          [libgfor_cv_have_as_needed],
>          [
> 
> > +    save_LDFLAGS="$LDFLAGS"
> > +    LDFLAGS="$LDFLAGS -Wl,--as-needed -lm -Wl,--no-as-needed"
> > +    libgfor_cv_have_as_needed=no
> > +    AC_LANG_WERROR
> > +    AC_LINK_IFELSE([int main(void){ return 0;} ],
> 
>        AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
> 
> 
> > +		      [eval "libgfor_cv_have_as_needed=yes"],
> > + 		      [eval "libgfor_cv_have_as_needed=no"])
> 
> eval and double-quotes unneeded.
> 
> > +    LDFLAGS="$save_LDFLAGS"
> > +    ac_[]_AC_LANG_ABBREV[]_werror_flag=$ac_xsave_[]_AC_LANG_ABBREV[]_werror_flag
> 
> Insert   ])  here.
> 
> > +    AC_DEFINE(HAVE_FLOAT128, 1, [Define if have a usable __float128 type.])
> 
> FWIW, I'd remove this line up to be the first after
>     if test "x$libgfor_cv_have_float128"
> 
> because it is not related to the as-needed test.
> 
> > +    dnl For static libgfortran linkage, depend on libquadmath only if needed.
> > +    if test "x$libgfor_cv_have_as_needed" = xyes; then
> > +      LIBQUADSPEC="%{static-libgfortran:--as-needed} -lquadmath %{static-libgfortran:--no-as-needed}"
> > +    else
> > +      LIBQUADSPEC="-lquadmath"
> > +    fi
> > +    LIBQUADLIB="../libquadmath/libquadmath.la"
> > +  fi
> 
> You could set LIBQUADLIB_DEP here, as stated above.
> 
> > +  dnl For the spec file
> > +  AC_SUBST(LIBQUADSPEC)
> > +  AC_SUBST(LIBQUADLIB)
> > +
> > +  dnl We need a conditional for the Makefile
> > +  AM_CONDITIONAL(LIBGFOR_BUILD_QUAD, [test "x$libgfor_cv_have_float128" = xyes])
> > +])
> > diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
> > index e5517a1..47315d5 100644
> > --- a/libgfortran/configure.ac
> > +++ b/libgfortran/configure.ac
> > @@ -111,6 +111,9 @@ esac
> >  AC_SUBST(toolexecdir)
> >  AC_SUBST(toolexeclibdir)
> >  
> > +# Create a spec file, so that compile/link tests don't fail
> > +test -f libgfortran.spec || touch libgfortran.spec
> > +
> >  # Check the compiler.
> >  # The same as in boehm-gc and libstdc++. Have to borrow it from there.
> >  # We must force CC to /not/ be precious variables; otherwise
> > @@ -459,6 +462,9 @@ LIBGFOR_CHECK_MINGW_SNPRINTF
> >  # Check for a broken powf implementation
> >  LIBGFOR_CHECK_FOR_BROKEN_POWF
> >  
> > +# Check whether we have a __float128 type
> > +LIBGFOR_CHECK_FLOAT128
> > +
> >  # Check for GNU libc feenableexcept
> >  AC_CHECK_LIB([m],[feenableexcept],[have_feenableexcept=yes AC_DEFINE([HAVE_FEENABLEEXCEPT],[1],[libm includes feenableexcept])])
> >  
> > @@ -509,6 +515,9 @@ else
> >    multilib_arg=
> >  fi
> >  
> > -# Write our Makefile.
> > -AC_CONFIG_FILES(Makefile)
> > +# Write our Makefile and spec file.
> > +AC_CONFIG_FILES([
> > +Makefile
> > +libgfortran.spec
> > +])
> >  AC_OUTPUT
> 
> > --- a/libgomp/configure.ac
> > +++ b/libgomp/configure.ac
> > @@ -147,15 +147,17 @@ case `echo $GFORTRAN` in
> >    -* | no* )
> >      FC=no ;;
> >    *)
> > -    set dummy $GFORTRAN; ac_word=$2
> > +    set dummy $GFORTRAN; ac_word="$2 -L ../libgfortran"
> >      if test -x "$ac_word"; then
> 
> This isn't right.  'test -x' tests whether a file is executable.  You
> should only pass it a file name here; simply dropping this hunk seems
> right to me.
> 
> >        FC="$GFORTRAN"
> >      else
> >        FC=no
> >      fi ;;
> >  esac
> > +
> > +# The -L../libgfortran is needed for to find libgfortran.spec
> >  AC_PROG_FC(gfortran)
> > -FCFLAGS="$FCFLAGS -Wall"
> > +FCFLAGS="$FCFLAGS -Wall -L ../libgfortran"
> 
> No space after -L
> 
> >  # For libtool versioning info, format is CURRENT:REVISION:AGE
> >  libtool_VERSION=1:0:0
> 
> Cheers,
> Ralf

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: RFC patch: Add libquadmath - and use it in gfortran (round THREE)
  2010-11-09 17:23 ` RFC patch: Add libquadmath - and use it in gfortran (round THREE) Tobias Burnus
  2010-11-09 23:37   ` Tobias Burnus
@ 2010-11-12 19:38   ` Ralf Wildenhues
  2010-11-12 19:38     ` Jack Howarth
  1 sibling, 1 reply; 29+ messages in thread
From: Ralf Wildenhues @ 2010-11-12 19:38 UTC (permalink / raw)
  To: Tobias Burnus; +Cc: gfortran, gcc patches

Hello,

* Tobias Burnus wrote on Tue, Nov 09, 2010 at 06:20:16PM CET:
> this patch is an updated version of the one posted at
> http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00790.html

> TODO: Fix using gfortran in libgomp. Currently, no .mod files are generated.
> It works if one manually runs "make omp_lib.mod" but it won't happen

I hope this is the most recent version of the patch I'm looking at.
This is a rough review of the build bits, I haven't actually tested
the code.

> --- a/Makefile.def
> +++ b/Makefile.def
> @@ -155,6 +155,7 @@ target_modules = { module= libmudflap; lib_path=.libs; };
>  target_modules = { module= libssp; lib_path=.libs; };
>  target_modules = { module= newlib; };
>  target_modules = { module= libgcc; bootstrap=true; no_check=true; };
> +target_modules = { module= libquadmath; };
>  target_modules = { module= libgfortran; };
>  target_modules = { module= libobjc; };
>  target_modules = { module= libtermcap; no_check=true;
> @@ -571,11 +572,13 @@ dependencies = { module=configure-target-libiberty; on=all-binutils; };
>  dependencies = { module=configure-target-libiberty; on=all-ld; };
>  dependencies = { module=configure-target-newlib; on=all-binutils; };
>  dependencies = { module=configure-target-newlib; on=all-ld; };
> +dependencies = { module=configure-target-libgfortran; on=all-target-libquadmath; };
>  
>  languages = { language=c;	gcc-check-target=check-gcc; };
>  languages = { language=c++;	gcc-check-target=check-c++;
>  				lib-check-target=check-target-libstdc++-v3; };
>  languages = { language=fortran;	gcc-check-target=check-fortran;
> +				lib-check-target=check-target-libquadmath;
>  				lib-check-target=check-target-libgfortran; };

This won't work; the current machinery in Makefile.tpl recognizes only
the first lib-check-target entry, thus will now ignore
check-target-libgfortran.  What you can do however is change in
Makefile.tpl the line

check-[+language+]: check-gcc-[+language+][+ IF lib-check-target +] [+ lib-check-target +][+ ENDIF lib-check-target +]

into:

check-[+language+]: check-gcc-[+language+][+ FOR lib-check-target +] [+ lib-check-target +][+ ENDFOR lib-check-target +]


>  languages = { language=java;	gcc-check-target=check-java;
>  				lib-check-target=check-target-libjava; };

> --- a/gcc/testsuite/lib/gcc-defs.exp
> +++ b/gcc/testsuite/lib/gcc-defs.exp
> @@ -251,8 +251,9 @@ proc gcc-set-multilib-library-path { compiler } {
>  
>      set libpath ":${rootme}"
>      set compiler [lindex $compiler 0]
> +    set options [lrange $compiler 1 end]

Erm, I'm still not tcl-fluent, but wouldn't this line need to come
_before_ the previous one, so $compiler isn't actually overwritten yet?

>      if { [is_remote host] == 0 && [which $compiler] != 0 } {
> -	foreach i "[exec $compiler --print-multi-lib]" {
> +	foreach i "[exec $compiler $options --print-multi-lib]" {
>  	    set mldir ""
>  	    regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir
>  	    set mldir [string trimright $mldir "\;@"]

> --- a/gcc/testsuite/lib/gfortran.exp
> +++ b/gcc/testsuite/lib/gfortran.exp
> @@ -103,11 +103,23 @@ proc gfortran_link_flags { paths } {
>        if [file exists "${gccpath}/libgfortran/libgforbegin.a"] {
>            append flags "-L${gccpath}/libgfortran "
>        }
> +      if [file exists "${gccpath}/libquadmath/.libs/libquadmath.a"] {
> +          # Some targets use libquadmath.a%s in their specs, so they need a -B option
> +          # for uninstalled testing.
> +          append flags "-B${gccpath}/libquadmath/.libs "
> +          append flags "-L${gccpath}/libquadmath/.libs "
> +          append ld_library_path ":${gccpath}/libquadmath/.libs"
> +      }
> +      if [file exists "${gccpath}/libquadmath/.libs/libquadmath.${shlib_ext}"] {
> +	  append flags "-L${gccpath}/libquadmath/.libs "
> +	  append ld_library_path ":${gccpath}/libquadmath/.libs"
> +      }
>        if [file exists "${gccpath}/libiberty/libiberty.a"] {
>            append flags "-L${gccpath}/libiberty "
>        }
> +      # Add ${gccpath}/libgfortran to make sure that the libgfortran.spec file is found
>        append ld_library_path \
> -	[gcc-set-multilib-library-path $GFORTRAN_UNDER_TEST]
> +	[gcc-set-multilib-library-path { ${GFORTRAN_UNDER_TEST} -L${gccpath}/libgfortran } ]
>      }
>  
>      set_ld_library_path_env_vars

> --- a/libgfortran/Makefile.am
> +++ b/libgfortran/Makefile.am
> @@ -34,9 +34,10 @@ LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) \
>  	    -no-undefined -bindir "$(bindir)"
>  
>  toolexeclib_LTLIBRARIES = libgfortran.la
> +toolexeclib_DATA = libgfortran.spec
>  libgfortran_la_LINK = $(LINK) $(libgfortran_la_LDFLAGS)
> -libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) -lm $(extra_ldflags_libgfortran) $(version_arg)
> -libgfortran_la_DEPENDENCIES = $(version_dep)
> +libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(LIBQUADLIB) -lm $(extra_ldflags_libgfortran) $(version_arg)
> +libgfortran_la_DEPENDENCIES = $(version_dep) libgfortran.spec

Not a dependency on a $(LIBQUADLIB_DEP) variable, that expands to
.../libquadlib.la if that happens to be in-tree (and empty if LIBQUADLIB
is -lquadlib)?

>  myexeclib_LTLIBRARIES = libgfortranbegin.la
>  myexeclibdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)$(MULTISUBDIR)

> --- a/libgfortran/acinclude.m4
> +++ b/libgfortran/acinclude.m4
> @@ -275,3 +275,65 @@ esac])
>      AC_DEFINE(HAVE_BROKEN_POWF, 1, [Define if powf is broken.])
>    fi
>  ])
> +
> +dnl Check whether we have a __float128 type
> +AC_DEFUN([LIBGFOR_CHECK_FLOAT128], [
> +  LIBQUADSPEC=
> +  AC_CACHE_CHECK([whether we have a usable __float128 type],
> +                 libgfor_cv_have_float128, [
> +    AC_TRY_LINK([
> +/* no header */
> +],[
> +  typedef _Complex float __attribute__((mode(TC))) __complex128;
> +
> +  __float128 x;
> +  x = __builtin_huge_valq() - 2.e1000Q;
> +
> +  __complex128 z1, z2;
> +  z1 = x;
> +  z2 = 2.Q;
> +
> +  z1 /= z2;
> +  z1 /= 7.Q;
> +],
> +    eval "libgfor_cv_have_float128=yes",
> +    eval "libgfor_cv_have_float128=no")

No need for eval and double-quotes in these two lines.

> +  ])
> +
> +  if test "x$libgfor_cv_have_float128" = xyes; then
> +    dnl Check whether -Wl,--as-needed is supported
> +    dnl 
> +    dnl Turn warnings into error to avoid testsuite breakage.  So enable
> +    dnl AC_LANG_WERROR, but there's currently (autoconf 2.64) no way to turn
> +    dnl it off again.  As a workaround, save and restore werror flag like
> +    dnl AC_PATH_XTRA.
> +    dnl Cf. http://gcc.gnu.org/ml/gcc-patches/2010-05/msg01889.html
> +    ac_xsave_[]_AC_LANG_ABBREV[]_werror_flag=$ac_[]_AC_LANG_ABBREV[]_werror_flag

The test that follows lacks commands for stdout output (so the user
knows what's being tested) and caching (so the user may override a test
that is broken).  I assume that is also the case in the place where you
copied it from.  Anyway, way to go is to wrap the actual test:

       AC_CACHE_CHECK([whether --as-needed works],
         [libgfor_cv_have_as_needed],
         [

> +    save_LDFLAGS="$LDFLAGS"
> +    LDFLAGS="$LDFLAGS -Wl,--as-needed -lm -Wl,--no-as-needed"
> +    libgfor_cv_have_as_needed=no
> +    AC_LANG_WERROR
> +    AC_LINK_IFELSE([int main(void){ return 0;} ],

       AC_LINK_IFELSE([AC_LANG_PROGRAM([])],


> +		      [eval "libgfor_cv_have_as_needed=yes"],
> + 		      [eval "libgfor_cv_have_as_needed=no"])

eval and double-quotes unneeded.

> +    LDFLAGS="$save_LDFLAGS"
> +    ac_[]_AC_LANG_ABBREV[]_werror_flag=$ac_xsave_[]_AC_LANG_ABBREV[]_werror_flag

Insert   ])  here.

> +    AC_DEFINE(HAVE_FLOAT128, 1, [Define if have a usable __float128 type.])

FWIW, I'd remove this line up to be the first after
    if test "x$libgfor_cv_have_float128"

because it is not related to the as-needed test.

> +    dnl For static libgfortran linkage, depend on libquadmath only if needed.
> +    if test "x$libgfor_cv_have_as_needed" = xyes; then
> +      LIBQUADSPEC="%{static-libgfortran:--as-needed} -lquadmath %{static-libgfortran:--no-as-needed}"
> +    else
> +      LIBQUADSPEC="-lquadmath"
> +    fi
> +    LIBQUADLIB="../libquadmath/libquadmath.la"
> +  fi

You could set LIBQUADLIB_DEP here, as stated above.

> +  dnl For the spec file
> +  AC_SUBST(LIBQUADSPEC)
> +  AC_SUBST(LIBQUADLIB)
> +
> +  dnl We need a conditional for the Makefile
> +  AM_CONDITIONAL(LIBGFOR_BUILD_QUAD, [test "x$libgfor_cv_have_float128" = xyes])
> +])
> diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
> index e5517a1..47315d5 100644
> --- a/libgfortran/configure.ac
> +++ b/libgfortran/configure.ac
> @@ -111,6 +111,9 @@ esac
>  AC_SUBST(toolexecdir)
>  AC_SUBST(toolexeclibdir)
>  
> +# Create a spec file, so that compile/link tests don't fail
> +test -f libgfortran.spec || touch libgfortran.spec
> +
>  # Check the compiler.
>  # The same as in boehm-gc and libstdc++. Have to borrow it from there.
>  # We must force CC to /not/ be precious variables; otherwise
> @@ -459,6 +462,9 @@ LIBGFOR_CHECK_MINGW_SNPRINTF
>  # Check for a broken powf implementation
>  LIBGFOR_CHECK_FOR_BROKEN_POWF
>  
> +# Check whether we have a __float128 type
> +LIBGFOR_CHECK_FLOAT128
> +
>  # Check for GNU libc feenableexcept
>  AC_CHECK_LIB([m],[feenableexcept],[have_feenableexcept=yes AC_DEFINE([HAVE_FEENABLEEXCEPT],[1],[libm includes feenableexcept])])
>  
> @@ -509,6 +515,9 @@ else
>    multilib_arg=
>  fi
>  
> -# Write our Makefile.
> -AC_CONFIG_FILES(Makefile)
> +# Write our Makefile and spec file.
> +AC_CONFIG_FILES([
> +Makefile
> +libgfortran.spec
> +])
>  AC_OUTPUT

> --- a/libgomp/configure.ac
> +++ b/libgomp/configure.ac
> @@ -147,15 +147,17 @@ case `echo $GFORTRAN` in
>    -* | no* )
>      FC=no ;;
>    *)
> -    set dummy $GFORTRAN; ac_word=$2
> +    set dummy $GFORTRAN; ac_word="$2 -L ../libgfortran"
>      if test -x "$ac_word"; then

This isn't right.  'test -x' tests whether a file is executable.  You
should only pass it a file name here; simply dropping this hunk seems
right to me.

>        FC="$GFORTRAN"
>      else
>        FC=no
>      fi ;;
>  esac
> +
> +# The -L../libgfortran is needed for to find libgfortran.spec
>  AC_PROG_FC(gfortran)
> -FCFLAGS="$FCFLAGS -Wall"
> +FCFLAGS="$FCFLAGS -Wall -L ../libgfortran"

No space after -L

>  # For libtool versioning info, format is CURRENT:REVISION:AGE
>  libtool_VERSION=1:0:0

Cheers,
Ralf

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: RFC patch: Add libquadmath - and use it in gfortran (round THREE)
  2010-11-12 19:38     ` Jack Howarth
@ 2010-11-12 19:40       ` Ralf Wildenhues
  0 siblings, 0 replies; 29+ messages in thread
From: Ralf Wildenhues @ 2010-11-12 19:40 UTC (permalink / raw)
  To: Jack Howarth; +Cc: Tobias Burnus, gfortran, gcc patches

* Jack Howarth wrote on Fri, Nov 12, 2010 at 08:21:09PM CET:
> On Fri, Nov 12, 2010 at 08:11:42PM +0100, Ralf Wildenhues wrote:
> > * Tobias Burnus wrote on Tue, Nov 09, 2010 at 06:20:16PM CET:
> > > this patch is an updated version of the one posted at
> > > http://gcc.gnu.org/ml/gcc-patches/2010-11/msg00790.html
> > 
> > > TODO: Fix using gfortran in libgomp. Currently, no .mod files are generated.
> > > It works if one manually runs "make omp_lib.mod" but it won't happen
> > 
> > I hope this is the most recent version of the patch I'm looking at.
> > This is a rough review of the build bits, I haven't actually tested
> > the code.
> 
> The current copy for review is...
> 
> http://gcc.gnu.org/ml/gcc-patches/2010-11/msg01058.html

Yeah, that version doesn't seem to have new issues in the build part,
but most of my comments still apply.

Thanks,
Ralf

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: RFC patch: Add libquadmath - and use it in gfortran (round two)
  2010-11-08 20:57 RFC patch: Add libquadmath - and use it in gfortran (round two) Tobias Burnus
                   ` (2 preceding siblings ...)
  2010-11-09 17:23 ` RFC patch: Add libquadmath - and use it in gfortran (round THREE) Tobias Burnus
@ 2010-11-14 16:00 ` Ralf Wildenhues
  3 siblings, 0 replies; 29+ messages in thread
From: Ralf Wildenhues @ 2010-11-14 16:00 UTC (permalink / raw)
  To: Tobias Burnus; +Cc: gcc patches

* Tobias Burnus wrote on Mon, Nov 08, 2010 at 09:33:21PM CET:
> a) libquadmath(.tar.bz2): __float128 math library. It exports all
> math functions with the suffix "q" ("tanq", "jnq" etc.); it also
> exports two I/O related functions with the prefix quadmath_. The
> library is used from libgfortran but can also be used from C/C++.
> However, there is no printf hook thus doing I/O from C/C++ is a bit
> more effort. The library is automatically build if language=fortran
> is enabled, but on systems without __float128 it is a no op.

FWIW, at a glance, configury inside libquadmath looks sane to me.

You could use the Automake option subdir-objects (added as argument to
AM_INIT_AUTOMAKE in libquadmath/configure.ac) to have objects built in
math/ and gdtoa/ subdirs; you might need to add AM_PROG_CC_C_O then too.
It nicely shortens the generated Makefile.in and is a wee bit more
efficient too.  This is not a necessity though.

Thanks,
Ralf

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2010-11-14 15:42 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-08 20:57 RFC patch: Add libquadmath - and use it in gfortran (round two) Tobias Burnus
2010-11-08 21:20 ` Jack Howarth
2010-11-08 21:23   ` Ralf Wildenhues
2010-11-08 21:30     ` Jack Howarth
2010-11-08 22:04       ` Jack Howarth
2010-11-08 23:43 ` Jack Howarth
2010-11-09  0:50   ` Steve Kargl
2010-11-09  1:08     ` Jack Howarth
2010-11-09  1:37       ` Steve Kargl
2010-11-09  1:42         ` Jack Howarth
2010-11-09  2:36           ` Jerry DeLisle
2010-11-09  3:18             ` Jack Howarth
2010-11-09  3:47               ` Jerry DeLisle
2010-11-09 16:17                 ` Jack Howarth
2010-11-09 16:22                   ` Jerry DeLisle
2010-11-09  7:10             ` Tobias Burnus
2010-11-09  7:52               ` Ralf Wildenhues
2010-11-09  9:18                 ` Rainer Orth
2010-11-09 17:23 ` RFC patch: Add libquadmath - and use it in gfortran (round THREE) Tobias Burnus
2010-11-09 23:37   ` Tobias Burnus
2010-11-10  2:05     ` Jack Howarth
2010-11-10  7:55       ` RFC patch: Add libquadmath - and use it in gfortran (round FOUR) Tobias Burnus
2010-11-10 13:51         ` Jack Howarth
2010-11-10 14:37           ` Tobias Burnus
2010-11-10 16:54             ` Jack Howarth
2010-11-12 19:38   ` RFC patch: Add libquadmath - and use it in gfortran (round THREE) Ralf Wildenhues
2010-11-12 19:38     ` Jack Howarth
2010-11-12 19:40       ` Ralf Wildenhues
2010-11-14 16:00 ` RFC patch: Add libquadmath - and use it in gfortran (round two) Ralf Wildenhues

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).