bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/25767] New: Zero-sized relocation section causes linker assert


From: hjl.tools at gmail dot com
Subject: [Bug ld/25767] New: Zero-sized relocation section causes linker assert
Date: Fri, 03 Apr 2020 01:45:18 +0000

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

            Bug ID: 25767
           Summary: Zero-sized relocation section causes linker assert
           Product: binutils
           Version: 2.35 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---

./ld -r -o y.o binary_confusion_matrix_fpt_dbl.o
./ld: BFD (GNU Binutils) 2.34.50.20200402 assertion fail
/export/gnu/import/git/gitlab/x86-binutils/bfd/elf.c:3652
./ld: BFD (GNU Binutils) 2.34.50.20200402 assertion fail
/export/gnu/import/git/gitlab/x86-binutils/bfd/elf.c:3652
./ld: BFD (GNU Binutils) 2.34.50.20200402 assertion fail
/export/gnu/import/git/gitlab/x86-binutils/bfd/elf.c:3652
./ld: BFD (GNU Binutils) 2.34.50.20200402 assertion fail
/export/gnu/import/git/gitlab/x86-binutils/bfd/elf.c:3652
./ld: BFD (GNU Binutils) 2.34.50.20200402 assertion fail
/export/gnu/import/git/gitlab/x86-binutils/bfd/elf.c:3652
./ld: BFD (GNU Binutils) 2.34.50.20200402 assertion fail
/export/gnu/import/git/gitlab/x86-binutils/bfd/elf.c:3652
./ld: BFD (GNU Binutils) 2.34.50.20200402 assertion fail
/export/gnu/import/git/gitlab/x86-binutils/bfd/elf.c:3652
./ld: BFD (GNU Binutils) 2.34.50.20200402 assertion fail
/export/gnu/import/git/gitlab/x86-binutils/bfd/elf.c:3652
./ld: BFD (GNU Binutils) 2.34.50.20200402 assertion fail
/export/gnu/import/git/gitlab/x86-binutils/bfd/elf.c:3652
make: *** [Makefile:6: y.o] Error 1

binary_confusion_matrix_fpt_dbl.o has

[581]
.rela.text._ZNK4daal15data_management10interface112NumericTable21getNumberOfCategoriesEm
RELA            0000000000000000 02b01c 000000 18   G  2 347  8

COMDAT group section [  172] `'
[_ZNK4daal15data_management10interface112NumericTable21getNumberOfCategoriesEm]
contains 2 sections:
   [Index]    Name
   [  347]  
.text._ZNK4daal15data_management10interface112NumericTable21getNumberOfCategoriesEm
   [  581]  
.rela.text._ZNK4daal15data_management10interface112NumericTable21getNumberOfCategoriesEm

It has zero size relocation section and bfd_elf_final_link removes the
zero-sized relocation section:

     if (o->reloc_count > 0)
        o->flags |= SEC_RELOC;
      else  
        {
          /* Explicitly clear the SEC_RELOC flag.  The linker tends to
             set it (this is probably a bug) and if it is set
             assign_section_numbers will create a reloc section.  */
          o->flags &=~ SEC_RELOC;
        }

      /* If the SEC_ALLOC flag is not set, force the section VMA to
         zero.  This is done in elf_fake_sections as well, but forcing
         the VMA to 0 here will ensure that relocs against these
         sections are handled correctly.  */
      if ((o->flags & SEC_ALLOC) == 0
          && ! o->user_set_vma)
        o->vma = 0;

Later, linker finds out one section is missing from the section group.
We should keep zero-sized relocation section in a section group or issue
an error for ld -r.

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