Darwin linker error "illegal text-relocation" with -shared
Ryan S. Elliott
relliott@umn.edu
Mon Apr 16 16:18:00 GMT 2018
Hello,
I would like to see if any progress can be made on the darwin linker error
reported in 2014 and documented here:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59888
This is a significant problem for the OpenKIM system (https://openkim.org)
which has many users who would like to use its kim-api package
(https://github.com/openkim/kim-api) and the associated "Model" codes available
at openkim.org with macOS.
We have been getting by with a work-around (compile for 32-bit architecture
"-m32" and use the "-read_only_relocs suppress" command line argument) but now
we would like to be able to provide precompiled binaries that will work with
other standard compiled software (i.e., 64-bit, etc.) through the homebrew
package management system.
Here is the minimal code snippet showing the problem and the compiler/linker
output.
----------------------------------------------
foo.f90
----------------------------------------------
module foo contains
subroutine bar
use, intrinsic :: iso_c_binding
call gee(c_funloc(gee))
end subroutine
subroutine gee(f) bind(c)
use, intrinsic :: iso_c_binding
type(c_funptr) :: f
end subroutine
end module foo
----------------------------------------------
$ gfortran-7 -shared foo.f90
ld: illegal text-relocation to '_gee' in
/var/folders/q0/mth73zrd307d66c43f8r3xv80000gp/T//ccYs60h3.o from 'lC0' in /var/folders/q0/mth73zrd307d66c43f8r3xv80000gp/T//ccYs60h3.o for architecture x86_64
collect2: error: ld returned 1 exit status
$ gfortran-7 --version
GNU Fortran (Homebrew GCC 7.3.0_1) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Thanks,
Ryan S. Elliott
-------------- next part --------------
module foo
contains
subroutine bar
use, intrinsic :: iso_c_binding
call gee(c_funloc(gee))
end subroutine
subroutine gee(f) bind(c)
use, intrinsic :: iso_c_binding
type(c_funptr) :: f
end subroutine
end module foo
More information about the Fortran
mailing list