Commit Graph

186 Commits

Author SHA1 Message Date
Rich Felker 132cc703f8 remove microblaze user.h incorrectly copied from arm 2012-11-25 21:12:34 -05:00
Rich Felker 4acc95e497 begin sys/user.h and sys/reg.h fixes for ports
aside from microblaze, these should be roughly correct for all archs
now. some misc junk macros and typedefs are missing, which should
probably be added for max compatibility with trace/debug tools.
2012-11-23 20:05:43 -05:00
Rich Felker 98f56b12ce fix powerpc ucontext, again..
it should now really match the kernel. some of the removed padding
corresponded to the difference between user and kernel sigset_t. the
space at the end was redundant with the uc_mcontext member and seems
to have been added as a result of misunderstanding glibc's definition
versus the kernel's.
2012-11-23 19:54:56 -05:00
Rich Felker 144dc4f479 fix termios constants on mips 2012-11-23 17:23:38 -05:00
Rich Felker c72fc23843 sigcontext/mcontext cleanup for arch-specific bits
with these changes, the members/types of mcontext_t and related stuff
should closely match the glibc definitions. unlike glibc, however, the
definitions here avoid using typedefs as much as possible and work
directly with the underlying types, to minimize namespace pollution
from signal.h in the default (_BSD_SOURCE) profile.

this is a first step in improving compatibility with applications
which poke at context/register information -- mainly debuggers, trace
utilities, etc. additional definitions in ucontext.h and other headers
may be needed later.

if feature test macros are used to request a conforming namespace,
mcontext_t is replaced with an opaque structure of the equivalent size
and alignment; conforming programs cannot examine its contents anyway.
2012-11-23 14:35:25 -05:00
Rich Felker a50136dfe1 fix powerpc setjmp/longjmp to save/restore float regs; enlarge/align jmp_buf 2012-11-23 14:30:58 -05:00
Rich Felker 7538708f8b fix up leftover, incorrect NSIG definitions in arch-specific signal.h 2012-11-23 12:20:53 -05:00
Rich Felker b0756d88a0 remove stuff that doesn't belong in powerpc 32-bit sigcontext
these fields were wrongly copied from the kernel's ppc64 struct def
2012-11-23 11:27:25 -05:00
Rich Felker 4860db9f54 more ppc signal.h typedef order fixes 2012-11-21 13:51:14 -05:00
Rich Felker 808f225b7c fix misordered typedefs in ppc signal.h 2012-11-21 13:50:40 -05:00
Rich Felker b5e3832f85 ppc signal/NSIG related fix (warning fix, redefinition) 2012-11-21 13:49:31 -05:00
Rich Felker 65b98213e4 add back NSIG, removed from powerpc in last commit, but for all archs
unlike the previous definition, NSIG/_NSIG is supposed to be one more
than the highest signal number. adding this will allow simplifying
libc-internal code that makes signal-related syscalls, which can be
done as a later step. some apps might use it too; while this usage is
questionable, it's at least not insane.
2012-11-21 13:41:58 -05:00
Rich Felker 57a0b82441 make powerpc signal.h namespace-clean for posix/isoc
also handle the non-GNUC case where alignment attribute is not available
by simply omitting it. this will not cause problems except for
inclusion of mcontex_t/ucontext_t in application-defined structures,
since the natural alignment of the uc_mcontext member relative to the
start of ucontext_t is already correct. and shame on whoever designed
this for making it impossible to satisfy the ABI requirements without
GNUC extensions.
2012-11-21 13:36:01 -05:00
Rich Felker 7bdf11c2c6 fix powerpc types to match abi, and some feature test issues 2012-11-21 13:29:50 -05:00
rofl0r 2df4f6f17b fix invalid usage of mcontext_t in powerpc signal.h 2012-11-21 06:24:05 +01:00
Rich Felker 0004ea613a fix breakage from introducing bits header for sys/io.h
apparently some other archs have sys/io.h and should not break just
because they don't have the x86 port io functions. provide a blank
bits/io.h everywhere for now.
2012-11-18 19:58:15 -05:00
Rich Felker 61aa6324af add port io functions to sys/io.h
based on proposal by Isaac Dunham. nonexistance of bits/io.h will
cause inclusion of sys/io.h to produce an error on archs that are not
supposed to have it. this is probably the desired behavior, but the
error message may be a bit unusual.
2012-11-18 19:31:58 -05:00
Rich Felker f54ac2446a add missing const on powerpc FE_DFL_ENV 2012-11-18 16:58:05 -05:00
Rich Felker 75c450cff3 fenv support for ppc, untested
based on code sent to the mailing list by nsz, with minor changes.
2012-11-18 16:31:14 -05:00
rofl0r 8d2887f884 fcntl.h: O_SEARCH was missing for powerpc
put some macros that do not differ between architectures in the
main header and remove from bits.
restructure mips header so it has the same structure as the others.
2012-11-18 05:14:40 +01:00
rofl0r ae67fe1aad ppc socket.h: add forgotten cmsghdr 2012-11-18 02:42:55 +01:00
Rich Felker a4db94ab78 dynamic linking support for powerpc
incomplete but at least partly working. requires all files to be
compiled in the new "secure" plt model, not the old one that put plt
code in the data segment. TLS is untested but may work. invoking the
dynamic linker explicitly to load a program does not yet handle argv
correctly.
2012-11-16 22:22:34 -05:00
Rich Felker 7718e7cce5 fix ppc stat structure definition 2012-11-16 01:19:42 -05:00
rofl0r 3bb6bd8580 fix powerpc termios.h and ioctl.h 2012-11-16 04:55:52 +01:00
Rich Felker 91738d0241 disable SO_REUSEPORT in sys/socket.h
although a number is reserved for it, this option is not implemented
on Linux and does not work. defining it causes some applications to
use it, and subsequently break due to its failure.
2012-11-15 19:16:10 -05:00
Rich Felker 7491bac33e ppc wchar_t is long, not int 2012-11-15 16:01:54 -05:00
Rich Felker e7257d3e63 fix powerpc atomic compare-and-swap function
previous version did not compare at all; it was just a fancy atomic
write. untested. further atomic fixes may be needed.
2012-11-14 14:24:22 -05:00
Rich Felker 574d01a696 update ppc atomic code to match the endian-agnostic version on other archs 2012-11-14 14:08:33 -05:00
Rich Felker 50cb6dbb0c fix wchar limits mistakenly copied from arm 2012-11-14 14:04:10 -05:00
rofl0r 1c8eb8bad7 PPC port cleaned up, static linking works well now. 2012-11-13 19:12:25 +01:00
Richard Pennington 7669d1e334 import preliminary ppc work by rdp. 2012-11-13 18:15:10 +01:00
Rich Felker 32d6d77e54 fix numerous mips abi constant definition mismatches 2012-11-05 14:29:04 -05:00
Rich Felker dde325d7b3 fix struct stat size/padding on microblaze 2012-10-19 18:52:14 -04:00
Rich Felker 25011215be inline syscalls for microblaze 2012-10-18 22:13:36 -04:00
Rich Felker 64251d8bbd better support for reverse-endian variants of arm/mips/microblaze
these macros are supported by more compilers
2012-10-18 21:50:55 -04:00
Rich Felker f321de9e0a floating point environment/exceptions support for mips 2012-10-18 20:19:53 -04:00
Rich Felker 21284ec75d microblaze TLS relocation support, completely untested 2012-10-15 21:01:48 -04:00
Rich Felker 9ec4283b28 add support for TLS variant I, presently needed for arm and mips
despite documentation that makes it sound a lot different, the only
ABI-constraint difference between TLS variants II and I seems to be
that variant II stores the initial TLS segment immediately below the
thread pointer (i.e. the thread pointer points to the end of it) and
variant I stores the initial TLS segment above the thread pointer,
requiring the thread descriptor to be stored below. the actual value
stored in the thread pointer register also tends to have per-arch
random offsets applied to it for silly micro-optimization purposes.

with these changes applied, TLS should be basically working on all
supported archs except microblaze. I'm still working on getting the
necessary information and a working toolchain that can build TLS
binaries for microblaze, but in theory, static-linked programs with
TLS and dynamic-linked programs where only the main executable uses
TLS should already work on microblaze.

alignment constraints have not yet been heavily tested, so it's
possible that this code does not always align TLS segments correctly
on archs that need TLS variant I.
2012-10-15 18:51:53 -04:00
Rich Felker 185a977074 ensure pointer decay in inline-asm arg for i386 syscall6
this is actually a rather subtle issue: do arrays decay to pointers
when used as inline asm args? gcc says yes, but currently pcc says no.
hopefully this discrepency in pcc will be fixed, but since the
behavior is not clearly defined anywhere I can find, I'm using an
explicit operation to cause the decay to occur.
2012-10-13 23:46:51 -04:00
Rich Felker 12e9b4faf6 i386 vsyscall support (vdso-provided sysenter/syscall instruction based)
this doubles the performance of the fastest syscalls on the atom I
tested it on; improvement is reportedly much more dramatic on
worst-case cpus. cannot be used for cancellable syscalls.
2012-10-11 22:47:07 -04:00
Rich Felker 99a2af6f45 fix incorrect TLS reloc macro names in x86_64 reloc.h 2012-10-05 01:00:40 -04:00
Rich Felker 9c74856af7 dynamic-linked TLS support for everything but dlopen'd libs
currently, only i386 is tested. x86_64 and arm should probably work.
the necessary relocation types for mips and microblaze have not been
added because I don't understand how they're supposed to work, and I'm
not even sure if it's defined yet on microblaze. I may be able to
reverse engineer the requirements out of gcc/binutils output.
2012-10-04 22:48:33 -04:00
Rich Felker 8c0a3d9e5c microblaze port
based on initial work by rdp, with heavy modifications. some features
including threads are untested because qemu app-level emulation seems
to be broken and I do not have a proper system image for testing.
2012-09-29 01:05:31 -04:00
Rich Felker cccc13221d fix IPC_64 in msgctl too 2012-09-22 08:04:17 -04:00
Rich Felker fce46bf980 fix broken semctl on systems that don't use IPC_64 flag
not tested on mips and arm; they may still be broken. x86_64 should be
ok now.
2012-09-22 08:02:42 -04:00
Rich Felker 6d05d86297 add O_EXEC open mode
the linux O_PATH mode provides the necessary semantics for both the
O_SEARCH and O_EXEC modes defined and required by POSIX 2008.
2012-09-15 23:45:41 -04:00
Rich Felker 075fdb909b fix syscall asm constraints for arm too
no problems were detected so far, but the constraints seem to have
been invalid just like the mips ones.
2012-09-15 03:19:41 -04:00
Rich Felker 4221f154ff fix buggy constraints in mips inline syscall asm
if same register is used for input/output, the compiler must be told.
otherwise is generates random junk code that clobbers the result. in
pure syscall-wrapper functions, nothing went wrong, but in more
complex functions where register allocation is non-trivial, things
broke badly.
2012-09-15 02:22:10 -04:00
Rich Felker b238b37a0f add O_PATH/O_SEARCH support to fcntl.h
I'm not 100% sure that Linux's O_PATH meets the POSIX requirements for
O_SEARCH, but it seems very close if not perfect. and old kernels
ignore it, so O_SEARCH will still work as desired as long as the
caller has read permissions to the directory.
2012-09-13 20:56:25 -04:00
Rich Felker cfc09b1ecf improve mips syscall asm constraints to use immediates, if possible
by using the "ir" constraint (immediate or register) and the carefully
constructed instruction addu $2,$0,%2 which can take either an
immediate or a register for %2, the new inline asm admits maximal
optimization with no register spillage to the stack when the compiler
successfully performs constant propagration, but still works by
allocating a register when the syscall number cannot be recognized as
a constant. in the case of syscalls with 0-3 arguments it barely
matters, but for 4-argument syscalls, using an immediate for the
syscall number avoids creating a stack frame for the syscall wrapper
function.
2012-09-11 02:23:47 -04:00