Android tls issue

Newbie2019 newbie2019 at gmail.com
Sun Jun 23 17:45:54 UTC 2019


On Sunday, 23 June 2019 at 17:09:32 UTC, kinke wrote:
> On Sunday, 23 June 2019 at 15:34:40 UTC, Newbie2019 wrote:
>> Is this a bugs ?  or the _tlsstart/_tlsend is some symbols 
>> import from android system lib ?
>
> These 2 symbols are inserted by the compiler into the object 
> file containing the D main function, see 
> https://run.dlang.io/is/QDwmHM. What triple are you using? Make 
> sure there's an `-android` at the end.

here is my cmake options:

D_FLAGS:STRING=-mtriple=aarch64-unknown-linux-android
LDC_TARGET_PRESET:STRING=Android-aarch64
TARGET_SYSTEM:STRING=Android


But when I run ninjia -8,  the D_FLAGS seems not used:

/data/data/com.termux/files/usr/bin/ldmd2 -c -wi -O -inline 
-release -J/data/data/com.termux/files/home/d/ldc/res 
-I/data/data/com.termux/files/home/d/ldc 
-I/data/data/com.termux/files/home/d/tmp -version=IN_LLVM 
-of/data/data/com.termux/files/home/d/tmp/obj/ldc2.o 
/data/data/com.termux/files/home/d/ldc/dmd/access.d 
/data/data/com.termux/files/home/d/ldc/dmd/aggregate.d 
/data/data/com.termux/files/home/d/ldc/dmd/aliasthis.d 
/data/data/com.termux/files/home/d/ldc/dmd/apply.d 
/data/data/com.termux/files/home/d/ldc/dmd/argtypes.d 
/data/data/com.termux/files/home/d/ldc/dmd/argtypes_sysv_x64.d 
/data/data/com.termux/files/home/d/ldc/dmd/arrayop.d 
/data/data/com.termux/files/home/d/ldc/dmd/arraytypes.d 
/data/data/com.termux/files/home/d/ldc/dmd/ast_node.d 
/data/data/com.termux/files/home/d/ldc/dmd/astcodegen.d 
/data/data/com.termux/files/home/d/ldc/dmd/attrib.d 
/data/data/com.termux/files/home/d/ldc/dmd/blockexit.d 
/data/data/com.termux/files/home/d/ldc/dmd/builtin.d 
/data/data/com.termux/files/home/d/ldc/dmd/canthrow.d 
/data/data/com.termux/files/home/d/ldc/dmd/cli.d 
/data/data/com.termux/files/home/d/ldc/dmd/clone.d 
/data/data/com.termux/files/home/d/ldc/dmd/compiler.d 
/data/data/com.termux/files/home/d/ldc/dmd/complex.d 
/data/data/com.termux/files/home/d/ldc/dmd/cond.d 
/data/data/com.termux/files/home/d/ldc/dmd/console.d 
/data/data/com.termux/files/home/d/ldc/dmd/constfold.d 
/data/data/com.termux/files/home/d/ldc/dmd/cppmangle.d 
/data/data/com.termux/files/home/d/ldc/dmd/cppmanglewin.d 
/data/data/com.termux/files/home/d/ldc/dmd/ctfeexpr.d 
/data/data/com.termux/files/home/d/ldc/dmd/ctorflow.d 
/data/data/com.termux/files/home/d/ldc/dmd/dcast.d 
/data/data/com.termux/files/home/d/ldc/dmd/dclass.d 
/data/data/com.termux/files/home/d/ldc/dmd/declaration.d 
/data/data/com.termux/files/home/d/ldc/dmd/delegatize.d 
/data/data/com.termux/files/home/d/ldc/dmd/denum.d 
/data/data/com.termux/files/home/d/ldc/dmd/dimport.d 
/data/data/com.termux/files/home/d/ldc/dmd/dinterpret.d 
/data/data/com.termux/files/home/d/l
32419 u0_a167   0:09 /data/data/com.termux/files/usr/bin/ldc2 
-ldmd -c -wi -O -enable-inlining -Hkeep-all-bodies -release 
-J/data/data/com.termux/files/home/d/ldc/res 
-I/data/data/com.termux/files/home/d/ldc 
-I/data/data/com.termux/files/home/d/tmp -d-version=IN_LLVM 
-of/data/data/com.termux/files/home/d/tmp/obj/ldc2.o 
/data/data/com.termux/files/home/d/ldc/dmd/access.d 
/data/data/com.termux/files/home/d/ldc/dmd/aggregate.d 
/data/data/com.termux/files/home/d/ldc/dmd/aliasthis.d 
/data/data/com.termux/files/home/d/ldc/dmd/apply.d 
/data/data/com.termux/files/home/d/ldc/dmd/argtypes.d 
/data/data/com.termux/files/home/d/ldc/dmd/argtypes_sysv_x64.d 
/data/data/com.termux/files/home/d/ldc/dmd/arrayop.d 
/data/data/com.termux/files/home/d/ldc/dmd/arraytypes.d 
/data/data/com.termux/files/home/d/ldc/dmd/ast_node.d 
/data/data/com.termux/files/home/d/ldc/dmd/astcodegen.d 
/data/data/com.termux/files/home/d/ldc/dmd/attrib.d 
/data/data/com.termux/files/home/d/ldc/dmd/blockexit.d 
/data/data/com.termux/files/home/d/ldc/dmd/builtin.d 
/data/data/com.termux/files/home/d/ldc/dmd/canthrow.d 
/data/data/com.termux/files/home/d/ldc/dmd/cli.d 
/data/data/com.termux/files/home/d/ldc/dmd/clone.d 
/data/data/com.termux/files/home/d/ldc/dmd/compiler.d 
/data/data/com.termux/files/home/d/ldc/dmd/complex.d 
/data/data/com.termux/files/home/d/ldc/dmd/cond.d 
/data/data/com.termux/files/home/d/ldc/dmd/console.d 
/data/data/com.termux/files/home/d/ldc/dmd/constfold.d 
/data/data/com.termux/files/home/d/ldc/dmd/cppmangle.d 
/data/data/com.termux/files/home/d/ldc/dmd/cppmanglewin.d 
/data/data/com.termux/files/home/d/ldc/dmd/ctfeexpr.d 
/data/data/com.termux/files/home/d/ldc/dmd/ctorflow.d 
/data/data/com.termux/files/home/d/ldc/dmd/dcast.d 
/data/data/com.termux/files/home/d/ldc/dmd/dclass.d 
/data/data/com.termux/files/home/d/ldc/dmd/declaration.d 
/data/data/com.termux/files/home/d/ldc/dmd/delegatize.d 
/data/data/com.termux/files/home/d/ldc/dmd/denum.d 
/data/data/com.termux/files/home/d/ldc/dmd/dimport.d 
/data/data/com.termux/files/home/d/ldc/dmd/dinterpret.d /d



try with example file from termux also get this error:

ldc2 -mtriple=aarch64-unknown-linux-android test.d
ldc2 -mtriple=aarch64-linux-android test.d

/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



More information about the digitalmars-d-ldc mailing list