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

    <tr>
        <th>Summary</th>
        <td>
            [lld] relocation R_AARCH64_ABS64 cannot be used against local symbol
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            lld
      </td>
    </tr>

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

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

<pre>
    My test case is
```assembly
.text

.global gf_vect_mad_neon
.type gf_vect_mad_neon, %function

x_const         .req    x0
q_tmp .req    q1

gf_vect_mad_neon:
        ldr     x_const, =const_tbl
        ldr     q_tmp, [x_const]
        ret

.section .data
.balign 8
const_tbl:
        .dword 0x0000000000000000, 0x0000000000000000
        .dword 0xffffffffffffffff, 0xffffffffffffffff
```
It is okay when I use ld but fails with lld (I use LLVM 17)
```
$ clang test.S -c
$ clang test.o -fPIC -shared -o libtest.so
# It is okay

$ clang test.o -fPIC -shared -o libtest.so -fuse-ld=lld
ld.lld: error: relocation R_AARCH64_ABS64 cannot be used against local symbol; recompile with -fPIC
>>> defined in test.o
>>> referenced by test.o:(.text+0x10)
clang: 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/eJykVE2PozgQ_TXmUgIZAyEcOCSdjbalGWk1I-01MnZBvGPstG3Syb9fYZLpr1xWa6HYVL2qelWPmHuvBoPYkmpLql3Cp3C0rkXuw5YVRdJZeW2_XyGgDyC4R1Ce0B2hG7Kiy8O9x7HT18WcBbyEG2IxDNp2XMPQH84owmHk8mDQmjv8esKvPvYEhFX9ZERQd-jyezkIa3yA-8ocvsz7hS7-l0MYT7-tL_n72C9lipvjnkxLF_dbkUij2MXzIXT6MThWjNBqew-sdh-xDj_OxGNsDDLJA7_ZOq7VYGC9vL4V_Uwyk6_WSaAX-mnNHB5YHwf3n9YS_MX6Uerl9TmA8mB_8Su8HtHAM0weQUvopgA9V9rDqwpH0FoCYevF_e3b398hrwlrHuYkrAShuRnil5b9hFQ8dFhI-7-enyD1R-5QQmpBqy66vL1HFPBG8f3Y_0suSPvJY6olKXZayyWBltl8LjaAzlk3HxxqK3gU88dhs_nx9OeqPGy2P1clCG6MDdDhPAAJfOBq_nJnvAZ_HTurSbEFh8KOJ6VxmVrkdONb_LE8ILFXBiUoc6P-GeCwR4dGoITuescUG8LWyx-Sbeklp7-nH6fwoQ-tzC90IOw4ciOjjCgXRnhRAYSVCPms56xmeoZgwSOCMudb_1-lTWRbyKZoeIJtXrOc5ZSuaHJsV3VdVSvOZdFgwwRbFyWrRNHz9aqQvawT1TLKSlrnNW2qktGs52Wfr3Mha7qWtFuRkuLIlc60Po-ZdUOivJ-wbRrW1InmHWof7zTGZsUYmy83187otJsGT0qqlQ_-LT6ooOM1OOOr3f8UNpmcbo8hnHxUYU_YflDhOHWZsCNh-7nsbUtPzv6DIhC2jz14wvZLG-eW_RsAAP__Xe2vXg">