<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/115706>115706</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
LLD strips PC-TABLE data lld:ELF
</td>
</tr>
<tr>
<th>Labels</th>
<td>
lld
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
noam1610
</td>
</tr>
</table>
<pre>
I am compiling some C code (hello_world.c) as an example with SanitizerCoverage (trace-pc-guard and pc-table).
Changing the linker to lld (with --fuse-ld=lld) strips the pcs addresses from the table:
Here are the 2 examples:
1. Default linker
Compiling:
```
clang-18 hello_world.c -o hello_world -fsanitize-coverage=trace-pc-guard,pc-table
```
Looking at the pc-table section in the elf sections ( __sancov_pcs)
```
llvm-readelf-20 ./hello_world -x __sancov_pcs
> 0x00046b70 **50ea0200** 00000000 01000000 00000000
```
You can see that the address of the instrumented basic block is written
2. Using lld as a linker
Compiling:
```
clang-18 hello_world.c -o hello_world -fsanitize-coverage=trace-pc-guard,pc-table --fuse-ld=lld
```
Looking at the pc-table section in the elf sections ( __sancov_pcs)
```
llvm-readelf-20 ./hello_world -x __sancov_pcs
> 0x00047430 **00000000** 00000000 01000000 00000000
```
You can see that the address of the instrumented basic block is 0
Are there some conflicts between SanitizerCoverage and the Linker ?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUVM-PszYQ_WvMZQQyJpsfBw75ko1aKYdKbQ89rQZ7AHeNjWyzu-1fXxlIv80q9_azIgcPnnnj98zDEHRniWr29I09nTOcYu98bR0O5bbkWePUX_XPgANIN4zaaNtBcAPBCaRTBEzsezLGvbw7b1QhmTgABkAL9IHDaAjedezhV7Q66r_Jn9wbeezmxOhRUj7KvJvQK0CrYJR5xMYQE4eC8TPjx1OPtkuosScw2r6Sh-jAGJVKzMXzvJ0C5Uax6myMSi2E6PUY5pxRBkClPIVAAVrvhjm8wFTHBWWZfyJPgJ7mDeJ2gvBlV1nAmVqcTFz7-fzydGPpe9KWr795KQ3aLi_3cEcb5O5zAPI2rIzlcmWMVed7wpg43eiCh1DLfHXuNfGHcaVjTQkko3YWtJ3jZNpbKCRm4eUloJXu7WWUgYnDQwRj3obcEyoybS44FExc7o7xcV9mqVE9A__gnG-2zY4DE0cmjk-ckAvOlxXwdQAvbw_reNjHH24CiRYCJe3Wk66ig2vnpbYh-mkgG0lBg0FLaIyTr6ADvHsdI9nPtIkCfg-Jt3TT0o3-_4j99b7_kNrvNtVN-3-l_U-0vyNsmY-LBXharE462xotY4CG4juRfWBnybwS0nVxKFZdIFN1pQ7VATOqy11VVqIsDyLr692O76mpGpQ7QrFtUZaHbSu2skRFm-qQ6VpwsSnT4FVVioKobZq2aXZNuac9r9iG04DaFEmEwvku0yFMVJfl045vM4MNmTBbuhCzI4rk7b6eNWumLrANNzrE8L1A1NFQfb2eb975yyn_7fjt-gwKI6avgFXH5-slm7yp-xjH2RbFhYlLp2M_NYV0AxOXVHD9y0fv_iQZmbjM7QUmLmuHb7X4JwAA__-p8P6e">