1. 02 5月, 2015 1 次提交
  2. 01 5月, 2015 2 次提交
  3. 28 4月, 2015 1 次提交
    • R
      fix sh jmp_buf size to match ABI · 85d12e02
      Rich Felker 提交于
      while the sh port is still experimental and subject to ABI
      instability, this is not actually an application/libc boundary ABI
      change. it only affects third-party APIs where jmp_buf is used in a
      shared structure at the ABI boundary, because nothing anywhere near
      the end of the jmp_buf object (which includes the oversized sigset_t)
      is accessed by libc.
      
      both glibc and uclibc have 15-slot jmp_buf for sh. presumably the
      smaller version was used in musl because the slots for fpu status
      register and thread pointer register (gbr) were incorrect and must not
      be restored by longjmp, but the size should have been preserved, as
      it's generally treated as a libc-agnostic ABI property for the arch,
      and having extra slots free in case we ever need them for something is
      useful anyway.
      85d12e02
  4. 25 4月, 2015 1 次提交
    • R
      fix ldso name for sh-nofpu subarch · 1fb0878e
      Rich Felker 提交于
      previously it was using the same name as the default ABI with hard
      float (floating point args and return value in registers).
      
      the test __SH_FPU_ANY__ || __SH4__ matches what's used in the
      configure script already, and seems correct under casual review
      against gcc's config/sh.h, but may need tweaks. the logic for
      predefined macros for sh, and what they all mean, is very complex.
      eventually this should be documented in comments here.
      
      configure already rejects "half-hard" configurations on sh where
      double=float since these do not conform to Annex F and are not
      suitable for musl, so these do not need to be considered here.
      1fb0878e
  5. 24 4月, 2015 1 次提交
  6. 21 4月, 2015 1 次提交
  7. 18 4月, 2015 2 次提交
  8. 14 4月, 2015 2 次提交
  9. 13 4月, 2015 1 次提交
    • R
      dynamic linker bootstrap overhaul · f3ddd173
      Rich Felker 提交于
      this overhaul further reduces the amount of arch-specific code needed
      by the dynamic linker and removes a number of assumptions, including:
      
      - that symbolic function references inside libc are bound at link time
        via the linker option -Bsymbolic-functions.
      
      - that libc functions used by the dynamic linker do not require
        access to data symbols.
      
      - that static/internal function calls and data accesses can be made
        without performing any relocations, or that arch-specific startup
        code handled any such relocations needed.
      
      removing these assumptions paves the way for allowing libc.so itself
      to be built with stack protector (among other things), and is achieved
      by a three-stage bootstrap process:
      
      1. relative relocations are processed with a flat function.
      2. symbolic relocations are processed with no external calls/data.
      3. main program and dependency libs are processed with a
         fully-functional libc/ldso.
      
      reduction in arch-specific code is achived through the following:
      
      - crt_arch.h, used for generating crt1.o, now provides the entry point
        for the dynamic linker too.
      
      - asm is no longer responsible for skipping the beginning of argv[]
        when ldso is invoked as a command.
      
      - the functionality previously provided by __reloc_self for heavily
        GOT-dependent RISC archs is now the arch-agnostic stage-1.
      
      - arch-specific relocation type codes are mapped directly as macros
        rather than via an inline translation function/switch statement.
      f3ddd173
  10. 08 4月, 2015 1 次提交
    • R
      fix possible clobbering of syscall return values on mips · 25748db3
      Rich Felker 提交于
      depending on the compiler's interpretation of __asm__ register names
      for register class objects, it may be possible for the return value in
      r2 to be clobbered by the function call to __stat_fix. I have not
      observed any such breakage in normal builds and suspect it only
      happens with -O0 or other unusual build options, but since there's an
      ambiguity as to the semantics of this feature, it's best to use an
      explicit temporary to avoid the issue.
      
      based on reporting and patch by Eugene.
      25748db3
  11. 02 4月, 2015 4 次提交
  12. 20 3月, 2015 1 次提交
  13. 18 3月, 2015 1 次提交
    • R
      fix MINSIGSTKSZ values for archs with large signal contexts · d5a50453
      Rich Felker 提交于
      the previous values (2k min and 8k default) were too small for some
      archs. aarch64 reserves 4k in the signal context for future extensions
      and requires about 4.5k total, and powerpc reportedly uses over 2k.
      the new minimums are chosen to fit the saved context and also allow a
      minimal signal handler to run.
      
      since the default (SIGSTKSZ) has always been 6k larger than the
      minimum, it is also increased to maintain the 6k usable by the signal
      handler. this happens to be able to store one pathname buffer and
      should be sufficient for calling any function in libc that doesn't
      involve conversion between floating point and decimal representations.
      
      x86 (both 32-bit and 64-bit variants) may also need a larger minimum
      (around 2.5k) in the future to support avx-512, but the values on
      these archs are left alone for now pending further analysis.
      
      the value for PTHREAD_STACK_MIN is not increased to match MINSIGSTKSZ
      at this time. this is so as not to preclude applications from using
      extremely small thread stacks when they know they will not be handling
      signals. unfortunately cancellation and multi-threaded set*id() use
      signals as an implementation detail and therefore require a stack
      large enough for a signal context, so applications which use extremely
      small thread stacks may still need to avoid using these features.
      d5a50453
  14. 15 3月, 2015 2 次提交
    • S
      aarch64: fix typo in bits/ioctl.h · 962cbfbf
      Szabolcs Nagy 提交于
      962cbfbf
    • S
      aarch64: add struct _aarch64_ctx to signal.h · 38bf2d7c
      Szabolcs Nagy 提交于
      The unwind code in libgcc uses this type for unwinding across signal
      handlers. On aarch64 the kernel may place a sequence of structs on the
      signal stack on top of the ucontext to provide additional information.
      The unwinder only needs the header, but added all the types the kernel
      currently defines for this mechanism because they are part of the uapi.
      38bf2d7c
  15. 13 3月, 2015 1 次提交
    • R
      align x32 pthread type sizes to be common with 32-bit archs · 673cab5c
      Rich Felker 提交于
      previously, commit e7b9887e aligned
      the sizes with the glibc ABI. subsequent discussion during the merge
      of the aarch64 port reached a conclusion that we should reject larger
      arch-specific sizes, which have significant cost and no benefit, and
      stick with the existing common 32-bit sizes for all 32-bit/ILP32 archs
      and the x86_64 sizes for 64-bit archs.
      
      one peculiarity of this change is that x32 pthread_attr_t is now
      larger in musl than in the glibc x32 ABI, making it unsafe to call
      pthread_attr_init from x32 code that was compiled against glibc. with
      all the ABI issues of x32, it's not clear that ABI compatibility will
      ever work, but if it's needed, pthread_attr_init and related functions
      could be modified not to write to the last slot of the object.
      
      this is not a regression versus previous releases, since on previous
      releases the x32 pthread type sizes were all severely oversized
      already (due to incorrectly using the x86_64 LP64 definitions).
      moreover, x32 is still considered experimental and not ABI-stable.
      673cab5c
  16. 12 3月, 2015 1 次提交
    • S
      add aarch64 port · 01ef3dd9
      Szabolcs Nagy 提交于
      This adds complete aarch64 target support including bigendian subarch.
      
      Some of the long double math functions are known to be broken otherwise
      interfaces should be fully functional, but at this point consider this
      port experimental.
      
      Initial work on this port was done by Sireesh Tripurari and Kevin Bortis.
      01ef3dd9
  17. 08 3月, 2015 1 次提交
  18. 05 3月, 2015 2 次提交
    • T
      fix POLLWRNORM and POLLWRBAND on mips · f5011c62
      Trutz Behn 提交于
      these macros have the same distinct definition on blackfin, frv, m68k,
      mips, sparc and xtensa kernels. POLLMSG and POLLRDHUP additionally
      differ on sparc.
      f5011c62
    • R
      fix x32 pthread type definitions · e7b9887e
      Rich Felker 提交于
      the previous definitions were copied from x86_64. not only did they
      fail to match the ABI sizes; they also wrongly encoded an assumption
      that long/pointer types are twice as large as int.
      e7b9887e
  19. 04 3月, 2015 1 次提交
    • R
      make all objects used with atomic operations volatile · 56fbaa3b
      Rich Felker 提交于
      the memory model we use internally for atomics permits plain loads of
      values which may be subject to concurrent modification without
      requiring that a special load function be used. since a compiler is
      free to make transformations that alter the number of loads or the way
      in which loads are performed, the compiler is theoretically free to
      break this usage. the most obvious concern is with atomic cas
      constructs: something of the form tmp=*p;a_cas(p,tmp,f(tmp)); could be
      transformed to a_cas(p,*p,f(*p)); where the latter is intended to show
      multiple loads of *p whose resulting values might fail to be equal;
      this would break the atomicity of the whole operation. but even more
      fundamental breakage is possible.
      
      with the changes being made now, objects that may be modified by
      atomics are modeled as volatile, and the atomic operations performed
      on them by other threads are modeled as asynchronous stores by
      hardware which happens to be acting on the request of another thread.
      such modeling of course does not itself address memory synchronization
      between cores/cpus, but that aspect was already handled. this all
      seems less than ideal, but it's the best we can do without mandating a
      C11 compiler and using the C11 model for atomics.
      
      in the case of pthread_once_t, the ABI type of the underlying object
      is not volatile-qualified. so we are assuming that accessing the
      object through a volatile-qualified lvalue via casts yields volatile
      access semantics. the language of the C standard is somewhat unclear
      on this matter, but this is an assumption the linux kernel also makes,
      and seems to be the correct interpretation of the standard.
      56fbaa3b
  20. 10 2月, 2015 1 次提交
    • S
      add syscall numbers for the new execveat syscall · f54c28cb
      Szabolcs Nagy 提交于
      this syscall allows fexecve to be implemented without /proc, it is new
      in linux v3.19, added in commit 51f39a1f0cea1cacf8c787f652f26dfee9611874
      (sh and microblaze do not have allocated syscall numbers yet)
      
      added a x32 fix as well: the io_setup and io_submit syscalls are no
      longer common with x86_64, so use the x32 specific numbers.
      f54c28cb
  21. 08 2月, 2015 1 次提交
    • S
      remove cruft from x86_64 syscall.h · e63833cd
      Szabolcs Nagy 提交于
      x86_64 syscall.h defined some musl internal syscall names and made
      them public. These defines were already moved to src/internal/syscall.h
      (except for SYS_fadvise which is added now) so the cruft in x86_64
      syscall.h is not needed.
      e63833cd
  22. 02 2月, 2015 1 次提交
  23. 31 1月, 2015 2 次提交
  24. 23 12月, 2014 1 次提交
    • S
      add new syscall numbers for bpf and kexec_file_load · f90fafea
      Szabolcs Nagy 提交于
      these syscalls are new in linux v3.18, bpf is present on all
      supported archs except sh, kexec_file_load is only allocted for
      x86_64 and x32 yet.
      
      bpf was added in linux commit 99c55f7d47c0dc6fc64729f37bf435abf43f4c60
      
      kexec_file_load syscall number was allocated in commit
      f0895685c7fd8c938c91a9d8a6f7c11f22df58d2
      f90fafea
  25. 21 12月, 2014 1 次提交
  26. 03 12月, 2014 1 次提交
  27. 23 11月, 2014 4 次提交
    • R
      unify non-inline version of syscall code across archs · 4134c68d
      Rich Felker 提交于
      except powerpc, which still lacks inline syscalls simply because
      nobody has written the code, these are all fallbacks used to work
      around a clang bug that probably does not exist in versions of clang
      that can compile musl. however, it's useful to have the generic
      non-inline code anyway, as it eases the task of porting to new archs:
      writing inline syscall code is now optional. this approach could also
      help support compilers which don't understand inline asm or lack
      support for the needed register constraints.
      
      mips could not be unified because it has special fixup code for broken
      layout of the kernel's struct stat.
      4134c68d
    • R
      inline 5- and 6-argument syscalls on arm · 0e971b0e
      Rich Felker 提交于
      0e971b0e
    • R
      remove old clang workarounds from arm syscall implementation · 7d310ed1
      Rich Felker 提交于
      the register constraints in the non-clang case were tested to work on
      clang back to 3.2, and earlier versions of clang have known bugs that
      preclude building musl.
      
      there may be other reasons to prefer not to use inline syscalls, but
      if so the function-call-based implementations should be added back in
      a unified way for all archs.
      7d310ed1
    • R
      fix __aeabi_read_tp oversight in arm atomics/tls overhaul · 8cd0b11e
      Rich Felker 提交于
      calls to __aeabi_read_tp may be generated by the compiler to access
      TLS on pre-v6 targets. previously, this function was hard-coded to
      call the kuser helper, which would crash on kernels with kuser helper
      removed.
      
      to fix the problem most efficiently, the definition of __aeabi_read_tp
      is moved so that it's an alias for the new __a_gettp. however, on v7+
      targets, code to initialize the runtime choice of thread-pointer
      loading code is not even compiled, meaning that defining
      __aeabi_read_tp would have caused an immediate crash due to using the
      default implementation of __a_gettp with a HCF instruction.
      
      fortunately there is an elegant solution which reduces overall code
      size: putting the native thread-pointer loading instruction in the
      default code path for __a_gettp, so that separate default/native code
      paths are not needed. this function should never be called before
      __set_thread_area anyway, and if it is called early on pre-v6
      hardware, the old behavior (crashing) is maintained.
      
      ideally __aeabi_read_tp would not be called at all on v7+ targets
      anyway -- in fact, prior to the overhaul, the same problem existed,
      but it was never caught by users building for v7+ with kuser disabled.
      however, it's possible for calls to __aeabi_read_tp to end up in a v7+
      binary if some of the object files were built for pre-v7 targets, e.g.
      in the case of static libraries that were built separately, so this
      case needs to be handled.
      8cd0b11e
  28. 19 11月, 2014 1 次提交
    • R
      overhaul ARM atomics/tls for performance and compatibility · 4a241f14
      Rich Felker 提交于
      previously, builds for pre-armv6 targets hard-coded use of the "kuser
      helper" system for atomics and thread-pointer access, resulting in
      binaries that fail to run (crash) on systems where this functionality
      has been disabled (as a security/hardening measure) in the kernel.
      additionally, builds for armv6 hard-coded an outdated/deprecated
      memory barrier instruction which may require emulation (extremely
      slow) on future models.
      
      this overhaul replaces the behavior for all pre-armv7 builds (both of
      the above cases) to perform runtime detection of the appropriate
      mechanisms for barrier, atomic compare-and-swap, and thread pointer
      access. detection is based on information provided by the kernel in
      auxv: presence of the HWCAP_TLS bit for AT_HWCAP and the architecture
      version encoded in AT_PLATFORM. direct use of the instructions is
      preferred when possible, since probing for the existence of the kuser
      helper page would be difficult and would incur runtime cost.
      
      for builds targeting armv7 or later, the runtime detection code is not
      compiled at all, and much more efficient versions of the non-cas
      atomic operations are provided by using ldrex/strex directly rather
      than wrapping cas.
      4a241f14