From 88c9f6d233719ecf79a09f3fae7f13b48a27ef77 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Tue, 3 Dec 2024 20:27:54 +0200 Subject: [PATCH] LibC: Make environ a weak alias If user program defines its own global `environ` variable it will still work :) --- userspace/libraries/LibC/unistd.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/userspace/libraries/LibC/unistd.cpp b/userspace/libraries/LibC/unistd.cpp index fbc8ef0f..3598421e 100644 --- a/userspace/libraries/LibC/unistd.cpp +++ b/userspace/libraries/LibC/unistd.cpp @@ -16,7 +16,8 @@ #include #include -char** environ; +char** __environ; +extern char** environ __attribute__((weak, alias("__environ"))); extern void _init_malloc(); extern void _init_stdio();