[llvm-bugs] [Bug 38449] New: ELFAsmParser warns on COMDAT sections since r335558

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Aug 5 01:43:06 PDT 2018


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

            Bug ID: 38449
           Summary: ELFAsmParser warns on COMDAT sections since r335558
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: MC
          Assignee: unassignedbugs at nondot.org
          Reporter: hahnjo at hahnjo.de
                CC: llvm-bugs at lists.llvm.org

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", at 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?

-- 
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/20180805/ce5adff0/attachment.html>


More information about the llvm-bugs mailing list