Static build with CONFIG_PAM fails on Debian Jessie due to undefined
references to libdl and libaudit.
Static build without pam, but with libcrypt required fails as well due
to undefined references to libpthread.
Fix these two cases by adding the missing libraries to LDLIBS when
appropriate.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Newer versions of libselinux has started linking against more libs.
Rather than continuing hardcoding things, switch to using pkg-config
to query for its dependencies.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
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>
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>
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=43810http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48278http://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>
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>
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.
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.