summaryrefslogtreecommitdiff
path: root/Makefile.flags
Commit message (Collapse)AuthorAgeFilesLines
* build system: Make it possible to build with 64bit time_tUwe Kleine-König2023-05-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | On most 32bit architectures time_t (and a few other time related types) are a signed 32bit wide integer type. As a consequence they can only represent dates between Fri Dec 13 08:45:52 PM UTC 1901 (-0x80000000 seconds before Jan 1 1970) and Tue Jan 19 03:14:07 AM UTC 2038 (0x7fffffff seconds after Jan 1 1970). Given that some machines that are built today have an expected lifetime of >15 years, this needs to be extended. To to that, define the cpp symbol _TIME_BITS to 64 which results in some magic in glibc to make time_t (and the few other time related types) 64 bit wide. This new switch CONFIG_TIME64 is in the spirit of CONFIG_LFS and only expected to have the expected effect with glibc. On musl for examples time_t already defaults to 64bit wide types. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Makefile.flags: add resolv to LDLIBS for linux compilers too (not only gnu ones)Denys Vlasenko2023-01-021-0/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Fix non-Linux buildsSamuel Thibault2022-11-291-1/+1
| | | | | | | | | | | 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>
* kbuild: Prefer -Oz over -OsBernhard Reutner-Fischer2022-04-241-2/+2
| | | | | | | | | | | | | | | | | | | -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>
* Makefile.flags: use all cflags for crypt and rt checksMartin Kaiser2021-12-121-2/+2
| | | | | | | | | | | | | | | 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>
* Makefile.flags: add a test for -lrt availabilityDenys Vlasenko2021-04-141-5/+8
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* trylink: do not drop libs from CONFIG_EXTRA_LDLIBSDenys Vlasenko2021-02-231-5/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Makefile.flags: fix the OS detection for libresolvMartin Kaiser2021-02-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Do not add -lresolv on non-Linux systemsAlex Samorukov2021-01-041-0/+2
| | | | | | | | 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>
* build system: make -static-libgcc selectable in configDenys Vlasenko2020-12-161-1/+2
| | | | | | OpenWrt wants this off. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Makefile.flags: restrict Wno-constant-logical-operand and ↵Biswapriyo Nath2020-06-101-0/+2
| | | | | | | | | | 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>
* build system: remove KBUILD_STR()Jean-Philippe Brucker2020-04-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Makefile.flags: suppress some clang-9 warningsDenys Vlasenko2019-10-251-3/+22
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Remove syscall wrappers around clock_gettime, closes 12091Denys Vlasenko2019-10-241-2/+4
| | | | | | | | | | | | | | | 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>
* build system: FEATURE_NSLOOKUP_BIG needs -lresolvDenys Vlasenko2018-04-161-0/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Change BB_EXTRA_VERSION: now it needs to contain any spaces/parenthesisDenys Vlasenko2017-07-041-1/+1
| | | | | | | | | | | | | | 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>
* build: add a sanitizer debug optionMike Frysinger2016-02-121-0/+5
| | | | | | | | | 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>
* build system: remove special-casing for extra libsDenys Vlasenko2015-10-121-14/+11
| | | | | | It is not reliable (tried on three systems, multiple problems). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* build system: -fno-builtin-printfDenys Vlasenko2015-10-071-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Aboriginal linux/musl build fixesDenys Vlasenko2015-10-051-0/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Makefile.flags: survive a build system which has no pthreadDenys Vlasenko2015-09-041-1/+6
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Makefile: add missing libraries to LDLIBSBartosz Golaszewski2015-08-171-9/+9
| | | | | | | | | | | | | | 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>
* build system: make CONFIG_EXTRA_LDFLAGS go to LDFLAGS, not EXTRA_LDFLAGSDenys Vlasenko2015-04-141-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* build system: use pkg-config to look up selinux libsMike Frysinger2012-10-201-1/+11
| | | | | | | | 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>
* build system: stop .eh_frame generationDenys Vlasenko2012-09-041-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* disable format security warningsMike Frysinger2012-08-041-0/+1
| | | | | | | | | | | | | | | | | | 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>
* fix build breakage with gcc 4.2.1Denys Vlasenko2012-04-201-1/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* build system: remove bogus $(1) in last commitDenys Vlasenko2012-03-111-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* build system: detect missing crypt and drop it from linkingDenys Vlasenko2012-03-101-7/+8
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* build system: fix broken CONFIG_SYSROOT handlingDenys Vlasenko2012-03-081-1/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Add SYSROOT, EXTRA_{LDFLAGS,LDLIBS} config opts; sample Android NDK configRob Walker2012-03-071-0/+15
| | | | | Signed-off-by: Rob Walker <rwalker@rwalker.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Fix link failure on some platforms when PAM is enabledTristan Schmelcher2011-12-051-1/+8
| | | | | Signed-off-by: Tristan Schmelcher <tristan_schmelcher@alumni.uwaterloo.ca> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Android build fixes and alternate (hopefully simpler) defconfig for itDenys Vlasenko2011-09-091-0/+5
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Compile options: default to -O2 when -Os is not availableWolfgang Denk2011-05-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | 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>
* allow SKIP_STRIP to be set in the envMike Frysinger2010-11-161-1/+1
| | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* diff: more compiler compat fixes. no code changesDan Fandrich2010-02-041-0/+1
| | | | | Signed-off-by: Dan Fandrich <dan@coneharvesters.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* preliminary work for gcc 4.4.0Denys Vlasenko2009-08-221-0/+9
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* the -elf2flt flag can be used w/out -Wl, so drop the requirement so people ↵Mike Frysinger2009-03-121-3/+3
| | | | can use either form
* - add flash_eraseallBernhard Reutner-Fischer2009-02-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* - add CONFIG_EXTRA_CFLAGS (thanks to keesj)Bernhard Reutner-Fischer2009-01-221-0/+5
| | | | | | 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.
* - reinstate commented out _FORTIFY_SOURCE that was somehow dropped by Denys?Bernhard Reutner-Fischer2008-08-051-1/+2
|
* Reinstate DEBUG_PESSIMIZE (by Christian Ionescu-Idbohrn)Denis Vlasenko2008-06-121-3/+10
|
* Build system: track -Wl,-elf2flt in CFLAGS_busybox too.Denis Vlasenko2008-06-061-2/+7
| | | | | | Document in comments that it generally should be thers, not in LDFLAGS
* remove -fno-jump-tables - after stripping it proved to be worseDenis Vlasenko2008-06-041-4/+0
|
* build system: add PIE build optionDenis Vlasenko2008-06-041-4/+16
|
* more -Wall warning fixes. -Wall is enabled now.Denis Vlasenko2008-05-181-3/+7
|
* Add more -W options to gcc.Denis Vlasenko2008-05-151-14/+3
|
* build system: do not rebuild entire tree if it is movedDenis Vlasenko2008-05-081-1/+1
|
* *: add -Wunused-parameter; fix resulting breakageDenis Vlasenko2008-03-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* defconfig: updateDenis Vlasenko2007-12-241-1/+2
| | | | | | | appletli.c: add vda's (C) top: fixlet for incorrect display of "0" Makefile: reduce stack size from 20k to 16k