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

    <tr>
        <th>Summary</th>
        <td>
            lld error "undefined symbol: _GLOBAL_OFFSET_TABLE_ " with LTO
        </td>
    </tr>

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

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

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

<pre>
    The following test file fails with LTO when compiled for x86. Other arches or bfd don't seem to exhibit this.

```sh
$ cat clang-bug.c 
void a(void) {}
void _start(void) { a(); }

$ clang -target i386-pc-linux-gnu -fuse-ld=lld -nostdlib -o /dev/null clang-bug.c

$ clang -target i386-pc-linux-gnu -fuse-ld=lld -nostdlib -o /dev/null clang-bug.c -flto
ld.lld: error: undefined symbol: _GLOBAL_OFFSET_TABLE_
>>> referenced by ld-temp.o
>>> lto.tmp:(_start)
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8U82OozwQfBpzaYGMnfBz4JAow3eJlMOXe2RwA941dmSbJPP2K5Ps7Myc9rSSBZa7mipc1cJ7NRrEhmz3ZHtIxBIm65oZ5YTDaJPOyvfmPCEMVmt7V2aEgD7AoDTCIJT2cFdhguP5BPcJDfR2viqNEgbr4FEVGZzChA6E6yf0YB10gwRpDWFlAI84Q7CAj0l1KkCYlM8IPRC6ez0L-lx-eh2wDfQiQK-FGdNuGbMenpWbVRIEYVXcEFYDKfekPHwqXnwQLnxFrB2E1YTv4QP9iSrSQBqEGzGA4lWRXvtUK7M80tEskA6Lx1RLwg9aS0iN9UFq1UFqgbBW4o2w1ixafxb8T0ggHXSwTxItMx3bd4DOWRc3i5E4KIMS_PvcWR3PLv8dT_vd8XJq2__fzpfzbn98u7xk8rfnAocDOjQ9SujeQcs04HzN7HeYDjYL85XwHWHV74uvn6inynz7RZBW5ie6mJ9ZGLlmC-UzXPhQAXorEXIgrFo8QnqLsfGIoMzN9iKomKj6W2gS2XBZ81ok2ORFWRZ1WTCWTE1eF5L2Oc-3Ii8p5XxbCbEZeLGpRMfyIlENo4xTTvO8psW2yrDkBe3qoS6k5JRxsqE4C6UzrW9zZt2YKO8XbIo8p3miRYfar0PFmME7rEXCWJwx18Se6JInG6qVD_7PV4IKGpto83ozQBj7a6si-GMck8XpZgrh6lcPWsLaUYVp6bLezoS1kfH1Sq_O_sA-ENauOj1h7fofvwIAAP__71NFSQ">