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

    <tr>
        <th>Summary</th>
        <td>
            ld.lld: Symbol in executable has `NULL` instead of a reloc value
        </td>
    </tr>

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

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

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

<pre>
    I'm trying to compile a binary, and export a symbol, but when it requires relocation, ld.lld emits `0x0` whereas GNU linker correctly generates the relocation value.

# Reproduction
```c
// main.c
__attribute__((visibility("default"))) const char *EXPORTED_VAR = "HelloWorld";

int main() {
    return 0;
}
```

# Expected (GNU Linker)
```sh
$ clang ./main.c -fPIC -o main -Wl,--export-dynamic 
$ gdb -nx -batch -q ./main  -ex "p/s (char*) EXPORTED_VAR" 
    $1 = 0x2004 "HelloWorld"
```

# Actual (LD.LLD)
```sh
$ clang ./main.c -fPIC -o main -Wl,--export-dynamic -fuse-ld=lld
$ gdb -nx -batch -q ./main  -ex "p/s (char*) EXPORTED_VAR" 
    $1 = 0x0
```

The only difference between the commands is `-fuse-ld=lld`. Even though I've mentioned `-Wl,--export-dynamic`, lld seems to not relocate the symbol in the resultant binary. Is there something I'm missing in terms of LLD specific flags?

## Tested on
```
Ubuntu clang version 15.0.6
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
```
This bug is still present in the `master` branch

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8Vd2O2zYTfRr6ZiCBomTZvvCFE6-_bwE3Dba7Te8MihxJbClS4Y_XfvuCkje73QS5awHBBn-GPHNmziH3XnUGcUuWH8hyv-Ax9NZtf-E-oNs9o7cDLhorr9t7wlYDBHdVpoNgQdhhVBqBQ6MMd1fCPgI3EvAyWheAg78OjdVpuokBnns0oAI4_BqVQw8OtRU8KGvSF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