Date: Fri, 25 Jul 2014 10:26:41 -0600 From: Warner Losh <imp@bsdimp.com> To: Stacey Son <sson@me.com> Cc: David Chisnall <theraven@FreeBSD.org>, freebsd-mips@FreeBSD.org Subject: Re: mips64 ld GOT problem Message-ID: <48935A3D-0387-42F1-ACF0-14EB7D8F9A06@bsdimp.com> In-Reply-To: <77F1DDA2-A4E5-4D64-AA43-F8CBC55249C4@me.com>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] On Jul 25, 2014, at 9:24 AM, Stacey Son <sson@me.com> wrote: > Hi all: > > I have been trying to bootstrap clang/llvm 3.5 for mips64 (i.e. cross build clang/llvm 3.5 for mips64 using clang/llvm 3.5) but run into the following linker problem (see below) in about the midway point as it is trying to link 'opt'. The assertions that fail are the following: > > BFD 2.17.50 [FreeBSD] 2007-07-03 assertion fail /usr/home/sson/freebsd/gnu/usr.bin/binutils/libbfd/../../../../contrib/binutils/bfd/elfxx-mips.c:7455 > > BFD_ASSERT (g->assigned_gotno - g->local_gotno > <= g->global_gotno); > > BFD 2.17.50 [FreeBSD] 2007-07-03 assertion fail /usr/home/sson/freebsd/gnu/usr.bin/binutils/libbfd/../../../../contrib/binutils/bfd/elfxx-mips.c:2767 > > /* There should have been enough room in the symbol table to > accommodate both the GOT and non-GOT symbols. */ > BFD_ASSERT (hsd.max_non_got_dynindx <= hsd.min_got_dynindx); > > BFD 2.17.50 [FreeBSD] 2007-07-03 assertion fail /usr/home/sson/freebsd/gnu/usr.bin/binutils/libbfd/../../../../contrib/binutils/bfd/elfxx-mips.c:10282 > > /* Make sure we didn't grow the global .got region. */ > dynobj = elf_hash_table (info)->dynobj; > got = mips_elf_got_section (dynobj, FALSE); > g = mips_elf_section_data (got)->u.got_info; > > if (g->global_gotsym != NULL) > BFD_ASSERT ((elf_hash_table (info)->dynsymcount > - g->global_gotsym->dynindx) > <= g->global_gotno); > > Does anyone have an idea for a work around or fix? Silly question: does using the latest binutils fix this problem? Failing that, perhaps we need to specify a larger GOT region that we do today? IIRC, that’s specified with -g on the linker line, Try adding “-G0”. I have a vague recollection we always used to do this, but moved it to be a default (or maybe other systems have the default and we still need to add it). It doesn’t look like it is being added from the output that you’ve posted. IIRC, it has to be specified on all the compiler invocations as well. But who knows, I may be crazy. Warner > Thanks in advance, > > -stacey. > > ---- > The full ld crash message: > > [ 50%] Building CXX object tools/opt/CMakeFiles/opt.dir/opt.cpp.o > Linking CXX executable ../../bin/opt > /home/sson/sdk/bin/mips64-unknown-freebsd-ld: BFD 2.17.50 [FreeBSD] 2007-07-03 assertion fail /usr/home/sson/freebsd/gnu/usr.bin/binutils/libbfd/../../../../contrib/binutils/bfd/elfxx-mips.c:7455 > /home/sson/sdk/bin/mips64-unknown-freebsd-ld: BFD 2.17.50 [FreeBSD] 2007-07-03 assertion fail /usr/home/sson/freebsd/gnu/usr.bin/binutils/libbfd/../../../../contrib/binutils/bfd/elfxx-mips.c:7455 > /home/sson/sdk/bin/mips64-unknown-freebsd-ld: BFD 2.17.50 [FreeBSD] 2007-07-03 assertion fail /usr/home/sson/freebsd/gnu/usr.bin/binutils/libbfd/../../../../contrib/binutils/bfd/elfxx-mips.c:7455 > /home/sson/sdk/bin/mips64-unknown-freebsd-ld: BFD 2.17.50 [FreeBSD] 2007-07-03 assertion fail /usr/home/sson/freebsd/gnu/usr.bin/binutils/libbfd/../../../../contrib/binutils/bfd/elfxx-mips.c:2767 > /home/sson/sdk/bin/mips64-unknown-freebsd-ld: BFD 2.17.50 [FreeBSD] 2007-07-03 assertion fail /usr/home/sson/freebsd/gnu/usr.bin/binutils/libbfd/../../../../contrib/binutils/bfd/elfxx-mips.c:10282 > CMakeFiles/opt.dir/PrintSCC.cpp.o: In function `llvm::scc_iterator<llvm::CallGraph*, llvm::GraphTraits<llvm::CallGraph*> >::hasLoop() const': > /usr/home/sson/llvm/tools/opt/PrintSCC.cpp:(.text._ZNK4llvm12scc_iteratorIPNS_9CallGraphENS_11GraphTraitsIS2_EEE7hasLoopEv[_ZNK4llvm12scc_iteratorIPNS_9CallGraphENS_11GraphTraitsIS2_EEE7hasLoopEv]+0x108): relocation truncated to fit: R_MIPS_CALL16 against `llvm::GraphTraits<llvm::CallGraphNode*>::child_end(llvm::CallGraphNode*)' > CMakeFiles/opt.dir/PrintSCC.cpp.o: In function `llvm::scc_iterator<llvm::CallGraph*, llvm::GraphTraits<llvm::CallGraph*> >::GetNextSCC()': > /usr/home/sson/llvm/tools/opt/PrintSCC.cpp:(.text._ZN4llvm12scc_iteratorIPNS_9CallGraphENS_11GraphTraitsIS2_EEE10GetNextSCCEv[_ZN4llvm12scc_iteratorIPNS_9CallGraphENS_11GraphTraitsIS2_EEE10GetNextSCCEv]+0x150): relocation truncated to fit: R_MIPS_CALL16 against `llvm::GraphTraits<llvm::CallGraphNode*>::child_end(llvm::CallGraphNode*)' > CMakeFiles/opt.dir/PrintSCC.cpp.o: In function `llvm::scc_iterator<llvm::CallGraph*, llvm::GraphTraits<llvm::CallGraph*> >::DFSVisitChildren()': > /usr/home/sson/llvm/tools/opt/PrintSCC.cpp:(.text._ZN4llvm12scc_iteratorIPNS_9CallGraphENS_11GraphTraitsIS2_EEE16DFSVisitChildrenEv[_ZN4llvm12scc_iteratorIPNS_9CallGraphENS_11GraphTraitsIS2_EEE16DFSVisitChildrenEv]+0xb0): relocation truncated to fit: R_MIPS_CALL16 against `llvm::GraphTraits<llvm::CallGraphNode*>::child_end(llvm::CallGraphNode*)' > ../../lib/libLLVMMipsCodeGen.a(Mips16ISelDAGToDAG.cpp.o): In function `$BB72_54': > /usr/home/sson/llvm/lib/Target/Mips/Mips16ISelDAGToDAG.cpp:(.text._ZNK4llvm16MipsDAGToDAGISel18CheckNodePredicateEPNS_6SDNodeEj[_ZNK4llvm16MipsDAGToDAGISel18CheckNodePredicateEPNS_6SDNodeEj]+0x1214): relocation truncated to fit: R_MIPS_CALL16 against `llvm::ISD::isBuildVectorAllOnes(llvm::SDNode const*)' > ../../lib/libLLVMMipsCodeGen.a(MipsSEISelLowering.cpp.o): In function `performXORCombine(llvm::SDNode*, llvm::SelectionDAG&, llvm::MipsSubtarget const&)': > /usr/home/sson/llvm/lib/Target/Mips/MipsSEISelLowering.cpp:(.text._ZL17performXORCombinePN4llvm6SDNodeERNS_12SelectionDAGERKNS_13MipsSubtargetE+0x180): relocation truncated to fit: R_MIPS_CALL16 against `llvm::ISD::isBuildVectorAllOnes(llvm::SDNode const*)' > /usr/home/sson/llvm/lib/Target/Mips/MipsSEISelLowering.cpp:(.text._ZL17performXORCombinePN4llvm6SDNodeERNS_12SelectionDAGERKNS_13MipsSubtargetE+0x1d8): relocation truncated to fit: R_MIPS_CALL16 against `llvm::ISD::isBuildVectorAllOnes(llvm::SDNode const*)' > ../../lib/libLLVMMipsDesc.a(MipsOptionRecord.cpp.o): In function `llvm::DenseMapBase<llvm::DenseMap<llvm::MCSection const*, llvm::MCSectionData*, llvm::DenseMapInfo<llvm::MCSection const*> >, llvm::MCSection const*, llvm::MCSectionData*, llvm::DenseMapInfo<llvm::MCSection const*> >::grow(unsigned int)': > /usr/home/sson/llvm/lib/Target/Mips/MCTargetDesc/MipsOptionRecord.cpp:(.text._ZN4llvm12DenseMapBaseINS_8DenseMapIPKNS_9MCSectionEPNS_13MCSectionDataENS_12DenseMapInfoIS4_EEEES4_S6_S8_E4growEj[_ZN4llvm12DenseMapBaseINS_8DenseMapIPKNS_9MCSectionEPNS_13MCSectionDataENS_12DenseMapInfoIS4_EEEES4_S6_S8_E4growEj]+0x28): relocation truncated to fit: R_MIPS_CALL16 against `llvm::DenseMap<llvm::MCSection const*, llvm::MCSectionData*, llvm::DenseMapInfo<llvm::MCSection const*> >::grow(unsigned int)' > clang-3.5: error: linker command failed with exit code 1 (use -v to see invocation) > *** Error code 1 > > ld invocation: > > /home/sson/sdk/bin/mips64-unknown-freebsd-ld --sysroot=/home/sson/sdk --eh-frame-hdr -dynamic-linker /libexec/ld > -elf.so.1 --enable-new-dtags -o ../../bin/opt /home/sson/sdk/usr/lib/crt1.o /home/sson/sdk/usr/lib/crti.o /home/ > sson/sdk/usr/lib/crtbegin.o -L/usr/local/lib -L/home/sson/sdk/usr/lib -z origin --export-dynamic CMakeFiles/opt. > dir/AnalysisWrappers.cpp.o CMakeFiles/opt.dir/BreakpointPrinter.cpp.o CMakeFiles/opt.dir/GraphPrinters.cpp.o CMa > keFiles/opt.dir/NewPMDriver.cpp.o CMakeFiles/opt.dir/Passes.cpp.o CMakeFiles/opt.dir/PassPrinters.cpp.o CMakeFil > es/opt.dir/PrintSCC.cpp.o CMakeFiles/opt.dir/opt.cpp.o ../../lib/libLLVMMipsCodeGen.a ../../lib/libLLVMMipsAsmPr > inter.a ../../lib/libLLVMMipsAsmParser.a ../../lib/libLLVMMipsDesc.a ../../lib/libLLVMMipsInfo.a ../../lib/libLL > VMMipsDisassembler.a ../../lib/libLLVMAnalysis.a ../../lib/libLLVMBitWriter.a ../../lib/libLLVMCodeGen.a ../../l > ib/libLLVMCore.a ../../lib/libLLVMipa.a ../../lib/libLLVMipo.a ../../lib/libLLVMIRReader.a ../../lib/libLLVMInst > Combine.a ../../lib/libLLVMInstrumentation.a ../../lib/libLLVMMC.a ../../lib/libLLVMObjCARCOpts.a ../../lib/libL > LVMScalarOpts.a ../../lib/libLLVMSupport.a ../../lib/libLLVMTarget.a ../../lib/libLLVMTransformUtils.a ../../lib > /libLLVMVectorize.a ../../lib/libLLVMAsmPrinter.a ../../lib/libLLVMSelectionDAG.a ../../lib/libLLVMCodeGen.a ../ > ../lib/libLLVMMipsAsmPrinter.a ../../lib/libLLVMMCParser.a ../../lib/libLLVMMipsInfo.a ../../lib/libLLVMMCDisass > embler.a ../../lib/libLLVMScalarOpts.a ../../lib/libLLVMInstCombine.a ../../lib/libLLVMAsmParser.a ../../lib/lib > LLVMBitReader.a ../../lib/libLLVMTransformUtils.a ../../lib/libLLVMipa.a ../../lib/libLLVMAnalysis.a ../../lib/l > ibLLVMTarget.a ../../lib/libLLVMCore.a ../../lib/libLLVMMC.a ../../lib/libLLVMSupport.a --library=rt --library=t > info --library=pthread --library=z -rpath $ORIGIN/../lib --library=c++ --library=m --library=gcc --as-needed --l > ibrary=gcc_s --no-as-needed --library=c --library=gcc --as-needed --library=gcc_s --no-as-needed /home/sson/sdk/ > usr/lib/crtend.o /home/sson/sdk/usr/lib/crtn.o > > _______________________________________________ > freebsd-mips@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-mips > To unsubscribe, send any mail to "freebsd-mips-unsubscribe@freebsd.org" [-- Attachment #2 --] -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJT0oVBAAoJEGwc0Sh9sBEAqIAQAKHB+aZFO2ShvN+t63qqwkvU ZMX9fArYwuDOMQ0crA8pnLVhlQupuyQZyBKPeuBbdTwOE/PO96xDhCUyR/TspkLM ZoVpUr9SCcPUBFmCNioAL9hOobNY70EiL1bL6NIrdHqQh/HRKxZjNsVz08981epi tkgG05mmkeBZLLZqF3xpFUwYEY62BXudvp2PjYHy+2KeDoE/pRxbGP04ldtpnKW+ lMydKqwEQZJneLir4mOrlbZeHN9oKcMt95Kb6rqccBbgX8mvUZO98IQg4Hly2wJ/ 20MYeoDVIC5nxvgpaZxHeQ08ZbKFxWD+8qsj43M2e/Sv5K/cMKv7dPy5QFd6/O4Z duByY+/WAb3NGZcoKVmi5tDFFNW9/M+mZ1RazU/SLIc9hxoTlAxwCS0kjYZg4Xvc SlZTEU2CuBEKKmVADu2FXChnXWu/SqE3ATvQV9+/NxYzFLZhFsJPcE7poCjV11Sf GwG0NficJJav0x8xOM6u2BZHxZnGgKAHiJJutdQAsY8ZMvwO2wtTiMRJQwmXdW8U vml1Khgp5+AZw9FmdvMaOJFEEIjYobbX9lmOaByCjXJWXRfTO6/lKgjrIWL3iYp+ Msd0Mn7OjM8EUtF3wqvDmWWQC7sljYnCROx2/GUH3cRRSMgoF3Pac1CZkoENAIuW 2hkzb4U2Smbr3iRUW/U8 =IZhb -----END PGP SIGNATURE-----home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48935A3D-0387-42F1-ACF0-14EB7D8F9A06>
