git: rtld-elf - Notify thread state to optimize relocations

Matthew Dillon dillon at crater.dragonflybsd.org
Sat May 11 21:07:43 PDT 2019


commit 50caca1a70a5f1f9dfba401f114bed0e721bbb0f
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Sat May 11 21:01:55 2019 -0700

    rtld-elf - Notify thread state to optimize relocations
    
    * Add shims to allow libthread_xu to notify rtld when threading
      is being used.
    
    * Requires weak symbols in libc which are overriden by rtld-elf.
    
    * Implement the feature in rtld-elf and use it to avoid making calls
      to lwp_gettid().  When threaded, use tls_get_tcb() (which does not
      require a system call) instead of lwp_gettid().  When not threaded,
      just use a constant.
    
      NOTE: We cannot use tls_get_tcb() unconditionally because the tcb
    	is not setup during early relocations.  So do this whack-a-mole
    	to make it work.
    
    * This leaves just the sigprocmask wrappers around rtld-elf (which
      are needed to prevent stacked relocations from signal handlers).
    
    Poked-by: mjg

Summary of changes:
 lib/libc/gen/Symbol.map               |  1 +
 lib/libc/gen/dlfcn.c                  |  8 ++++
 lib/libthread_xu/thread/thr_kern.c    |  1 +
 lib/libthread_xu/thread/thr_private.h |  1 +
 libexec/rtld-elf/Symbol.map           |  1 +
 libexec/rtld-elf/rtld.c               |  1 +
 libexec/rtld-elf/rtld_lock.c          | 71 ++++++++++++++++++++++++++---------
 7 files changed, 66 insertions(+), 18 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/50caca1a70a5f1f9dfba401f114bed0e721bbb0f


-- 
DragonFly BSD source repository


More information about the Commits mailing list