Dan Olson <zans.is.for.c...@yahoo.com> writes:
>
> For Android, LDC generates the usual .tbss/.tdata sections for TLS vars
> and __aeabi_read_tp() when needed to lookup the base address.
>
>   ldc2 -mtriple=thumbv7-linux-anrdoideabi -output-s test.d 
>
>   tlsvar = 42;
>
>       ldr     r1, .LCPI1_0
>       movs    r2, #42
>       bl      __aeabi_read_tp
>       str     r2, [r0, r1]
>
> For iOS, I then added what was missing from the OS loader to find TLS
> sections and provide the lookup function to lazy init TLS block and
> return address.  These are just linked in with the app instead being
> provided by OS libs and kernel.  At that point, it looked to
> ldc_sections.d like normal OSX TLS.
>
> I would guess you could do the same for Android/ARM with LDC and make it
> look like linux to ld_sections.

As PIC:
  ldc2 -mtriple=thumbv7-linux-androideabi -output-s -relocation-model=pic -O 
tls1.d

        ldr     r0, .LCPI1_0
.LPC1_0:
        add     r0, pc
        bl      __tls_get_addr(PLT)
        movs    r1, #42
        str     r1, [r0]

Shouldn't that work?

Reply via email to