about summary refs log tree commit diff
path: root/arch
Commit message (Collapse)AuthorAgeFilesLines
* fix RLIMIT_ constants for mipsSzabolcs Nagy2014-04-168-0/+5
| | | | | | | | | 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. (cherry picked from commit fcea534e579077e10456f6ed06c033dfaa013a24)
* fix microblaze syscall register clobbersRich Felker2014-04-161-7/+7
| | | | | | | | | | | the kernel entry point for syscalls on microblaze nominally saves and restores all registers, and testing on qemu always worked since qemu behaves this way too. however, the real kernel treats r3:r4 as a potential 64-bit return value from the syscall function, and copies both over top of the saved registers before returning to userspace. thus, we need to treat r4 as always-clobbered. (cherry picked from commit 91d5aa06572d2660122f9a06ed242fef0383f292)
* fix signal.h breakage from moving stack_t to arch-specific bitsRich Felker2014-03-188-48/+48
| | | | | | in the previous changes, I missed the fact that both the prototype of the sigaltstack function and the definition of ucontext_t depend on stack_t.
* fix mips stack_tRich Felker2014-03-181-1/+1
| | | | like almost everything on mips, this is gratuitously different.
* move signal.h definition of stack_t to arch-specific bitsRich Felker2014-03-188-0/+48
| | | | | it's different at least on mips. mips version will be fixed in a separate commit to show the change.
* fix typo in filename used in sh portRich Felker2014-03-181-0/+0
|
* fix size of mips jmp_bufRich Felker2014-03-181-1/+1
| | | | | | | | | | | the excess space was unused and unintentional. this change does not affect the ABI between applications and libc. while it does theoretically affect linkage between third-party translation units using jmp_buf as part of a structure, we've already changed jmp_buf at least once on all archs, and problems were never observed, likely because such usage would be very unusual. in any case it's best to get things right now rather than making changes sometime during the 1.0.x series or later.
* remove useless and incorrect uc_regspace member from mips ucontext_tRich Felker2014-03-181-1/+0
| | | | | | this seems to have been copied erroneously from the arm version of the file. it's fairly harmless but it's a mistake and better to fix now than later.
* x32: fix struct statfsrofl0r2014-03-171-2/+4
| | | | | the omission of the padding was uncovered by the latest regression statvfs regression test added to libc-test.
* superh: fix dynamic linking of __fpscr_valuesBobby Bingham2014-03-162-1/+7
| | | | | | | | | | | | | | Applications ended up with copy relocations for this array, which resulted in libc's references to this array pointing to the application's copy. The dynamic linker, however, can require this array before the application is relocated, and therefore before the application's copy of this array is initialized. This resulted in garbage being loaded into FPSCR before executing main, which violated the ABI. We fix this by putting the array in crt1 and making the libc copy private. This prevents libc's reference to the array from pointing to an uninitialized copy in the application.
* fix statfs struct on mipsSzabolcs Nagy2014-03-121-3/+4
| | | | | | The mips statfs struct layout is different than on other archs, so the statfs, fstatfs, statvfs and fstatvfs APIs were broken on mips. Now the ordering is fixed, the types are kept consistent with other archs.
* fix semid_ds structure on mipsSzabolcs Nagy2014-03-121-2/+0
| | | | | This used to be broken when all archs had the same semid_ds definition: there is no padding around the time_t members on mips.
* fix socket.h struct msghdr member types on powerpcRich Felker2014-03-111-4/+4
| | | | | | these were incorrectly copied from the kernel, whose ABI matches the POSIX requirements but with the wrong underlying types and wrong signedness.
* fix sysvipc structures on powerpcRich Felker2014-03-114-20/+16
| | | | | | | | these have been wrong for a long time and were never detected or corrected. powerpc needs some gratuitous extra padding/reserved slots in ipc_perm, big-endian ordering for the padding of time_t slots that was intended by the kernel folks to allow a transition to 64-bit time_t, and some minor gratuitous reordering of struct members.
* move struct semid_ds to from shared sys/sem.h to bitsRich Felker2014-03-118-0/+128
| | | | | | | | | | | | the definition was found to be incorrect at least for powerpc, and fixing this cleanly requires making the definition arch-specific. this will allow cleaning up the definition for other archs to make it more specific, and reversing some of the ugliness (time_t hacks) introduced with the x32 port. this first commit simply copies the existing definition to each arch without any changes. this is intentional, to make it easier to review changes made on a per-arch basis.
* add bits/user.h for sh portRich Felker2014-03-081-0/+75
| | | | | this seems to have been overlooked, and resulted in breakage in anything including sys/user.h.
* x32: fix sysinfo()rofl0r2014-03-061-0/+47
| | | | | | | | the kernel uses long longs in the struct, but the documentation says they're long. so we need to fixup the mismatch between the userspace and kernelspace structs. since the struct offers a mem_unit member, we can avoid truncation by adjusting that value.
* add nofpu subarchs to the sh arch, and properly detect compiler's fpu configRich Felker2014-02-271-0/+9
|
* fix endian subarchs for sh archRich Felker2014-02-272-5/+5
| | | | | default endianness for sh on linux is little, and while conventions vary, "eb" seems to be the most widely used suffix for big endian.
* rename superh port to "sh" for consistencyRich Felker2014-02-2730-0/+0
| | | | | | | | | linux, gcc, etc. all use "sh" as the name for the superh arch. there was already some inconsistency internally in musl: the dynamic linker was searching for "ld-musl-sh.path" as its path file despite its own name being "ld-musl-superh.so.1". there was some sentiment in both directions as to how to resolve the inconsistency, but overall "sh" was favored.
* mips: add mips-sf subarch support (soft-float)Szabolcs Nagy2014-02-242-1/+12
| | | | | | | | | Userspace emulated floating-point (gcc -msoft-float) is not compatible with the default mips abi (assumes an FPU or in kernel emulation of it). Soft vs hard float abi should not be mixed, __mips_soft_float is checked in musl's configure script and there is no runtime check. The -sf subarch does not save/restore floating-point registers in setjmp/longjmp and only provides dummy fenv implementation.
* fixup general __syscall breakage introduced in x32 portrofl0r2014-02-243-0/+6
| | | | | | | | | the reordering of headers caused some risc archs to not see the __syscall declaration anymore. this caused build errors on mips with any compiler, and on arm and microblaze with clang. we now declare it locally just like the powerpc port does.
* make the x32 port use the correct ld-musl-x32.path filenameRich Felker2014-02-231-1/+1
| | | | | previously it was wrongly using the x86_64 one, precluding having both x32 and x86_64 libs present on the same system.
* superh portBobby Bingham2014-02-2330-0/+1950
|
* fix x32 syscall arch.h timespec fixup coderofl0r2014-02-231-53/+49
| | | | | | | | it's legal to call the __syscall functions with more arguments than necessary, and the __syscall_cp cancel dummy impl. does just that. thus we must insert the switch for all possible syscalls numbers into all of the syscallN inline functions.
* fix some issues in x32 syscall_cp_fixuprofl0r2014-02-231-11/+8
| | | | | | - the nanosleep fixup "fixed" the second timespec* argument erroneusly. - the futex fixup was missing the check for FUTEX_WAIT. - general cleanup using a macro.
* mostly-cosmetic fixups to x32 port mergeRich Felker2014-02-231-1/+1
|
* x32 port (diff against vanilla x86_64)rofl0r2014-02-2313-679/+762
|
* import vanilla x86_64 code as x32rofl0r2014-02-2330-0/+1986
|
* sys/shm.h: move arch specific structs to bits/rofl0r2014-02-236-0/+66
|
* remove more unnecessary operand-size suffixes from x86_64 atomic.hRich Felker2014-01-151-3/+3
|
* remove gratuitous temp vars, casts, and suffixes in x86_64 atomic.hRich Felker2014-01-111-13/+11
| | | | | aside from general cleanup, this should allow the identical atomic.h file to be used for the upcoming x32 port.
* remove size suffix in x86_64 __pthread_self asmRich Felker2014-01-111-1/+1
| | | | | | the operand size is unnecessary, since the assembler knows it from the destination register size. removing the suffix makes it so the same code should work for x32.
* make type of st_dev explicitly dev_t in x86_64 stat.hRich Felker2014-01-111-1/+1
| | | | | | otherwise it's unclear that it's correct. aside from that, it makes for a gratuitous difference between the x86_64 header and the upcoming x32 header.
* add IUTF8 to termios.h on archs that were missing itRich Felker2014-01-084-0/+4
|
* fix namespace violations in termios.h, at least mostlyRich Felker2014-01-086-52/+49
| | | | | | the fix should be complete on archs that use the generic definitions (i386, arm, x86_64, microblaze), but mips and powerpc have not been checked thoroughly and may need more fixes.
* workaround clang deficiency affecting thread pointer access on powerpcRich Felker2013-12-021-1/+6
| | | | | based on patch by Richard Pennington, who initially reported the issue.
* add O_TMPFILE flag, new in linux 3.11Szabolcs Nagy2013-11-236-0/+6
| | | | | | definition in linux: #define O_TMPFILE (__O_TMPFILE | O_DIRECTORY) where __O_TMPFILE and O_DIRECTORY are arch specific
* fix the nominal type of LDBL_* limits on archs with ld64Rich Felker2013-11-204-16/+16
| | | | | | | | | | | previously these macros wrongly had type double rather than long double. I see no way an application could detect the error in C99, but C11's _Generic can trivially detect it. at the same time, even though these archs do not have excess precision, the number of decimal places used to represent these constants has been increased to 21 to be consistent with the decimal representations used for the DBL_* macros.
* add missing i386 syscall numbersRich Felker2013-09-261-0/+10
| | | | somehow the range 335-339 was missed when updating the file.
* remove duplicate lines from mips bits/syscall.hRich Felker2013-09-261-48/+0
|
* fix arm atomic store and generate simpler/less-bloated/faster codeRich Felker2013-09-221-6/+8
| | | | | | | | | | | | | | | | atomic store was lacking a barrier, which was fine for legacy arm with no real smp and kernel-emulated cas, but unsuitable for more modern systems. the kernel provides another "kuser" function, at 0xffff0fa0, which could be used for the barrier, but using that would drop support for kernels 2.6.12 through 2.6.14 unless an extra conditional were added to check for barrier availability. just using the barrier in the kernel cas is easier, and, based on my reading of the assembly code in the kernel, does not appear to be significantly slower. at the same time, other atomic operations are adapted to call the kernel cas function directly rather than using a_cas; due to small differences in their interface contracts, this makes the generated code much simpler.
* support configurable page size on mips, powerpc and microblazeSzabolcs Nagy2013-09-156-6/+3
| | | | | | | | | | | | | | | | PAGE_SIZE was hardcoded to 4096, which is historically what most systems use, but on several archs it is a kernel config parameter, user space can only know it at execution time from the aux vector. PAGE_SIZE and PAGESIZE are not defined on archs where page size is a runtime parameter, applications should use sysconf(_SC_PAGE_SIZE) to query it. Internally libc code defines PAGE_SIZE to libc.page_size, which is set to aux[AT_PAGESZ] in __init_libc and early in __dynlink as well. (Note that libc.page_size can be accessed without GOT, ie. before relocations are done) Some fpathconf settings are hardcoded to 4096, these should be actually queried from the filesystem using statfs.
* fix mips sysv ipc bits headersRich Felker2013-09-142-3/+9
| | | | | | | msg.h was wrong for big-endian (wrong endiannness padding). shm.h was just plain wrong (mips is not supposed to have padding). both changes were tested using libc-test on qemu-system-mips.
* remove the __mxcsr member from fenv_t on i386 to follow the glibc abiSzabolcs Nagy2013-08-181-1/+0
| | | | | | in the previous commit sse fenv support was added, but there is no need to save mxcsr (sse fenv register) so fix the abi incompatibility with glibc.
* fix detection of arm hardfloatRich Felker2013-08-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | it turns out that __SOFTFP__ does not indicate the ABI in use but rather that fpu instructions are not to be used at all. this is specified in ARM's documentation so I'm unclear on how I previously got the wrong idea. unfortunately, this resulted in the 0.9.12 release producing a dynamic linker with the wrong name. fortunately, there do not yet seem to be any public toolchain builds using the wrong name. the __ARM_PCS_VFP macro does not seem to be official from ARM, and in fact it was missing from the very earliest gcc versions (around 4.5.x) that added -mfloat-abi=hard. it would be possible on such versions to perform some ugly linker-based tests instead in hopes that the linker will reject ABI-mismatching object files, if there is demand for supporting such versions. I would probably prefer to document which versions are broken and warn users to manually add -D__ARM_PCS_VFP if using such a version. there's definitely an argument to be made that the fenv macros should be exposed even in -mfloat-abi=softfp mode. for now, I have chosen not to expose them in this case, since the math library will not necessarily have the capability to raise exceptions (it depends on the CFLAGS used to compile it), and since exceptions are officially excluded from the ARM EABI, which the plain "arm" arch aims to follow.
* support floating point environment (fenv) on armhf (hard float) subarchsRich Felker2013-08-161-0/+13
| | | | | patch by nsz. I've tested it on an armhf machine and it seems to be working correctly.
* add function types to arm crt assemblyRich Felker2013-08-151-0/+1
| | | | | | | | | without these, calls may be resolved incorrectly if the calling code has been compiled to thumb instead of arm. it's not clear to me at this point whether crt_arch.h is even working if crt1.c is built as thumb; this needs testing. but the _init and _fini issues were known to cause crashes in static-linked apps when libc was built as thumb, and this commit should fix that issue.
* add missing a_or_l to atomic.h for non-x86 archsRich Felker2013-08-114-0/+20
| | | | this is needed for recently committed sigaction code
* fix _NSIG and SIGRTMAX on mipsRich Felker2013-08-101-1/+1
| | | | | | | | | | | | | | | | | | | | | a mips signal mask contains 128 bits, enough for signals 1 through 128. however, the exit status obtained from the wait-family functions only has room for values up to 127. reportedly signal 128 was causing kernelspace bugs, so it was removed from the kernel recently; even without that issue, however, it was impossible to support it correctly in userspace. at the same time, the bug was masked on musl by SIGRTMAX incorrectly yielding 64 on mips, rather than the "correct" value of 128. now that the _NSIG issue is fixed, SIGRTMAX can be fixed at the same time, exposing the full range of signals for application use. note that the (nonstandardized) libc _NSIG value is actually one greater than the max signal number, and also one greater than the kernel headers' idea of _NSIG. this is the reason for the discrepency with the recent kernel changes. since reducing _NSIG by one brought it down from 129 to 128, rather than from 128 to 127, _NSIG/8, used widely in the musl sources, is unchanged.