<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Can emit SHF_MERGE section with a sh_entsize of 0"
   href="http://llvm.org/bugs/show_bug.cgi?id=22463">22463</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Can emit SHF_MERGE section with a sh_entsize of 0
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>MC
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>peter@pcc.me.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Given the following IR:

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

$foo = comdat any
@foo = unnamed_addr constant [4 x i32] [i32 7, i32 8, i32 9, i32 10], comdat

define [4 x i32]* @f() {
  ret [4 x i32]* @foo
}

we can emit a SHF_MERGE section with a sh_entsize of 0. This is invalid and can
cause some versions of gold to crash.

$ ~/src/llvm-build-rel/bin/llc -filetype=obj -o foo.o foo.ll
$ readelf -a -W foo.o | grep rodata.foo
  [ 6] .rodata.foo       PROGBITS        0000000000000000 000058 000010 00 AMG 
0   0  4
$ ld.gold -r -o foo2.o foo.o
Floating point exception (core dumped)

(binutils bug fix: <a href="https://sourceware.org/ml/binutils/2015-02/msg00040.html">https://sourceware.org/ml/binutils/2015-02/msg00040.html</a>)</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>