1. 27 5月, 2014 2 次提交
    • R
      fix placement of multiple inclusion guard endif in internal syscall.h · 92899314
      Rich Felker 提交于
      this was messed up during a recent commit when the socketcall macros
      were moved to the common internal/syscall.h, and the following commit
      expanded the problem by adding more new content outside the guard.
      92899314
    • R
      fix type of extended argument array to pselect6 syscall · 4ef04a27
      Rich Felker 提交于
      this only matters on x32 (and perhaps future 32-on-64 abis for other
      archs); otherwise the type is long anyway. the cast through uintptr_t
      prevents nonsensical "sign extension" of pointers, and follows the
      principle that uintptr_t is the canonical integer type to which
      pointer conversion is safe.
      4ef04a27
  2. 25 5月, 2014 2 次提交
    • R
      support kernels with no SYS_open syscall, only SYS_openat · 594c827a
      Rich Felker 提交于
      open is handled specially because it is used from so many places, in
      so many variants (2 or 3 arguments, setting errno or not, and
      cancellable or not). trying to do it as a function would not only
      increase bloat, but would also risk subtle breakage.
      
      this is the first step towards supporting "new" archs where linux
      lacks "old" syscalls.
      594c827a
    • R
      overhaul siginfo_t definition in signal.h · 44d28e55
      Rich Felker 提交于
      the main motivation for this change is that, with the previous
      definition, it was arguably illegal, in standard C, to initialize both
      si_value and si_pid/si_uid with designated initializers, due to the
      rule that only one member of a union can have an initializer. whether
      or not this affected real-world application code, it affected some
      internal code, and clang was producing warnings (and possibly
      generating incorrect code).
      
      the new definition uses a more complex hierarchy of structs and unions
      to avoid the need to initialize more than one member of a single union
      in usage cases that make sense. further work would be needed to
      eliminate even the ones with no practical applications.
      
      at the same time, some fixes are made to the exposed names for
      nonstandard fields, to match what software using them expects.
      44d28e55
  3. 21 5月, 2014 2 次提交
  4. 20 5月, 2014 2 次提交
    • R
      fix unhandled cases in strptime · dec66750
      Rich Felker 提交于
      %C, %U, %W, and %y handling were completely missing; %C wrongly
      fell-through to unrelated cases, and the rest returned failure. for
      now, they all parse numbers in the proper forms and range-check the
      values, but they do not store the value anywhere.
      
      it's not clear to me whether, as "derived" fields, %U and %W should
      produce any result. they certainly cannot produce a result unless the
      year and weekday are also converted, but in this case it might be
      desirable for them to do so. clarification is needed on the intended
      behavior of strptime in cases like this.
      
      %C and %y have well-defined behavior as long as they are used together
      (and %y is defined by itself but may change in the future).
      implementing them (including their correct interaction) is left as a
      later change to be made.
      
      finally, strptime now rejects unknown/invalid format characters
      instead of ignoring them.
      dec66750
    • R
      remove unsupported nonstandard sysconf macros and their table entries · 93be56ba
      Rich Felker 提交于
      some of these may have been from ancient (pre-SUSv2) POSIX versions;
      more likely, they were from POSIX drafts or glibc interpretations of
      what ancient versions of POSIX should have added (instead they made
      they described functionality mandatory and/or dropped it completely).
      others are purely glibc-isms, many of them ill-thought-out, like
      providing ways to lookup the min/max values of types at runtime
      (despite the impossibility of them changing at runtime and the
      impossibility of representing ULONG_MAX in a return value of type
      long).
      
      since our sysconf implementation does not support or return meaningful
      values for any of these, it's harmful to have the macros around;
      applications' build scripts may detect and attempt to use them, only
      to get -1/EINVAL as a result.
      
      if removing them does break some applications, and it's determined
      that the usage was reasonable, some of these could be added back on an
      as-needed basis, but they should return actual meaningful values, not
      junk like they were returning before.
      93be56ba
  5. 19 5月, 2014 2 次提交
    • R
      rework sysconf table to treat zero entries as invalid · ff78355b
      Rich Felker 提交于
      based on patch by Timo Teräs. previously, the value zero was used as a
      literal zero, meaning that all invalid sysconf "names", which should
      result in sysconf returning -1, had to be explicitly listed. (in
      addition, it was not possible for sysconf to set errno to EINVAL, as
      there was no distinction between -1 as an error and -1 as a valid
      result.)
      
      now, the value 0 is used for invalid/undefined slots in the table and
      a new switch table entry is used for returning literal zeros.
      
      in addition, an off-by-one error in checking against the table size is
      fixed.
      ff78355b
    • R
      add configure check for broken gcc 4.9.0 and possibly other versions · 9ca4dae5
      Rich Felker 提交于
      this is gcc bug #61144. the broken compiler is detected, but the user
      must manually work around it. this is partly to avoid complex logic
      for adding workaround CFLAGS and attempting to recheck with them, and
      partly for the sake of letting the user know the compiler is broken
      (since the workaround will result in less-efficient code production).
      
      some refactoring was also needed to move the check for gcc outside of
      the check for whether to build the compiler wrapper.
      9ca4dae5
  6. 14 5月, 2014 1 次提交
    • R
      add cp437 and cp850 to available iconv conversions · 8a2d8719
      Rich Felker 提交于
      perhaps some additional legacy DOS-era codepages would also be useful
      to have, but these are the ones for which there has been demand. the
      size of the diff is due to the fact that legacychars.h is updated in
      such a way that new characters are inserted into the table in unicode
      codepoint order; thus other mappings in codepages.h have changed to
      reflect the new table indices of their characters.
      8a2d8719
  7. 13 5月, 2014 1 次提交
    • R
      add configure check for working compiler · 8945667f
      Rich Felker 提交于
      without this, broken choices of CC/CPPFLAGS/CFLAGS don't show up until
      late in the configure process where they are confusingly reported as a
      different failure such as incorrect long double type.
      8945667f
  8. 09 5月, 2014 1 次提交
  9. 05 5月, 2014 1 次提交
  10. 01 5月, 2014 2 次提交
  11. 28 4月, 2014 1 次提交
    • B
      fix superh nofpu check on old gcc versions · 23d64182
      Bobby Bingham 提交于
      As far as gcc3 knows, sh4 is the only processor version that can have an
      FPU, so it indicates the FPU's presence by defining __SH4__.  This is not
      defined if there is no FPU, even if the processor really is an SH4.
      
      Starting with gcc4, there is support for the sh2a processor, which has an
      FPU but is not an SH4.  gcc4 therefore additionally defines __SH_FPU_ANY__
      when there is an FPU, but still doesn't define __SH4__ for an FPU-less sh4.
      
      Therefore, to support all gcc versions, we must look at both preprocessor
      symbols.
      23d64182
  12. 23 4月, 2014 2 次提交
    • R
      perform minimal sanity checks on zoneinfo files loaded via TZ variable · c3d9d172
      Rich Felker 提交于
      previously, setting TZ to the pathname of a file which was not a valid
      zoneinfo file would usually cause programs using local time zone based
      operations to crash. the new code checks the file size and magic at
      the beginning of the file, which seems sufficient to prevent
      accidental misconfiguration from causing crashes. attempting to make
      fully-robust validation would be futile unless we wanted to drop use
      of mmap (shared zoneinfo) and instead read it into a local buffer,
      since such validation would be subject to race conditions with
      modification of the file.
      c3d9d172
    • T
  13. 22 4月, 2014 4 次提交
    • R
      make __init_libc static for non-shared libc · 3176b57e
      Rich Felker 提交于
      being static allows it to be inlined in __libc_start_main; inlining
      should take place at all levels since the function is called exactly
      once. this further reduces mandatory startup code size for static
      binaries.
      3176b57e
    • R
      further micro-optimize startup code for size · fbcfed7c
      Rich Felker 提交于
      there is no reason (and seemingly there never was any) for
      __init_security to be its own function. it's linked unconditionally
      so it can just be placed inline in __init_libc.
      fbcfed7c
    • R
      micro-optimize some startup code for size · 9b52ab1c
      Rich Felker 提交于
      moving the call to __init_ssp from __init_security to __init_libc
      makes __init_security a leaf function, which allows the compiler to
      make it smaller. __init_libc is already non-leaf, and the additional
      call makes no difference to the amount of register spillage.
      
      in addition, it really made no sense for the call to __init_ssp to be
      buried inside __init_security rather than parallel with other init
      functions.
      9b52ab1c
    • R
      allow zoneinfo-path-relative filenames with no slashes in TZ variable · 5c4f11d9
      Rich Felker 提交于
      since the form TZ=name is reserved for POSIX-form time zone strings,
      TZ=:name needs to be used when the zoneinfo filename is in the
      top-level zoneinfo directory and therefore does not contain a slash.
      previously the leading colon was merely dropped, making it impossible
      to access such zones without a full absolute pathname.
      
      changes based on patch by Timo Teräs.
      5c4f11d9
  14. 20 4月, 2014 1 次提交
  15. 19 4月, 2014 1 次提交
  16. 18 4月, 2014 1 次提交
  17. 17 4月, 2014 1 次提交
    • R
      add options when explicitly invoking dynamic loader · de45164e
      Rich Felker 提交于
      so far the options are --library-path and --preload which override the
      corresponding environment variables, and --list which forces the
      behavior of ldd even if the invocation name is not ldd. both the
      two-arg form and the one-arg form using an equals sign are supported.
      
      based loosely on a patch proposed by Rune.
      de45164e
  18. 16 4月, 2014 8 次提交
    • R
      release 1.1.0 · b1ef8067
      Rich Felker 提交于
      b1ef8067
    • R
      add working vdso clock_gettime support, including static linking · 58e75db4
      Rich Felker 提交于
      the vdso symbol lookup code is based on the original 2011 patch by
      Nicholas J. Kain, with some streamlining, pointer arithmetic fixes,
      and one symbol version matching fix.
      
      on the consumer side (clock_gettime), per-arch macros for the
      particular symbol name and version to lookup are added in
      syscall_arch.h, and no vdso code is pulled in on archs which do not
      define these macros. at this time, vdso is enabled only on x86_64.
      
      the vdso support at the dynamic linker level is no longer useful to
      libc, but is left in place for the sake of debuggers (which may need
      the vdso in the link map to find its functions) and possibly use with
      dlsym.
      58e75db4
    • R
      fix deadlock race in pthread_once · 0d0c2f40
      Rich Felker 提交于
      at the end of successful pthread_once, there was a race window during
      which another thread calling pthread_once would momentarily change the
      state back from 2 (finished) to 1 (in-progress). in this case, the
      status was immediately changed back, but with no wake call, meaning
      that waiters which arrived during this short window could block
      forever. there are two possible fixes. one would be adding the wake to
      the code path where it was missing. but it's better just to avoid
      reverting the status at all, by using compare-and-swap instead of
      swap.
      0d0c2f40
    • S
      fix RLIMIT_ constants for mips · fcea534e
      Szabolcs Nagy 提交于
      The mips arch is special in that it uses different RLIMIT_
      numbers than other archs, so allow bits/resource.h to override
      the default RLIMIT_ numbers (empty on all archs except mips).
      Reported by orc.
      fcea534e
    • R
      96315d27
    • R
      add namespace-protected name for sysinfo function · de20a8ff
      Rich Felker 提交于
      it will be needed to implement some things in sysconf, and the syscall
      can't easily be used directly because the x32 syscall uses the wrong
      structure layout. the l (uncreative, for "linux") prefix is used since
      the symbol name __sysinfo is already taken for AT_SYSINFO from the aux
      vector.
      
      the way the x32 override of this function works is also changed to be
      simpler and avoid the useless jump instruction.
      de20a8ff
    • R
      in sysconf, use getrlimit function rather than raw syscall for rlimits · 6cf7d17f
      Rich Felker 提交于
      the syscall is deprecated (replaced by prlimit64) and does not work
      correctly on x32. this change mildly increases size, but is likely
      needed anyway for newer archs that might omit deprecated syscalls.
      6cf7d17f
    • R
      avoid linear-time if/else special cases in sysconf · 233767b4
      Rich Felker 提交于
      the previous handling of cases that could not fit in the 16-bit table
      or which required non-constant results was extremely ugly and could
      not scale. the new code remaps these keys into a contiguous range
      that's efficient for a switch statement.
      233767b4
  19. 15 4月, 2014 2 次提交
  20. 12 4月, 2014 2 次提交
    • R
      use hidden visibility rather than protected for syscall internals · 83c98aac
      Rich Felker 提交于
      the use of visibility at all is purely an optimization to avoid the
      need for the caller to load the GOT register or similar to prepare for
      a call via the PLT. there is no reason for these symbols to be
      externally visible, so hidden works just as well as protected, and
      using protected visibility is undesirable due to toolchain bugs and
      the lack of testing it receives.
      
      in particular, GCC's microblaze target is known to generate symbolic
      relocations in the GOT for functions with protected visibility. this
      in turn results in a dynamic linker which crashes under any nontrivial
      usage that requires making a syscall before symbolic relocations are
      processed.
      83c98aac
    • S
      math: fix aliasing violation in long double wrappers · 73c870ed
      Szabolcs Nagy 提交于
      modfl and sincosl were passing long double* instead of double*
      to the wrapped double precision functions (on archs where long
      double and double have the same size).
      This is fixed now by using temporaries (this is not optimized
      to a single branch so the generated code is a bit bigger).
      Found by Morten Welinder.
      73c870ed
  21. 10 4月, 2014 1 次提交
    • T
      fix search past the end of haystack in memmem · 6fbdeff0
      Timo Teräs 提交于
      to optimize the search, memchr is used to find the first occurrence of
      the first character of the needle in the haystack before switching to
      a search for the full needle. however, the number of characters
      skipped by this first step were not subtracted from the haystack
      length, causing memmem to search past the end of the haystack.
      6fbdeff0