On 03/08/2015 07:28 PM, Michael Cronenworth wrote:
The attached test case is getting the offset location of a TLS variable. When compiled with -O0 the test case compiles. When compiled with -O1 the test case will not compile with an error for an undefined reference to the TLS variable. If you move the THREAD_VAR_OFFSET macro call to main() gcc will compile without error. Any suggestions?
FYI: The issue is resolve when using __attribute__((used)) on the global variable.