Issue 91312
Summary miscompile TLS wrapper, likely coroutine related, with sanitizer
Labels new issue
Assignees
Reporter avikivity
    Prior to 533b7c1f6c696817df332cc7c9acbe3b454eadf2, compiling some coroutine that references a TLS variable generates this wrapper:

```
0000000000029d80 <_ZTWN2db13schema_tablesL14the_merge_lockE>:
   29d80: 50 	pushq	%rax
   29d81: e8 4a b3 10 00 	callq	0x1350d0 <__tls_init>
   29d86: 64 48 8b 04 25 00 00 00 00 	movq	%fs:0x0, %rax
   29d8f: 48 8d 80 00 00 00 00 	leaq	(%rax), %rax
		0000000000029d92: R_X86_64_TPOFF32	_ZN2db13schema_tablesL14the_merge_lockE
   29d96: 59 	popq	%rcx
   29d97: c3 	retq
   29d98: 0f 1f 84 00 00 00 00 00 	nopl	(%rax,%rax)
```

It correctly calls __tls_init.

With 533b7c1f6c696817df332cc7c9acbe3b454eadf2 and later, up to 18.1.1, the following TLS wrapper is generated:

```
0000000000029d80 <_ZTWN2db13schema_tablesL14the_merge_lockE>:
   29d80: 50 	pushq	%rax
   29d81: e8 00 00 00 00 	callq	0x29d86 <_ZTWN2db13schema_tablesL14the_merge_lockE+0x6>
		0000000000029d82: R_X86_64_PLT32	_ZTH15data_type_for_vIN7seastar13basic_sstringIcjLj15ELb1EEEE-0x4
 29d86: 64 48 8b 04 25 00 00 00 00   	movq	%fs:0x0, %rax
   29d8f: 48 8d 80 00 00 00 00         	leaq	(%rax), %rax
		0000000000029d92: R_X86_64_TPOFF32	_ZN2db13schema_tablesL14the_merge_lockE
   29d96: 59 	popq	%rcx
   29d97: c3 	retq
   29d98: 0f 1f 84 00 00 00 00 00 	nopl	(%rax,%rax)
```

The call to __tls_init was replaced by a call to some random function. When the coroutine is then called, it does not inirialize the object.

I will follow up with a full reproducer.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to