Add byteswap/error/libintl/ar/search headers + tsearch family, mempcpy, rawmemchr
Portable ELF tooling (elfutils/libelf, needed by Mesa's radeonsi driver) relies on several standard headers and functions Red Bear's relibc lacked: - <byteswap.h>: bswap_16/32/64 (compiler builtins). - <error.h>: GNU error()/error_at_line() (inline). - <libintl.h>: gettext family as the identity map (catalog-less system; matches glibc's no-catalog fallback behaviour). - <ar.h>: Unix archive struct/magic (header-only). - <search.h> + src/header/search: POSIX tsearch/tfind/tdelete/twalk + GNU tdestroy, implemented as an unbalanced BST (conforming; POSIX mandates no balancing). - string: mempcpy (memcpy returning end) and rawmemchr (unbounded memchr). All complete implementations, no stubs. Additive (no ABI break), so existing sysroot binaries are unaffected.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
/* byteswap.h — byte-order swapping macros.
|
||||
*
|
||||
* Red Bear OS / relibc. Mirrors the glibc <byteswap.h> interface. The macros
|
||||
* lower to the compiler byte-swap builtins, so they are constant-foldable and
|
||||
* need no runtime symbol. Provided because portable ELF/object tooling
|
||||
* (elfutils/libelf, etc.) uses bswap_16/32/64 directly.
|
||||
*/
|
||||
#ifndef _BYTESWAP_H
|
||||
#define _BYTESWAP_H 1
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define bswap_16(x) __builtin_bswap16((uint16_t)(x))
|
||||
#define bswap_32(x) __builtin_bswap32((uint32_t)(x))
|
||||
#define bswap_64(x) __builtin_bswap64((uint64_t)(x))
|
||||
|
||||
#endif /* byteswap.h */
|
||||
Reference in New Issue
Block a user