libc: Always declare getenv, link/symlink and atexit/on_exit

since many c++ library implementation reference these symbols by using ::xxx but never
really use them, the declaration avoid the unused code is pulled into the final binary

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Idd7bf9a1e09b77a6b21f900cd3ede08a1cc82d86
This commit is contained in:
Xiang Xiao 2020-07-06 21:06:43 +08:00 committed by Abdelatif Guettouche
parent a349595316
commit 1bca457b28
4 changed files with 1 additions and 18 deletions

View File

@ -40,7 +40,6 @@ namespace std
using ::rand; using ::rand;
using ::random; using ::random;
#ifndef CONFIG_DISABLE_ENVIRON
// Environment variable support // Environment variable support
using ::get_environ_ptr; using ::get_environ_ptr;
@ -49,18 +48,13 @@ namespace std
using ::clearenv; using ::clearenv;
using ::setenv; using ::setenv;
using ::unsetenv; using ::unsetenv;
#endif
// Process exit functions // Process exit functions
using ::exit; using ::exit;
using ::abort; using ::abort;
#ifdef CONFIG_SCHED_ATEXIT
using ::atexit; using ::atexit;
#endif
#ifdef CONFIG_SCHED_ONEXIT
using ::on_exit; using ::on_exit;
#endif
#ifndef __KERNEL__ #ifndef __KERNEL__
// System command // System command

View File

@ -94,10 +94,8 @@ namespace std
using ::access; using ::access;
using ::rmdir; using ::rmdir;
using ::unlink; using ::unlink;
#ifdef CONFIG_PSEUDOFS_SOFTLINKS using ::symlink;
using ::link;
using ::readlink; using ::readlink;
#endif
// Execution of program files // Execution of program files

View File

@ -121,7 +121,6 @@ int rand(void);
#define srandom(s) srand(s) #define srandom(s) srand(s)
long random(void); long random(void);
#ifndef CONFIG_DISABLE_ENVIRON
/* Environment variable support */ /* Environment variable support */
FAR char **get_environ_ptr(void); FAR char **get_environ_ptr(void);
@ -130,18 +129,13 @@ int putenv(FAR const char *string);
int clearenv(void); int clearenv(void);
int setenv(FAR const char *name, FAR const char *value, int overwrite); int setenv(FAR const char *name, FAR const char *value, int overwrite);
int unsetenv(FAR const char *name); int unsetenv(FAR const char *name);
#endif
/* Process exit functions */ /* Process exit functions */
void exit(int status) noreturn_function; void exit(int status) noreturn_function;
void abort(void) noreturn_function; void abort(void) noreturn_function;
#ifdef CONFIG_SCHED_ATEXIT
int atexit(CODE void (*func)(void)); int atexit(CODE void (*func)(void));
#endif
#ifdef CONFIG_SCHED_ONEXIT
int on_exit(CODE void (*func)(int, FAR void *), FAR void *arg); int on_exit(CODE void (*func)(int, FAR void *), FAR void *arg);
#endif
/* _Exit() is a stdlib.h equivalent to the unistd.h _exit() function */ /* _Exit() is a stdlib.h equivalent to the unistd.h _exit() function */

View File

@ -357,11 +357,8 @@ int access(FAR const char *path, int amode);
int rmdir(FAR const char *pathname); int rmdir(FAR const char *pathname);
int unlink(FAR const char *pathname); int unlink(FAR const char *pathname);
int truncate(FAR const char *path, off_t length); int truncate(FAR const char *path, off_t length);
#ifdef CONFIG_PSEUDOFS_SOFTLINKS
int symlink(FAR const char *path1, FAR const char *path2); int symlink(FAR const char *path1, FAR const char *path2);
ssize_t readlink(FAR const char *path, FAR char *buf, size_t bufsize); ssize_t readlink(FAR const char *path, FAR char *buf, size_t bufsize);
#endif
/* Execution of programs from files */ /* Execution of programs from files */