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

    <tr>
        <th>Summary</th>
        <td>
            [LLD] ld64 adds doubled N_SO STABS entry
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            lld:MachO,
            platform:macos
      </td>
    </tr>

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

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

<pre>
    While trying to run the LLDB test suite with a clang configuration on Darwin that uses `ld64.lld` instead of the system `ld`, I discovered that LLDB broadly fails to locate source files for the DWARF (but not dSYM) versions of its test.

The root cause ended up being that these tests had `N_SO` STABS entries of the form `%s/%s`, where the first `%s` is `DW_AT_comp_dir` and the second is `DW_AT_name`. In our case, `DW_AT_comp_dir` is an absolute path, which makes the resulting path invalid. LLDB uses this path without further correction, although strangely I did find iOS specific logic for this.

I ran the same command line against the Darwin system `ld` from XCode v13.2.1, and it produce correct `N_SO` entry for the path.
Accordingly, I've filed this against LLD, since it seems to be an important behavioral difference between it and the Darwin `ld` it's simulating.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsVE9v6zYM_zTKhXiBrcRJfMghr0GBAn0rsBbodipkiba5yVIgUiny7QfZbffesEsMRBT5-0cZZhoC4lE131VzXpksY0zH6caC6TYZGVdddLfj60geQdKNwgASIeUAMiI8Pp6_gyALcCZBeCcZwYD1JgxgY-hpyMkIxQAxwNmkdyoXjUBmZFC7yrvddu29U7sKKLCgcRD7uTkXFNNSpHaV0nfwAI7YxismdEufGUGXonH-Br0hzwWfj9YIAsecLEJPHhn6mOa259fT7_eg9KHLAiEKuOc_fyjdwhUTUwxc5pPwzGutqrOqTsvvy4iQYhSwJjMCBocO8gU6nGUpcGRExvkmw2hcAf_b2_NTYff8cvr-DBgkEfInxz6mmaHSDSt9P38Wqu8jJlxqKLF8FRWdZuXOr2-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