Skip site navigation (1)Skip section navigation (2)
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>
References:  <77F1DDA2-A4E5-4D64-AA43-F8CBC55249C4@me.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_1A0FAA76-C97E-470E-92C7-B8BFB489C39B
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=windows-1252


On Jul 25, 2014, at 9:24 AM, Stacey Son <sson@me.com> wrote:

> Hi all:
>=20
> 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:
>=20
> BFD 2.17.50 [FreeBSD] 2007-07-03 assertion fail =
/usr/home/sson/freebsd/gnu/usr.bin/binutils/libbfd/../../../../contrib/bin=
utils/bfd/elfxx-mips.c:7455
>=20
>                  BFD_ASSERT (g->assigned_gotno - g->local_gotno
>                              <=3D g->global_gotno);
>=20
> BFD 2.17.50 [FreeBSD] 2007-07-03 assertion fail =
/usr/home/sson/freebsd/gnu/usr.bin/binutils/libbfd/../../../../contrib/bin=
utils/bfd/elfxx-mips.c:2767
>=20
>  /* 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 <=3D hsd.min_got_dynindx);
>=20
> BFD 2.17.50 [FreeBSD] 2007-07-03 assertion fail =
/usr/home/sson/freebsd/gnu/usr.bin/binutils/libbfd/../../../../contrib/bin=
utils/bfd/elfxx-mips.c:10282
>=20
>      /* Make sure we didn't grow the global .got region.  */
>      dynobj =3D elf_hash_table (info)->dynobj;
>      got =3D mips_elf_got_section (dynobj, FALSE);
>      g =3D mips_elf_section_data (got)->u.got_info;
>=20
>      if (g->global_gotsym !=3D NULL)
>        BFD_ASSERT ((elf_hash_table (info)->dynsymcount
>                     - g->global_gotsym->dynindx)
>                    <=3D g->global_gotno);
>=20
> 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=92s specified with -g on the linker line, Try adding =
=93-G0=94. 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=92t look like it is being added from the =
output that you=92ve 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,
>=20
> -stacey.
>=20
> ----
> The full  ld crash message:
>=20
> [ 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/bin=
utils/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/bin=
utils/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/bin=
utils/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/bin=
utils/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/bin=
utils/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_iteratorI=
PNS_9CallGraphENS_11GraphTraitsIS2_EEE7hasLoopEv[_ZNK4llvm12scc_iteratorIP=
NS_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_iteratorIP=
NS_9CallGraphENS_11GraphTraitsIS2_EEE10GetNextSCCEv[_ZN4llvm12scc_iterator=
IPNS_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_iteratorIP=
NS_9CallGraphENS_11GraphTraitsIS2_EEE16DFSVisitChildrenEv[_ZN4llvm12scc_it=
eratorIPNS_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._ZNK4llv=
m16MipsDAGToDAGISel18CheckNodePredicateEPNS_6SDNodeEj[_ZNK4llvm16MipsDAGTo=
DAGISel18CheckNodePredicateEPNS_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._ZL17per=
formXORCombinePN4llvm6SDNodeERNS_12SelectionDAGERKNS_13MipsSubtargetE+0x18=
0): relocation truncated to fit: R_MIPS_CALL16 against =
`llvm::ISD::isBuildVectorAllOnes(llvm::SDNode const*)'
> =
/usr/home/sson/llvm/lib/Target/Mips/MipsSEISelLowering.cpp:(.text._ZL17per=
formXORCombinePN4llvm6SDNodeERNS_12SelectionDAGERKNS_13MipsSubtargetE+0x1d=
8): 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:(.te=
xt._ZN4llvm12DenseMapBaseINS_8DenseMapIPKNS_9MCSectionEPNS_13MCSectionData=
ENS_12DenseMapInfoIS4_EEEES4_S6_S8_E4growEj[_ZN4llvm12DenseMapBaseINS_8Den=
seMapIPKNS_9MCSectionEPNS_13MCSectionDataENS_12DenseMapInfoIS4_EEEES4_S6_S=
8_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
>=20
> ld invocation:
>=20
> /home/sson/sdk/bin/mips64-unknown-freebsd-ld --sysroot=3D/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=3Drt --library=3Dt
> info --library=3Dpthread --library=3Dz -rpath $ORIGIN/../lib =
--library=3Dc++ --library=3Dm --library=3Dgcc --as-needed --l
> ibrary=3Dgcc_s --no-as-needed --library=3Dc --library=3Dgcc =
--as-needed --library=3Dgcc_s --no-as-needed /home/sson/sdk/
> usr/lib/crtend.o /home/sson/sdk/usr/lib/crtn.o
>=20
> _______________________________________________
> 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"


--Apple-Mail=_1A0FAA76-C97E-470E-92C7-B8BFB489C39B
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----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-----

--Apple-Mail=_1A0FAA76-C97E-470E-92C7-B8BFB489C39B--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48935A3D-0387-42F1-ACF0-14EB7D8F9A06>