Android tls issue

Newbie2019 newbie2019 at gmail.com
Sun Jun 23 15:34:40 UTC 2019


_tlsstart/_tlsend in the file druntime/src/rt/sections_android.d 
defined with extern:

extern(C)
{
     /* Symbols created by the compiler/linker and inserted into 
the
      * object file that 'bracket' sections.
      */
     extern __gshared
     {
         void* __start_deh;
         void* __stop_deh;
         version (LDC)
         {
             void* __start___minfo;
             void* __stop___minfo;
         }
         else
         {
             void* __start_minfo;
             void* __stop_minfo;
         }

         version(X86) size_t _end;
         else version(X86_64) size_t _end;
         else version(ARM) size_t __bss_end__;
         else version(AArch64) size_t __bss_end__;
         else static assert( false, "Android architecture not 
supported." );

         int _tlsstart;
         int _tlsend;
     }
}

  I can not find the position of _tlsstart/_tlsend.  I try build 
this example get this error:

extern(C) __gshared extern {
         int _tlsstart;
         int _tlsend;
}
int tls_v1 = 1;
void main(string[] args){
}

/data/data/com.termux/files/usr/bin/aarch64-linux-android-ld: 
/data/data/com.termux/files/usr/bin/../lib/libdruntime-ldc.a(sections_android.o): in function `_D2rt16sections_android12initSectionsFNbNiZv':
sections_android.d:(.text._D2rt16sections_android12initSectionsFNbNiZv[_D2rt16sections_android12initSectionsFNbNiZv]+0x54): undefined reference to `_tlsend'
/data/data/com.termux/files/usr/bin/aarch64-linux-android-ld: 
sections_android.d:(.text._D2rt16sections_android12initSectionsFNbNiZv[_D2rt16sections_android12initSectionsFNbNiZv]+0x64): undefined reference to `_tlsend'
/data/data/com.termux/files/usr/bin/aarch64-linux-android-ld: 
/data/data/com.termux/files/usr/bin/../lib/libdruntime-ldc.a(sections_android.o): in function `__tls_get_addr':
sections_android.d:(.text.__tls_get_addr[__tls_get_addr]+0x50): 
undefined reference to `_tlsstart'
/data/data/com.termux/files/usr/bin/aarch64-linux-android-ld: 
sections_android.d:(.text.__tls_get_addr[__tls_get_addr]+0x58): 
undefined reference to `_tlsstart'
/data/data/com.termux/files/usr/bin/aarch64-linux-android-ld: 
sections_android.d:(.text.__tls_get_addr[__tls_get_addr]+0x6c): 
undefined reference to `_tlsend'
/data/data/com.termux/files/usr/bin/aarch64-linux-android-ld: 
sections_android.d:(.text.__tls_get_addr[__tls_get_addr]+0x70): 
undefined reference to `_tlsend'
clang-8: error: linker command failed with exit code 1 (use -v to 
see invocation)
Error: /data/data/com.termux/files/usr/bin/gcc failed with 
status: 1

Is this a bugs ?  or the _tlsstart/_tlsend is some symbols import 
from android system lib ?






More information about the digitalmars-d-ldc mailing list