[PATCH] Fix IA-64 -pie support
Richard Henderson
rth@redhat.com
Wed Jul 2 18:00:00 GMT 2003
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~
More information about the Binutils
mailing list