these are also needed by qemu.
both kernel and glibc define it only on x86(_64).
this is needed for qemu, and since it differs for each arch it can't be circumvented easily by using a macro in CFLAGS.
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.