diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/applets.h | 10 | ||||
-rw-r--r-- | include/busybox.h | 14 | ||||
-rw-r--r-- | include/libbb.h | 19 | ||||
-rw-r--r-- | include/platform.h | 5 |
4 files changed, 34 insertions, 14 deletions
diff --git a/include/applets.h b/include/applets.h index ac3f65f..ceab003 100644 --- a/include/applets.h +++ b/include/applets.h @@ -24,11 +24,11 @@ s - suid type: */ #if defined(PROTOTYPES) -# define APPLET(name,l,s) int name##_main(int argc, char **argv); -# define APPLET_NOUSAGE(name,main,l,s) int main##_main(int argc, char **argv); -# define APPLET_ODDNAME(name,main,l,s,name2) int main##_main(int argc, char **argv); -# define APPLET_NOEXEC(name,main,l,s,name2) int main##_main(int argc, char **argv); -# define APPLET_NOFORK(name,main,l,s,name2) int main##_main(int argc, char **argv); +# define APPLET(name,l,s) int name##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; +# define APPLET_NOUSAGE(name,main,l,s) int main##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; +# define APPLET_ODDNAME(name,main,l,s,name2) int main##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; +# define APPLET_NOEXEC(name,main,l,s,name2) int main##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; +# define APPLET_NOFORK(name,main,l,s,name2) int main##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; #elif defined(NAME_MAIN_CNAME) # define APPLET(name,l,s) name name##_main name diff --git a/include/busybox.h b/include/busybox.h index 1c23b9b..5c01eca 100644 --- a/include/busybox.h +++ b/include/busybox.h @@ -48,12 +48,22 @@ struct bb_applet { #endif }; + /* Defined in appletlib.c */ extern const struct bb_applet applets[]; extern const unsigned short NUM_APPLETS; -void bbox_prepare_main(char **argv); + +/* Length of these names has effect on size of libbusybox + * and "individual" binaries. Keep them short. + */ +void lbb_prepare(char **argv) MAIN_EXTERNALLY_VISIBLE; #if ENABLE_BUILD_LIBBUSYBOX -int libbusybox_main(int argc, char **argv); +#if ENABLE_FEATURE_SHARED_BUSYBOX +int lbb_main(int argc, char **argv) EXTERNALLY_VISIBLE; +#else +int lbb_main(int argc, char **argv); #endif +#endif + #endif /* _BB_INTERNAL_H_ */ diff --git a/include/libbb.h b/include/libbb.h index 9d8b5f3..be548a3 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -673,7 +673,7 @@ extern int die_sleep; extern int xfunc_error_retval; extern jmp_buf die_jmp; extern void xfunc_die(void) ATTRIBUTE_NORETURN; -extern void bb_show_usage(void) ATTRIBUTE_NORETURN ATTRIBUTE_EXTERNALLY_VISIBLE; +extern void bb_show_usage(void) ATTRIBUTE_NORETURN; extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); extern void bb_perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); @@ -687,18 +687,27 @@ extern void bb_perror_nomsg(void); extern void bb_info_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); extern void bb_verror_msg(const char *s, va_list p, const char *strerr); +/* We need to export XXX_main from libbusybox + * only if we build "individual" binaries + */ +#if ENABLE_FEATURE_INDIVIDUAL +#define MAIN_EXTERNALLY_VISIBLE EXTERNALLY_VISIBLE +#else +#define MAIN_EXTERNALLY_VISIBLE +#endif + /* applets which are useful from another applets */ int bb_cat(char** argv); int bb_echo(char** argv); -int test_main(int argc, char** argv); -int kill_main(int argc, char **argv); +int test_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; +int kill_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; #if ENABLE_ROUTE void bb_displayroutes(int noresolve, int netstatfmt); #endif -int chown_main(int argc, char **argv); +int chown_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; #if ENABLE_GUNZIP -int gunzip_main(int argc, char **argv); +int gunzip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; #endif int bbunpack(char **argv, char* (*make_new_name)(char *filename), diff --git a/include/platform.h b/include/platform.h index 3980945..53d7282 100644 --- a/include/platform.h +++ b/include/platform.h @@ -71,9 +71,10 @@ /* -fwhole-program makes all symbols local. The attribute externally_visible forces a symbol global. */ # if __GNUC_PREREQ (4,1) -# define ATTRIBUTE_EXTERNALLY_VISIBLE __attribute__ ((__externally_visible__)) +# define EXTERNALLY_VISIBLE __attribute__(( visibility("default") )); +//__attribute__ ((__externally_visible__)) # else -# define ATTRIBUTE_EXTERNALLY_VISIBLE +# define EXTERNALLY_VISIBLE # endif /* GNUC >= 4.1 */ /* We use __extension__ in some places to suppress -pedantic warnings |