Commit Graph

153 Commits

Author SHA1 Message Date
Kang-Che Sung
f10f7a21d4 Allow FAST_FUNC to be overridden at build time
Busybox uses FAST_FUNC macro to tweak with IA-32 calling conventions in
order to make the function call slightly smaller or slightly faster.
However, when I experiment with GCC's LTO (Link Time Optimization), I
discovered that FAST_FUNC could hinder LTO's optimization so that the
resulting executable become a few bytes larger (than what is compiled
without FAST_FUNC).

This change allows to specify e.g.
	CONFIG_EXTRA_CFLAGS="-DFAST_FUNC= -flto"
and compile with LTO without a source code hack.

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-09 18:52:32 +01:00
Ari Sundholm
b505251242 include/platform.h: Remove extra #endif introduced in 6df9612.
It causes the compilation to fail.

Signed-off-by: Ari Sundholm <ari@tuxera.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2015-12-17 15:54:04 -05:00
Chris Renshaw
6df961257d Resolve linker issues with Android API 21 (dprintf, tcdrain)
Signed-off-by: Chris Renshaw <osm0sis@outlook.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-12-17 16:42:41 +01:00
Matt Whitlock
778efe37ee Conditionalize Bionic workarounds on __ANDROID_API__
Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-05-03 19:33:32 +02:00
Matt Whitlock
f23e3ec529 Bionic lacks mempcpy; enable existing workaround
Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-05-03 18:57:44 +02:00
Matt Whitlock
cee59053dc Bionic lacks ttyname_r; provide a workaround
Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-04-25 21:32:48 +02:00
Denys Vlasenko
f7f70bf1b3 gzip: speed up and shrink put_16bit()
function                                             old     new   delta
put_16bit                                            104      98      -6

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-02 16:07:07 +01:00
Denys Vlasenko
5104645cf8 platform.h: enable mempcpy for FreeBSD
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-02 03:51:47 +01:00
Denys Vlasenko
8c05a74f7e platform.h: mempcpy needs <string.h>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-29 16:41:48 +01:00
Denys Vlasenko
50a6d86520 platform.h: add compat mempcpy
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-25 22:08:46 +01:00
Bartosz Golaszewski
bf0f2c7aa6 Rename INIT_LAST to INIT_FUNC to avoid confusion
We don't have an INIT_FIRST, so let's rename INIT_LAST to INIT_FUNC
to imply that the function is called at program start-up.

Also: the priority argument for __attribute__((constructor)) isn't
used, so let's remove it.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-30 16:26:57 +02:00
Bartosz Golaszewski
3ed81cf052 unit-tests: implement the unit-testing framework
This set of patches adds a simple unit-testing framework to Busybox

unit-tests: add some helper macros for unit-test framework implementation
unit-tests: implement the unit-testing framework
unit-tests: add basic documentation on writing the unit test cases
unit-tests: modify the Makefile 'test' target to run unit-tests too
unit-tests: add two example test cases
unit-tests: modify the existing strrstr test code to use the unit-test framework

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-22 16:30:41 +02:00
Bernhard Reutner-Fischer
ad16741ccd libbb: provide usleep() fallback implementation
POSIX.1-2008 removed the usleep function, provide a fallback
implementaion using the recommended nanosleep().

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-13 16:37:57 +02:00
Denys Vlasenko
8e0ad2647a Another FreeBSD fix from Matthias Andree
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-08 15:10:54 +01:00
Denys Vlasenko
432fbd7a1a platform.h: undef HAVE_STRCHRNUL only on correct versions of FreeBSD
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-07 14:09:47 +01:00
Daniel Borca
d9fc4d8f92 platform: strchrnul is missing if __APPLE__
Signed-off-by: Daniel Borca <dborca@yahoo.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-27 00:27:46 +01:00
Denys Vlasenko
1f5e81f8f8 md5/sha512: a better fix for strict aliasing warnings
The locations *are* well-aligned for direct stores
on any architecture.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-06-27 01:03:19 +02:00
Mike Frysinger
445e7543e8 platform: use KERNEL_VERSION to simplify uClibc version checking
This makes reading the logic (as well as adding new code) a lot simpler,
and fixes one or two cases that were broken due to incorrect sub-version
tests.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-03-12 11:13:22 -04:00
Denys Vlasenko
e3e321682c Fix move_to_unaligned16
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-27 15:49:38 +01:00
Lauri Kasanen
b8173b603f sha3sum: new applet
function                                             old     new   delta
KeccakF                                                -     496    +496
KeccakF_RoundConstants                                 -     192    +192
sha3_hash                                              -     171    +171
sha3_end                                               -      40     +40
hash_file                                            274     299     +25
KeccakF_RotationConstants                              -      25     +25
KeccakF_PiLane                                         -      25     +25
packed_usage                                       29213   29232     +19
sha3_begin                                             -      18     +18
KeccakF_Mod5                                           -      10     +10
applet_names                                        2445    2453      +8
applet_main                                         1420    1424      +4
applet_nameofs                                       710     712      +2
------------------------------------------------------------------------------
(add/remove: 8/0 grow/shrink: 9/7 up/down: 1049/-54)         Total: ~995 bytes

Signed-off-by: Lauri Kasanen <curaga@operamail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-14 05:20:50 +01:00
Denys Vlasenko
2ffd710656 platform.h: disable ALIGNn macros for s390[x]
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-08-06 17:17:15 +02:00
Tias Guns
3645195377 platform.h: Android tweaks: ioprio defines, BB_ADDITIONAL_PATH
Signed-off-by: Tias Guns <tias@ulyssis.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-10 14:26:32 +02:00
Denys Vlasenko
a76dd50ce1 Move Adroid endgrent() and endpwent() NOPS to libbb.h
They should be after includes of pwd.h and grp.h

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-01-08 16:11:38 +01:00
Denys Vlasenko
6b64a26976 platform.h: define endgrent() and endpwent() as no-ops on Android
Surprisingly, bionic libc seems to lack these functions.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-01-06 16:23:18 +01:00
Oliver Metz
cc87588a61 disable strverscmp usage if we build against uClibc-0.9.31
Signed-off-by: Oliver Metz <oliver.metz@googlemail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-09 02:08:42 +02: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
Matthias Andree
1285437217 Fixes for FreeBSD build
Signed-off-by: Matthias Andree <mandree@freebsd.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-08-28 05:05:02 +02:00
Denys Vlasenko
14bd16ac56 more tweak for bionic
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-08 08:49:40 +02:00
Denys Vlasenko
4dc35fb5b6 platform.h: tweaks for cygwin
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-08 04:41:38 +02:00
Dan Fandrich
75214cfe00 Use the _unlocked stdio macros only when they're all available
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-30 02:59:17 +02:00
Dan Fandrich
0e79e7bb42 Use the built-in getline on more systems that don't have it
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-30 02:11:49 +02:00
Timo Teras
0a5b310067 platform.c: provide getline implementation
Signed-off-by: Timo Teras <timo.teras@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-29 02:19:58 +02:00
Denys Vlasenko
1e18a01fa2 ls: fix HAVE_STRVERSCMP check; add check for older uclibc versions
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-21 17:12:52 +02:00
Denys Vlasenko
561f9c8585 Add HAVE_STRVERSCMP, guard the only usage of strverscmp with #ifdef
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-21 16:38:29 +02:00
Dan Fandrich
f533ec8767 *: simplify Ethernet header includes
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-10 05:17:59 +02:00
Dan Fandrich
71d7313625 platform.h: support for build under Android
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-03 20:51:58 +02:00
Denys Vlasenko
89f5bfd6c3 libbb.h: use inlined sigfillset, sigemptyset, sigisemptyset on uclibc
text    data     bss     dec     hex filename
 875879     493    7584  883956   d7cf4 busybox_old
 875879     493    7584  883956   d7cf4 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-12 23:03:18 +02:00
Denys Vlasenko
47061b4e9b straighten out dprintf/fdprintf mess; remove old "define lchown chown"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-17 23:14:19 +02:00
Dan Fandrich
dc50676cce Move stpcpy replacement function into libbb
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-13 18:37:12 +01:00
Denys Vlasenko
698e8095fa use unistd.h before _POSIX_VERSION
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-08 05:35:04 +01:00
Denys Vlasenko
dd807c16f9 incorporate header fixes proposed in bug 3097
Not sure these are *really* needed, but I suppose they don't hurt

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-07 14:58:57 +01:00
Chris Rees
330718ef55 FreeBSD compat
Signed-off-by: Chris Rees <utisoft@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-24 17:07:06 +01:00
Chris Rees
e3c127d846 FreeBSD compat
Signed-off-by: Chris Rees <utisoft@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-24 17:04:59 +01:00
Denys Vlasenko
1f4a987d47 pltaform.h: move include of stdint.h before uint16_t is used
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-22 17:31:35 +01:00
Denys Vlasenko
b40da22357 fix compile error on non-x86 architectures
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-21 01:16:09 +01:00
Chris Rees
9ad97d5041 sighandler_t definition for BSD
Signed-off-by: Chris Rees <utisoft@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-20 00:51:52 +01:00
Denys Vlasenko
fb132e4737 whitespace cleanup
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-29 11:46:52 +02:00
Denys Vlasenko
e4dcba1c10 *: whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-28 18:57:19 +02:00
Denys Vlasenko
58647e8f85 Remove check for supported libc.
If it is not supported, it won't work. No need to break working ones
which happen to this over this check.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-24 03:02:57 +02:00
Denys Vlasenko
9ff50b8697 *: deinline SWAP_xE64 on 32-bit CPUs. Wins !90 bytes both on 32 and 64 bits
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-18 11:40:26 +02:00