[PATCH V3] optimize handle_COMDAT
Alan Modra
amodra@gmail.com
Tue Aug 1 22:22:13 GMT 2023
On Tue, Aug 01, 2023 at 10:41:55AM +0930, Alan Modra wrote:
> On Mon, Jul 03, 2023 at 12:09:22AM +0200, Oleg Tolmatcev via Binutils wrote:
> > Am Fr., 30. Juni 2023 um 14:08 Uhr schrieb Nick Clifton <nickc@redhat.com>:
> > > Thank you. Unfortunately there are still a couple of problems
> > > with the patch, Firstly, and most importantly, the patch triggers
> > > a new failure in the linker testsuite:
> > >
> > > Running ld/testsuite/ld-linkonce/linkonce.exp ...
> > > [...]
> > > FAIL: pr26103
> > >
> >
> > I have run "make check" in WSL and it passed. I then rebased the patch
> > on top of master and ran "make check" in WSL again and it passed. I
> > can not reproduce the failure. I develop on Windows, but I even ran it
> > on my Linux machine with Manjaro Linux and it passed.
>
> I applied your latest patch, and it results in failures as Nick said.
>
> aarch64-pe +FAIL: pr26103
> arm-pe +FAIL: pr26103
> arm-wince-pe +FAIL: pr26103
> i686-pe +FAIL: pr26103
> mcore-pe +FAIL: pr26103
> sh-pe +FAIL: pr26103
> x86_64-w64-mingw32 +FAIL: pr26103
>
> This is with mainline binutils built on x86_64-linux using
> ~/src/binutils-gdb/configure \
> --disable-nls \
> --disable-gdb --disable-gdbserver --disable-gdbsupport --disable-gprofng \
> --disable-libbacktrace --disable-libdecnumber --disable-readline --disable-sim \
> --enable-obsolete --target=$target
> make && make check
>
> I think something is wrong with your testing. In ld/ld.log for
> x86_64-w64-mingw32 I see
>
> ./ld-new -o tmpdir/pr26103 -L/home/alan/src/binutils-gdb/ld/testsuite/ld-linkonce tmpdir/ref1.o --start-group tmpdir/sym.a tmpdir/ref2.o --end-group
> Executing on host: sh -c {./ld-new -o tmpdir/pr26103 -L/home/alan/src/binutils-gdb/ld/testsuite/ld-linkonce tmpdir/ref1.o --start-group tmpdir/sym.a tmpdir/ref2.o --end-group 2>&1} /dev/null ld.tmp (timeout = 300)
> spawn [open ...]
> ./ld-new: tmpdir/sym.a(sym2.o):fake:(.gnu.linkonce.d.foo[onex]+0x0): multiple definition of `foo'; tmpdir/sym.a(sym1.o):fake:(.gnu.linkonce.d.foo[one]+0x0): first defined here
> ./ld-new: tmpdir/sym.a(sym3.o):fake:(.gnu.linkonce.d.foo[oney]+0x0): multiple definition of `foo'; tmpdir/sym.a(sym1.o):fake:(.gnu.linkonce.d.foo[one]+0x0): first defined here
> ./ld-new: tmpdir/sym.a(sym2.o):fake:(.gnu.linkonce.d.foo[onex]+0x0): multiple definition of `foo'; tmpdir/sym.a(sym1.o):fake:(.gnu.linkonce.d.foo[one]+0x0): first defined here
> ./ld-new: tmpdir/sym.a(sym3.o):fake:(.gnu.linkonce.d.foo[oney]+0x0): multiple definition of `foo'; tmpdir/sym.a(sym1.o):fake:(.gnu.linkonce.d.foo[one]+0x0): first defined here
> FAIL: pr26103
There is also this with a -fsanitize=address,undefined build.
Executing on host: sh -c {/home/alan/build/gas-san32/x86_64-w64-mingw32/ld/../binutils/ar rc tmpdir/sym.a tmpdir/sym1.o tmpdir/sym2.o tmpdir/sym3.o tmpdir/ref2.o 2>&1} /dev/null ld.tmp (timeout = 300)
spawn [open ...]
=================================================================
==3449699==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf43036ea at pc 0x569046d2 bp 0xffff86c8 sp 0xffff86b8
READ of size 1 at 0xf43036ea thread T0
#0 0x569046d1 in bfd_getl32 /home/alan/src/binutils-gdb/bfd/libbfd.c:838
#1 0x56975f86 in _bfd_pex64i_swap_aux_in /home/alan/build/gas-san32/x86_64-w64-mingw32/bfd/peXXigen.c:319
#2 0x5695fe88 in fill_comdat_hash /home/alan/src/binutils-gdb/bfd/coffcode.h:943
#3 0x5695fe88 in handle_COMDAT /home/alan/src/binutils-gdb/bfd/coffcode.h:1090
#4 0x5695fe88 in styp_to_sec_flags /home/alan/src/binutils-gdb/bfd/coffcode.h:1299
#5 0x569ec52c in make_a_section_from_file /home/alan/src/binutils-gdb/bfd/coffgen.c:210
#6 0x569ec52c in coff_real_object_p /home/alan/src/binutils-gdb/bfd/coffgen.c:368
#7 0x569ee70a in coff_object_p /home/alan/src/binutils-gdb/bfd/coffgen.c:446
#8 0x568f91c9 in bfd_check_format_matches /home/alan/src/binutils-gdb/bfd/format.c:431
#9 0x568fc611 in bfd_check_format /home/alan/src/binutils-gdb/bfd/format.c:94
#10 0x568dd80c in _bfd_write_archive_contents /home/alan/src/binutils-gdb/bfd/archive.c:2180
#11 0x5690cebb in bfd_close /home/alan/src/binutils-gdb/bfd/opncls.c:892
#12 0x568c0723 in write_archive /home/alan/src/binutils-gdb/binutils/ar.c:1288
#13 0x568b0038 in replace_members /home/alan/src/binutils-gdb/binutils/ar.c:1550
#14 0x568b0038 in main /home/alan/src/binutils-gdb/binutils/ar.c:936
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list