[llvm-bugs] [Bug 26968] New: i386 lld produces incorrect fatal error "SHF_MERGE section size must be a multiple of sh_entsize" linking FreeBSD/i386 userland

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 16 13:16:24 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=26968

            Bug ID: 26968
           Summary: i386 lld produces incorrect fatal error "SHF_MERGE
                    section size must be a multiple of sh_entsize" linking
                    FreeBSD/i386 userland
           Product: lld
           Version: unspecified
          Hardware: PC
               URL: http://reviews.llvm.org/D18222
                OS: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: emaste at freebsd.org
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

lld considers sh_entsize == 0 a fatal error in a SHF_MERGE section.

  if (!EntSize || Sec.sh_size % EntSize)
    fatal("SHF_MERGE section size must be a multiple of sh_entsize");

In a FreeBSD/i386 buildworld many objects have SHF_MERGE with sh_entsize == 0,
and this shouldn't be a fatal error. At a minimum we can just return false.

For reference here is an example readelf -S from one of the objects:

/tank/emaste/obj/i386.i386/tank/emaste/src/freebsd/tmp/usr/lib/crt1.o
There are 14 section headers, starting at offset 0x68c:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf
Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0 
0
  [ 1] .eh_frame         PROGBITS        00000000 000034 000034 00   A  0   0 
4
  [ 2] .note.tag         NOTE            00000000 000068 000030 00   A  0   0 
4
  [ 3] .rodata           PROGBITS        00000000 000098 000001 00 AMS  0   0 
1
  [ 4] .text             PROGBITS        00000000 0000a0 0001aa 00  AX  0   0
16
  [ 5] .data             PROGBITS        00000000 00024c 000004 00  WA  0   0 
4
  [ 6] .bss              NOBITS          00000000 000250 000004 00  WA  0   0 
4
  [ 7] .rel.text         REL             00000000 000250 0000b8 08   I 12   4 
4
  [ 8] .comment          PROGBITS        00000000 000308 00005d 00  MS  0   0 
1
  [ 9] .rel.eh_frame     REL             00000000 000368 000008 08   I 12   1 
4
  [10] .rel.data         REL             00000000 000370 000008 08   I 12   5 
4
  [11] .shstrtab         STRTAB          00000000 000548 00005d 00      0   0 
1
  [12] .symtab           SYMTAB          00000000 000378 0001d0 10     13  21 
4
  [13] .strtab           STRTAB          00000000 0005a5 0000e5 00      0   0 
1


As an aside, it would be useful to have the file name in the error message too.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160316/a2ba865b/attachment.html>


More information about the llvm-bugs mailing list