summaryrefslogtreecommitdiff
path: root/Makefile.flags
AgeCommit message (Collapse)Author
2023-01-02Makefile.flags: add resolv to LDLIBS for linux compilers too (not only gnu ones)Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-11-29Fix non-Linux buildsSamuel Thibault
Various tools are Linuxish and should thus only attempted to build on Linux only. Some features are also Linux-only. Also, libresolv is used on all GNU platforms, notably GNU/Hurd and GNU/kfreeBSD. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-04-24kbuild: Prefer -Oz over -OsBernhard Reutner-Fischer
-Oz Optimize aggressively for size rather than speed. with gcc-12 so far (i think only https://gcc.gnu.org/PR32803 and 103773 ) "shorter load imm on x86_64": (add/remove: 0/0 grow/shrink: 4/1670 up/down: 6/-13196) Total: -13190 bytes text data bss dec hex filename 975753 4227 1816 981796 efb24 busybox_old 962442 4227 1816 968485 ec725 busybox_unstripped with clang-15: (add/remove: 394/34 grow/shrink: 161/1856 up/down: 18644/-98946)Total: -80302 bytes text data bss dec hex filename 1120994 16066 1696 1138756 116044 busybox_old 1040689 16026 1696 1058411 10266b busybox_unstripped Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2021-12-12Makefile.flags: use all cflags for crypt and rt checksMartin Kaiser
To check if libcrypt and librt are available, we check if we can compile and link a simple test program. These checks do not match the actual linking if CONFIG_STATIC is enabled. For CONFIG_STATIC, CFLAGS_busybox is set to -static. The checks don't use CFLAGS_busybox and detect a shared libcrypt or librt. If we link busybox later and we have no static libcrypt or librt, linking will fail. Update the libcrypt and librt checks to use CFLAGS_busybox. Signed-off-by: Martin Kaiser <martin@kaiser.cx> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-14Makefile.flags: add a test for -lrt availabilityDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-23trylink: do not drop libs from CONFIG_EXTRA_LDLIBSDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-07Makefile.flags: fix the OS detection for libresolvMartin Kaiser
054493350 ("Do not add -lresolv on non-Linux systems") adds a condition to link with libresolv only on linux systems. The check requires that CONFIG_UNAME_OSNAME equals Linux. This works only if the uname applet is enabled. Otherwise, CONFIG_UNAME_OSNAME is empty, regardless of the platform. By default, CONFIG_UNAME_OSNAME is the output of uname -o. For most linux systems, uname -o returns "GNU/Linux" and the check fails. In this case, linking a static busybox fails because of missing symbols from libresolv. networking/lib.a(nslookup.o): In function `add_query': nslookup.c:789: undefined reference to `__res_mkquery' networking/lib.a(nslookup.o): In function `parse_reply': nslookup.c:355: undefined reference to `ns_initparse' nslookup.c:361: undefined reference to `ns_parserr' nslookup.c:404: undefined reference to `ns_name_uncompress' nslookup.c:418: undefined reference to `ns_get16' nslookup.c:419: undefined reference to `ns_name_uncompress' .. nslookup.c:456: undefined reference to `ns_get16' ... nslookup.c:469: undefined reference to `ns_name_uncompress' ... nslookup.c:489: undefined reference to `ns_get32' ... collect2: error: ld returned 1 exit status This patch uses the output of $CC -dumpmachine to detect the target platform for which we compile. Both gcc and clang support -dumpmachine. Like the original patch, we link against libresolv only if our target platform is linux-based. Fixes: 054493350 ("Do not add -lresolv on non-Linux systems") Signed-off-by: Martin Kaiser <martin@kaiser.cx> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2021-01-04Do not add -lresolv on non-Linux systemsAlex Samorukov
On FreeBSD getaddrinfo and friends are part of libc. Other OS-es will also have own dependencies Signed-off-by: Alex Samorukov <samm@os2.kiev.ua> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-16build system: make -static-libgcc selectable in configDenys Vlasenko
OpenWrt wants this off. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-10Makefile.flags: restrict Wno-constant-logical-operand and ↵Biswapriyo Nath
Wno-string-plus-int options for clang these options were added in b4ef2e3467d8e980ccf13c9dd342459c013b455f commit gcc shows unrecognized command-line option warnings Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-04-29build system: remove KBUILD_STR()Jean-Philippe Brucker
When using GNU Make >=4.3, the KBUILD_STR() definition interferes badly with dependency checks during build, and forces a complete rebuild every time Make runs. In if_changed_rule, Kconfig checks if the command used to build a file has changed since last execution. The previous command is stored in the generated .<file>.o.cmd file. For example applets/.applets.o.cmd defines a "cmd_applets/applets.o" variable: cmd_applets/applets.o := gcc ... -D"KBUILD_STR(s)=#s" ... Here the '#' should be escaped with a backslash, otherwise GNU Make interprets it as starting a comment, and ignore the rest of the variable. As a result of this truncation, the previous command doesn't equal the new command and Make rebuilds each target. The problem started to appear when GNU Make 4.3 (released January 2020), introduced a backward-incompatible fix to macros containing a '#'. While the above use of '#', a simple Make variable, still needs to be escaped, a '#' within a function invocation doesn't need to be escaped anymore. As Martin Dorey explained on the GNU Make discussion [1], the above declaration is generated from make-cmd, defined as: make-cmd = $(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1)))) Since GNU Make 4.3, the first argument of subst should not have a backslash. make-cmd now looks for literally \# and doesn't find it, and as a result doesn't add the backslash when generating .o.cmd files. [1] http://savannah.gnu.org/bugs/?20513 We could fix it by changing make-cmd to "$(subst #,\#,...)", but to avoid compatibility headaches, simply get rid of the KBUILD_STR definition, as done in Linux by b42841b7bb62 ("kbuild: Get rid of KBUILD_STR"). Quote the string arguments directly rather than asking the preprocessor to quote them. Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25Makefile.flags: suppress some clang-9 warningsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-24Remove syscall wrappers around clock_gettime, closes 12091Denys Vlasenko
12091 "Direct use of __NR_clock_gettime is not time64-safe". function old new delta runsv_main 1698 1712 +14 startservice 378 383 +5 get_mono 31 25 -6 date_main 932 926 -6 gettimeofday_ns 17 - -17 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 2/2 up/down: 19/-29) Total: -10 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-16build system: FEATURE_NSLOOKUP_BIG needs -lresolvDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-04Change BB_EXTRA_VERSION: now it needs to contain any spaces/parenthesisDenys Vlasenko
Before this change, BB_EXTRA_VERSION of "" resulted in: "BusyBox v1.28.0.git () multi-call binary" message, after the fix it is: "BusyBox v1.28.0.git multi-call binary" While at it, eliminate BB_BT and BANNER single-use macros. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-02-12build: add a sanitizer debug optionMike Frysinger
Building & running with ASAN is super helpful, so add a dedicated config knob for it. This way people don't have to guess at the right compiler settings in order to get a good build. We can just tell people to enable this one option. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2015-10-12build system: remove special-casing for extra libsDenys Vlasenko
It is not reliable (tried on three systems, multiple problems). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-07build system: -fno-builtin-printfDenys Vlasenko
Benefits are: drops reference to out-of-line putchar(), fixes a few cases of failed string merge. function old new delta i2cdump_main 1488 1502 +14 sha256_process_block64 423 433 +10 sendmail_main 1183 1185 +2 list_table 1114 1116 +2 i2cdetect_main 1235 1237 +2 fdisk_main 2852 2854 +2 builtin_type 119 121 +2 unicode_conv_to_printable2 325 324 -1 scan_recursive 380 378 -2 mkfs_minix_main 2687 2684 -3 buffer_fill_and_print 178 169 -9 putchar 152 - -152 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 7/4 up/down: 34/-167) Total: -133 bytes text data bss dec hex filename 937788 932 17676 956396 e97ec busybox_old 937564 932 17676 956172 e970c busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-05Aboriginal linux/musl build fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-09-04Makefile.flags: survive a build system which has no pthreadDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-17Makefile: add missing libraries to LDLIBSBartosz Golaszewski
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>
2015-04-14build system: make CONFIG_EXTRA_LDFLAGS go to LDFLAGS, not EXTRA_LDFLAGSDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-10-20build system: use pkg-config to look up selinux libsMike Frysinger
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>
2012-09-04build system: stop .eh_frame generationDenys Vlasenko
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-08-04disable format security warningsMike Frysinger
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-04-20fix build breakage with gcc 4.2.1Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-11build system: remove bogus $(1) in last commitDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-10build system: detect missing crypt and drop it from linkingDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-08build system: fix broken CONFIG_SYSROOT handlingDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-07Add SYSROOT, EXTRA_{LDFLAGS,LDLIBS} config opts; sample Android NDK configRob Walker
Signed-off-by: Rob Walker <rwalker@rwalker.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-12-05Fix link failure on some platforms when PAM is enabledTristan Schmelcher
Signed-off-by: Tristan Schmelcher <tristan_schmelcher@alumni.uwaterloo.ca> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-09Android build fixes and alternate (hopefully simpler) defconfig for itDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-02Compile options: default to -O2 when -Os is not availableWolfgang Denk
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>
2010-11-16allow SKIP_STRIP to be set in the envMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-02-04diff: more compiler compat fixes. no code changesDan Fandrich
Signed-off-by: Dan Fandrich <dan@coneharvesters.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-08-22preliminary work for gcc 4.4.0Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-03-12the -elf2flt flag can be used w/out -Wl, so drop the requirement so people ↵Mike Frysinger
can use either form
2009-02-18- add flash_eraseallBernhard Reutner-Fischer
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-01-22- add CONFIG_EXTRA_CFLAGS (thanks to keesj)Bernhard Reutner-Fischer
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.
2008-08-05- reinstate commented out _FORTIFY_SOURCE that was somehow dropped by Denys?Bernhard Reutner-Fischer
2008-06-12Reinstate DEBUG_PESSIMIZE (by Christian Ionescu-Idbohrn)Denis Vlasenko
2008-06-06Build system: track -Wl,-elf2flt in CFLAGS_busybox too.Denis Vlasenko
Document in comments that it generally should be thers, not in LDFLAGS
2008-06-04remove -fno-jump-tables - after stripping it proved to be worseDenis Vlasenko
2008-06-04build system: add PIE build optionDenis Vlasenko
2008-05-18more -Wall warning fixes. -Wall is enabled now.Denis Vlasenko
2008-05-15Add more -W options to gcc.Denis Vlasenko
2008-05-08build system: do not rebuild entire tree if it is movedDenis Vlasenko
2008-03-17*: add -Wunused-parameter; fix resulting breakageDenis Vlasenko
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
2007-12-24defconfig: updateDenis Vlasenko
appletli.c: add vda's (C) top: fixlet for incorrect display of "0" Makefile: reduce stack size from 20k to 16k
2007-10-11add -fvisibility=hidden to CC flags, mark XXX_main functionsDenis Vlasenko
EXTERNALLY_VISIBLE. 5% size reduction of libbusybox.so