[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Portable inline asm to get address of TLS variable
|
From: |
Florian Weimer |
|
Subject: |
Re: Portable inline asm to get address of TLS variable |
|
Date: |
Wed, 16 Feb 2022 21:46:02 +0100 |
|
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
* Stefan Hajnoczi:
> I'm basically asking whether the &tls_var input operand is treated as
> volatile and part of the inline assembly or whether it's just regular
> C code that the compiler may optimize with the surrounding function?
&tls_var is evaluated outside of the inline assembly, any compiler
barrier will come after that. It's subject to CSE (or whatever it's
called. Three asm statements in a row
asm volatile("" : "=r"(dst_ptr) : "0"(&tls_var));
asm volatile("" : "=r"(dst_ptr) : "0"(&tls_var));
asm volatile("" : "=r"(dst_ptr) : "0"(&tls_var));
result in
movq tls_var@gottpoff(%rip), %rax
addq %fs:0, %rax
movq %rax, %rdx
movq %rax, %rdx
which is probably not what you want.
Thanks,
Florian
- Portable inline asm to get address of TLS variable, Stefan Hajnoczi, 2022/02/16
- Re: Portable inline asm to get address of TLS variable, Florian Weimer, 2022/02/16
- Re: Portable inline asm to get address of TLS variable, Florian Weimer, 2022/02/16
- Re: Portable inline asm to get address of TLS variable, Stefan Hajnoczi, 2022/02/17
- Re: Portable inline asm to get address of TLS variable, Paolo Bonzini, 2022/02/17
- Re: Portable inline asm to get address of TLS variable, Serge Guelton, 2022/02/17
- Re: Portable inline asm to get address of TLS variable, Stefan Hajnoczi, 2022/02/17
- Re: Portable inline asm to get address of TLS variable, Paolo Bonzini, 2022/02/17
- Re: Portable inline asm to get address of TLS variable, Serge Guelton, 2022/02/17
Re: Portable inline asm to get address of TLS variable, Paolo Bonzini, 2022/02/16