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=powerpc-linux CFLAGS="-g -O2 -fsanitize=address,undefined -Wno-error" CXXLAGS="-g -O2 -fsanitize=address,undefined -Wno-error" LDFLAGS="-ldl" Target: powerpc-linux FAIL: TLSdesc2 Executing on host: sh -c {./ld-new -o tmpdir/tlsdesc3 -z norelro -L/home/mliska/Programming/binutils/ld/testsuite/ld-powerpc -melf64ppc --no-tls-optimize tmpdir/tlsdll.o tmpdir/tlsdesc.o 2>&1} /dev/null ld.tmp (timeout = 300) ==31104==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6180000007a0 at pc 0x000000950b99 bp 0x7fffffffb9c0 sp 0x7fffffffb9b8 #0 0x950b98 in ppc64_elf_size_stubs /home/mliska/Programming/binutils/bfd/elf64-ppc.c:13389 #1 0x4e522b in gldelf64ppc_after_allocation /dev/shm/ygujf3tf/ld/eelf64ppc.c:568 #2 0x489e9d in lang_process /home/mliska/Programming/binutils/ld/ldlang.c:8164 #3 0x41a0fa in main /home/mliska/Programming/binutils/ld/ldmain.c:494 #4 0x7ffff6adacc9 in __libc_start_main (/lib64/libc.so.6+0x26cc9) #5 0x41c949 in _start (/dev/shm/ygujf3tf/ld/ld-new+0x41c949)
The master branch has been updated by Alan Modra <amodra@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=918dc783deadc206691dcc20bf8aa6c807c10244 commit 918dc783deadc206691dcc20bf8aa6c807c10244 Author: Alan Modra <amodra@gmail.com> Date: Tue Aug 25 01:55:38 2020 +0930 PR26489, ASAN: ppc64_elf_size_stubs elf64-ppc.c:13389 Stub sections are inserted after sec_info is sized, so have higher ids. Test flags that will exclude stub sections before looking at the sec_info array. PR 26489 * elf64-ppc.c (ppc64_elf_size_stubs): Test code_sec->has_toc_reloc and code_sec->makes_toc_func_call before sec_info[code_sec->id].
Fixed.
The binutils-2_35-branch branch has been updated by Alan Modra <amodra@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e658f42c0fe7e84a0e1eedaea4b29a4e3a23840c commit e658f42c0fe7e84a0e1eedaea4b29a4e3a23840c Author: Alan Modra <amodra@gmail.com> Date: Tue Aug 25 01:55:38 2020 +0930 PR26489, ASAN: ppc64_elf_size_stubs elf64-ppc.c:13389 Stub sections are inserted after sec_info is sized, so have higher ids. Test flags that will exclude stub sections before looking at the sec_info array. PR 26489 * elf64-ppc.c (ppc64_elf_size_stubs): Test code_sec->has_toc_reloc and code_sec->makes_toc_func_call before sec_info[code_sec->id]. (cherry picked from commit 918dc783deadc206691dcc20bf8aa6c807c10244)