public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Ryan S. Elliott" <relliott@umn.edu>
To: Steve Kargl <sgk@troutmask.apl.washington.edu>
Cc: Thomas Koenig <tkoenig@netcologne.de>, fortran@gcc.gnu.org
Subject: Re: Darwin linker error "illegal text-relocation" with -shared
Date: Mon, 16 Apr 2018 21:09:00 -0000	[thread overview]
Message-ID: <alpine.OSX.2.21.1804161606530.40759@er-10-128-80-101.wireless.umn.edu> (raw)
In-Reply-To: <20180416201435.GA21886@troutmask.apl.washington.edu>

On Mon, 16 Apr 2018, Steve Kargl wrote:

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

Yes, this is a long standing issue.  I do not believe that it is really an 
apple problem.  I think gfortran is doing something that apple considers 
invalid.

The "-Wl,-read_only_relocs suppress" argument only works if you compile in 32 
bit  (with "-m32") otherwise it is not a valid argument:

$ gfortran-7 -shared -fPIC "-Wl,-read_only_relocs suppress" foo.f90
ld: unknown option: -read_only_relocs suppress
collect2: error: ld returned 1 exit status


Ryan

      reply	other threads:[~2018-04-16 21:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-16 16:18 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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.OSX.2.21.1804161606530.40759@er-10-128-80-101.wireless.umn.edu \
    --to=relliott@umn.edu \
    --cc=fortran@gcc.gnu.org \
    --cc=sgk@troutmask.apl.washington.edu \
    --cc=tkoenig@netcologne.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).