Date: Tue, 17 Jan 2017 22:56:13 +0100 From: Roman Divacky <rdivacky@vlakno.cz> To: Mark Millard <markmi@dsl-only.net> Cc: Ed Maste <emaste@freebsd.org>, FreeBSD Toolchain <freebsd-toolchain@freebsd.org> 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: <20170117215613.GA95258@vlakno.cz> In-Reply-To: <237EB920-0795-4B18-94D4-2EAC0FC76F01@dsl-only.net> References: <932E3C38-B226-4BF1-B587-5A2D5EA19300@dsl-only.net> <F3923971-6FDF-4269-A7CA-3428249A128F@dsl-only.net> <20170116194035.GA20175@vlakno.cz> <2B1414C5-C56D-42F2-A1CB-4B1FE074667B@dsl-only.net> <43DBF7C7-6632-4906-BB37-FD00621AF857@dsl-only.net> <82402941-D1B2-4938-A43D-E21A390DE041@dsl-only.net> <F38C9607-5AB9-4BF9-BEC1-88EA2518A9CE@dsl-only.net> <27422F1B-6906-4D37-860A-D1BC8DC83BBF@dsl-only.net> <20170117195424.GA89237@vlakno.cz> <237EB920-0795-4B18-94D4-2EAC0FC76F01@dsl-only.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Go with Out. On Tue, Jan 17, 2017 at 01:53:14PM -0800, Mark Millard wrote: > On 2017-Jan-17, at 11:54 AM, Roman Divacky <rdivacky at vlakno.cz> wrote: > > . . . > > I wonder if it doesnt work because of my first patch (the one to turn GOT > > reloc into PLT one). > > > > LLD understands that we use GOT as TOC (which was true before my patch), > > I wonder if something like this: > > > > ndex: tools/lld/ELF/Target.cpp > > =================================================================== > > --- tools/lld/ELF/Target.cpp (revision 292071) > > +++ tools/lld/ELF/Target.cpp (working copy) > > @@ -1070,7 +1070,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; > > @@ -1099,7 +1100,7 @@ > > // TOC starts where the first of these sections starts. We always create a > > // .got when we see a relocation that uses it, so for us the start is always > > // the .got. > > - uint64_t TocVA = In<ELF64BE>::Got->getVA(); > > + uint64_t TocVA = In<ELF64BE>::Plt->getVA(); > > > > // Per the ppc64-elf-linux ABI, The TOC base is TOC value plus 0x8000 > > // thus permitting a full 64 Kbytes segment. Note that the glibc startup > > The modern 3.9.1 source does not match for the last. Note the > "Out" vs. "In" below ("svnlite status" does not show my source > as different in this area): > > uint64_t getPPC64TocBase() { > // The TOC consists of sections .got, .toc, .tocbss, .plt in that order. The > // TOC starts where the first of these sections starts. We always create a > // .got when we see a relocation that uses it, so for us the start is always > // the .got. > uint64_t TocVA = Out<ELF64BE>::Got->getVA(); > > // Per the ppc64-elf-linux ABI, The TOC base is TOC value plus 0x8000 > // thus permitting a full 64 Kbytes segment. Note that the glibc startup > // code (crt1.o) assumes that you can get from the TOC base to the > // start of the .toc section with only a single (signed) 16-bit relocation. > return TocVA + PPC64TocOffset; > } > > [Also the "// TOC . . ." comment is at line 1005 (given the prior > GotRel vs. PltRel split into separate lines).] > > Which should I use?: In vs. Out > > > would make any difference? It's not correct but might shed some light on what needs to be done > > if I am right. > > Separately if I understand the change you are picking out which section > is first of .got, .toc, .tocbss, .plt (.got.plt as well?). But for the > order of things that would still make the .ctors, .dtors, .jcr, .dynamic, > and .data sections as being inside the TOC and taking TOC address range > space: > > 0x0000000010010560 - 0x00000000100105c0 is .plt <<<<<===== NOTE!!!! > 0x0000000010020000 - 0x0000000010020010 is .ctors > 0x0000000010020010 - 0x0000000010020020 is .dtors > 0x0000000010020020 - 0x0000000010020028 is .jcr > 0x0000000010020028 - 0x0000000010020138 is .dynamic > 0x0000000010020138 - 0x0000000010020138 is .got <<<<<===== NOTE!!!! > 0x0000000010030000 - 0x0000000010030019 is .data > 0x0000000010030020 - 0x0000000010030050 is .got.plt <<<<<===== NOTE!!!! > 0x0000000010030050 - 0x00000000100300a0 is .toc <<<<<===== NOTE!!!! > > Is that expected/desired/allowed? > > > Could you explore this please? > > After you report for sure for In vs. Out I'll take a stab > at it. > > === > Mark Millard > markmi at dsl-only.net
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170117215613.GA95258>