about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
* fix mismatched type in posix_getdents definition HEAD masterRich Felker2 days1-1/+1
| | | | | | | commit 1b0d48517f816e98f19111df82f32bfc1608ecec wrongly copied the getdents return type of int rather than matching the ssize_t used by posix_getdents. this was overlooked in testing on 32-bit archs but obviously broke 64-bit archs.
* aarch64 crti.o: fix alignment of _init/_finimojyack3 days1-0/+2
| | | | | | without explicit alignment directives, whether they end up at the necessary alignment depends on linker/linking conditions. initially reported as mold issue 1255.
* fix typo that broke sys/reg.h and sys/user.hGonzalo Alvarez3 days2-2/+2
| | | | | commit 7019fbe103165b9b26a9391d5ecd4c7fcb6f3ec9 and commit e709a6f07ade208ba513f9225222336f30c304b0 misspelled bits/alltypes.h.
* implement posix_getdents adopted for next issue of POSIXRich Felker7 days2-3/+26
| | | | | | this interface was added as the outcome of Austin Group tracker issue 697. no error is specified for unsupported flags, which is probably an oversight. for now, EOPNOTSUPP is used so as not to overload EINVAL.
* stdint.h: derive limits from __LONG_MAX, use common fast16 typesRich Felker8 days18-340/+9
| | | | | | the bits file is retained, but as a single generic version, to allow for the unlikely future possibility of letting a new arch define something differently.
* sys/user.h: derive __WORDSIZE from __LONG_MAXRich Felker8 days5-12/+9
| | | | | | previously, only a few archs defined it here. this change makes the presence consistent across all archs, and reduces the amount of header duplication (and potential for future inconsistency) between archs.
* sys/reg.h: derive __WORDSIZE from __LONG_MAXRich Felker8 days19-42/+9
| | | | | this removes an otherwise-unnecessary bits header from most archs, replacing it with an empty generic version.
* unistd.h: derive ILP32/LP64 macros from __LONG_MAX instead of arch bitsRich Felker8 days19-37/+7
|
* unify bits/stat.h for all archs sharing a common definitionRich Felker8 days4-54/+0
| | | | | future archs should not define their own bits/stat.h but use this generic one.
* align aarch64, riscv64, loongarch64 stat structure padding typeRich Felker8 days3-3/+3
| | | | | | | this change is purely to document that they are the same in preparation to remove the arch-specific headers for these archs and replace them with a generic version that matches riscv32 and can be shared by these and all future archs.
* ldso: fix non-functional fix to early dynamic PAGE_SIZE accessRich Felker8 days1-3/+5
| | | | | | | | | | | | | commit f47a8cdd250d9163fcfb39bf4e9d813957c0b187 introduced an alternate mechanism for access to runtime page size for compatibility with early stages of dynamic linking, but because pthread_impl.h indirectly includes libc.h, the condition #ifndef PAGE_SIZE was never satisfied. rather than depend on order of inclusion, use the (baseline POSIX) macro PAGESIZE, not the (XSI) macro PAGE_SIZE, to determine whether page size is dynamic. our internal libc.h only provides a dynamic definition for PAGE_SIZE, not for PAGESIZE.
* strptime: implement conversion specifiers adopted for next POSIX issueRich Felker8 days1-1/+65
| | | | | | | | | | | | | | | | | the %s conversion is added as the outcome of Austin Group tracker issue 169 and its unspecified behavior is clarified as the outcome of issue 1727. the %F, %g, %G, %u, %V, %z, and %Z conversions are added as the outcome of Austin Group tracker issue 879 for alignment with strftime and the behaviors of %u, %z, and %Z are defined as the outcome of issue 1727. at this time, the conversions with unspecified effects on struct tm are all left as parse-only no-ops. this may be changed at a later time, particularly for %s, if there is reasonable cross-implementation consensus outside the standards process on what the behavior should be.
* printf decimal integer formatting: shave off one divisionRich Felker8 days1-1/+2
| | | | | | | | | | once the remaining value is less than 10, the modulo operation to produce the final digit and division to prepare for next loop iteration can be dropped. this may be a meaningful performance distinction when formatting low-magnitude numbers in bulk, and should never hurt. based on patch by Viktor Reznov.
* riscv mcontext_t/sigcontext: use __aligned__ instead of alignedMichael Forney9 days2-2/+2
| | | | | aligned may be defined by the application for its own use before bits/signal.h is included.
* add missing STATX_ATTR_* macros omitted when statx was addedRich Felker2024-04-241-0/+10
| | | | | commit b817541f1cfd38e4b81257b3215e276ea9d0fc61 added statx and the mask constant macros, but not the stx_attributes[_mask] ones.
* initgroups: do not artificially limit number of supplementary groupsRich Felker2024-04-131-4/+22
| | | | | | | | | | | | | | | | | | | | | historically linux limited the number of supplementary groups a process could be in to 32, but this limit was raised to 65536 in linux 2.6.4. proposals to support the new limit, change NGROUPS_MAX, or make it dynamic have been stalled due to the impact it would have on initgroups where the groups array exists in automatic storage. the changes here decouple initgroups from the value of NGROUPS_MAX and allow it to fall back to allocating a buffer in the case where getgrouplist indicates the user has more supplementary groups than could be reported in the buffer. getgrouplist already involves allocation, so this does not pull in any new link dependency. likewise, getgrouplist is already using the public malloc (vs internal libc one), so initgroups does the same. if this turns out not to be the best choice, both can be changed together later. the initial buffer size is left at 32, but now as the literal value, so that any potential future change to NGROUPS_MAX will not affect initgroups.
* printf: fix edge case where hex float precision was not honoredRich Felker2024-04-121-9/+2
| | | | | | | | | | | | | | | | | | commit cfa0a54c082d41db6446638eed1d57f163434092 attempted to fix rounding on archs where long double is not 80-bit (where LDBL_MANT_DIG is not zero mod four), but failed to address the edge case where rounding was skipped because LDBL_MANT_DIG/4 rounded down in the comparison against the requested precision. the rounding logic based on hex digit count is difficult to understand and not well-motivated, so rather than try to fix it, replace it with an explicit calculation in terms of number of bits to be kept, without any truncating division operations. based on patch by Peter Ammon, but with scalbn to apply the rounding exponent since the value will not generally fit in any integer type. scalbn is used instead of scalbnl to avoid pulling in the latter unnecessarily, since the value is an exact power of two whose exponent range is bounded by LDBL_MANT_DIG, a small integer.
* complex: fix comment in cacoshSzabolcs Nagy2024-03-141-1/+1
| | | | | | | | | | | The principal expressions defining acosh and acos are such that acosh(z) = ±i acos(z) where the + is only true on the Im(z)>0 half of the complex plane (and partly on Im(z)==0 depending on number representation). fix the comment without expanding on the details.
* math: fix fma(x,y,0) when x*y rounds to -0Szabolcs Nagy2024-03-141-1/+1
| | | | | | | | | if x!=0, y!=0, z==0 then fma(x,y,z) == x*y in all rounding modes, while adding z can ruin the sign of 0 if x*y rounds to -0.
* fix pwrite/pwritev handling of O_APPEND filesRich Felker2024-03-142-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | POSIX requires pwrite to honor the explicit file offset where the write should take place even if the file was opened as O_APPEND. however, linux historically defined the pwrite syscall family as honoring O_APPEND. this cannot be changed on the kernel side due to stability policy, but the addition of the pwritev2 syscall with a flags argument opened the door to fixing it, and linux commit 73fa7547c70b32cc69685f79be31135797734eb6 adds the RWF_NOAPPEND flag that lets us request a write honoring the file offset argument. this patch changes the pwrite function to first attempt using the pwritev2 syscall with RWF_NOAPPEND, falling back to using the old pwrite syscall only after checking that O_APPEND is not set for the open file. if O_APPEND is set, the operation fails with EOPNOTSUPP, reflecting that the kernel does not support the correct behavior. this is an extended error case needed to avoid the wrong behavior that happened before (writing the data at the wrong location), and is aligned with the spirit of the POSIX requirement that "An attempt to perform a pwrite() on a file that is incapable of seeking shall result in an error." since the pwritev2 syscall interprets the offset of -1 as a request to write at the current file offset, it is mapped to a different negative value that will produce the expected error. pwritev, though not governed by POSIX at this time, is adjusted to match pwrite in honoring the offset.
* uio.h: add RWF_NOAPPEND flag for pwritev2Rich Felker2024-03-131-0/+1
| | | | | | | added in linux kernel commit 73fa7547c70b32cc69685f79be31135797734eb6. this is added now as a prerequisite for fixing pwrite/pwritev behavior for O_APPEND files.
* iconv: fix missing bounds checking for shift_jis decodingRich Felker2024-03-021-0/+1
| | | | | | | | the jis0208 table we use is only 84x94 in size, but the shift_jis encoding supports a 94x94 grid. attempts to convert sequences outside of the supported zone resulted in out-of-bounds table reads, misinterpreting adjacent rodata as part of the character table and thereby converting these sequences to unexpected characters.
* add missing inline keyword on default a_barrier definitionRich Felker2024-03-021-1/+1
| | | | | | this is not needed, but may act as a hint to the compiler, and also serves to suppress unused function warnings if enabled (on by default since commit 86ac0f794731f03dfff40ee843ff9e2752945d5e).
* iconv: add aliases for GBKRich Felker2024-03-011-1/+1
| | | | | these are taken from the IANA registry, restricted to those that match the forms already used for other supported character encodings.
* iconv: add euro symbol to GBK as single byte 0x80Rich Felker2024-03-011-0/+4
| | | | | | | | | this is how it's defined in the cp936 document referenced by the IANA charset registry as defining GBK, and of the mappings defined there, was the only one missing. it is not accepted for GB18030, as GB18030 is a UTF and has its own unique mapping for the euro symbol.
* release 1.2.5 v1.2.5Rich Felker2024-02-292-1/+43
|
* iconv: add cp932 as an alias for shift_jisRich Felker2024-02-291-1/+1
|
* update INSTALL file archs list with riscv32, loongarch64 additionsRich Felker2024-02-291-1/+6
|
* loongarch64: add new syscall numberswanghongliang2024-02-291-0/+15
|
* loongarch64: remove getrlimit/setrlimit syscall numbersRich Felker2024-02-291-2/+0
| | | | | these are not supported by the kernel for new archs; prlimit64 replaces them.
* loongarch64: remove ptrace.h macroswanghongliang2024-02-291-4/+0
|
* configure: enable riscv32 portStefan O'Rear2024-02-291-1/+2
|
* riscv: define REG_S1 and REG_S2Khem Raj2024-02-292-0/+4
| | | | | These are used by applications to access members of mcontext, and are also defined by other libcs on linux.
* riscv32: add new syscall numbersKhem Raj2024-02-291-1/+15
| | | | | | | | | | | | | | - add mount_setattr from linux v5.12 - add epoll_pwait2 from linux v5.11 - add process_madvise from linux v5.10 - add __NR_faccessat2 from linux v5.8 - add pidfd_getfd and openat2 syscall numbers from linux v5.6 - add clone3 syscall number from linux v5.3 - add process_mrelease from linux v5.15 - add futex_waitv from linux v5.16 - add set_mempolicy_home_node from linux v5.17 - add cachestat from linux v6.4 - add __NR_fchmodat2 from linux v6.6
* riscv32: add sysvipc msg/sem/shm bitsRich Felker2024-02-294-0/+68
| | | | | | | | | | despite riscv32 being natively time64, the IPC_TIME64 bit (0x100) is set in IPC_STAT and derived command macros, differentiating their values from the raw command values used to interface with the kernel. this reflects that the kernel ipc structure types are not natively time64, but have broken-down hi/lo fields that cannot be used in-place and require translation, and that the userspace struct types differ from the kernel types (relevant to things like strace).
* riscv32: add thread supportStefan O'Rear2024-02-294-0/+76
| | | | Identical to riscv64 except for stack offsets in clone.
* riscv32: add setjmp/longjmp and sigreturnStefan O'Rear2024-02-294-0/+114
| | | | Largely copied from riscv64 but required recalculation of offsets.
* riscv32: add dlsymStefan O'Rear2024-02-291-0/+6
| | | | Identical to riscv64.
* riscv32: add fenv and mathStefan O'Rear2024-02-2914-0/+239
| | | | These are identical to riscv64.
* riscv32: add arch headersStefan O'Rear2024-02-2917-0/+659
| | | | | | | | | | | | | | | | | These are mostly copied from riscv64. _Addr and _Reg had to become int to match compiler-controlled parts of the ABI (result type of sizeof, etc.). There is no kernel stat struct; the userspace stat matches glibc in the sizes and offsets of all fields (including glibc's __dev_t __pad1). The jump buffer is 12 words larger to account for 12 saved double-precision floats; additionally it should be 64-bit aligned to save doubles. The syscall list was significantly revised by deleting all time32 and pre-statx syscalls, and renaming several syscalls that have different names depending on __BITS_PER_LONG, notably mmap2 and _llseek. futex was added as an alias to futex_time64 since it is widely used by software which does not pass time arguments.
* getnameinfo: fix calling __dns_parse with potentially too large rlenAlexey Izbyshev2024-02-291-1/+3
| | | | | | | | | __res_send returns the full answer length even if it didn't fit the buffer, but __dns_parse expects the length of the filled part of the buffer. This is analogous to commit 77327ed064bd57b0e1865cd0e0364057ff4a53b4, which fixed the only other __dns_parse call site.
* posix_spawn: fix child spinning on write to a broken pipeAlexey Izbyshev2024-02-291-1/+6
| | | | | | | | | A child process created by posix_spawn reports errors to its parent via a pipe, retrying infinitely on any write error to prevent falsely reporting success. If the (original) parent dies before write is attempted, there is nobody to report to, but the child will remain stuck in the write loop forever if SIGPIPE is blocked or ignored. Fix this by not retrying write if it fails with EPIPE.
* loongarch64 __clone: align stack pointer mod 16wanghongliang2024-02-261-0/+1
| | | | | According to LoongArch ABI Specs, stack need to be 16 align to improve performance and compiler layout of stack frames.
* add loongarch64 user.h structs; adjust elf_fpreg_t and ELF_NFPREGHongliang Wang2024-02-261-2/+21
| | | | | | | | user_regs_struct and user_fp_struct were missing from the initial commit of the port. the union type for elf_fpreg_t and the new value of ELF_NFPREG are made consistent with glibc.
* add loongarch64 signal.h register index macroswanghongliang2024-02-261-0/+11
|
* switch __STDC_UTF_{16,32}__ macro definitions from #undef to #ifndefRich Felker2024-02-261-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | originally, compilers did not provide these macros and we had to provide them ourselves. this meant we were redefining them, which was technically invalid unless the token sequence of the original definition matched exactly. the original patch proposed by Jules Maselbas to fix this made the definitions conditional on them not already being defined; however I suggested using #undef to avoid any possibly-wrong definitions already in place and ensure that the definitions are 1. the version adopted as commit 8b7048680731707d135ea231f81eb3eaf52378ee made this change. unfortunately, gcc is loud about not liking #undef of any __STDC_* macro name, and while warnings are suppressed in the system include path, there is apparently no way to suppress this warning if the system include dir has also been provided via -I. while normally we don't go out of our way to satisfy warnings over style in the public headers, in this case, it seems to be a matter of disagreement over contract of which part of "the implementation" is entitled to define or undefine macros belonging to the implementation, and it's quite reasonable to conclude that the compiler may reject attempts to undefine them. this commit reverts to the originally-submitted version of the patch making the definitions conditional.
* riscv: fall back to syscall __riscv_flush_icacheStefan O'Rear2024-02-251-0/+1
| | | | | Matches glibc behavior and fixes a case where we could fall off the function without returning a value.
* sh dlsym: fix passing of return address for RTLD_NEXT useRich Felker2024-02-251-1/+1
| | | | | | | this code dates back to the original commit of the sh port, with no real clue as to how the bug was introduced. it looks like it was written to assume the return address was pushed to the stack like on x86, rather than arriving in the pr special register.
* add statx interface using syscall, fallback to fstatatDuncan Bellamy2024-02-242-0/+97
|
* use new SYS_fchmodat2 syscall to implement fchmodat with flagsGaël PORTAY2024-02-221-1/+4
| | | | | | | | | | | commit 0dc4824479e357a3e23a02d35527e23fca920343 worked around for lack of flags argument in syscall for fchmodat. linux 6.6 introduced a new syscall, SYS_fchmodat2, fixing this deficiency. use it if any flags are passed, and fallback to the old strategy on ENOSYS. continue using the old syscall when there are no flags. this is the exact same strategy used when SYS_faccessat2 was used to implement faccessat with flags.