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: Is there bug in elf64_alpha_finish_dynamic_sections() of binutils/bfd/elf64-alpha.c? //new bug-2


Hi,

Sorry. This is not bug.
I consider it erroneously.

Sincerely,
Wei Jiaming

________________________________________
From: Jiaming Wei
Sent: Wednesday, August 10, 2016 9:36 AM
To: Nick Clifton
Cc: binutils@sourceware.org
Subject: Is there bug in elf64_alpha_finish_dynamic_sections() of binutils/bfd/elf64-alpha.c?   //new bug-2

Hi,

I think I found another bug. It is very curious why this bug is not triggered.
static bfd_boolean
elf64_alpha_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
{
  bfd *dynobj;
  asection *sdyn;

  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;
      .....................

Because
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)
    {
       bfd *dynobj;
       asection *s;
       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.

Sincerely,
Wei Jiaming

________________________________________
From: Nick Clifton [nickc@redhat.com]
Sent: Tuesday, August 9, 2016 11:17 PM
To: Jiaming Wei
Cc: binutils@sourceware.org
Subject: Re: FW: Is there bug in elf64_alpha_copy_indirect_symbol() of binutils/bfd/elf64-alpha.c?

Hi Jiaming,

> 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.

Cheers
  Nick

bfd/ChangeLog
2016-08-09  Jiaming Wei  <jmwei@hxgpt.com>

        * elf64-alpha.c (elf64_alpha_copy_indirect_symbol): Fix thinko
        adjusting the use_count of merged .got entries.


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