Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flang should accept linker command line options #15

Open
sscalpone opened this issue Jun 12, 2017 · 3 comments
Open

Flang should accept linker command line options #15

sscalpone opened this issue Jun 12, 2017 · 3 comments
Labels

Comments

@sscalpone
Copy link
Member

pawosm-arm commented on Sep 21, 2016
This is required by software packages that use autoconf's 'configure' script to generate makefiles. As it turns out, for some of them (e.g. openmpi) 'configure' script literally adds linker options to the command line not prefixing them with '-Wl,'. This only happens when flang is discovered by 'configure' as a frontend driver. Following options were frequently encountered (AFAIR, with singe or double dash):
--whole-archive, --no-whole-archive, --rpath (with all instances of its allowed syntax), -soname.
As a workaround, --disable-shared --enable-static (usually accompanied with setting ENV variables having -fPIC -DPIC as compiler flags) can be passed to configure. This isn't a permanent solution though, the best option would be to accept these flags and pass them to the linker as they are.
@ppenzin

ppenzin commented on Sep 21, 2016
Would other Fortran compilers accept those options?

AFAIR there is check for compiler that sets some variable to prepend -Wl, (or whatever is appropriate for particular compiler) to linker flags. If compiler is not recognized that prefix stays blank, therefore it would try to pass linker flags directly.
@pawosm-arm

pawosm-arm commented on Sep 21, 2016
They would not (I tried gfortran and some other, commercial) and the least intrusive solution needs to be found. Any solution that would require the users to update their autotools will be likely rejected by the wider audience.
@ppenzin

ppenzin commented on Sep 21, 2016
Any new compiler will have to be added to autotools at some point. For now we can probably provide a way to patch makefiles or configure scripts.

@Romendakil
Copy link

Actually, the only thing to be adapted is the libtool version. Usually, software packages ship with their own libtool version. E.g. for the NAGFOR compiler we managed to get our specifics for that compiler to be included in the official libtool release. So, in general is it possible to create shared libraries with flang?

@sscalpone
Copy link
Member Author

It would be great if someone updated libtool!

Yes, it's possible to create a shared library with flang using ld directly.

% cat flt.f90
real(4) function flt(x)
  real(4) :: x
  f = sin(x)
end
% flang -fPIC -c flt.f90
% ld -shared  -o libflt.so.1.0 flt.o
% flang mn.f90 libflt.so.1.0
% a.out
   2.8025969E-45

@pawosm-arm
Copy link

pawosm-arm commented Feb 13, 2018

It would be great if someone updated libtool!

I tried some time ago: https://lists.gnu.org/archive/html/libtool-patches/2017-08/msg00002.html
No reaction though. Patches were also sent to gnulib, autoconf and automake lists, again, no reaction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants