Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for all functions provided by glibc #2

Open
tuliom opened this issue Nov 14, 2024 · 1 comment
Open

Add support for all functions provided by glibc #2

tuliom opened this issue Nov 14, 2024 · 1 comment

Comments

@tuliom
Copy link

tuliom commented Nov 14, 2024

C11 added a new memory management function called aligned_alloc.

The lack of this function may cause errors such as zlib-ng/zlib-ng#1809

Keep in mind that glibc provides more function too. A full list is available at:
https://www.gnu.org/software/libc/manual/html_node/Replacing-malloc.html#Replacing-malloc

@lanurmi
Copy link

lanurmi commented Nov 15, 2024

The fix is actually very simple, and here it is as a patch:

diff -rup ElectricFence-2.2.2/efence.c ElectricFence-2.2.2-build/efence.c
--- ElectricFence-2.2.2/efence.c        2024-11-15 10:41:40.989554003 +0200
+++ ElectricFence-2.2.2-build/efence.c  2024-11-15 10:42:43.287556617 +0200
@@ -968,6 +968,12 @@ calloc(size_t nelem, size_t elsize)
        return allocation;
 }

+extern C_LINKAGE void *
+aligned_alloc(size_t alignment, size_t userSize)
+{
+       return memalign(alignment, userSize);
+}
+
 /*
  * This will catch more bugs if you remove the page alignment, but it
  * will break some software.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants