From owner-freebsd-bugs@freebsd.org Mon Jun 4 21:02:51 2018 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8CA3FF3207 for ; Mon, 4 Jun 2018 21:02:50 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 6EBBD86659 for ; Mon, 4 Jun 2018 21:02:50 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id 320A8FF31FF; Mon, 4 Jun 2018 21:02:50 +0000 (UTC) Delivered-To: bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8869FF31FE for ; Mon, 4 Jun 2018 21:02:49 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.ysv.freebsd.org (mxrelay.ysv.freebsd.org [IPv6:2001:1900:2254:206a::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.ysv.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 80B6486658 for ; Mon, 4 Jun 2018 21:02:49 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.ysv.freebsd.org (Postfix) with ESMTPS id B1FBB118ED for ; Mon, 4 Jun 2018 21:02:48 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id w54L2mvJ084334 for ; Mon, 4 Jun 2018 21:02:48 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id w54L2mBk084325 for bugs@FreeBSD.org; Mon, 4 Jun 2018 21:02:48 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 228753] [i386] lld emits malformed DWARF info for crt1.o Date: Mon, 04 Jun 2018 21:02:48 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: markj@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2018 21:02:51 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D228753 Bug ID: 228753 Summary: [i386] lld emits malformed DWARF info for crt1.o Product: Base System Version: CURRENT Hardware: i386 OS: Any Status: New Severity: Affects Only Me Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: markj@FreeBSD.org With an lld-linked i386 world, ld.bfd hangs when linking the following prog= ram: $ cat conftest.c int k; int foo () { __builtin_alloca (k); } $ During the link, ld emits a warning referencing _start1; it looks like ld f= rom binutils 2.18.5 gets into an infinite loop when performing a lookup in the DWARF info: (gdb) bt=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 #0 0x000d0c1c in add_line_info (table=3D0x207d4548, address=3D, filename=3D0x201a80c0 "\001/usr/home/markj/src/freebsd-dev/lib/csu/i386", l= ine=3D1, column=3D0, end_sequence=3D0) at /usr/home/markj/src/freebsd-dev/gnu/usr.bin/binutils/libbfd/../../../../con= trib/binutils/bfd/dwarf2.c:849 #1 0x000cfd1e in decode_line_info (unit=3D, stash=3D) at /usr/home/markj/src/freebsd-dev/gnu/usr.bin/binutils/libbfd/../../../../con= trib/binutils/bfd/dwarf2.c:1169 #2 0x000cf693 in comp_unit_find_nearest_line (unit=3D0x207d44bc, addr=3D, filename_ptr=3D0xffbfe5d0, functionname_ptr=3D0xffbfe5cc, linenumber_ptr=3D0xffbfe5c8, stash=3D0x20469e30) at /usr/home/markj/src/freebsd-dev/gnu/usr.bin/binutils/libbfd/../../../../con= trib/binutils/bfd/dwarf2.c:2103=20 #3 0x000ced29 in find_line (abfd=3D0x201d50c0, section=3D, offset=3D160, symbol=3D0x0, symbols=3D0x20480000, filename_ptr=3D0xffbfe5d0= ,=20=20=20=20=20=20=20=20=20=20=20=20 functionname_ptr=3D0xffbfe5cc, linenumber_ptr=3D0xffbfe5c8, addr_size= =3D0, pinfo=3D0x20197344)=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 at /usr/home/markj/src/freebsd-dev/gnu/usr.bin/binutils/libbfd/../../../../con= trib/binutils/bfd/dwarf2.c:2575=20 #4 0x000ce063 in _bfd_dwarf2_find_nearest_line (abfd=3D0x201d50c0, section=3D0x201990d0, symbols=3D0x20480000, offset=3D160, filename_ptr=3D0x= ffbfe5d0,=20=20=20=20 functionname_ptr=3D0xffbfe5cc, linenumber_ptr=3D0xffbfe5c8, addr_size= =3D0, pinfo=3D0x20197344)=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 at /usr/home/markj/src/freebsd-dev/gnu/usr.bin/binutils/libbfd/../../../../con= trib/binutils/bfd/dwarf2.c:2607=20 #5 0x000ac37e in _bfd_elf_find_nearest_line (abfd=3D0x201d50c0, section=3D0x201990d0, symbols=3D0x20480000, offset=3D160, filename_ptr=3D0x= ffbfe5d0,=20=20=20=20 functionname_ptr=3D0xffbfe5cc, line_ptr=3D0xffbfe5c8)=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 at /usr/home/markj/src/freebsd-dev/gnu/usr.bin/binutils/libbfd/../../../../con= trib/binutils/bfd/elf.c:7198=20 #6 0x0007c3a9 in vfinfo (fp=3D0x181bac <__sF+472>, fmt=3D0x250e8 " undefin= ed reference to `%T'\n", arg=3D0xffbfe668 "\300P\035 \320\220\031 \240", is_warning=3D1)=20=20 at /usr/home/markj/src/freebsd-dev/gnu/usr.bin/binutils/ld/../../../../contrib= /binutils/ld/ldmisc.c:324=20 #7 0x0007c82d in einfo (fmt=3D0x250e3 "%X%C: undefined reference to `%T'\n= ")=20=20=20=20=20 at /usr/home/markj/src/freebsd-dev/gnu/usr.bin/binutils/ld/../../../../contrib= /binutils/ld/ldmisc.c:465=20 #8 0x0007b838 in undefined_symbol (info=3D0x1831d0 , name=3D0x2= 01bf6c8 "main", abfd=3D0x201d50c0, section=3D0x201990d0, address=3D160, error=3D1)= =20=20=20=20=20=20=20=20=20=20=20=20 at /usr/home/markj/src/freebsd-dev/gnu/usr.bin/binutils/ld/../../../../contrib= /binutils/ld/ldmain.c:1397=20 #9 0x0008f1d6 in elf_i386_relocate_section (output_bfd=3D0x201d5000, info=3D0x1831d0 , input_bfd=3D0x201d50c0, input_section=3D0x2019= 90d0,=20=20=20=20=20=20 contents=3D0x206d5000 "1\355U\211\345\203\344\360\215E\b\203\354\004P\377u\004R\350\b", relocs=3D0x201d8288, local_syms=3D0x2046be00,=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 local_sections=3D0x201ff400) at /usr/home/markj/src/freebsd-dev/gnu/usr.bin/binutils/libbfd/../../../../con= trib/binutils/bfd/elf32-i386.c:2346=20 #10 0x000bb38d in elf_link_input_bfd (input_bfd=3D, finfo=3D)=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 at /usr/home/markj/src/freebsd-dev/gnu/usr.bin/binutils/libbfd/../../../../con= trib/binutils/bfd/elflink.c:8706=20 #11 bfd_elf_final_link (abfd=3D0x201d5000, info=3D0x1831d0 )=20= =20=20=20=20=20=20=20=20=20=20=20=20 at /usr/home/markj/src/freebsd-dev/gnu/usr.bin/binutils/libbfd/../../../../con= trib/binutils/bfd/elflink.c:9843=20 #12 0x0007cf35 in ldwrite () at /usr/home/markj/src/freebsd-dev/gnu/usr.bin/binutils/ld/../../../../contrib= /binutils/ld/ldwrite.c:557=20 #13 0x0007a728 in main (argc=3D, argv=3D)=20= =20=20=20=20=20=20=20=20=20=20=20=20 at /usr/home/markj/src/freebsd-dev/gnu/usr.bin/binutils/ld/../../../../contrib= /binutils/ld/ldmain.c:468 The problem seems to occur only if crt1.o, which is a partial link of crt1_= c.o and crt1_s.o, is linked using lld. That is, if I link everything under lib/= csu using lld and just link crt1.o using ld.bfd, the infinite loop doesn't occu= r. If I try to link conftest.c using ld from binutils 2.30, I get an internal warning instead of a hang: $ clang conftest.c=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20 conftest.c:1:43: warning: control reaches end of non-void function [-Wreturn-type]=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 int k; int foo () { __builtin_alloca (k); }=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20 ^=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20 1 warning generated.=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 /usr/bin/ld: Dwarf Error: Line info data is bigger (0xefb0101) than the spa= ce remaining in the section (0x23f) /usr/lib/crt1.o: In function `_start1':=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20 (.text+0xa0): undefined reference to `main'=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20 clang: error: linker command failed with exit code 1 (use -v to see invocat= ion) $ So it looks like lld is somehow messing up the DWARF info when merging crt1= _c.o and crt1_s.o. --=20 You are receiving this mail because: You are the assignee for the bug.=