public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* Darwin linker error "illegal text-relocation" with -shared
@ 2018-04-16 16:18 Ryan S. Elliott
  2018-04-16 18:20 ` Thomas Koenig
  0 siblings, 1 reply; 7+ messages in thread
From: Ryan S. Elliott @ 2018-04-16 16:18 UTC (permalink / raw)
  To: fortran

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

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

[-- Attachment #2: Type: text/plain, Size: 249 bytes --]

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

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

end of thread, other threads:[~2018-04-16 21:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-16 16:18 Darwin linker error "illegal text-relocation" with -shared Ryan S. Elliott
2018-04-16 18:20 ` Thomas Koenig
2018-04-16 19:35   ` Ryan S. Elliott
2018-04-16 19:46     ` Thomas Koenig
2018-04-16 19:51       ` Ryan S. Elliott
2018-04-16 20:14         ` Steve Kargl
2018-04-16 21:09           ` Ryan S. Elliott

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).