bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/13302] IRELATIVE relocation should come last


From: cvs-commit at gcc dot gnu.org
Subject: [Bug binutils/13302] IRELATIVE relocation should come last
Date: Sat, 02 Sep 2017 22:15:23 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=13302

--- Comment #9 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot 
gnu.org> ---
The master branch has been updated by H.J. Lu <address@hidden>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5e2ac45d561dffec63af4c83a545b46db032c70c

commit 5e2ac45d561dffec63af4c83a545b46db032c70c
Author: H.J. Lu <address@hidden>
Date:   Sat Sep 2 07:37:05 2017 -0700

    x86: Add _bfd_x86_elf_size_dynamic_sections

    elf_i386_size_dynamic_sections and elf_x86_64_size_dynamic_sections are
    very similar, except for the followings:

    1. elf_i386_size_dynamic_sections checks GOT_TLS_IE and GOT_TLS_IE_BOTH.
    elf_x86_64_size_dynamic_sections checks only GOT_TLS_IE.  Since
    GOT_TLS_IE_BOTH is never true for x86-64, it is OK to check GOT_TLS_IE
    for both i386 and x86-64.
    2, x86-64 sets tlsdesc_plt, but i386 doesn't.  We set tlsdesc_plt only
    if target_id == X86_64_ELF_DATA.
    3. x86-64 has

          if (s != htab->elf.srelplt)
            s->reloc_count = 0;

    and i386 has

          s->reloc_count = 0;

    i386 did have

          if (s != htab->srelplt)
            s->reloc_count = 0;

    in the original commit:

    commit 67a4f2b710581acc83afecff55424af285ecbc28
    Author: Alexandre Oliva <address@hidden>
    Date:   Wed Jan 18 21:07:51 2006 +0000

    But it was removed by

    commit 5ae0bfb60a576344d7f701605346282c1144499e
    Author: Richard Sandiford <address@hidden>
    Date:   Tue Feb 28 07:16:12 2006 +0000

        bfd/
                * elf32-i386.c (elf_i386_link_hash_table): Add
next_tls_desc_index.
                (elf_i386_link_hash_table_create): Initialize it.
                (elf_i386_compute_jump_table_size): Use it instead of
                srelplt->reloc_count.
                (allocate_dynrelocs): Likewise.
                (elf_i386_size_dynamic_sections): Likewise.
                (elf_i386_relocate_section): Likewise.

    A later commit:

    commit e1f987424b7b3f5ac63a2a6ae044a202a44b8ff8
    Author: H.J. Lu <address@hidden>
    Date:   Fri Oct 21 15:13:37 2011 +0000

        Put IRELATIVE relocations after JUMP_SLOT.

        bfd/

        2011-10-21  H.J. Lu  <address@hidden>

                PR ld/13302
                * elf32-i386.c (elf_i386_link_hash_table): Add
next_jump_slot_index
                and next_irelative_index.
                (elf_i386_link_hash_table_create): Initialize
next_jump_slot_index
                and next_irelative_index.
                (elf_i386_allocate_dynrelocs): Increment reloc_count instead of
                next_tls_desc_index.
                (elf_i386_size_dynamic_sections): Set next_tls_desc_index and
                next_irelative_index from reloc_count.
                (elf_i386_finish_dynamic_symbol): Put R_386_IRELATIVE after
                R_386_JUMP_SLOT.

    changed it back to use reloc_count again. So it is correct to use

          if (s != htab->elf.srelplt)
            s->reloc_count = 0;

    for both i386 and x86-64 now.
    4. i386 and x86-64 use different DT_XXXs.  They are handled by adding
    them to elf_x86_link_hash_table.

    With these changes, we can share _bfd_x86_elf_size_dynamic_sections in
    elf32-i386.c and elf64-x86-64.c.

        * elf32-i386.c (elf_i386_convert_load): Renamed to ...
        (_bfd_i386_elf_convert_load): This.  Remove static.
        (elf_i386_size_dynamic_sections): Removed.
        (elf_backend_size_dynamic_sections): Likewise.
        * elf64-x86-64.c (elf_x86_64_convert_load): Renamed to ...
        (_bfd_x86_64_elf_convert_load): This.  Remove static.
        (elf_x86_64_size_dynamic_sections): Removed.
        (elf_backend_size_dynamic_sections): Likewise.
        * elfxx-x86.c (_bfd_x86_elf_allocate_dynrelocs): Renamed to ...
        (elf_x86_allocate_dynrelocs): This.  Make it static.
        (_bfd_x86_elf_allocate_local_dynrelocs): Renamed to ...
        (elf_x86_allocate_local_dynreloc): This.  Make it static.
        (elf_i386_is_reloc_section): New function.
        (elf_x86_64_is_reloc_section): Likewise.
        (_bfd_x86_elf_link_hash_table_create): Initialize convert_load,
        is_reloc_section, dt_reloc, dt_reloc_sz and dt_reloc_ent.
        Rearrange got_entry_size initialization.
        (_bfd_x86_elf_size_dynamic_sections): New function.
        * elfxx-x86.h (elf_x86_link_hash_table): Add convert_load,
        is_reloc_section, dt_reloc, dt_reloc_sz and dt_reloc_ent.
        (_bfd_i386_elf_convert_load): New.
        (_bfd_x86_64_elf_convert_load): Likewise.
        (_bfd_x86_elf_size_dynamic_sections): Likewise.
        (elf_backend_size_dynamic_sections): Likewise.
        (_bfd_x86_elf_allocate_dynrelocs): Removed.
        (_bfd_x86_elf_allocate_local_dynrelocs): Likewise.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]