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

    <tr>
        <th>Summary</th>
        <td>
            llvm-strip utility strips debuglink sections by default whereas GNU strip does not
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    I ran into a problem where debug info was not being loaded by gdb. In yocto we split the debug info and keep them separate.
so it turns out to be that when we use `llvm-strip` for providing `STRIP` it ends up eating `.gnu_debuglink` section as well which contains the link to separated out debug info file and hence the debugger can not find the link any more. This is seen with clang-14/clang-15 and trunk too.

Here is a testcase

```
set -x
#CROSS=x86_64-yoe-linux-
#TC=llvm-
rm -rf a.out*
clang -g -xc /dev/null -ffreestanding -shared -o a.out
${CROSS}${TC}objcopy --version
${CROSS}${TC}objcopy --only-keep-debug a.out a.out.dbg
${CROSS}${TC}objcopy --add-gnu-debuglink=a.out.dbg a.out
#${CROSS}${TC}strip --remove-section=.note -o a.out.stripped a.out
${CROSS}${TC}strip -o a.out.stripped a.out
#${CROSS}${TC}objcopy --strip-debug a.out a.out.stripped
${CROSS}readelf -wk a.out.stripped
```

bad 

```
TC=llvm- sh build.sh
```
good
```
sh build.sh
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNVMFu2zAM_Rr7QshwbMdJDj5sC7b1sg1rdy5ki7bVKpIhyUnz96NsN1mBbCsgKJJJPj4-MayNOFd3YLkGqb0BDoM1tcIDnHq0CALrsSNTa-DEHWjjoUapO1CGCxRQn6ETdQJ3Gs6mIYATghuU9OD7N9FcC3hGHML3AzgcuOUekyjdR-kHZyBEjFY7MCOdDGUhT-4DDR1AR4cQlalSxwNz3sqBLtAaG_gepQiU6Mv9w8-7H8FCcKiFg3EA5H6xJp0eHydOSurn4Oaw8dJooNJOqBRlk00PjdGeS-ISagiugdArZTEx_KOyViqcyiOmDV7r7tBCQ7oGzVpJ9gsa12c4GIsJPPTSAS2HoUrpKbfiumOrIso-L8f1BO7tOPEwi2Tz_jW8EcVz8Oh8wx3-aaUKlzWrjB7Yy2LK8k8_v9_fR_n-ZVs-lgU7G2TEbnxhF4-HT2SeFJ8_2QMw2wJPSIEoW5JMLIHRemmAWAs80q5HUpO1rUXiRfzDCzDXc0v6MbNALHmKaPNxJrPZzzdKvNmb-qkxwxkYO6J19Erv9jdanVloNjY_05Rt3hNRd-_G4UIwahl2bZl8f0F5W0P-V7ipWQnM4sEckS0dR0gJNQZexEgmv4HkeY82C-i_Y__O6VriFHlDplfEWzws0l9ftcBOz7e937bdvNdcwD9689pq4HqoR6lE4vqbrp0xtxP9LzDGalWWq7LYpHkZiyoXu3zHYy-9wuo6WGD0kgbYGaabg8vrv04LF6aewJaPys9jksbHl2-_5gAQBqdBGY9WVb33g4tyUvAzrY7-4WOdNOZAl5Bx-WE0xJ4InK7SuREdHdabIt3EfbUrxW5VpLt2vVpt67pe7UTLMxSiEGm5q4tY8RqVq6L1xyjLNJ5ggqBztN7HssrSLEu32TZN882qTPL1FvlmtxVNm615nUZFigcuVRJ4JMZ2sZ21oKIdGZV03l2N3DnZacQpHeHz0ffGVs-WP8VT3mri_Rucyvm8">