RDP1974 40 Posted March 20, 2021 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
KodeZwerg 54 Posted March 20, 2021 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 Posted March 21, 2021 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
RDP1974 40 Posted March 21, 2021 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
David Heffernan 2345 Posted March 21, 2021 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
RDP1974 40 Posted March 22, 2021 https://quality.embarcadero.com/browse/RSP-33463 Share this post Link to post