Darwin linker error "illegal text-relocation" with -shared

Steve Kargl sgk@troutmask.apl.washington.edu
Mon Apr 16 20:14:00 GMT 2018


On Mon, Apr 16, 2018 at 02:51:16PM -0500, Ryan S. Elliott wrote:
> 
> No, you are right.   I should have included the -fPIC flag, but this doesn't 
> change the results:
> 
> 
> $ gfortran-7 -shared -fPIC foo.f90
> ld: illegal text-relocation to '_gee' in /var/folders/q0/mth73zrd307d66c43f8r3xv80000gp/T//ccG1nHc0.o from 'lC0' in /var/folders/q0/mth73zrd307d66c43f8r3xv80000gp/T//ccG1nHc0.o for architecture x86_64
> collect2: error: ld returned 1 exit status
> 

google 'macos ld illegal text-relocation' suggests that this
is a longstanding problem with macos.  Perhaps, a bug report
to Apple is appropriate?

Try adding "-Wl,-read_only_relocs suppress" to your command line.

-- 
Steve



More information about the Fortran mailing list