<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - ELFAsmParser warns on COMDAT sections since r335558"
   href="https://bugs.llvm.org/show_bug.cgi?id=38449">38449</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ELFAsmParser warns on COMDAT sections since r335558
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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>hahnjo@hahnjo.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Commit r335558 says: "Add a warning if someone attempts to add extra section
flags to sections with well defined semantics like .rodata."
In other words: Many sections are not allowed to have different than their
default flags.

As a result LLVM warns on COMDAT sections. Consider the following LLVM IR:
$test = comdat any

define void @test() comdat {
  ret void
}

Compilation to an object file works without problems:
 $ clang -c comdat.ll
 $ objdump -h comdat.o
[...]
  1 .group        00000008  0000000000000000  0000000000000000  00000078  2**2
                  CONTENTS, READONLY, EXCLUDE, GROUP, LINK_ONCE_DISCARD
  2 .text.test    00000001  0000000000000000  0000000000000000  00000040  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
[...]

However LLVM complains when reading its own assembly file:
 $ clang --save-temps -c comdat.ll
comdat.s:3:2: warning: setting incorrect section attributes for .text.test
        .section        .text.test,"axG",@progbits,test,comdat
        ^
The object file is still fine though:
 $ objdump -h comdat.o
[...]
  1 .group        00000008  0000000000000000  0000000000000000  00000078  2**2
                  CONTENTS, READONLY, EXCLUDE, GROUP, LINK_ONCE_DISCARD
  2 .text.test    00000001  0000000000000000  0000000000000000  00000040  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
[...]

I'm seeing the same problem for OpenMP offloading which also makes use of
COMDAT sections.
(1) Is the above LLVM IR incorrect? or
(2) Is the check overly strict? Maybe there is a valid set of (optional) flags
that can be attached to these sections?</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>