Open Source & Linux Lab

It's better when it's simple

User Tools

Site Tools


etc:users:jcmvbkbc:binutils-xtensa

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
etc:users:jcmvbkbc:binutils-xtensa [2024/02/25 14:28] jcmvbkbcetc:users:jcmvbkbc:binutils-xtensa [2024/03/06 05:22] – add TLS link time optimizations jcmvbkbc
Line 1: Line 1:
-===== binutils support for Xtensa =====+====== binutils support for Xtensa ======
  
   * git tree: https://github.com/jcmvbkbc/binutils-gdb-xtensa   * git tree: https://github.com/jcmvbkbc/binutils-gdb-xtensa
  
-==== FDPIC support ====+===== FDPIC support =====
  
   * [+] static linking   * [+] static linking
Line 11: Line 11:
   * [-] TLS   * [-] TLS
  
-==== FDPIC instruction sequences ====+===== FDPIC instruction sequences =====
  
-=== Local call ====+==== Local call ====
  
 Default local call Default local call
Line 44: Line 44:
 </code> </code>
  
-=== PLT call ====+==== PLT call ====
  
 Obvious version: Obvious version:
Line 73: Line 73:
 </code> </code>
 that reduces the inline part from 14 to 5 bytes, but adds two jumps to each call and some special logic to the resolver to avoid name resolution on each call. that reduces the inline part from 14 to 5 bytes, but adds two jumps to each call and some special logic to the resolver to avoid name resolution on each call.
 +
 +==== TLS Support ====
  
 === TLS General Dynamic === === TLS General Dynamic ===
  
 <code> <code>
-+0:     movi    tmp1, x@GOTTLSDESC ++0:     movi    tmp1, x@GOTTLSDESC              # TLS_GOTDESC_OFF 
-+3:     add     arg0, tmp1, localGOTptr ++3:     add     arg0, tmp1, localGOTptr         # TLS_ARG 
-+5:     l32i    tmp2, arg0, 0 ++5:     l32i    tmp2, arg0, 0                   # TLS_FUNCDESC 
-+7:     l32i    GOTptr, tmp2, 4 ++7:     l32i    GOTptr, tmp2, 4                 # TLS_GOT 
-+9:     l32i    tmp3, tmp2, 0 ++9:     l32i    tmp3, tmp2, 0                   # TLS_FUNC 
-+11:    callx0  tmp3++11:    callx0  tmp3                            # TLS_CALL
 </code> </code>
  
Line 118: Line 120:
 +3:     rur     tmp2, THREADPTR +3:     rur     tmp2, THREADPTR
 +6:     add     res, tmp1, tmp2 +6:     add     res, tmp1, tmp2
 +</code>
 +
 +==== Linker optimizations ====
 +
 +=== General Dynamic -> Initial Exec ===
 +
 +<code>
 ++0:     movi    tmp1, x@GOTTLSDESC              # TLS_GOTDESC_OFF               movi    tmp1, x@GOTTPOFF
 ++3:     add     arg0, tmp1, localGOTptr         # TLS_ARG                       add     arg0, tmp1, localGOTptr
 ++5:     l32i    tmp2, arg0, 0                   # TLS_FUNCDESC                  l32i    arg0, arg0, 0
 ++7:     l32i    GOTptr, tmp2, 4                 # TLS_GOT                       nop
 ++9:     _l32i   tmp3, tmp2, 0                   # TLS_FUNC                      rur     tmp3, THREADPTR
 ++12:    callx0  tmp3                            # TLS_CALL                      add     arg0, arg0, tmp3
 +</code>
 +
 +=== General Dynamic -> Local Exec ===
 +
 +<code>
 ++0:     movi    tmp1, x@GOTTLSDESC              # TLS_GOTDESC_OFF               movi    tmp1, x@TPOFF
 ++3:     add     arg0, tmp1, localGOTptr         # TLS_ARG                       mov     arg0, tmp1
 ++5:     l32i    tmp2, arg0, 0                   # TLS_FUNCDESC                  nop
 ++7:     l32i    GOTptr, tmp2, 4                 # TLS_GOT                       nop
 ++9:     _l32i   tmp3, tmp2, 0                   # TLS_FUNC                      rur     tmp3, THREADPTR
 ++12:    callx0  tmp3                            # TLS_CALL                      add     arg0, arg0, tmp3
 </code> </code>
  
etc/users/jcmvbkbc/binutils-xtensa.txt · Last modified: 2024/03/18 14:47 by jcmvbkbc