This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 18a0893838a libs/libc/libc.csv: Export the environment functions.
18a0893838a is described below

commit 18a0893838a1a22fe9417e9be8c1ebc3c35f93d2
Author: Marco Casaroli <[email protected]>
AuthorDate: Mon Oct 19 11:52:55 2026 +0200

    libs/libc/libc.csv: Export the environment functions.
    
    crt0 passes the environment to main() as its third argument, so every
    ELF program refers to get_environ_ptr().  The system symbol table
    (CONFIG_EXECFUNCS_SYSTEM_SYMTAB), which libc.csv generates, did not have
    it, so no ELF program could be loaded with that table:
    
      libelf_symvalue: ERROR: SHN_UNDEF: Exported symbol "get_environ_ptr"
      not found
    
    Add get_environ_ptr() and the other functions of the environment:
    clearenv(), getenv(), putenv(), secure_getenv(), setenv() and
    unsetenv(), with the condition that builds them.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 libs/libc/libc.csv | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libs/libc/libc.csv b/libs/libc/libc.csv
index 4b80e00415e..451835fdbba 100644
--- a/libs/libc/libc.csv
+++ b/libs/libc/libc.csv
@@ -32,6 +32,7 @@
 "cfgetspeed","termios.h","","speed_t","FAR const struct termios *"
 "cfsetspeed","termios.h","","int","FAR struct termios *","speed_t"
 "chdir","unistd.h","!defined(CONFIG_DISABLE_ENVIRON)","int","FAR const char *"
+"clearenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","int"
 "clock_getcpuclockid","time.h","","int","pid_t","FAR clockid_t *"
 "clock_getres","time.h","","int","clockid_t","FAR struct timespec *"
 "closedir","dirent.h","","int","DIR *"
@@ -91,11 +92,13 @@
 "funlockfile","stdio.h","!defined(CONFIG_FILE_STREAM)","void","FAR FILE *"
 "fwrite","stdio.h","defined(CONFIG_FILE_STREAM)","size_t","FAR const void 
*","size_t","size_t","FAR FILE *"
 "gai_strerror","netdb.h","defined(CONFIG_LIBC_NETDB)","FAR const char *","int"
+"get_environ_ptr","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","FAR char ***"
 "getaddrinfo","netdb.h","defined(CONFIG_LIBC_NETDB)","int","FAR const char 
*","FAR const char *","FAR const struct addrinfo *","FAR struct addrinfo **"
 "getc","stdio.h","","int","FAR FILE *"
 "getcwd","unistd.h","!defined(CONFIG_DISABLE_ENVIRON)","FAR char *","FAR char 
*","size_t"
 "get_current_dir_name","unistd.h","!defined(CONFIG_DISABLE_ENVIRON)","FAR char 
*","void"
 "getegid","unistd.h","","gid_t"
+"getenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","FAR char *","FAR const 
char *"
 "geteuid","unistd.h","","uid_t"
 "gethostbyname","netdb.h","defined(CONFIG_LIBC_NETDB)","FAR struct hostent 
*","FAR const char *"
 "gethostbyname2","netdb.h","defined(CONFIG_LIBC_NETDB)","FAR struct hostent 
*","FAR const char *","int"
@@ -244,6 +247,7 @@
 "pthread_setspecific","pthread.h","!defined(CONFIG_DISABLE_PTHREAD) && 
CONFIG_TLS_NELEM > 0","int","pthread_key_t","FAR const void *"
 
"pthread_sigqueue","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_t","int","const
 union sigval"
 "pthread_yield","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","void"
+"putenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","int","FAR const char *"
 "puts","stdio.h","defined(CONFIG_FILE_STREAM)","int","FAR const IPTR char *"
 "putwc","wchar.h","defined(CONFIG_FILE_STREAM)","wint_t","wchar_t","FAR FILE *"
 
"putwc_unlocked","wchar.h","defined(CONFIG_FILE_STREAM)","wint_t","wchar_t","FAR
 FILE *"
@@ -261,8 +265,10 @@
 "scandir","dirent.h","","int","FAR const char *","FAR struct dirent ***","FAR 
int (*)(const struct dirent *)|FAR void *","FAR void *"
 "sched_get_priority_max","sched.h","","int","int"
 "sched_get_priority_min","sched.h","","int","int"
+"secure_getenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","FAR char 
*","FAR const char *"
 "sem_getvalue","semaphore.h","","int","FAR sem_t *","FAR int *"
 "sem_init","semaphore.h","","int","FAR sem_t *","int","unsigned int"
+"setenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","int","FAR const char 
*","FAR const char *","int"
 "setlocale","locale.h","defined(CONFIG_LIBC_LOCALE)","FAR char *","int","FAR 
const char *"
 "setlogmask","syslog.h","","int","int"
 "setpriority","sys/resource.h","","int","int","id_t","int"
@@ -348,6 +354,7 @@
 "ungetc","stdio.h","defined(CONFIG_FILE_STREAM)","int","int","FAR FILE *"
 "ungetwc","wchar.h","defined(CONFIG_FILE_STREAM)","wint_t","wint_t","FAR FILE 
*"
 
"ungetwc_unlocked","wchar.h","defined(CONFIG_FILE_STREAM)","wint_t","wint_t","FAR
 FILE *"
+"unsetenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","int","FAR const char 
*"
 "usleep","unistd.h","","int","useconds_t"
 "vasprintf","stdio.h","","int","FAR char **","FAR const IPTR char *","va_list"
 "versionsort","dirent.h","","int","FAR const struct dirent **","FAR const 
struct dirent **"

Reply via email to