arch/mips/boot/compressed/decompress.c:undefined reference to `__ashldi3'
Subsystems (3)
kernel test robot
build bottree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 551c722f40809618230001baccf219193e22fc5a commit: d4dba3b9c03a326cfa73833d6b166aeb442f82b5 lib: decompress_bunzip2: fix 32-bit shift undefined behavior date: 6 months ago config: mips-randconfig-r2300-20260930 (https://download.01.org/0day-ci/archive/20260930/[email protected]/config) compiler: mips-linux-gcc (GCC) 15.2.0 sparse: v0.6.5-rc1 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260930/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Fixes: d4dba3b9c03a ("lib: decompress_bunzip2: fix 32-bit shift undefined behavior")
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/All errors (new ones prefixed by >>):
mips-linux-ld: arch/mips/boot/compressed/decompress.o: in function `get_bits':
>> arch/mips/boot/compressed/decompress.c:(.text+0xf4): undefined reference to `__ashldi3' >> mips-linux-ld: arch/mips/boot/compressed/decompress.c:(.text+0x168): undefined reference to `__ashldi3'
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Andrew Morton
maintainerQuoted 11 lines · On Wed, 30 Sep 2026 18:36:50 +0200 kernel test robot <[email protected]> wrote:
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 551c722f40809618230001baccf219193e22fc5a commit: d4dba3b9c03a326cfa73833d6b166aeb442f82b5 lib: decompress_bunzip2: fix 32-bit shift undefined behavior date: 6 months ago config: mips-randconfig-r2300-20260930 (https://download.01.org/0day-ci/archive/20260930/[email protected]/config) compiler: mips-linux-gcc (GCC) 15.2.0 sparse: v0.6.5-rc1 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260930/[email protected]/reproduce)If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
Quoted 9 lines
| Fixes: d4dba3b9c03a ("lib: decompress_bunzip2: fix 32-bit shift undefined behavior") | Reported-by: kernel test robot <[email protected]> | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/All errors (new ones prefixed by >>):
mips-linux-ld:
arch/mips/boot/compressed/decompress.o: in function `get_bits':Quoted 2 lines
Quoted 2 lines
arch/mips/boot/compressed/decompress.c:(.text+0xf4): undefined reference to `__ashldi3'
mips-linux-ld: arch/mips/boot/compressed/decompress.c:(.text+0x168): undefined reference to `__ashldi3'
I dunno, I'd be suspecting a toolchain issue here?
lib/decompress_bunzip2.c +2 -2
@@ -135,7 +135,7 @@ static unsigned int INIT get_bits(struct bunzip_data *bd, char bits_wanted) }/* Avoid 32-bit overflow (dump bit buffer to top of output) */ if (bd->inbufBitCount >=24 ) { - bits = bd->inbufBits&((1 << bd->inbufBitCount)-1 ); + bits = bd->inbufBits & ((1ULL << bd->inbufBitCount) -1 ); bits_wanted -= bd->inbufBitCount; bits <<= bits_wanted; bd->inbufBitCount =0 ;
@@ -146,7 +146,7 @@ static unsigned int INIT get_bits(struct bunzip_data *bd, char bits_wanted) }/* Calculate result */ bd->inbufBitCount -= bits_wanted; - bits |= (bd->inbufBits >> bd->inbufBitCount)&((1 << bits_wanted)-1 ); + bits |= (bd->inbufBits >> bd->inbufBitCount) & ((1ULL << bits_wanted) -1 );return bits; }
32-bit MIPS should be able to do this?
Quoted 57 lines · Andrew Morton
Quoted 1 line · On Wed, 30 Sep 2026 18:36:50 +0200 kernel test robot <[email protected]> wrote:
tree:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
Quoted 2 lines
head: 551c722f40809618230001baccf219193e22fc5a commit: d4dba3b9c03a326cfa73833d6b166aeb442f82b5 lib:
decompress_bunzip2: fix 32-bit shift undefined behaviorQuoted 2 lines
date: 6 months ago config: mips-randconfig-r2300-20260930(https://download.01.org/0day-ci/archive/20260930/[email protected]/config)
Quoted 3 lines
compiler: mips-linux-gcc (GCC) 15.2.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build):(https://download.01.org/0day-ci/archive/20260930/[email protected]/reproduce)
Quoted 2 lines
If you fix the issue in a separate patch/commit (i.e. not just a new
version of
Quoted 2 lines
the same patch/commit), kindly add following tags
| Fixes:d4dba3b9c03a("lib:decompress_bunzip2: fix 32-bit shiftundefined behavior")
Quoted 2 lines
| Reported-by: kernel test robot <[email protected]>
| Closes:https://lore.kernel.org/oe-kbuild-all/[email protected]/
Quoted 4 lines
All errors (new ones prefixed by >>):
mips-linux-ld:
arch/mips/boot/compressed/decompress.o: in function`get_bits':
Quoted 1 line
Quoted 1 line
Quoted 1 line
arch/mips/boot/compressed/decompress.c:(.text+0xf4): undefined
reference to `__ashldi3'
Quoted 1 line
Quoted 1 line
Quoted 1 line
mips-linux-ld: arch/mips/boot/compressed/decompress.c:(.text+0x168):
undefined reference to `__ashldi3'
I dunno, I'd be suspecting a toolchain issue here?
lib/decompress_bunzip2.c +2
-2@@ -135,7 +135,7 @@ static unsigned int INIT get_bits(struct bunzip_data *bd, char bits_wanted) }/* Avoid 32-bit overflow (dump bit buffer to top of output) */ if (bd->inbufBitCount >=24 ) { - bits = bd->inbufBits&((1 << bd->inbufBitCount)-1 ); + bits = bd->inbufBits & ((1ULL << bd->inbufBitCount) -1 ); bits_wanted -= bd->inbufBitCount; bits <<= bits_wanted; bd->inbufBitCount =0 ;@@ -146,7 +146,7 @@ static unsigned int INIT get_bits(struct bunzip_data *bd, char bits_wanted) }/* Calculate result */ bd->inbufBitCount -= bits_wanted; - bits |= (bd->inbufBits >> bd->inbufBitCount)&((1 << bits_wanted)-1 ); + bits |= (bd->inbufBits >> bd->inbufBitCount) & ((1ULL << bits_wanted) -1 );return bits; }
Quoted 1 line
32-bit MIPS should be able to do this?
May I ask why I got CCed in this..??
--- Thanks!
"I'm not a very positive person" - Linus torvalds
Quoted 46 lines · Andrew Morton
Quoted 11 lines · On Wed, 30 Sep 2026 18:36:50 +0200 kernel test robot <[email protected]> wrote:
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 551c722f40809618230001baccf219193e22fc5a commit: d4dba3b9c03a326cfa73833d6b166aeb442f82b5 lib: decompress_bunzip2: fix 32-bit shift undefined behavior date: 6 months ago config: mips-randconfig-r2300-20260930 (https://download.01.org/0day-ci/archive/20260930/[email protected]/config) compiler: mips-linux-gcc (GCC) 15.2.0 sparse: v0.6.5-rc1 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260930/[email protected]/reproduce)If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
Quoted 9 lines
| Fixes: d4dba3b9c03a ("lib: decompress_bunzip2: fix 32-bit shift undefined behavior") | Reported-by: kernel test robot <[email protected]> | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/All errors (new ones prefixed by >>):
mips-linux-ld:
arch/mips/boot/compressed/decompress.o: in function `get_bits':Quoted 2 lines
Quoted 2 lines
arch/mips/boot/compressed/decompress.c:(.text+0xf4): undefined reference to `__ashldi3'
mips-linux-ld: arch/mips/boot/compressed/decompress.c:(.text+0x168): undefined reference to `__ashldi3'I dunno, I'd be suspecting a toolchain issue here?
lib/decompress_bunzip2.c +2
-2@@ -135,7 +135,7 @@ static unsigned int INIT get_bits(struct bunzip_data *bd, char bits_wanted) }/* Avoid 32-bit overflow (dump bit buffer to top of output) */ if (bd->inbufBitCount >=24 ) { - bits = bd->inbufBits&((1 << bd->inbufBitCount)-1 ); + bits = bd->inbufBits & ((1ULL << bd->inbufBitCount) -1 ); bits_wanted -= bd->inbufBitCount; bits <<= bits_wanted; bd->inbufBitCount =0 ;@@ -146,7 +146,7 @@ static unsigned int INIT get_bits(struct bunzip_data *bd, char bits_wanted) }/* Calculate result */ bd->inbufBitCount -= bits_wanted; - bits |= (bd->inbufBits >> bd->inbufBitCount)&((1 << bits_wanted)-1 ); + bits |= (bd->inbufBits >> bd->inbufBitCount) & ((1ULL << bits_wanted) -1 );return bits; }
Quoted 1 line
32-bit MIPS should be able to do this?
FWIW the patch seems entirely bogus. I don't think you can have inbufBitCount >=
32. If you could, then the patch would still not fix anything, because bd->inbufBits is an (32-bit) unsigned int.
As per MIPS itself, MIPS does not link ashldi3.o into the decompressor for BZ2. It only does so for XZ and ZSTD.
Changing arch/mips/boot/compressed/Makefile would work, but since the change is entirely wrong I would suggest perhaps reverting?
Signature · 1 line
Pedro
Andrew Morton
maintainerQuoted 12 lines · On Thu, 1 Oct 2026 11:30:09 +0100 Pedro Falcato <[email protected]> wrote:
Quoted 7 lines
lib/decompress_bunzip2.c +1
-1- bits |= (bd->inbufBits >> bd->inbufBitCount)&((1 << bits_wanted)-1 ); + bits |= (bd->inbufBits >> bd->inbufBitCount) & ((1ULL << bits_wanted) -1 );return bits; }32-bit MIPS should be able to do this?
FWIW the patch seems entirely bogus. I don't think you can have inbufBitCount >=
32. If you could, then the patch would still not fix anything, becausebd->inbufBitsis an (32-bit) unsigned int.
Quoted 5 lines
As per MIPS itself, MIPS does not link ashldi3.o into the decompressor for BZ2. It only does so for XZ and ZSTD.
Changing
arch/mips/boot/compressed/Makefilewould work, but since the change is entirely wrong I would suggest perhaps reverting?
Sure, thanks. Do you have time to send a formal patch?
Quoted 44 lines · On Thu, 1 Oct 2026 11:30:09 +0100 Pedro Falcato <[email protected]> wrote:
Quoted 43 lines · Andrew Morton
Quoted 11 lines · On Wed, 30 Sep 2026 18:36:50 +0200 kernel test robot <[email protected]> wrote:
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 551c722f40809618230001baccf219193e22fc5a commit: d4dba3b9c03a326cfa73833d6b166aeb442f82b5 lib: decompress_bunzip2: fix 32-bit shift undefined behavior date: 6 months ago config: mips-randconfig-r2300-20260930 (https://download.01.org/0day-ci/archive/20260930/[email protected]/config) compiler: mips-linux-gcc (GCC) 15.2.0 sparse: v0.6.5-rc1 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260930/[email protected]/reproduce)If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
Quoted 9 lines
| Fixes: d4dba3b9c03a ("lib: decompress_bunzip2: fix 32-bit shift undefined behavior") | Reported-by: kernel test robot <[email protected]> | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/All errors (new ones prefixed by >>):
mips-linux-ld:
arch/mips/boot/compressed/decompress.o: in function `get_bits':Quoted 2 lines
Quoted 2 lines
arch/mips/boot/compressed/decompress.c:(.text+0xf4): undefined reference to `__ashldi3'
mips-linux-ld: arch/mips/boot/compressed/decompress.c:(.text+0x168): undefined reference to `__ashldi3'I dunno, I'd be suspecting a toolchain issue here?
lib/decompress_bunzip2.c +2
-2@@ -135,7 +135,7 @@ static unsigned int INIT get_bits(struct bunzip_data *bd, char bits_wanted) }/* Avoid 32-bit overflow (dump bit buffer to top of output) */ if (bd->inbufBitCount >=24 ) { - bits = bd->inbufBits&((1 << bd->inbufBitCount)-1 ); + bits = bd->inbufBits & ((1ULL << bd->inbufBitCount) -1 ); bits_wanted -= bd->inbufBitCount; bits <<= bits_wanted; bd->inbufBitCount =0 ;@@ -146,7 +146,7 @@ static unsigned int INIT get_bits(struct bunzip_data *bd, char bits_wanted) }/* Calculate result */ bd->inbufBitCount -= bits_wanted; - bits |= (bd->inbufBits >> bd->inbufBitCount)&((1 << bits_wanted)-1 ); + bits |= (bd->inbufBits >> bd->inbufBitCount) & ((1ULL << bits_wanted) -1 );
Quoted 8 lines
Quoted 4 lines
lib/decompress_bunzip2.c +0
-0return bits; }32-bit MIPS should be able to do this?
FWIW the patch seems entirely bogus. I don't think you can have inbufBitCount >=
32. If you could, then the patch would still not fix anything, becausebd->inbufBitsis an (32-bit) unsigned int.
The 1 should probably be 1U (or possibly 1UL is 64bit values can happen on 64bit) rather than 1ULL.
Wasn't the problem being solved '1 << 31' being undefined (or UB) and one of the static checkers deciding that should never shift a signed value left? That is entirely bogus anyway.
It is only non-portable because C allows 1's compliment and sign overpunch for negative integers, gcc supports neither (and I think the next C standard mandates 2's compliment).
That is separate from shift right of negative values being UB to allow for cpu that don't have a sign replicating shift (all modern ones do). Think about it, for a shift/rotate left you need one of 0/carry/high-bit and for shift right 0/carry/low-bit so two instruction bits can select one of 0/carry/low-bit/high-bit (giving the often implemented but undocumented shift left that replicates the low bit).
David
Quoted 8 lines
As per MIPS itself, MIPS does not link ashldi3.o into the decompressor for BZ2. It only does so for XZ and ZSTD.
Changing
arch/mips/boot/compressed/Makefilewould work, but since the change is entirely wrong I would suggest perhaps reverting?