<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/56994>56994</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            C++17 leads to linker error with `ld` due to some strange debug info?
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            compiler-rt:asan,
            build-problem
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          tru
      </td>
    </tr>
</table>

<pre>
    As noted in the diff for the C++17 standards upgrade there has been some strange issues after we enabled C++17 with some configurations - this one reported by @dyung 

https://reviews.llvm.org/D130689#3705474

```
[165/1101] Generating GwpAsan-x86_64-Test
FAILED: projects/compiler-rt/lib/gwp_asan/tests/GwpAsan-x86_64-Test 
cd /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/projects/compiler-rt/lib/gwp_asan/tests && /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/./bin/clang++ GwpAsanTestObjects.printf_sanitizer_common.cpp.x86_64.o GwpAsanTestObjects.alignment.cpp.x86_64.o GwpAsanTestObjects.backtrace.cpp.x86_64.o GwpAsanTestObjects.basic.cpp.x86_64.o GwpAsanTestObjects.compression.cpp.x86_64.o GwpAsanTestObjects.iterate.cpp.x86_64.o GwpAsanTestObjects.crash_handler_api.cpp.x86_64.o GwpAsanTestObjects.driver.cpp.x86_64.o GwpAsanTestObjects.mutex_test.cpp.x86_64.o GwpAsanTestObjects.slot_reuse.cpp.x86_64.o GwpAsanTestObjects.thread_contention.cpp.x86_64.o GwpAsanTestObjects.harness.cpp.x86_64.o GwpAsanTestObjects.enable_disable.cpp.x86_64.o GwpAsanTestObjects.late_init.cpp.x86_64.o GwpAsanTestObjects.options.cpp.x86_64.o GwpAsanTestObjects.gtest-all.cc.x86_64.o /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/projects/compiler-rt/lib/gwp_asan/tests/libRTGwpAsanTest.x86_64.a -o /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/projects/compiler-rt/lib/gwp_asan/tests/./GwpAsan-x86_64-Test -ldl -lstdc++ --driver-mode=g++ -pthread -m64
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: DWARF error: invalid or unhandled FORM value: 0x23
GwpAsanTestObjects.backtrace.cpp.x86_64.o: in function `Backtrace_ExceedsStorableLength_Test::TestBody()':
backtrace.cpp:(.text+0xca6): undefined reference to `gwp_asan::AllocationMetadata::kMaxTraceLengthToCollect'
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
```

bot that's failing: https://lab.llvm.org/staging/#/builders/180/builds/7174

This seems like enabling c++17 makes clang emit some kind of DWARF info that's not handled correctly by `ld`?

This is a bit outside my expertise - so maybe we can get some help to fix this issue?

CC @MaskRay for linker stuff and @dwblaikie for DWARF knowledge.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNVktv4zYQ_jXyhZCghy3bBx-ceL0osMECaYAeDUocyawpUiApP_rrOyRlJ9lN4fTQYmFBFsnhzDcPDr9KsctqbYhUFhjhktg9EMabhjRK-8FjlD_gk82JsVQyqpkhQ99qysCtayB7akgFIIlRHaCUprIFwo0ZwBDaWNDkBAQkrQTaeNV34nYf9tRKNrwdNLVcSUNiVMwNURKIhl5pB626kGiasssgWxKlmyhdh_fe2t5ExTrKt_hoOHI4mUSIY5co3eLUJivScrGM8qKYp7PpfPp2d1Sm4xOGs4esnOGmLEuzaLYhX0GCQ4VGv576taEyPi_KXTmNX8DYsGm7_u3blw1CIL1Wf0JtDSqoVddzATrWFkeCV_huT_2Oogr8tLjbiX2gdPSuZgTXj1TftlcDF6xSTt9J6QNop8AMBuKW6kvclYtDXGtlvHmBOQhTgsvhfFvAHLaQ4ce_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