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

    <tr>
        <th>Summary</th>
        <td>
            LLDB relies on linker --apply-dynamic-relocs to print globals on x86-64
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            lldb
      </td>
    </tr>

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

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

<pre>
    LLDB's test suite includes a number of cases where a global string constant is printed, e.g.:
https://github.com/llvm/llvm-project/blob/06adac8c4e26376fb54d87dede3ebce46783010a/lldb/test/API/commands/target/basic/globals.c#L4
https://github.com/llvm/llvm-project/blob/06adac8c4e26376fb54d87dede3ebce46783010a/lldb/test/API/commands/target/basic/TestTargetCommand.py#L170

When building for Debian x86-64 using LLD, these instead print as nullptr. These have RELA dynamic relocations, and the addend is stored in the relocation, while the data section is all zeroes. LLD has a flag, `--apply-dynamic-relocs`, to redundantly store the addend in the data section as well, but it disables it by default, since it's considered to be a legacy behavior. ld and gold, by contrast, both default to this flag being true. Accordingly, the test suite as-is fails for each of these cases when built with LLD in its default configuration.

Seems like LLDB shouldn't depend on this behavior if possible; it should be able to read the value out of the dynamic relocations. 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVE1v4zYQ_TXyZWBBohTJOfiQbGqggA9Fu0DPQ3IksUuTBodKqv76Yqhkd4vupbde_EFxnt6bN2-Q2c2B6Fw9PFcPLwdc8xLT-bZxprTdMC8HHe12vl5fnis1MmTiDLy6TOCC8aslBoSw3jQliBMYZGJ4WygRIMw-avTAObkwg4mBM4YMjuGeXMhkK_UJqJ7rqnuqmpeqeVpyvrP8U5dKXWaXl1XXJt4qdfH-9ePreE_xDzK5Uhfto67UpRnQojmZntTQjcOkH3p7Gi1Z6kgb6ofx1DVtgwXASoUoqdTl6ZefK3Ux8XbDYFnOMc1Uk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