[llvm-bugs] [Bug 45022] New: [compiler-rt] .init_array section cmake check fails silently when -DLLVM_PROFDATA_FILE passed

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Feb 25 10:27:23 PST 2020


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

            Bug ID: 45022
           Summary: [compiler-rt] .init_array section cmake check fails
                    silently when -DLLVM_PROFDATA_FILE passed
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: zhizhouy at google.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

This bug happens after https://reviews.llvm.org/rL372209 is in.

To reproduce:

1. cmake -G Ninja -DLLVM_ENABLE_PROJECTS=compiler-rt \
-DLLVM_PROFDATA_FILE=/foo/bar.profdata path-to-llvm

2. Build llvm and `objdump -D
lib64/clang/10.0.0/lib/linux/clang_rt.crtbegin-x86_64.o`:

Disassembly of section .ctors:

0000000000000000 <.ctors>:
   0:   ff                      (bad)
   1:   ff                      (bad)
   2:   ff                      (bad)
   3:   ff                      (bad)
   4:   ff                      (bad)
   5:   ff                      (bad)
   6:   ff                      (bad)
   7:   ff                      .byte 0xff

Disassembly of section .bss.__do_fini.__finalized:

0000000000000000 <.bss.__do_fini.__finalized>:
        ...

Disassembly of section .dtors:

0000000000000000 <.dtors>:
   0:   ff                      (bad)
   1:   ff                      (bad)
   2:   ff                      (bad)
   3:   ff                      (bad)
   4:   ff                      (bad)
   5:   ff                      (bad)
   6:   ff                      (bad)
   7:   ff                      .byte 0xff



Root cause:

check_cxx_section_exists() in compiler-rt/lib/crt/CMakeLists.txt will fail
silently when -DLLVM_PROFILE_FILE is passed, causing .init_array section check
to return False after this check, and later compiler will generate objects with
bad .ctors/.dtors section.

To make this hidden error show up:

Adding command to print execution result error after `COMMAND
${test_compiler_command}` in compiler-rt/lib/crt/CMakeLists.txt,

error: Could not read profile
"/usr/local/google/home/zhizhouy/chromiumos/src/scripts/Workspace/llvm.profdata":
No such file or directory

-- 
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/20200225/5ebd2376/attachment.html>


More information about the llvm-bugs mailing list