http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59888
--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
When I opened this PR I missed the "-fshared". With it I get the linker error.
On IRC Iain Sandoe gives the following workaround:
(1) gfc -S F03_iso.f90
(2) apply the following patch:
--- F03_iso.s 2014-01-20 20:54:05.000000000 +0100
+++ F03_iso_orig.s 2014-01-20 20:53:06.000000000 +0100
@@ -54,7 +54,7 @@ LCFI4:
LCFI5:
ret
LFE1:
- .const
+ .const_data
.align 3
LC2:
.quad _compute
(3) gfc -shared F03_iso.s -o F03_iso.dylib
(4) gfc F03_iso_main.f90 F03_iso.dylib with F03_iso_main.f90 being
use F03_ISO_C
use, intrinsic :: iso_c_binding
implicit none
integer :: F03_ISO_C_init
integer :: i
i = F03_ISO_C_init()
print *, i
end
Then the executable outputs
4493950477 is the address
1
and otool -Lv gives
F03_iso.dylib (compatibility version 0.0.0, current version 0.0.0)
time stamp 2 Thu Jan 1 01:00:02 1970
/opt/gcc/gcc4.9w/lib/libgfortran.3.dylib (compatibility version 4.0.0,
current version 4.0.0)
time stamp 2 Thu Jan 1 01:00:02 1970
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
1197.1.1)
time stamp 2 Thu Jan 1 01:00:02 1970
/opt/gcc/gcc4.9w/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current
version 1.0.0)
time stamp 2 Thu Jan 1 01:00:02 1970
/opt/gcc/gcc4.9w/lib/libquadmath.0.dylib (compatibility version 1.0.0,
current version 1.0.0)
time stamp 2 Thu Jan 1 01:00:02 1970