From: David Huggins-Daines <dhd@linuxcare.com>
To: Alan Modra <alan@linuxcare.com.au>
Cc: parisc-linux@thepuffingroup.com, parisc@lists.linuxcare.com
Subject: Re: Incompatibility of PIC and non-PIC
Date: 18 Aug 2000 16:14:27 -0400 [thread overview]
Message-ID: <87vgwyz5r0.fsf@linuxcare.com> (raw)
In-Reply-To: David Huggins-Daines's message of "18 Aug 2000 13:25:53 -0400"
David Huggins-Daines <dhd@linuxcare.com> writes:
> Alan Modra <alan@linuxcare.com.au> writes:
> > A bit of head-scratching, a couple of added functions, and the linker now
> > detects PIC functions and handles them appropriately.
>
> Sorry to burst your bubble but this doesn't work in the real world,
> where "real world" is defined as 'hppa-linux-gcc -o hello hello.c'
Actually it wasn't so bad after all. Here's a patch that fixes the
case of statically linked binaries, though I'm reluctant to check it
in because I'm not quite sure the logic is 100% correct; without
removing the check for defined weak symbols, we end up generating a
*lot* of useless import stubs when linking with a static libc, but
this might not be the right way to avoid this.
It's not fixed in the case of dynamically linked binaries that are
statically linked with PIC (which is basically all dynamically linked
binaries since libgcc.a is linked statically). It might make sense to
unify the generation of import stubs and PLT slots for all PIC symbols
whether they are linked statically or dynamically, but I don't know if
I want to attempt that myself :-)
Oh, also, I've been bad about ChangeLog entries lately, sorry - should
I retroactively create some for the recent checkins I've made?
2000-08-18 David Huggins-Daines <dhd@linuxcare.com>
* elf32-hppa.c (final_link_relocate): Call an import stub in
the case of statically linked PIC symbols.
(hppa_handle_PIC_calls): Don't try to handle undefined weak
symbols at all, and don't create import stubs for locally
defined weak symbols unless they are PIC.
Index: bfd/elf32-hppa.c
===================================================================
RCS file: /home/cvs/parisc/binutils-2.10/bfd/elf32-hppa.c,v
retrieving revision 1.22
diff -u -r1.22 elf32-hppa.c
--- elf32-hppa.c 2000/08/18 15:25:47 1.22
+++ elf32-hppa.c 2000/08/18 20:04:42
@@ -1961,8 +1961,8 @@
|| (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
{
if (h->plt.refcount <= 0
+ || h->root.type == bfd_link_hash_undefweak
|| ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
- && h->root.type != bfd_link_hash_defweak
&& (!info->shared || info->symbolic)
&& !(!info->shared
&& (h->root.type == bfd_link_hash_defined
@@ -1971,13 +1971,13 @@
{
/* The .plt entry is not needed when:
a) Garbage collection has removed all references to the
- symbol, or
- b) We know for certain the symbol is defined in this
- object, and it's not a weak definition. Either this
- object is the application or we are doing a shared
- symbolic link. As a special sop to the hppa ABI, we
- keep a .plt entry for functions in sections containing
- PIC code. */
+ symbol.
+ b) It's an undefined weak symbol.
+ c) We know for certain the symbol is defined in this
+ object. Either this object is the application or we are
+ doing a shared symbolic link. As a special sop to the
+ hppa ABI, we keep a .plt entry for functions in sections
+ containing PIC code. */
h->plt.offset = (bfd_vma) -1;
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
return true;
@@ -2851,8 +2851,11 @@
case R_PARISC_PCREL17F:
case R_PARISC_PCREL22F:
/* If this is a call to a function defined in another dynamic
- library, then find the import stub in the stub hash. */
- if (sym_sec == NULL || sym_sec->output_section == NULL)
+ library, or if it is a call to a PIC function in the same
+ object, then find the import stub in the stub hash. */
+ if (sym_sec == NULL
+ || sym_sec->output_section == NULL
+ || (h != NULL && h->pic_call))
{
stub_entry = hppa_get_stub_entry (input_section, sym_sec,
h, rel, info);
--
dhd@linuxcare.com, http://www.linuxcare.com/
Linuxcare. Support for the revolution.
next prev parent reply other threads:[~2000-08-18 20:15 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-08-17 22:25 [parisc-linux] Incompatibility of PIC and non-PIC David Huggins-Daines
2000-08-18 0:12 ` Alan Modra
2000-08-18 14:29 ` Alan Modra
2000-08-18 17:25 ` David Huggins-Daines
2000-08-18 20:14 ` David Huggins-Daines [this message]
2000-08-18 23:35 ` Alan Modra
2000-08-19 5:29 ` Alan Modra
2000-08-21 17:46 ` David Huggins-Daines
2000-08-21 19:09 ` David Huggins-Daines
2000-08-21 23:39 ` Alan Modra
2000-08-19 22:00 ` David Huggins-Daines
2000-08-20 3:07 ` Alan Modra
2000-08-20 2:43 ` Matthew Wilcox
2000-08-20 4:19 ` Alan Modra
2000-08-21 13:41 ` David Huggins-Daines
2000-08-21 13:38 ` David Huggins-Daines
[not found] <alan@linuxcare.com.au>
2000-08-23 8:49 ` Tor Arntsen
2000-08-23 9:49 ` Alan Modra
-- strict thread matches above, loose matches on Subject: below --
2000-08-23 10:31 Tor Arntsen
2000-08-23 10:46 ` Alan Modra
2000-08-23 11:26 Tor Arntsen
2000-08-23 13:51 ` Matthew Wilcox
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=87vgwyz5r0.fsf@linuxcare.com \
--to=dhd@linuxcare.com \
--cc=alan@linuxcare.com.au \
--cc=parisc-linux@thepuffingroup.com \
--cc=parisc@lists.linuxcare.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.