Issue 115706
Summary LLD strips PC-TABLE data lld:ELF
Labels lld
Assignees
Reporter noam1610
    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 ? 
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to