Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android UE5: dlopen failed due to TLS model in tracy_rpmalloc.cpp #779

Open
natepaynefb opened this issue Apr 30, 2024 · 1 comment
Open

Comments

@natepaynefb
Copy link

Hi. Thanks for the great profiler! I'm trying to use it in a UE5 project built for Android and deployed onto a Meta Queset VR headset. It crashes immediately with an error of the form:

java.lang.UnsatisfiedLinkError: dlopen failed: TLS symbol "(null)" in dlopened "<path>/libtracy.so" referenced from "<path>/libtracy.so" using IE access model

The dynamic linker is trying to handle the following variable from tracy_rpmalloc.cpp:

static _Thread_local heap_t* _memory_thread_heap TLS_MODEL;

where TLS_MODEL is defined as:

define TLS_MODEL __attribute__((tls_model("initial-exec")))

I can work around this problem by removing the tls_model attribute. Doing so fixes the crash and does not cause any other problems that I have been able to observe. However, I don't feel confident about this fix because I don't know why the specific TLS model was used in the first place.

I also tried compiling with linker flag -fvisibility=hidden. I was hoping that would hide the variable from the dynamic linker entirely, but it did not.

What would you suggest? Would the following revision to tracy_rpmalloc.cpp cause any problems that you are aware of?

#    if !defined(__HAIKU__) && !defined(__ANDROID__)
#      define TLS_MODEL __attribute__((tls_model("initial-exec")))
#    else
#      define TLS_MODEL
#    endif

In case it matters, here are the other defines used when building Tracy:

         -DTRACY_ENABLE=1,
        -DTRACY_FIBERS=1,
        -DTRACY_ON_DEMAND=1,
        -DTRACY_DELAYED_INIT=1,
        -DTRACY_MANUAL_LIFETIME=1,
        -DTRACY_EXPORTS=1,

Thanks for your help.

@wolfpld
Copy link
Owner

wolfpld commented Apr 30, 2024

It would be best to ask about this in rpmalloc: https://github.com/mjansson/rpmalloc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants