This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v4] ARM: Fix relocation of EXIDX sections


On 23/09/16 11:24, Akihiko Odaki wrote:
> As reported in PR binutils/20595, BFD has a bug that it doesn't delete
> relocations for deleted exidx. This change fixes the behavior.
> 
> bfd * elf-bfd.h: Add callback to count relocations in the final output.
>     * elf-arm.c (elf32_arm_add_relocation): Deleted.
>     (elf32_arm_write_section): Move additional relocation to emit_relocs.
>     (elf32_arm_count_output_relocs): New function.
>     (emit_relocs): New function.
>     (elf32_arm_emit_relocs): New function.
>     (elf32_arm_vxworks_emit_relocs): New function.
>     (elf_backend_emit_relocs): Updated to use the new functions.
>     (elf_backend_count_output_relocs): New define.
>     * bfd/elflink.c (bfd_elf_final_link): Do not add additional_reloc_count
>     to the relocation count.
>     (_bfd_elf_link_size_reloc_section): Use callback to count the
>     relocations which will be in output.
>     (_bfd_elf_default_count_output_relocs): New function.
>     * bfd/elfxx-target.h (elf_backend_count_output_relocs): New define.
> ---
>  bfd/elf-bfd.h      |   8 ++
>  bfd/elf32-arm.c    | 266 ++++++++++++++++++++++++++++++++++++++++++++---------
>  bfd/elflink.c      |  46 ++++++---
>  bfd/elfxx-target.h |   4 +
>  4 files changed, 263 insertions(+), 61 deletions(-)
> 

this breaks cross compilation of glibc on arm.

i'm still investigating the issue, when linking libc_pic.so i get

Program received signal SIGSEGV, Segmentation fault.
elf_link_adjust_relocs (abfd=abfd@entry=0x7a2f30, reldata=reldata@entry=0x35f52f8, sort=sort@entry=1) at
/SRC/bfd/elflink.c:8406
8406          BFD_ASSERT ((*rel_hash)->indx >= 0);
(gdb) bt
#0  elf_link_adjust_relocs (abfd=abfd@entry=0x7a2f30, reldata=reldata@entry=0x35f52f8, sort=sort@entry=1) at
/SRC/bfd/elflink.c:8406
#1  0x000000000047f06d in bfd_elf_final_link (abfd=abfd@entry=0x7a2f30, info=info@entry=0x78ddc0 <link_info>)
at /SRC/bfd/elflink.c:11966
#2  0x000000000045590b in elf32_arm_final_link (abfd=0x7a2f30, info=0x78ddc0 <link_info>) at
/SRC/bfd/elf32-arm.c:12841
#3  0x00000000004181e4 in ldwrite () at /SRC/ld/ldwrite.c:577
#4  0x0000000000403755 in main (argc=<optimised out>, argv=<optimised out>) at /SRC/ld/ldmain.c:431
(gdb) i loc
irela = {{r_offset = 0, r_info = 3153664, r_addend = 0}, {r_offset = 13, r_info = 8007472, r_addend = 4408895},
{r_offset = 13, r_info = 7339, r_addend = 85397}}
j = <optimised out>
i = <optimised out>
bed = 0x788060 <elf32_bed>
erela = 0x385ba00 "\b"
swap_in = 0x45a8f0 <bfd_elf32_swap_reloc_in>
swap_out = 0x45a980 <bfd_elf32_swap_reloc_out>
r_type_mask = 255
r_sym_shift = 8
count = 3
rel_hash = 0x3763330
__PRETTY_FUNCTION__ = "elf_link_adjust_relocs"
(gdb) p *rel_hash
$1 = (struct elf_link_hash_entry *) 0x20



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]