<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64469>64469</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Segmentation fault occurs due to the use of static parameters in ThreadSanitizer
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Lantern-r
</td>
</tr>
</table>
<pre>
When using the example code simple_race.cc, enabling the -static parameter will cause the code to segfault
```shell
➜ DataRaceTest clang++ simple_race.cc -fsanitize=thread -fPIE -g -static -o simple_race_static
➜ DataRaceTest ./simple_race_static
[1] 4011847 segmentation fault (core dumped) ./simple_race_static
➜ DataRaceTest clang++ simple_race.cc -fsanitize=thread -fPIE -g -o simple_race_static
➜ DataRaceTest ./simple_race_static
==================
WARNING: ThreadSanitizer: data race (pid=4012114)
.................
==================
ThreadSanitizer: reported 1 warnings
```
**Suggested modification: Add code similar to ASan**
```shell
➜ DataRaceTest clang++ simple_race.cc -fsanitize=address -fPIE -g -static -o simple_race_static
........
`__asan::AsanDoesNotSupportStaticLinkage()':
.........
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VFGPozYQ_jXmZUQEBpLwwENybKqTTqvqctI9RoM9gFtjI9t02_76yiS37eW2K7WrRZZBZr7x9409H3qvBkPUsOrIqjbBJYzWNZ_QBHImdUln5R_N15EMLF6ZAcJIQL_jNGsCYSWBV_H74lDQRgjGPwAZ7PS32NQHDErAjA4nCuTgSWkNAhdPa8CaJFjwNPS46MCylmWH27zNrsOPpPVt7YGz-oHVHwBaDPgZBX0hH0BoNAPjR8aPd5wg7T0aFdSfxIo2jI5QQtr__PEB0uGZYGr_CbtcV1_fcsP46UcM3EDVMWdVCwBQZnm-L3dR4kQmBlkDq1hgfC-sI5DLNJNkvIZ_yfpO4l8SDW9RXbT_Z6zYr4fPjx8ff2LFAb6sPM834i4uSQwIccNYs1lJVrRllvM8Lxmvrwk298_bOb1AxNFsXSAJOTyhM8oM_u62fneFeRznZRjIR9BkpeqVWO9AzHaQ8rmPlEYXW-FwRnPFvXczoJSOvP9P3fCtuPBM63JBj1ENKw4Hj6a15B9tOC9zrNR5xX5S5lcciPF9PC6-i9HfH9prRVznRDaFrIsaE2rybZ0XeVHxMhkb5Dsksce-7_O8K7dFV-d9XfCO11hhVieq4Rkvsn22zep8X5Yb3EnBqyzr-rImWdWszGhCpTda_zZtrBsS5f1CzbYst3WisSPtV4vk3NATrD8Z59ExXRMxabcMnpWZVj74v7MEFTQ15x_73gqxOA9yWb0v-mD0Q9vDvV16UOa-HZLF6WYMYfaxivzE-GlQYVy6jbAT46e4_e2Vzs7-QiIwflpJe8ZPq6i_AgAA___xd8_q">