intel / intel/confidential-computing.sgx.sdk

SGX thread_local variable causes link error: undefined reference to `__cxa_thread_atexit'

Open
#37 13 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
2
Forks
3
PR merge metrics
No merged PRs in 30d

Description

Hello, I have a linking error inside SGX enclaves when using thread_local variables:
For example:
thread_local MyStruct tl_var { };

Errors:
Enclave/Enclave.o: In function __tls_init:
Enclave.cpp: undefined reference to `__cxa_thread_atexit'

How could I solve this problem please ?

Contributor guide

Open the contributing guide

Research direction

Start with the thread_local example and the linker output for Enclave/Enclave.o and Enclave.cpp. Investigate how the SGX enclave build handles the missing __cxa_thread_atexit symbol and compare the supported C++ thread-local behavior. Done means the enclave links successfully when using the shown thread_local variable.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.