Jump to content
Sign in to follow this  
RDP1974

[dcc64 Error] E2216 Can't handle section '.tls$' in object file

Recommended Posts

hello dear community,

 

I'm doing a C library conversion producing .o static files

 

However now I'm stopped by this linker error:

[dcc64 Error] E2216 Can't handle section '.tls$' in object file

 

Can be possible to solve this problem with C compiler options making the files? I'm using clang 11

 

Thank you

Share this post


Link to post

This does not help much to solve, just to understand.

http://docwiki.embarcadero.com/RADStudio/Sydney/en/E2216_Can't_handle_section_'%s'_in_object_file_'%s'_(Delphi)

Quote

You are trying to link object modules into your program with the $L compiler directive. However, the object file is too complex for the compiler to handle. For example, you may be trying to link in a C++ object file. This is not supported.

 

Share this post


Link to post
Guest
11 hours ago, RDP1974 said:

Can be possible to solve this problem with C compiler options making the files? I'm using clang 11

I don't have an answer, but the documentation is your guide

https://clang.llvm.org/docs/UsersManual.html#cmdoption-ftls-model

https://clang.llvm.org/docs/UsersManual.html#cmdoption-femulated-tls

https://clang.llvm.org/docs/UsersManual.html#cmdoption-fopenmp-use-tls

 

These control thread variables in clang compiler, but may be, just may be that your C code and its library does have control over to use thread vars or not, so check that out.

 

Also you must understand that .TLS and .TLS$ sections are the storage place for thread variables, in Delphi you declare them with threadvar.

More details on these sections 

https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#the-tls-section

 

Share this post


Link to post

this E2216 should be solved in the Delphi/Linker compiler

 

example with Clang 11 a large ecosystem of C libraries can be compiled without rely on VisualC runtime (further Windows 10 comes with VC 2015 crt by default).

So we can embed objects without redistribute any DLL or dependancies!

 

Share this post


Link to post

The simple solution is to put this code in a DLL. Use a side by side assembly manifest to make it self contained. 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×