Bug 26423

Summary: UBSAN error: bfd/elf32-arm.c:10236:24:
Product: binutils Reporter: Martin Liska <mliska>
Component: binutilsAssignee: Alan Modra <amodra>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 2.34   
Target Milestone: 2.36   
Host: Target:
Build: Last reconfirmed: 2020-08-31 00:00:00

Description Martin Liska 2020-08-20 12:07:15 UTC
The following fails when I build binutils with:
configure --build=x86_64-linux --disable-nls --disable-gdb --disable-gdbserver --disable-sim --disable-readline --disable-libdecnumber --enable-obsolete --target=arm-elf CFLAGS="-g -O2 -fsanitize=address,undefined -Wno-error" CXXLAGS="-g -O2 -fsanitize=address,undefined -Wno-error" LDFLAGS="-ldl"
Target: arm-elf
FAIL: TLS shared library gdesc local
Executing on host: sh -c {./ld-new   -L/home/mliska/Programming/binutils/ld/testsuite/ld-arm  -Ttext 0x8000 --section-start foo=0x9010 -o tmpdir/dump tmpdir/group-relocs-alu-bad.o  2>&1}  /dev/null dump.tmp (timeout = 300)
/home/mliska/Programming/binutils/bfd/elf32-arm.c:10236:24: runtime error: left shift of 3 by 30 places cannot be represented in type 'int'
Comment 1 Sourceware Commits 2020-09-01 06:58:27 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=00c91124d44f799a4fb9cd45a0ef44dc47ab1b1a

commit 00c91124d44f799a4fb9cd45a0ef44dc47ab1b1a
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Sep 1 08:03:52 2020 +0930

    PR26423 UBSAN: elf32-arm.c:10237 left shift cannot be represented
    
            PR 26423
            * elf32-arm.c (calculate_group_reloc_mask): Use 3u in shift.
Comment 2 Alan Modra 2020-09-01 07:00:05 UTC
fixed