From owner-freebsd-toolchain@freebsd.org Wed Jan 11 21:09:29 2017 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5EA9CAA21E for ; Wed, 11 Jan 2017 21:09:29 +0000 (UTC) (envelope-from rdivacky@vlakno.cz) Received: from vlakno.cz (mail.vlakno.cz [91.217.96.224]) by mx1.freebsd.org (Postfix) with ESMTP id 3AA5C1C1D for ; Wed, 11 Jan 2017 21:09:28 +0000 (UTC) (envelope-from rdivacky@vlakno.cz) Received: by vlakno.cz (Postfix, from userid 1002) id 6BADF12CD47; Wed, 11 Jan 2017 22:06:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=vlakno.cz; s=mail; t=1484168818; bh=BNNUEc2nP5p+WokX1WJ2koRTgCDe8dYX+iQiqQ+h8ls=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=bDFba2tz6M5C4dmVGnPJ9CQ8uNsny/vStkdeX1wndIGNOcD7y4DUjWAsyFZSAS/Ch 0UDHQFytyrhTreu385yal8hFuKxO9OnB+rfeb/Az/Qxbny8aIEajeQTK8YBD6Feedq 2CUypwtZkzQvAq3KNDfxsgpiZKMc4SvZTeKy99RI= Date: Wed, 11 Jan 2017 22:06:58 +0100 From: Roman Divacky To: Mark Millard Cc: FreeBSD Toolchain Subject: Re: /usr/bin/ld.lld on powerpc64: produces a.out for which: ld-elf.so.1: assert failed: /usr/src/libexec/rtld-elf/powerpc64/reloc.c:374 Message-ID: <20170111210658.GA20265@vlakno.cz> References: <7139F615-8F18-4EDC-9051-5FFEC0C4057F@dsl-only.net> <20170111194844.GA16135@vlakno.cz> <8242A7B9-7ED3-4861-8209-F3728113D188@dsl-only.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8242A7B9-7ED3-4861-8209-F3728113D188@dsl-only.net> User-Agent: Mutt/1.7.2 (2016-11-26) X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2017 21:09:29 -0000 Looks like a progress :) Three questions... Is the readelf -a reasonable now? If you compile with -g, does the backtrace make a bit more sense? And finally, can you try to "nexti/stepi" in gdb from _start to see where things go wrong? Possibly doing it both for ld linked a.out and lld linked a.out and compare where things differ. Thanks! Roman On Wed, Jan 11, 2017 at 12:37:52PM -0800, Mark Millard wrote: > On 2017-Jan-11, at 11:48 AM, Roman Divacky wrote: > > > Can you try this patch? > > > > Index: tools/lld/ELF/Target.cpp > > =================================================================== > > --- tools/lld/ELF/Target.cpp (revision 291691) > > +++ tools/lld/ELF/Target.cpp (working copy) > > @@ -1062,7 +1062,8 @@ > > } > > > > PPC64TargetInfo::PPC64TargetInfo() { > > - PltRel = GotRel = R_PPC64_GLOB_DAT; > > + GotRel = R_PPC64_GLOB_DAT; > > + PltRel = R_PPC64_JMP_SLOT; > > RelativeRel = R_PPC64_RELATIVE; > > GotEntrySize = 8; > > GotPltEntrySize = 8; > > The result for the generated a.out (via ld.lld) was: > > # /usr/local/bin/gdb a.out > . . . > Reading symbols from a.out...done. > (gdb) run > Starting program: /root/c_tests/a.out > > Program received signal SIGSEGV, Segmentation fault. > 0x000000001001056c in ?? () > (gdb) bt > #0 0x000000001001056c in ?? () > #1 0x00000000100100d8 in ?? () > #2 0x00000000500279e0 in ._rtld_start () at /usr/src/libexec/rtld-elf/powerpc64/rtld_start.S:104 > Backtrace stopped: frame did not save the PC > > > === > Mark Millard > markmi at dsl-only.net > > > On Wed, Jan 11, 2017 at 09:47:34AM -0800, Mark Millard wrote: > > > > On 2017-Jan-11, at 8:07 AM, Ed Maste wrote: > > > >> On 11 January 2017 at 04:15, Mark Millard wrote: > >>> > >>> # ./a.out > >>> ld-elf.so.1: assert failed: /usr/src/libexec/rtld-elf/powerpc64/reloc.c:374 > >>> Abort trap (core dumped) > >> > >> Would you paste the output of `readelf -r a.out`? > > > > Here you go, for ld.lld and for ld.bfd . . . > > > > For -fuse-ld=lld : > > > > # readelf -r a.out > > > > Relocation section with addend (.rela.plt): > > r_offset r_info r_type st_value st_name + r_addend > > 000010030038 000300000014 0000000000000000 atexit + 0 > > 000010030040 000200000014 0000000000000000 _init_tls + 0 > > 000010030048 000500000014 0000000000000000 exit + 0 > > > > For -fuse-ld=bfd : > > > > # readelf -r a.out > > > > Relocation section with addend (.rela.plt): > > r_offset r_info r_type st_value st_name + r_addend > > 000010010cb8 000300000015 0000000000000000 atexit + 0 > > 000010010cd0 000400000015 0000000000000000 _init_tls + 0 > > 000010010ce8 000600000015 0000000000000000 exit + 0 > > > > These were done on the powerpc64 machine (native). > > > > > > === > > Mark Millard > > markmi at dsl-only.net > > _______________________________________________ > > freebsd-toolchain@freebsd.org mailing list > > https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain > > To unsubscribe, send any mail to "freebsd-toolchain-unsubscribe@freebsd.org" > > _______________________________________________ > freebsd-toolchain@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain > To unsubscribe, send any mail to "freebsd-toolchain-unsubscribe@freebsd.org"