This is the mail archive of the
mailing list for the binutils project.
Is there bug in elf64_alpha_finish_dynamic_sections() of binutils/bfd/elf64-alpha.c? //new bug-2
- From: Jiaming Wei <jmwei at hxgpt dot com>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Wed, 10 Aug 2016 01:36:38 +0000
- Subject: Is there bug in elf64_alpha_finish_dynamic_sections() of binutils/bfd/elf64-alpha.c? //new bug-2
- Authentication-results: sourceware.org; auth=none
- References: <firstname.lastname@example.org> <email@example.com>,<firstname.lastname@example.org>
I think I found another bug. It is very curious why this bug is not triggered.
elf64_alpha_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
dynobj = elf_hash_table (info)->dynobj;
sdyn = bfd_get_linker_section (dynobj, ".dynamic");
if (elf_hash_table (info)->dynamic_sections_created)
asection *splt, *sgotplt, *srelaplt;
Elf64_External_Dyn *dyncon, *dynconend;
bfd_vma plt_vma, gotplt_vma;
splt = bfd_get_linker_section (dynobj, ".plt");
srelaplt = bfd_get_linker_section (output_bfd, ".rela.plt"); //<---- I think here is also a bug. It should be srelaplt = bfd_get_linker_section (dynobj, ".rela.plt");
BFD_ASSERT (splt != NULL && sdyn != NULL);
plt_vma = splt->output_section->vma + splt->output_offset;
1. In other places, bfd_get_linker_section (dynobj, ".rela.plt") is used with dynobj.
2. .rela.plt is created in elf64_alpha_create_dynamic_sections(), s = bfd_make_section_anyway_with_flags (abfd, ".rela.plt", flags);
elf64_alpha_create_dynamic_sections() is called in elf64_alpha_adjust_dynamic_symbol(), and dynobj is passed.
elf64_alpha_adjust_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h)
struct alpha_elf_link_hash_entry *ah;
dynobj = elf_hash_table(info)->dynobj;
if (!s && !elf64_alpha_create_dynamic_sections (dynobj, info)) <---------- Here dynobj is passed.
Please consider this problem again.
From: Nick Clifton [email@example.com]
Sent: Tuesday, August 9, 2016 11:17 PM
To: Jiaming Wei
Subject: Re: FW: Is there bug in elf64_alpha_copy_indirect_symbol() of binutils/bfd/elf64-alpha.c?
> I am studying elf64-alpha.c. I think there is one bug in the below function.
> Because I cannot send mail to Richard Henderson, so I send this mail to you.
I am sorry for the delay in replying to your email. I was hoping that an Alpha
expert would answer your question, but since no-one has stepped up, I have had
a look at the code.
I have to say that I agree with your analysis. There is indeed a bug, and the
correction you propose is the right way to solve the problem. So I have checked
the patch in, along with the changelog entry below.
Thank you very much for reporting this problem and providing the solution.
2016-08-09 Jiaming Wei <firstname.lastname@example.org>
* elf64-alpha.c (elf64_alpha_copy_indirect_symbol): Fix thinko
adjusting the use_count of merged .got entries.