From: Ian Lance Taylor <ian@wasabisystems.com>
To: "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: binutils@sourceware.org
Subject: Re: News MIPS option -mno-shared
Date: Thu, 09 Dec 2004 21:05:00 -0000 [thread overview]
Message-ID: <m34qiv89nn.fsf@gossamer.airs.com> (raw)
In-Reply-To: <Pine.LNX.4.58L.0412091756310.18083@blysk.ds.pg.gda.pl>
"Maciej W. Rozycki" <macro@linux-mips.org> writes:
> On Thu, 9 Dec 2004, Ian Lance Taylor wrote:
>
> > The idea is that you can use -KPIC -mno-shared and get code which
> > still uses the usual Unix calling convention, but is slightly more
> > efficient at each function entry. Of course, the resulting code is
> > not position independent and can not be put into a shared library.
>
> The resulting naming of options is a bit unfortunate -- -KPIC suggests
> the result is PIC regardless of other options.
The option naming in general is somewhat confusing. -KPIC doesn't
really mean PIC in the sense that -fpic does to gcc. It means to use
the Unix calling conventions, which are designed to be PIC. -KPIC
affects how some pseudo-ops and instructions like jal are interpreted.
You can easily write non-PIC code while using -KPIC. A synonym for
-KPIC is -mcall_shared, which is perhaps a better name.
> > Hence the name -mno-shared. (Note that nothing will prevent you from
> > trying to put -mno-shared code into a shared library, but the
> > resulting shared library will not work correctly.)
>
> Shouldn't the relocations be forwarded to the .rel.dyn section upon
> static linking for resolution (or complaint) by ld.so? Like it happens
> for other platforms where you can build PDC shared libraries that still
> work. Not that such libraries are optimal, but still better than ones
> that silently break.
I don't think it will work, because the resulting relocation will be
against the _gp symbol, which is specific to the executable, not to
the shared link of the executable and the shared library. The dynamic
linker will probably use the wrong value of _gp when resolving this
relocation. I suppose it would be possible to make it work through
some further hackery, but I doubt anybody would really want to use it.
Ian
next prev parent reply other threads:[~2004-12-09 21:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-09 15:34 Ian Lance Taylor
2004-12-09 16:41 ` Richard Sandiford
2004-12-09 16:44 ` Ian Lance Taylor
2004-12-10 9:34 ` Richard Sandiford
2004-12-11 3:45 ` Ian Lance Taylor
2004-12-09 16:53 ` Thiemo Seufer
2004-12-09 18:03 ` David Daney
2004-12-09 20:32 ` Ian Lance Taylor
2004-12-10 13:45 ` Dave Korn
2004-12-10 14:12 ` Thiemo Seufer
2004-12-09 18:19 ` Maciej W. Rozycki
2004-12-09 21:05 ` Ian Lance Taylor [this message]
2004-12-09 18:52 ` David Daney
2004-12-09 21:20 ` Ian Lance Taylor
2005-02-21 22:42 ` David Daney
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=m34qiv89nn.fsf@gossamer.airs.com \
--to=ian@wasabisystems.com \
--cc=binutils@sourceware.org \
--cc=macro@linux-mips.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).