This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [PATCH] Fix IA-64 -pie support
- From: Richard Henderson <rth at redhat dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: David Mosberger <davidm at napali dot hpl dot hp dot com>, Jim Wilson <wilson at tuliptree dot org>, binutils at sources dot redhat dot com, drepper at redhat dot com
- Date: Wed, 2 Jul 2003 10:59:40 -0700
- Subject: Re: [PATCH] Fix IA-64 -pie support
- References: <20030702123023.GJ20507@sunsite.ms.mff.cuni.cz>
On Wed, Jul 02, 2003 at 02:30:23PM +0200, Jakub Jelinek wrote:
> While working on this, I've noticed that assembling and linking into shlib
> of the following
> addl r2 = @ltoff(@fptr(foobar)), gp
> addl r3 = @ltoff(foobar), gp
> creates only one .got entry, as if both relocations were @ltoff(@fptr()).
> Is that on purpose?
No, that is a bug. Of course, that shouldn't be generated either.
How did this come up, just inspection?
> @@ -2083,7 +2084,7 @@ get_fptr (abfd, info, ia64_info)
> | SEC_LOAD
> | SEC_HAS_CONTENTS
> | SEC_IN_MEMORY
> - | SEC_READONLY
> + | (info->pie ? 0 : SEC_READONLY)
> | SEC_LINKER_CREATED))
> || !bfd_set_section_alignment (abfd, fptr, 4))
> {
> @@ -2092,6 +2093,26 @@ get_fptr (abfd, info, ia64_info)
> }
>
> ia64_info->fptr_sec = fptr;
> +
> + if (info->pie)
> + {
> + asection *fptr_rel;
> + fptr_rel = bfd_make_section(abfd, ".rela.opd");
> + if (fptr_rel == NULL
> + || !bfd_set_section_flags (abfd, fptr_rel,
> + (SEC_ALLOC | SEC_LOAD
> + | SEC_HAS_CONTENTS
> + | SEC_IN_MEMORY
> + | SEC_LINKER_CREATED
> + | SEC_READONLY))
> + || !bfd_set_section_alignment (abfd, fptr_rel, 3))
> + {
> + BFD_ASSERT (0);
> + return NULL;
> + }
> +
> + ia64_info->rel_fptr_sec = fptr_rel;
> + }
> }
>
> return fptr;
Hum. I'd think that it'd be better to not generate descriptors
in .opd when they're mutable, but instead let ld.so generate them.
r~