public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@google.com>
To: Eli Bendersky <eliben@gmail.com>
Cc: gcc-help@gnu.org
Subject: Re: why does -fno-pic coge generation on x64 require the large model?
Date: Mon, 07 Nov 2011 15:37:00 -0000	[thread overview]
Message-ID: <mcrpqh46j13.fsf@dhcp-172-18-216-180.mtv.corp.google.com> (raw)
In-Reply-To: <CAF-Rda_zw1y5KHk4rYD9hBdSYq8aeSUawXfZDk=YhKfTFLJR=A@mail.gmail.com>	(Eli Bendersky's message of "Mon, 7 Nov 2011 13:39:05 +0200")

Eli Bendersky <eliben@gmail.com> writes:

> I'm experimenting with generating PIC and non-PIC code on x64 Ubuntu.
> It's possible to generate non PIC code as follows:
>
>   gcc -fno-PIC -mcmodel=large -shared -c file.c
>
> However, I noticed that for other models (i.e. -mcmodel=small, or by
> default, without the -mcmodel argument), the code being generated is
> not really suitable for PIC as it has problematic load-time
> relocations.
>
> My question is - why is the large model required to generate true PIC code?

It's odd to try to create PIC while using -fno-PIC.  I think you must
have some goal in mind for what you want your generated code to look
like, but I don't know what that is.  It most likely does not correspond
to gcc's goal when using -fno-PIC, which is to not generate PIC.

Ian

  reply	other threads:[~2011-11-07 15:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-07 11:39 Eli Bendersky
2011-11-07 15:37 ` Ian Lance Taylor [this message]
2011-11-07 15:57   ` Eli Bendersky
2011-11-07 17:17     ` Andrew Haley
2011-11-07 18:12     ` Ian Lance Taylor
2011-11-08  3:19       ` Eli Bendersky
2011-11-08  5:49         ` Ian Lance Taylor
2011-11-08  6:09           ` Eli Bendersky

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=mcrpqh46j13.fsf@dhcp-172-18-216-180.mtv.corp.google.com \
    --to=iant@google.com \
    --cc=eliben@gmail.com \
    --cc=gcc-help@gnu.org \
    /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).