Re: [power-ieee128] What should the math functions be annotated with?

2021-12-04 Thread Thomas Koenig via Fortran



Hi,


I have loaded Advance Toolchain 15.0 on the system.  It is located in
/opt/at15.0.  AT 15 provides a GCC 11.2 compiler and GLIBC 2.34.


Thanks!


I built a trunk compiler using the options:

 --enable-languages=c,c++,fortran \
 --disable-plugin \
 --enable-checking \
 --enable-stage1-checking \
 --enable-gnu-indirect-function \
 --disable-libgomp \
 --enable-decimal-float \
 --enable-secureplt \
 --enable-threads=posix \
 --enable-__cxa_atexit \
 --with-cpu=power8 \
 --with-long-double-128 \
 --with-as=/opt/at15.0/bin/as \
 --with-ld=/opt/at15.0/bin/ld \
 --with-gnu-as=/opt/at15.0/bin/as \
 --with-gnu-ld=/opt/at15.0/bin/ld \
 --with-advance-toolchain=at15.0 \
 --with-system-zlib \
 --with-native-system-header-dir=/opt/at15.0/include \
 --without-ppl \
 --without-cloog \
 --without-isl


I will add --enable-maintainer-mode and change --with-cpu=power8 to
--with-cpu=power9, and see how things go.

One question: Your configure has --with-long-double-128. Will this also
allow use of the IBM long double functions with a compiler switch
(and which one)?

Regards

Thomas


Re: [power-ieee128] What should the math functions be annotated with?

2021-12-04 Thread Thomas Koenig via Fortran



On 04.12.21 07:39, Michael Meissner via Fortran wrote:

I have loaded Advance Toolchain 15.0 on the system.  It is located in
/opt/at15.0.  AT 15 provides a GCC 11.2 compiler and GLIBC 2.34.


I tried bootstrapping (from a separate account I set up on the
machine to make sure I don't mess up anybody else's stuff)
with the options

../gcc/configure \
--prefix=$HOME \
--enable-languages=c,c++,fortran \
--disable-plugin \
--enable-checking \
--enable-stage1-checking \
--enable-gnu-indirect-function \
--enable-maintainer-mode \
--disable-libgomp \
--enable-decimal-float \
--enable-secureplt \
--enable-threads=posix \
--enable-__cxa_atexit \
--with-cpu=power9 \
--with-long-double-128 \
--with-as=/opt/at15.0/bin/as \
--with-ld=/opt/at15.0/bin/ld \
--with-gnu-as=/opt/at15.0/bin/as \
--with-gnu-ld=/opt/at15.0/bin/ld \
--with-advance-toolchain=at15.0 \
--with-system-zlib \
--with-native-system-header-dir=/opt/at15.0/include \
--without-ppl \
--without-cloog \
--without-isl

but it failed with

../../gcc/gcc/lto-compress.c:34:10: fatal error: zlib.h: No such file or 
directory


Any idea how to fix this?

Regards

Thomas


Re: [power-ieee128] What should the math functions be annotated with?

2021-12-04 Thread Jakub Jelinek via Fortran
On Sat, Dec 04, 2021 at 11:16:28AM +0100, Thomas Koenig wrote:
> 
> On 04.12.21 07:39, Michael Meissner via Fortran wrote:
> > I have loaded Advance Toolchain 15.0 on the system.  It is located in
> > /opt/at15.0.  AT 15 provides a GCC 11.2 compiler and GLIBC 2.34.
> 
> I tried bootstrapping (from a separate account I set up on the
> machine to make sure I don't mess up anybody else's stuff)
> with the options
> 
> ../gcc/configure \
> --prefix=$HOME \
> --enable-languages=c,c++,fortran \
> --disable-plugin \
> --enable-checking \
> --enable-stage1-checking \
> --enable-gnu-indirect-function \
> --enable-maintainer-mode \
> --disable-libgomp \
> --enable-decimal-float \
> --enable-secureplt \
> --enable-threads=posix \
> --enable-__cxa_atexit \
> --with-cpu=power9 \
> --with-long-double-128 \
> --with-as=/opt/at15.0/bin/as \
> --with-ld=/opt/at15.0/bin/ld \
> --with-gnu-as=/opt/at15.0/bin/as \
> --with-gnu-ld=/opt/at15.0/bin/ld \
> --with-advance-toolchain=at15.0 \
> --with-system-zlib \
> --with-native-system-header-dir=/opt/at15.0/include \
> --without-ppl \
> --without-cloog \
> --without-isl
> 
> but it failed with
> 
> ../../gcc/gcc/lto-compress.c:34:10: fatal error: zlib.h: No such file or
> directory
> 
> Any idea how to fix this?

If zlib devel isn't installed, drop --with-system-zlib option
or use --without-system-zlib.

You've asked in another mail how to configure gcc to default to
-mabi=ieeelongdouble, that is
--with-long-double-format=ieee

Jakub



Re: [power-ieee128] What should the math functions be annotated with?

2021-12-04 Thread Thomas Koenig via Fortran

On 04.12.21 11:29, Jakub Jelinek wrote:

If zlib devel isn't installed, drop --with-system-zlib option
or use --without-system-zlib.

You've asked in another mail how to configure gcc to default to
-mabi=ieeelongdouble, that is
--with-long-double-format=ieee


Thanks for those hints.

I have now managed to bootstrap a compiler on that machine, but
success at running programs is somewhat limited:

tkoenig@gcc-fortran:~/Tst$ which gcc
/home/tkoenig/bin/gcc
tkoenig@gcc-fortran:~/Tst$ cat hello.c
#include 

int main()
{
  printf ("Hello, world!\n");
  return 0;
}
tkoenig@gcc-fortran:~/Tst$ gcc hello.c
tkoenig@gcc-fortran:~/Tst$ ldd ./a.out
./a.out: /lib/powerpc64le-linux-gnu/libc.so.6: version `GLIBC_2.34' not 
found (required by ./a.out)

linux-vdso64.so.1 (0x7a16a451)
libc.so.6 => /lib/powerpc64le-linux-gnu/libc.so.6 
(0x7a16a42c)
/opt/at15.0/lib64/ld64.so.2 => /lib64/ld64.so.2 
(0x7a16a453)

tkoenig@gcc-fortran:~/Tst$ export LD_LIBRARY_PATH=~/lib64:/opt/at15.0/lib64/
tkoenig@gcc-fortran:~/Tst$ ls
Segmentation fault (core dumped)

@IBM folks: I would appreciate if you gave me access to a system
which actually worked, together with the necessary information,
so I can actually do what I volunteered to do.

Right now, I appear to be just wasting my time.

Regards

Thomas



Re: [power-ieee128] What should the math functions be annotated with?

2021-12-04 Thread Michael Meissner via Fortran
On Sat, Dec 04, 2021 at 02:42:13PM +0100, Thomas Koenig wrote:
> On 04.12.21 11:29, Jakub Jelinek wrote:
> > If zlib devel isn't installed, drop --with-system-zlib option
> > or use --without-system-zlib.
> > 
> > You've asked in another mail how to configure gcc to default to
> > -mabi=ieeelongdouble, that is
> > --with-long-double-format=ieee
> 
> Thanks for those hints.
> 
> I have now managed to bootstrap a compiler on that machine, but
> success at running programs is somewhat limited:
> 
> tkoenig@gcc-fortran:~/Tst$ which gcc
> /home/tkoenig/bin/gcc
> tkoenig@gcc-fortran:~/Tst$ cat hello.c
> #include 
> 
> int main()
> {
>   printf ("Hello, world!\n");
>   return 0;
> }
> tkoenig@gcc-fortran:~/Tst$ gcc hello.c
> tkoenig@gcc-fortran:~/Tst$ ldd ./a.out
> ./a.out: /lib/powerpc64le-linux-gnu/libc.so.6: version `GLIBC_2.34' not
> found (required by ./a.out)
> linux-vdso64.so.1 (0x7a16a451)
> libc.so.6 => /lib/powerpc64le-linux-gnu/libc.so.6
> (0x7a16a42c)
> /opt/at15.0/lib64/ld64.so.2 => /lib64/ld64.so.2 (0x7a16a453)
> tkoenig@gcc-fortran:~/Tst$ export LD_LIBRARY_PATH=~/lib64:/opt/at15.0/lib64/
> tkoenig@gcc-fortran:~/Tst$ ls
> Segmentation fault (core dumped)
> 
> @IBM folks: I would appreciate if you gave me access to a system
> which actually worked, together with the necessary information,
> so I can actually do what I volunteered to do.
> 
> Right now, I appear to be just wasting my time.

The Advance Toolchain has its own GLIBC, and it sets a different path to load
up the libraries.  You should not need to set the LD_LIBRARY_PATH variable.

Note, the system ldd does not tend to accurately report the library
dependencies for AT libraries:

15:15:03 ~/tests
-gcc-fortran-> /home/meissner/fsf-install-ppc64le/trunk/bin/gcc -O2 hello.c

15:15:23 ~/tests
-gcc-fortran-> ldd a.out
./a.out: /lib/powerpc64le-linux-gnu/libc.so.6: version `GLIBC_2.34' not found 
(required by ./a.out)
linux-vdso64.so.1 (0x796b63da)
libm.so.6 => /lib/powerpc64le-linux-gnu/libm.so.6 (0x796b63c5)
libc.so.6 => /lib/powerpc64le-linux-gnu/libc.so.6 (0x796b63a1)
/opt/at15.0/lib64/ld64.so.2 => /lib64/ld64.so.2 (0x796b63dc)

15:15:27 ~/tests
-gcc-fortran-> /opt/at15.0/bin/ldd a.out
linux-vdso64.so.1 (0x70dea014)
libm.so.6 => /opt/at15.0/lib64/power9/libm.so.6 (0x70dea002)
libc.so.6 => /opt/at15.0/lib64/power9/libc.so.6 (0x70de9fdb)
/opt/at15.0/lib64/ld64.so.2 (0x70dea016)


This is done by the GCC driver setting a different dynamic linker path
internally:

-dynamic-linker /opt/at15.0/lib64/ld64.so.2

Tulio can probably expand on what is going on in more detail.  The reason for
using the Advance Toolchain is to get access to newer libraries.  I don't know
Ubuntu at all, but I believe the version that is installed is too old to have
the necessary changes in it.  There isn't a LTS (long time support) version of
Ubuntu yet available that has the library.  There are newer versions that
aren't LTS (i.e. every 6 months you have to jump to the next release), and
Peter, Bill and I have talked about upgrading the partition to use those.

-- 
Michael Meissner, IBM
PO Box 98, Ayer, Massachusetts, USA, 01432
email: meiss...@linux.ibm.com


Re: [power-ieee128] What should the math functions be annotated with?

2021-12-04 Thread Peter Bergner via Fortran
On 12/4/21 9:25 AM, Michael Meissner wrote:
> On Sat, Dec 04, 2021 at 02:42:13PM +0100, Thomas Koenig wrote:
> Note, the system ldd does not tend to accurately report the library
> dependencies for AT libraries:

And using AT15's ldd, it shows your a.out is linked to the correct libc:

ubuntu@gcc-fortran:/home/tkoenig/Tst$ ldd ./a.out 
./a.out: /lib/powerpc64le-linux-gnu/libc.so.6: version `GLIBC_2.34' not found 
(required by ./a.out)
linux-vdso64.so.1 (0x7f633962)
libc.so.6 => /lib/powerpc64le-linux-gnu/libc.so.6 (0x7f63393d)
/opt/at15.0/lib64/ld64.so.2 => /lib64/ld64.so.2 (0x7f633964)
ubuntu@gcc-fortran:/home/tkoenig/Tst$ /opt/at15.0/bin/ldd ./a.out 
linux-vdso64.so.1 (0x7158fb1c)
libc.so.6 => /opt/at15.0/lib64/power9/libc.so.6 (0x7158faf4)
/opt/at15.0/lib64/ld64.so.2 (0x7158fb1e)


What I would do is place /opt/at15.0/bin as the 2nd directory in your PATH,
with your new GCC install dir being first.  That way, things should be
seemless for you.

Peter




Re: [power-ieee128] What should the math functions be annotated with?

2021-12-04 Thread Peter Bergner via Fortran
On 12/4/21 9:37 AM, Peter Bergner wrote:
> On 12/4/21 9:25 AM, Michael Meissner wrote:
> ubuntu@gcc-fortran:/home/tkoenig/Tst$ ldd ./a.out 
> ./a.out: /lib/powerpc64le-linux-gnu/libc.so.6: version `GLIBC_2.34' not found 
> (required by ./a.out)
>   linux-vdso64.so.1 (0x7f633962)
>   libc.so.6 => /lib/powerpc64le-linux-gnu/libc.so.6 (0x7f63393d)
>   /opt/at15.0/lib64/ld64.so.2 => /lib64/ld64.so.2 (0x7f633964)

To go into a little more in depth, the important thing is your a.out
was linked with the correct loader:

ubuntu@gcc-fortran:/home/tkoenig/Tst$ readelf -l a.out | grep interpreter
  [Requesting program interpreter: /opt/at15.0/lib64/ld64.so.2]


...and the error message you saw was a good thing, it showed your a.out was
expecting to see the newer GLIBC 2.34 and didn't.  The reason it didn't
was that the system ldd which you used does some magic and overrides the
a.out runtime loader with the system loader and that loader uses its
own ld.so.cache which doesn't include AT15's library paths.  The AT15
loader has its own /opt/at15.0/etc/ld.so.cache which includes its lib dirs
as well the system lib dirs.  This way, the AT15 libs are found first and
any library AT15 doesn't provide it automatically picked up from the system.
As long as you keep the AT15 bin path before the system bin dirs, you should
be fine.

Peter





Re: [power-ieee128] What should the math functions be annotated with?

2021-12-04 Thread Jakub Jelinek via Fortran
On Sat, Dec 04, 2021 at 10:12:37AM -0600, Peter Bergner via Gcc wrote:
> On 12/4/21 9:37 AM, Peter Bergner wrote:
> > On 12/4/21 9:25 AM, Michael Meissner wrote:
> > ubuntu@gcc-fortran:/home/tkoenig/Tst$ ldd ./a.out 
> > ./a.out: /lib/powerpc64le-linux-gnu/libc.so.6: version `GLIBC_2.34' not 
> > found (required by ./a.out)
> > linux-vdso64.so.1 (0x7f633962)
> > libc.so.6 => /lib/powerpc64le-linux-gnu/libc.so.6 (0x7f63393d)
> > /opt/at15.0/lib64/ld64.so.2 => /lib64/ld64.so.2 (0x7f633964)
> 
> To go into a little more in depth, the important thing is your a.out
> was linked with the correct loader:
> 
> ubuntu@gcc-fortran:/home/tkoenig/Tst$ readelf -l a.out | grep interpreter
>   [Requesting program interpreter: /opt/at15.0/lib64/ld64.so.2]
> 
> 
> ...and the error message you saw was a good thing, it showed your a.out was
> expecting to see the newer GLIBC 2.34 and didn't.  The reason it didn't
> was that the system ldd which you used does some magic and overrides the
> a.out runtime loader with the system loader and that loader uses its
> own ld.so.cache which doesn't include AT15's library paths.  The AT15
> loader has its own /opt/at15.0/etc/ld.so.cache which includes its lib dirs
> as well the system lib dirs.  This way, the AT15 libs are found first and
> any library AT15 doesn't provide it automatically picked up from the system.
> As long as you keep the AT15 bin path before the system bin dirs, you should
> be fine.

But when Thomas is working on the vanilla gcc tree, trying to make it work
for Fortran, I think he'll need to patch that gcc tree too to use the
AT15's dynamic linker and rpath like the AT15 gcc is.

Jakub



Re: [power-ieee128] What should the math functions be annotated with?

2021-12-04 Thread Thomas Koenig via Fortran



On 04.12.21 17:12, Peter Bergner via Fortran wrote:

As long as you keep the AT15 bin path before the system bin dirs, you should
be fine.


OK, what I have now is

tkoenig@gcc-fortran:~$ echo $PATH
/home/tkoenig/bin:/opt/at15.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
tkoenig@gcc-fortran:~$ echo $LD_LIBRARY_PATH
/home/tkoenig/lib64

I generally use LD_LIBRARY_PATH to point to where the shared
libgfortran and other libraries is installed.

However, this breaks man (and I don't know what else):

man: command exited with status 1: (cd /usr/share/man && 
/usr/lib/man-db/zsoelim) | (cd /usr/share/man && /usr/lib/man-db/manconv 
-f UTF-8:ISO-8859-1 -t UTF-8//IGNORE) | (cd /usr/share/man && preconv -e 
UTF-8) | (cd /usr/share/man && tbl) | (cd /usr/share/man && nroff 
-mandoc -rLL=231n -rLT=231n -Tutf8)


Any ideas there?

Regards

Thomas


Re: [power-ieee128] What should the math functions be annotated with?

2021-12-04 Thread Peter Bergner via Fortran
On 12/4/21 10:19 AM, Jakub Jelinek wrote:
> But when Thomas is working on the vanilla gcc tree, trying to make it work
> for Fortran, I think he'll need to patch that gcc tree too to use the
> AT15's dynamic linker and rpath like the AT15 gcc is.

That is part of the magic that happens when you configure with
--with-advance-toolchain=at15.0, it forces the gcc to use AT15's
dynamic linker and AT15's ld.so.cache makes it so that the
dynamic linker finds AT15's libs etc.

Peter




Re: [power-ieee128] What should the math functions be annotated with?

2021-12-04 Thread Peter Bergner via Fortran
On 12/4/21 11:40 AM, Thomas Koenig wrote:
> OK, what I have now is
> 
> tkoenig@gcc-fortran:~$ echo $PATH
> /home/tkoenig/bin:/opt/at15.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
> tkoenig@gcc-fortran:~$ echo $LD_LIBRARY_PATH
> /home/tkoenig/lib64
> 
> I generally use LD_LIBRARY_PATH to point to where the shared
> libgfortran and other libraries is installed.
> 
> However, this breaks man (and I don't know what else):

So LD_LIBRARY_PATH is searched before the directories in ld.so.cache,
so you end up picking up some "new" libs from /home/tkoenig/lib64
and some of these rely on the newer libs in AT15.  However, man and
some of the other system binaries use the system dynamic linker, so
they search first through LD_LIBRARY_PATH an dnot finding something,
they fall back to /etc/ld.so.cache and that doesn't have the newer
AT15 libs, so you hit errors.

Instead of setting LD_LIBRARY_PATH=/home/tkoenig/lib64 could you try
setting it to LD_LIBRARY_PATH='$ORIGIN/lib64' instead?  This would
allow the other system binaries to not find your /home/tkoenig/lib64
directory so they'd behave normally.  However, any binary that was
compiled in a directory where your lib64/ exists would find your
new libs and use them.  I'm not sure if that cramps your testing
or not, to limit yourself to compiling your tests in that one directory.

If that doesn't work, could you instead not set LD_LIBRARY_PATH and
instead compile using -L/home/bergner/lib64 -R/home/bergner/lib64 ?

Peter