Re: How to make gcc generate optimized code for statically linked TLS

2013-07-14 Thread Vitali Sokhin
Thank you, with -ftls-model=local-exec gcc emits code that calculates offset at link time: threadedVar = 0xDEAD; 1125c:d53bd041 mrsx1, tpidr_el0 11260:91401020 addx0, x1, #0x4, lsl #12 11264:9105a000 addx0, x0, #0x168 11268:529bd5a2 movz

RE: How to make gcc generate optimized code for statically linked TLS

2013-07-14 Thread Pinski, Andrew
Yes don't compile with -fPIC or compile with -ftls-model=local-exec . Thanks, Andrew Pinski From: linaro-toolchain-boun...@lists.linaro.org on behalf of Vitali Sokhin Sent: Sunday, July 14, 2013 12:21 AM To: linaro-toolchain@lists.linaro.org Subject: How to mak

How to make gcc generate optimized code for statically linked TLS

2013-07-14 Thread Vitali Sokhin
Hello, I use gcc-linaro-aarch64-linux-gnu-4.8 to compile my C code with thread-local variables. Here is an example of my C code: __thread u32 threadedVar; void test(void) { threadedVar = 0xDEAD; } gcc produces the following assembly to access my threaded variable: threadedVar = 0xDEAD;