diff options
author | Kang-Che Sung | 2017-01-08 14:31:06 +0100 |
---|---|---|
committer | Denys Vlasenko | 2017-01-08 14:31:06 +0100 |
commit | d5e7ff02921854e28a9859d443f96900e041ca03 (patch) | |
tree | 74c979231242b91b25d3c4557f2db089f5c5901b /archival | |
parent | a474728e82510aa98995f02ac53ca7207b0baf76 (diff) | |
download | busybox-d5e7ff02921854e28a9859d443f96900e041ca03.zip busybox-d5e7ff02921854e28a9859d443f96900e041ca03.tar.gz |
bunzip2: fix code bloat caused by zcat's seamless magic
This example single-applet configuration would trigger the bloat:
CONFIG_FEATURE_SEAMLESS_XZ=y
CONFIG_FEATURE_SEAMLESS_LZMA=y
CONFIG_FEATURE_SEAMLESS_BZ2=y
CONFIG_FEATURE_SEAMLESS_GZ=y
CONFIG_BUNZIP2=y
# CONFIG_ZCAT is not set
# All other applets disabled
Here, the resulting "busybox-bunzip2" binary would contain
unpack_gz_stream, unpack_lzma_stream and unpack_xz_stream functions
code. In other words, the gzip, lzma and xz decompressors' code are
linked into the binary unnecessarily.
This happens because SEAMLESS_MAGIC != 0 and compiler is unable
to figure out that SEAMLESS_MAGIC bit is never set.
Fix this by disabling SEAMLESS_MAGIC option flag (setting its value
to 0) when zcat is disabled. This will help the compiler optimize out
bbunpack() and no longer generate open_zipped() function call.
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival')
-rw-r--r-- | archival/bbunzip.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/archival/bbunzip.c b/archival/bbunzip.c index 60a837e..0eff587 100644 --- a/archival/bbunzip.c +++ b/archival/bbunzip.c @@ -25,7 +25,7 @@ enum { OPT_QUIET = 1 << 3, OPT_DECOMPRESS = 1 << 4, OPT_TEST = 1 << 5, - SEAMLESS_MAGIC = (1 << 31) * SEAMLESS_COMPRESSION, + SEAMLESS_MAGIC = (1 << 31) * ENABLE_ZCAT * SEAMLESS_COMPRESSION, }; static |