Commit Graph

57 Commits

Author SHA1 Message Date
Denys Vlasenko
9b80b903c7 build system: stop .eh_frame generation
From Rich Felker:

By default, modern GCC generates DWARF2 debug/unwind tables in the
.eh_frame section of the object files/binaries. This adds significant
bloat (as much as 15%) to the size of the busybox binary, including
the portion mapped/loaded into memory at runtime (possibly a big issue
for NOMMU targets), and the section is not strippable with the strip
command due to being part of the loaded program text.

I've since done some further checking - both testing and asking the
GCC developers about it - and it seems the solution is to add to the
CFLAGS -fno-unwind-tables and -fno-asynchronous-unwind-tables. If
debugging is disabled, this will prevent GCC from outputting DWARF2
tables entirely. But since busybox builds with -g by default, the
interesting case is what happens then. I originally thought these
options would break debugging, but they don't; instead, they tell GCC
to output the DWARF2 tables in the .debug_frame section instead of
the newish .eh_frame section (used for exception handling). With these
options added, busybox_unstripped is still fully debuggable, and the
final busybox binary loses the 15% bloat factor from the DWARF2
tables.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-09-04 11:46:44 +02:00
Mike Frysinger
ca81a93722 disable format security warnings
We pass strings to printf directly a lot.  Some distros enable some flags
in their gcc by default like -Wformat-security.  With these two things, we
end up with a lot of build warnings like so:
	loginutils/chpasswd.c:42:3: warning: format not a string literal and
		no format arguments [-Wformat-security]

But we don't care.  Our focus is first and foremost on size, so adding a
lot of dummy calls like:
-	printf(some_constant_string);
+	printf("%s", some_constant_string);
is pointless bloat.

Disable this warning flag if the compiler supports it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-08-04 16:14:24 -04:00
Denys Vlasenko
6dca172610 fix build breakage with gcc 4.2.1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-04-20 18:24:09 +02:00
Denys Vlasenko
65457625a7 build system: remove bogus $(1) in last commit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-11 12:17:20 +01:00
Denys Vlasenko
c528917195 build system: detect missing crypt and drop it from linking
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-10 16:30:00 +01:00
Denys Vlasenko
39c2cb2e93 build system: fix broken CONFIG_SYSROOT handling
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-08 00:20:01 +01:00
Rob Walker
bf6343796e Add SYSROOT, EXTRA_{LDFLAGS,LDLIBS} config opts; sample Android NDK config
Signed-off-by: Rob Walker <rwalker@rwalker.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-07 12:25:53 +01:00
Tristan Schmelcher
5560e1af0a Fix link failure on some platforms when PAM is enabled
Signed-off-by: Tristan Schmelcher <tristan_schmelcher@alumni.uwaterloo.ca>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-12-05 04:38:58 +01:00
Denys Vlasenko
e0894f567a Android build fixes and alternate (hopefully simpler) defconfig for it
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-09 18:00:44 +02:00
Wolfgang Denk
91b77c3953 Compile options: default to -O2 when -Os is not available
Recent versions of GCC for PowerPC systems suffer from some compiler
bugs which prevent the use of "--enable-target-optspace" in their
configuration, which makes the compiler option "-Os" unavailable;
for reference see

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43810
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48278
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45053

In the result, BusyBox will be compiled without any optimization
options, which causes a huge binary (1.8 MiB for default configuration
on PPC, built with gcc 54.51 from the Yocto / Poky / OpenEmbedded tool
chains).  This commit changes behaviour so "-O2" gets used as fallback
when "-Os" is not available.  This reduces the image size in above
test to 1.3 MiB.  This is still 10...15% more then what we get with
"-Os", but much better than using no optimization at all.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-02 02:50:46 +02:00
Mike Frysinger
b78d561ec7 allow SKIP_STRIP to be set in the env
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-11-16 09:01:30 -05:00
Dan Fandrich
1821d188ca diff: more compiler compat fixes. no code changes
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-04 04:04:56 +01:00
Denys Vlasenko
dc3d8939d4 preliminary work for gcc 4.4.0
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-08-22 02:34:10 +02:00
Mike Frysinger
dec37b3232 the -elf2flt flag can be used w/out -Wl, so drop the requirement so people can use either form 2009-03-12 07:56:49 +00:00
Bernhard Reutner-Fischer
0d22d1755c - add flash_eraseall
This is the result after converting mtd-utils' flash_eraseall to BB.
The functionality given by this patch almost the same except that this
one does not support long options.
I needed this tool a system which does not have a lot of flash for RFS
and merging this into BB as the only way out.

[bigeasy@]$ ./scripts/bloat-o-meter bb_wo_fl bb_w_fl
function                                             old     new   delta
flash_eraseall_main                                    -    1072   +1072
show_progress                                          -      62     +62
packed_usage                                       25156   25176     +20
applet_names                                        1958    1973     +15
applet_main                                         2352    2360      +8
target_endian                                          -       4      +4
applet_nameofs                                       588     590      +2
applet_install_loc                                   147     148      +1
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 5/0 up/down: 1184/0)           Total: 1184 bytes
[bigeasy@]$ size miscutils/flash_eraseall.o
   text    data     bss     dec     hex filename
   1586       4       0    1590     636 miscutils/flash_eraseall.o

Signed-off-by: Benedigt Spranger <b.spranger@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
2009-02-18 13:23:46 +00:00
Bernhard Reutner-Fischer
f6107c7e88 - add CONFIG_EXTRA_CFLAGS (thanks to keesj)
This helps with remembering additional flags like e.g. cpu settings for
  people who did not configured their compiler to produce code for their cpu
  per default.
2009-01-22 13:27:14 +00:00
Bernhard Reutner-Fischer
e6ce824edd - reinstate commented out _FORTIFY_SOURCE that was somehow dropped by Denys? 2008-08-05 19:06:35 +00:00
Denis Vlasenko
bd8390a872 Reinstate DEBUG_PESSIMIZE (by Christian Ionescu-Idbohrn) 2008-06-12 20:23:03 +00:00
Denis Vlasenko
401de648a7 Build system: track -Wl,-elf2flt in CFLAGS_busybox too.
Document in comments that it generally should be thers,
not in LDFLAGS
2008-06-06 16:11:12 +00:00
Denis Vlasenko
1a9bbfb96f remove -fno-jump-tables - after stripping it proved to be worse 2008-06-04 11:53:24 +00:00
Denis Vlasenko
1da86d2f40 build system: add PIE build option 2008-06-04 11:28:24 +00:00
Denis Vlasenko
5599502a55 more -Wall warning fixes. -Wall is enabled now. 2008-05-18 22:28:26 +00:00
Denis Vlasenko
e251337a4d Add more -W options to gcc. 2008-05-15 21:44:46 +00:00
Denis Vlasenko
4b04f543a1 build system: do not rebuild entire tree if it is moved 2008-05-08 16:26:49 +00:00
Denis Vlasenko
68404f13d4 *: add -Wunused-parameter; fix resulting breakage
function                                             old     new   delta
procps_scan                                         1265    1298     +33
aliascmd                                             278     283      +5
parse_file_cmd                                       116     120      +4
dname_enc                                            373     377      +4
setcmd                                                90      93      +3
execcmd                                               57      60      +3
count_lines                                           72      74      +2
process_command_subs                                 340     339      -1
test_main                                            409     407      -2
mknod_main                                           179     177      -2
handle_incoming_and_exit                            2653    2651      -2
argstr                                              1312    1310      -2
shiftcmd                                             131     128      -3
exitcmd                                               46      43      -3
dotcmd                                               297     294      -3
breakcmd                                              86      83      -3
evalpipe                                             353     349      -4
evalcommand                                         1180    1176      -4
evalcmd                                              109     105      -4
send_tree                                            374     369      -5
mkfifo_main                                           82      77      -5
evalsubshell                                         152     147      -5
typecmd                                               75      69      -6
letcmd                                                61      55      -6
add_cmd                                             1190    1183      -7
main                                                 891     883      -8
ash_main                                            1415    1407      -8
parse_stream                                        1377    1367     -10
alloc_procps_scan                                     55       -     -55
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 7/21 up/down: 54/-148)          Total: -94 bytes
   text    data     bss     dec     hex filename
 797195     658    7428  805281   c49a1 busybox_old
 797101     658    7428  805187   c4943 busybox_unstripped
2008-03-17 09:00:54 +00:00
Denis Vlasenko
fcfb5c04bb defconfig: update
appletli.c: add vda's (C)
top: fixlet for incorrect display of "0"
Makefile: reduce stack size from 20k to 16k
2007-12-24 12:16:24 +00:00
Denis Vlasenko
9b49a5ed85 add -fvisibility=hidden to CC flags, mark XXX_main functions
EXTERNALLY_VISIBLE. 5% size reduction of libbusybox.so
2007-10-11 10:05:36 +00:00
Denis Vlasenko
8d82cf72c9 add -fpic to CC flags when we build libbusybox (14% smaller .so) 2007-10-11 10:02:52 +00:00
Denis Vlasenko
def8898596 reviving libbusybox, adding CONFIG_INDIVIDUAL part 3 2007-10-07 17:06:01 +00:00
Denis Vlasenko
76a6b236a9 reviving libbusybox, adding CONFIG_INDIVIDUAL part 2 2007-10-07 17:05:42 +00:00
Denis Vlasenko
d6e81c7762 login: optional support for PAM 2007-08-21 10:58:18 +00:00
Denis Vlasenko
150d2fa114 Modify method of linking against libs. Now we fisrt try all
specified libs, and if it succeeds, we try to remove them
one-by-one. If link succeeds, then library is thrown out.
Should solve the problem with SELinux linking in libsepol
even when not needed.
2007-07-17 20:39:27 +00:00
Denis Vlasenko
931de892cc random shrinkage of statics, -60 bytes saved 2007-06-21 12:43:45 +00:00
Bernhard Reutner-Fischer
b7e61485d6 since we removed the deprecated matches() now and thus not alot of warnings are currently seen, let's strive to fixup these:
- warn a little bit about unused results
2007-06-21 10:28:11 +00:00
Mike Frysinger
5b5bcf24f5 punt %.bflt target in favor of proper LDFLAGS=-Wl,-elf2flt handling 2007-06-19 15:58:02 +00:00
Denis Vlasenko
e8a0788b24 moved biggest stack buffers to malloc space, or made their size configurable
(8k of shell line edit buffer is an overkill)

# make ARCH=i386 bloatcheck
function                                             old     new   delta
read_line_input                                     3933    3967     +34
ifaddrlist                                           348     345      -3
do_loadfont                                          208     191     -17
edit_file                                            840     819     -21
.rodata                                           129112  129080     -32
uncompress                                          1305    1268     -37
loadfont_main                                        566     495     -71
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/6 up/down: 34/-181)          Total: -147 bytes
2007-06-10 15:08:44 +00:00
Mike Frysinger
c7b10dc037 set default FLTFLAGS for a fatty stack 2007-04-05 21:10:59 +00:00
Mike Frysinger
52a9db6bb8 introduce the concept of LDLIBS for additional libraries so that when we do the final link, the objects/libraries are in the correct order 2007-03-30 05:44:15 +00:00
Bernhard Reutner-Fischer
58a275b303 - reinstate dmalloc and efence support 2007-03-28 15:00:27 +00:00
Denis Vlasenko
d46d3c292e new applets: selinux utils by KaiGai Kohei <kaigai@kaigai.gr.jp> 2007-02-06 19:28:50 +00:00
Denis Vlasenko
4bb31899e5 add -Wwrite-strings to Makefile 2007-02-01 01:51:36 +00:00
Denis Vlasenko
c562bb7487 disable -Wold-style-definition for gcc 3.x 2007-01-29 17:08:51 +00:00
Denis Vlasenko
9dca07d949 make it possible to build bbox without warnings again. 2007-01-27 14:03:15 +00:00
Denis Vlasenko
e0eebc1ef3 Make -Werror configurable 2007-01-27 13:44:53 +00:00
Bernhard Reutner-Fischer
82f8788acc - call cc-option to check if the compiler supports the flags we asked to use 2007-01-23 11:39:13 +00:00
Bernhard Reutner-Fischer
fdcd7c4237 - add more strict prototype checking to catch wrong and broken code (like nested functions) 2007-01-22 17:50:21 +00:00
Bernhard Reutner-Fischer
d6c23aeefb - guess we need dl too 2007-01-08 16:38:33 +00:00
Bernhard Reutner-Fischer
c1feac6e9f - set LD to ld
- simplify the cmd_busybox__ a bit and pass the LDFLAGS via -Wl down to CC
2007-01-08 16:29:15 +00:00
Bernhard Reutner-Fischer
9729e65706 - honor CONFIG_DEBUG 2006-12-13 17:44:24 +00:00
Bernhard Reutner-Fischer
feea1b972c - better distinction between CFLAGS and CPPFLAGS. 2006-12-06 21:51:59 +00:00