mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 16:24:59 +00:00
LibC: Hide posix_memalign
by default
This should keep ports from preferring `posix_memalign` over other implementations of aligned memory.
This commit is contained in:
parent
45995aaeb6
commit
dcd76db319
3 changed files with 10 additions and 0 deletions
|
@ -139,6 +139,9 @@ set(SOURCES ${LIBC_SOURCES} ${AK_SOURCES} ${ELF_SOURCES} ${ASM_SOURCES})
|
||||||
# Prevent GCC from removing null checks by marking the `FILE*` argument non-null
|
# Prevent GCC from removing null checks by marking the `FILE*` argument non-null
|
||||||
set_source_files_properties(stdio.cpp PROPERTIES COMPILE_FLAGS "-fno-builtin-fputc -fno-builtin-fputs -fno-builtin-fwrite")
|
set_source_files_properties(stdio.cpp PROPERTIES COMPILE_FLAGS "-fno-builtin-fputc -fno-builtin-fputs -fno-builtin-fwrite")
|
||||||
|
|
||||||
|
# Add in the `posix_memalign` symbol to avoid breaking existing binaries.
|
||||||
|
set_source_files_properties(stdlib.cpp PROPERTIES COMPILE_FLAGS "-DSERENITY_LIBC_SHOW_POSIX_MEMALIGN")
|
||||||
|
|
||||||
add_library(LibCStaticWithoutDeps STATIC ${SOURCES})
|
add_library(LibCStaticWithoutDeps STATIC ${SOURCES})
|
||||||
target_link_libraries(LibCStaticWithoutDeps PUBLIC ssp LibTimeZone PRIVATE NoCoverage)
|
target_link_libraries(LibCStaticWithoutDeps PUBLIC ssp LibTimeZone PRIVATE NoCoverage)
|
||||||
add_dependencies(LibCStaticWithoutDeps LibM LibSystem LibUBSanitizer)
|
add_dependencies(LibCStaticWithoutDeps LibM LibSystem LibUBSanitizer)
|
||||||
|
|
|
@ -1336,6 +1336,7 @@ void _Exit(int status)
|
||||||
_exit(status);
|
_exit(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SERENITY_LIBC_SHOW_POSIX_MEMALIGN
|
||||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_memalign.html
|
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_memalign.html
|
||||||
int posix_memalign(void** memptr, size_t alignment, size_t size)
|
int posix_memalign(void** memptr, size_t alignment, size_t size)
|
||||||
{
|
{
|
||||||
|
@ -1344,3 +1345,4 @@ int posix_memalign(void** memptr, size_t alignment, size_t size)
|
||||||
(void)size;
|
(void)size;
|
||||||
TODO();
|
TODO();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -101,6 +101,11 @@ int posix_openpt(int flags);
|
||||||
int grantpt(int fd);
|
int grantpt(int fd);
|
||||||
int unlockpt(int fd);
|
int unlockpt(int fd);
|
||||||
|
|
||||||
|
// FIXME: Remove the ifdef once we have a working memalign implementation.
|
||||||
|
// This is hidden by default until then because many applications prefer
|
||||||
|
// `posix_memalign` over other implementations of aligned memory.
|
||||||
|
#ifdef SERENITY_LIBC_SHOW_POSIX_MEMALIGN
|
||||||
int posix_memalign(void**, size_t alignment, size_t size);
|
int posix_memalign(void**, size_t alignment, size_t size);
|
||||||
|
#endif
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue