diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-05-09 17:59:34 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-05-09 17:59:34 +0000 |
commit | 98636eb08c5ecc216e18970e11f7021206ac9b04 (patch) | |
tree | dfc70b7c6bf6276776c4e8198457dcf2df1e09fb /include | |
parent | 50dbed95fb7c0a97135b771385160ca26c377a15 (diff) | |
download | busybox-98636eb08c5ecc216e18970e11f7021206ac9b04.tar.gz |
Use intra-DSO calls when we build libbusybox. No-op for normal build.
This was Bernhard Fischer' idea.
text data bss dec hex filename
773549 7781 9740 791070 c121e busybox.t7/0_lib/libbusybox.so.1.11.0.svn_unstripped
769683 7397 9740 786820 c0184 busybox.t9t/0_lib/libbusybox.so.1.11.0.svn_unstripped
Diffstat (limited to 'include')
-rw-r--r-- | include/busybox.h | 7 | ||||
-rw-r--r-- | include/dump.h | 9 | ||||
-rw-r--r-- | include/grp_.h | 14 | ||||
-rw-r--r-- | include/libbb.h | 42 | ||||
-rw-r--r-- | include/platform.h | 52 | ||||
-rw-r--r-- | include/pwd_.h | 15 | ||||
-rw-r--r-- | include/rtc_.h | 10 | ||||
-rw-r--r-- | include/shadow_.h | 15 | ||||
-rw-r--r-- | include/unarchive.h | 8 | ||||
-rw-r--r-- | include/xatonum.h | 8 | ||||
-rw-r--r-- | include/xregex.h | 9 |
11 files changed, 131 insertions, 58 deletions
diff --git a/include/busybox.h b/include/busybox.h index 0c44d2f51..314b95126 100644 --- a/include/busybox.h +++ b/include/busybox.h @@ -9,6 +9,10 @@ #include "libbb.h" +#if __GNUC_PREREQ(4,1) +# pragma GCC visibility push(hidden) +#endif + /* order matters: used as index into "install_dir[]" in appletlib.c */ typedef enum bb_install_loc_t { _BB_DIR_ROOT = 0, @@ -67,5 +71,8 @@ int lbb_main(char **argv); #endif #endif +#if __GNUC_PREREQ(4,1) +# pragma GCC visibility pop +#endif #endif /* _BB_INTERNAL_H_ */ diff --git a/include/dump.h b/include/dump.h index 7e1715430..20c39c41e 100644 --- a/include/dump.h +++ b/include/dump.h @@ -1,4 +1,9 @@ /* vi: set sw=4 ts=4: */ + +#if __GNUC_PREREQ(4,1) +# pragma GCC visibility push(hidden) +#endif + #define F_IGNORE 0x01 /* %_A */ #define F_SETREP 0x02 /* rep count set, not default */ #define F_ADDRESS 0x001 /* print offset */ @@ -48,3 +53,7 @@ extern int bb_dump_blocksize; /* data block size */ extern int bb_dump_length; /* max bytes to read */ extern enum _vflag bb_dump_vflag; extern off_t bb_dump_skip; /* bytes to skip */ + +#if __GNUC_PREREQ(4,1) +# pragma GCC visibility pop +#endif diff --git a/include/grp_.h b/include/grp_.h index 061b86ef7..45ee22ba9 100644 --- a/include/grp_.h +++ b/include/grp_.h @@ -21,15 +21,13 @@ * POSIX Standard: 9.2.1 Group Database Access <grp.h> */ -#if !ENABLE_USE_BB_PWD_GRP - -#include <grp.h> - -#else - #ifndef _GRP_H #define _GRP_H 1 +#if __GNUC_PREREQ(4,1) +# pragma GCC visibility push(hidden) +#endif + /* The group structure. */ struct group { char *gr_name; /* Group name. */ @@ -128,6 +126,8 @@ extern int getgrouplist(__const char *__user, gid_t __group, of which USER is a member. Also include GROUP. */ extern int initgroups(__const char *__user, gid_t __group); +#if __GNUC_PREREQ(4,1) +# pragma GCC visibility pop +#endif -#endif /* grp.h */ #endif diff --git a/include/libbb.h b/include/libbb.h index 281152f5f..09dcc1b7f 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -65,15 +65,21 @@ #define setlocale(x,y) ((void)0) #endif -#include "pwd_.h" -#include "grp_.h" -/* ifdef it out, because it may include <shadow.h> */ -/* and we may not even _have_ <shadow.h>! */ +#ifdef DMALLOC +#include <dmalloc.h> +#endif + +#if !ENABLE_USE_BB_PWD_GRP +# include <pwd.h> +# include <grp.h> +#endif #if ENABLE_FEATURE_SHADOWPASSWDS -#include "shadow_.h" +# if !ENABLE_USE_BB_SHADOW +# include <shadow.h> +# endif #endif -/* Some libc's don't declare it, help them */ +/* Some libc's forget to declare these, help them */ extern char **environ; #if defined(__GLIBC__) && __GLIBC__ < 2 @@ -106,6 +112,23 @@ struct sysinfo { int sysinfo(struct sysinfo* info); +/* Make all declarations hidden (-fvisibility flag only affects definitions) */ +/* (don't include system headers after this until corresponding pop!) */ +#if __GNUC_PREREQ(4,1) +# pragma GCC visibility push(hidden) +#endif + + +#if ENABLE_USE_BB_PWD_GRP +# include "pwd_.h" +# include "grp_.h" +#endif +#if ENABLE_FEATURE_SHADOWPASSWDS +# if ENABLE_USE_BB_SHADOW +# include "shadow_.h" +# endif +#endif + /* Tested to work correctly with all int types (IIRC :]) */ #define MAXINT(T) (T)( \ ((T)-1) > 0 \ @@ -1344,11 +1367,12 @@ extern const char bb_default_login_shell[]; #undef isdigit #define isdigit(a) ((unsigned)((a) - '0') <= 9) +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) -#ifdef DMALLOC -#include <dmalloc.h> + +#if __GNUC_PREREQ(4,1) +# pragma GCC visibility pop #endif -#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) #endif /* __LIBBUSYBOX_H__ */ diff --git a/include/platform.h b/include/platform.h index 57cff2c33..0e0ccaf90 100644 --- a/include/platform.h +++ b/include/platform.h @@ -17,7 +17,7 @@ #endif /* __restrict is known in EGCS 1.2 and above. */ -#if !__GNUC_PREREQ (2,92) +#if !__GNUC_PREREQ(2,92) # ifndef __restrict # define __restrict /* Ignore */ # endif @@ -27,7 +27,7 @@ macros freely, and know that they will come into play for the version of gcc in which they are supported. */ -#if !__GNUC_PREREQ (2,7) +#if !__GNUC_PREREQ(2,7) # ifndef __attribute__ # define __attribute__(x) # endif @@ -37,7 +37,7 @@ #if defined(__STDC_VERSION__) && __STDC_VERSION__ > 199901L /* it's a keyword */ #else -# if __GNUC_PREREQ (2,7) +# if __GNUC_PREREQ(2,7) # define inline __inline__ # else # define inline @@ -48,49 +48,49 @@ # define __const const #endif -# define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) -# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) -# define ATTRIBUTE_PACKED __attribute__ ((__packed__)) -# define ATTRIBUTE_ALIGNED(m) __attribute__ ((__aligned__(m))) +#define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +#define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) +#define ATTRIBUTE_PACKED __attribute__ ((__packed__)) +#define ATTRIBUTE_ALIGNED(m) __attribute__ ((__aligned__(m))) /* __NO_INLINE__: some gcc's do not honor inlining! :( */ -# if __GNUC_PREREQ (3,0) && !defined(__NO_INLINE__) -# define ALWAYS_INLINE __attribute__ ((always_inline)) inline +#if __GNUC_PREREQ(3,0) && !defined(__NO_INLINE__) +# define ALWAYS_INLINE __attribute__ ((always_inline)) inline /* I've seen a toolchain where I needed __noinline__ instead of noinline */ -# define NOINLINE __attribute__((__noinline__)) -# if !ENABLE_WERROR -# define ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__)) -# define ATTRIBUTE_UNUSED_RESULT __attribute__ ((warn_unused_result)) -# else -# define ATTRIBUTE_DEPRECATED /* n/a */ -# define ATTRIBUTE_UNUSED_RESULT /* n/a */ -# endif +# define NOINLINE __attribute__((__noinline__)) +# if !ENABLE_WERROR +# define ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__)) +# define ATTRIBUTE_UNUSED_RESULT __attribute__ ((warn_unused_result)) # else -# define ALWAYS_INLINE inline /* n/a */ -# define NOINLINE /* n/a */ # define ATTRIBUTE_DEPRECATED /* n/a */ # define ATTRIBUTE_UNUSED_RESULT /* n/a */ # endif +#else +# define ALWAYS_INLINE inline /* n/a */ +# define NOINLINE /* n/a */ +# define ATTRIBUTE_DEPRECATED /* n/a */ +# define ATTRIBUTE_UNUSED_RESULT /* n/a */ +#endif /* -fwhole-program makes all symbols local. The attribute externally_visible forces a symbol global. */ -# if __GNUC_PREREQ (4,1) -# define EXTERNALLY_VISIBLE __attribute__(( visibility("default") )) +#if __GNUC_PREREQ(4,1) +# define EXTERNALLY_VISIBLE __attribute__(( visibility("default") )) //__attribute__ ((__externally_visible__)) -# else -# define EXTERNALLY_VISIBLE -# endif /* GNUC >= 4.1 */ +#else +# define EXTERNALLY_VISIBLE +#endif /* GNUC >= 4.1 */ /* We use __extension__ in some places to suppress -pedantic warnings about GCC extensions. This feature didn't work properly before gcc 2.8. */ -#if !__GNUC_PREREQ (2,8) +#if !__GNUC_PREREQ(2,8) # ifndef __extension__ # define __extension__ # endif #endif /* gcc-2.95 had no va_copy but only __va_copy. */ -#if !__GNUC_PREREQ (3,0) +#if !__GNUC_PREREQ(3,0) # include <stdarg.h> # if !defined va_copy && defined __va_copy # define va_copy(d,s) __va_copy((d),(s)) diff --git a/include/pwd_.h b/include/pwd_.h index f47e4eb2c..6199034d2 100644 --- a/include/pwd_.h +++ b/include/pwd_.h @@ -21,15 +21,13 @@ * POSIX Standard: 9.2.2 User Database Access <pwd.h> */ -#if !ENABLE_USE_BB_PWD_GRP - -#include <pwd.h> - -#else - #ifndef _PWD_H #define _PWD_H 1 +#if __GNUC_PREREQ(4,1) +# pragma GCC visibility push(hidden) +#endif + /* The passwd structure. */ struct passwd { char *pw_name; /* Username. */ @@ -118,5 +116,8 @@ extern int fgetpwent_r(FILE *__restrict __stream, will expect, but this need not be the format of the password file. */ extern int getpw(uid_t __uid, char *__buffer); -#endif /* pwd.h */ +#if __GNUC_PREREQ(4,1) +# pragma GCC visibility pop #endif + +#endif /* pwd.h */ diff --git a/include/rtc_.h b/include/rtc_.h index df359da74..b8e4de895 100644 --- a/include/rtc_.h +++ b/include/rtc_.h @@ -9,12 +9,14 @@ #include "libbb.h" +#if __GNUC_PREREQ(4,1) +# pragma GCC visibility push(hidden) +#endif + extern int rtc_adjtime_is_utc(void); extern int rtc_xopen(const char **default_rtc, int flags); extern time_t rtc_read_time(int fd, int utc); - - /* * Everything below this point has been copied from linux/rtc.h * to eliminate the kernel header dependency @@ -70,4 +72,8 @@ struct linux_rtc_wkalrm { #define RTC_AF 0x20 #define RTC_UF 0x10 +#if __GNUC_PREREQ(4,1) +# pragma GCC visibility pop +#endif + #endif diff --git a/include/shadow_.h b/include/shadow_.h index 92bcde864..5a8b71a47 100644 --- a/include/shadow_.h +++ b/include/shadow_.h @@ -19,15 +19,13 @@ /* Declaration of types and functions for shadow password suite */ -#if !ENABLE_USE_BB_SHADOW - -#include <shadow.h> - -#else - #ifndef _SHADOW_H #define _SHADOW_H 1 +#if __GNUC_PREREQ(4,1) +# pragma GCC visibility push(hidden) +#endif + /* Paths to the user database files */ #ifndef _PATH_SHADOW #define _PATH_SHADOW "/etc/shadow" @@ -110,5 +108,8 @@ extern int lckpwdf(void); /* Unlock password file */ extern int ulckpwdf(void); -#endif /* shadow.h */ +#if __GNUC_PREREQ(4,1) +# pragma GCC visibility pop #endif + +#endif /* shadow.h */ diff --git a/include/unarchive.h b/include/unarchive.h index b49e6cbb5..a6b047794 100644 --- a/include/unarchive.h +++ b/include/unarchive.h @@ -2,6 +2,10 @@ #ifndef __UNARCHIVE_H__ #define __UNARCHIVE_H__ +#if __GNUC_PREREQ(4,1) +# pragma GCC visibility push(hidden) +#endif + #define ARCHIVE_PRESERVE_DATE 1 #define ARCHIVE_CREATE_LEADING_DIRS 2 #define ARCHIVE_EXTRACT_UNCONDITIONAL 4 @@ -126,4 +130,8 @@ extern int open_transformer(int src_fd, const char *transform_prog); #define open_transformer(src_fd, transformer, transform_prog) open_transformer(src_fd, transform_prog) #endif +#if __GNUC_PREREQ(4,1) +# pragma GCC visibility pop +#endif + #endif diff --git a/include/xatonum.h b/include/xatonum.h index 49ddced50..6cf1299b3 100644 --- a/include/xatonum.h +++ b/include/xatonum.h @@ -7,6 +7,10 @@ * Licensed under GPLv2, see file LICENSE in this tarball for details. */ +#if __GNUC_PREREQ(4,1) +# pragma GCC visibility push(hidden) +#endif + /* Provides extern declarations of functions */ #define DECLARE_STR_CONV(type, T, UT) \ \ @@ -166,3 +170,7 @@ uint32_t bb_strtou32(const char *arg, char **endp, int base) /* Floating point */ /* double bb_strtod(const char *arg, char **endp); */ + +#if __GNUC_PREREQ(4,1) +# pragma GCC visibility pop +#endif diff --git a/include/xregex.h b/include/xregex.h index 23cf19c02..d4bf73279 100644 --- a/include/xregex.h +++ b/include/xregex.h @@ -12,7 +12,16 @@ #define __BB_REGEX__ #include <regex.h> + +#if __GNUC_PREREQ(4,1) +# pragma GCC visibility push(hidden) +#endif + char* regcomp_or_errmsg(regex_t *preg, const char *regex, int cflags); void xregcomp(regex_t *preg, const char *regex, int cflags); +#if __GNUC_PREREQ(4,1) +# pragma GCC visibility pop +#endif + #endif |