*: a few more NOINLINEs
authorDenys Vlasenko <vda.linux@googlemail.com>
Thu, 8 Oct 2009 12:35:37 +0000 (14:35 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Thu, 8 Oct 2009 12:35:37 +0000 (14:35 +0200)
function                                             old     new   delta
print_linkinfo                                         -     815    +815
do_msg                                                 -     783    +783
INET_setroute                                          -     757    +757
varvalue                                               -     746    +746
do_sem                                                 -     637    +637
inflate_codes                                          -     617    +617
INET6_setroute                                         -     491    +491
edir                                                   -     370    +370
sync_cursor                                            -     298    +298
update_utmp                                            -     246    +246
searchLines                                            -     165    +165
setup_alarm                                            -     144    +144
may_wakeup                                             -     101    +101
getNum                                               566     371    -195
refresh                                             1166     848    -318
rtcwake_main                                         809     479    -330
getty_main                                          2396    1921    -475
chpst_main                                          1373     746    -627
inflate_unzip_internal                              1335     567    -768
evalvar                                             1384     612    -772
ipaddr_list_or_flush                                2160    1246    -914
route_main                                          1585     245   -1340
ipcs_main                                           2523    1049   -1474
------------------------------------------------------------------------------
(add/remove: 13/0 grow/shrink: 0/10 up/down: 6170/-7213)    Total: -1043 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
13 files changed:
archival/libunarchive/decompress_unzip.c
docs/keep_data_small.txt
editors/ed.c
editors/vi.c
loginutils/getty.c
networking/libiproute/ipaddress.c
networking/route.c
runit/chpst.c
scripts/mkdiff_obj [new file with mode: 0755]
scripts/mkdiff_obj_bloat [new file with mode: 0755]
shell/ash.c
util-linux/ipcs.c
util-linux/rtcwake.c

index c571ab43892754d06683cacca0d9f18009303763..feaa047bd6b2e160228d023f67aca1cec06fdde2 100644 (file)
@@ -503,7 +503,7 @@ static void inflate_codes_setup(STATE_PARAM unsigned my_bl, unsigned my_bd)
        md = mask_bits[bd];
 }
 /* called once from inflate_get_next_window */
-static int inflate_codes(STATE_PARAM_ONLY)
+static NOINLINE int inflate_codes(STATE_PARAM_ONLY)
 {
        unsigned e;     /* table entry flag/number of extra bits */
        huft_t *t;      /* pointer to table entry */
index 2ba24e4a1139c3ec8ddfbe152f88e94726fbb26d..079bac3a6de7ea99bf16021dd8dfd3718d83c5e8 100644 (file)
@@ -245,3 +245,7 @@ subCommand             -     841    +841 loss
 receive                -     834    +834 loss
 
 855 bytes saved in total.
+
+scripts/mkdiff_obj_bloat may be useful to automate this process: run
+"scripts/mkdiff_obj_bloat NORMALLY_BUILT_TREE FORCED_NOINLINE_TREE"
+and select modules which shrank.
index 9084a17fbd32159cc4696e78a7cbd2d9f5e2cbd4..dbd8020759ffe0c25f8d55d10eed1c47a766c87e 100644 (file)
@@ -951,7 +951,7 @@ static void deleteLines(int num1, int num2)
  * Returns the line number which matches, or 0 if there was no match
  * with an error printed.
  */
-static int searchLines(const char *str, int num1, int num2)
+static NOINLINE int searchLines(const char *str, int num1, int num2)
 {
        const LINE *lp;
        int len;
index 4decbea17ed269258f2c4829165c426d74f38a7c..a24b723030f693d34e10944722e6aa7e0909d22a 100644 (file)
@@ -1210,7 +1210,7 @@ static int next_tabstop(int col)
 }
 
 //----- Synchronize the cursor to Dot --------------------------
-static void sync_cursor(char *d, int *row, int *col)
+static NOINLINE void sync_cursor(char *d, int *row, int *col)
 {
        char *beg_cur;  // begin and end of "d" line
        char *tp;
index 838adf2e76b116fe702ec12326a1c08256ae415d..f44d387b63ed6d6fe3db2ead0866d58bcd1040a2 100644 (file)
@@ -583,7 +583,7 @@ static void touch(const char *filename)
 }
 
 /* update_utmp - update our utmp entry */
-static void update_utmp(const char *line, char *fakehost)
+static NOINLINE void update_utmp(const char *line, char *fakehost)
 {
        struct utmp ut;
        struct utmp *utp;
index d042af07bc6130a5e3e8b6853f8d3a24f7234713..39af883240cd1e0aaf808db24c5e53ba05eb0bbe 100644 (file)
@@ -94,7 +94,7 @@ static void print_queuelen(char *name)
                printf("qlen %d", ifr.ifr_qlen);
 }
 
-static int print_linkinfo(const struct nlmsghdr *n)
+static NOINLINE int print_linkinfo(const struct nlmsghdr *n)
 {
        struct ifinfomsg *ifi = NLMSG_DATA(n);
        struct rtattr * tb[IFLA_MAX+1];
index 5d2540802c32b1cb2ea51fe46a8ebe85cfaade2c..241be8e09a3507e8d8bc93d90b34ea688783f6e4 100644 (file)
@@ -151,7 +151,7 @@ static int kw_lookup(const char *kwtbl, char ***pargs)
 
 /* Add or delete a route, depending on action. */
 
-static void INET_setroute(int action, char **args)
+static NOINLINE void INET_setroute(int action, char **args)
 {
        struct rtentry rt;
        const char *netmask = NULL;
@@ -336,7 +336,7 @@ static void INET_setroute(int action, char **args)
 
 #if ENABLE_FEATURE_IPV6
 
-static void INET6_setroute(int action, char **args)
+static NOINLINE void INET6_setroute(int action, char **args)
 {
        struct sockaddr_in6 sa6;
        struct in6_rtmsg rt;
index 21297daf6d5f58099eff6f981c5a15bb26e3d101..270ec0aebd42a2ca2131cefa5972fba2cd416f26 100644 (file)
@@ -92,7 +92,7 @@ enum {
        OPT_2 = (1 << 20) * ENABLE_CHPST,
 };
 
-static void edir(const char *directory_name)
+static NOINLINE void edir(const char *directory_name)
 {
        int wdir;
        DIR *dir;
diff --git a/scripts/mkdiff_obj b/scripts/mkdiff_obj
new file mode 100755 (executable)
index 0000000..a6ec5e6
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+filter() {
+       # sed removes " address: " prefixes which mess up diff
+       sed $'s/^\\(\t*\\)[ ]*[0-9a-f][0-9a-f]*:[ \t]*/\\1/' \
+       | sed 's/__GI_//g'
+}
+
+test -d "$1" || exit 1
+test -d "$2" || exit 1
+
+{
+       (
+               cd "$1" || exit 1
+               find -name '*.o' -o -name '*.os' # -o -name '*.so'
+       )
+       (
+               cd "$2" || exit 1
+               find -name '*.o' -o -name '*.os' # -o -name '*.so'
+       )
+} | sed 's:^\./::' | sort | uniq | \
+tee LST | \
+(
+IFS=''
+while read -r oname; do
+       if ! test -f "$1/$oname"; then
+               echo "Only $2/$oname"
+               continue
+       fi
+       if ! test -f "$2/$oname"; then
+               echo "Only $1/$oname"
+               continue
+       fi
+       diff -q -- "$1/$oname" "$2/$oname" >/dev/null && continue
+       (cd "$1"; objdump -dr "$oname" | filter >"$oname.disasm")
+       (cd "$2"; objdump -dr "$oname" | filter >"$oname.disasm")
+       diff -u "$1/$oname.disasm" "$2/$oname.disasm"
+done
+)
diff --git a/scripts/mkdiff_obj_bloat b/scripts/mkdiff_obj_bloat
new file mode 100755 (executable)
index 0000000..63b2c2e
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+test -d "$1" || exit 1
+test -d "$2" || exit 1
+
+{
+       (
+               cd "$1" || exit 1
+               find -name '*.o' -o -name '*.os' # -o -name '*.so'
+       )
+       (
+               cd "$2" || exit 1
+               find -name '*.o' -o -name '*.os' # -o -name '*.so'
+       )
+} | sed 's:^\./::' | sort | uniq | \
+tee LST | \
+(
+IFS=''
+while read -r oname; do
+       if ! test -f "$1/$oname"; then
+               echo "Only $2/$oname"
+               continue
+       fi
+       if ! test -f "$2/$oname"; then
+               echo "Only $1/$oname"
+               continue
+       fi
+       $1/scripts/bloat-o-meter $1/$oname $2/$oname | grep 'otal: 0 byte' >/dev/null && continue
+       $1/scripts/bloat-o-meter $1/$oname $2/$oname
+       size $1/$oname $2/$oname
+       echo
+done
+)
index 54af39ada3c8ea8037247f17a2dd7149c32d2235..f2d372f4afab7e16f3c3957ca4c97dbabd786344 100644 (file)
@@ -6376,7 +6376,7 @@ subevalvar(char *p, char *str, int strloc, int subtype,
  * ash -c 'echo ${#$1}'  name:'$=1'
  * ash -c 'echo ${#1#}'  name:'1=#'
  */
-static ssize_t
+static NOINLINE ssize_t
 varvalue(char *name, int varflags, int flags, struct strlist *var_str_list)
 {
        int num;
index c8c6d76fa15869fd3cece0e7ca03cb0858cfe4c0..c1103b09313e2cedc874447221078e9c3b819ba6 100644 (file)
@@ -242,7 +242,7 @@ static NOINLINE void do_shm(void)
 }
 
 
-static void do_sem(void)
+static NOINLINE void do_sem(void)
 {
        int maxid, semid, id;
        struct semid_ds semary;
@@ -348,7 +348,7 @@ static void do_sem(void)
 }
 
 
-static void do_msg(void)
+static NOINLINE void do_msg(void)
 {
        int maxid, msqid, id;
        struct msqid_ds msgque;
index 278acf3472137edd9ffb7ac74c97d24c6f6d0f58..ee2f031b42333f8e2b143da1015f0caf647fe7ee 100644 (file)
@@ -32,7 +32,7 @@
 
 static time_t rtc_time;
 
-static bool may_wakeup(const char *rtcname)
+static NOINLINE bool may_wakeup(const char *rtcname)
 {
        ssize_t ret;
        char buf[128];
@@ -50,7 +50,7 @@ static bool may_wakeup(const char *rtcname)
        return strncmp(buf, "enabled\n", 8) == 0;
 }
 
-static void setup_alarm(int fd, time_t *wakeup)
+static NOINLINE void setup_alarm(int fd, time_t *wakeup)
 {
        struct tm *tm;
        struct linux_rtc_wkalrm wake;