Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Sep 2013 09:01:32 +0100
From:      David Chisnall <theraven@FreeBSD.org>
To:        "Joe Holden" <lists@rewt.org.uk>
Cc:        'Adrian Chadd' <adrian@FreeBSD.org>, 'freebsd-current' <freebsd-current@FreeBSD.org>, freebsd-mips@FreeBSD.org
Subject:   Re: how do i cross build world/kernel with clang?
Message-ID:  <AB0EC291-A1BF-4975-994C-560DD3B391F6@FreeBSD.org>
In-Reply-To: <024001ceb262$e87f9ea0$b97edbe0$@rewt.org.uk>
References:  <CAJ-Vmom3cLdEei%2BjwNRx7n_MgU0H3X0LigagNzU567tyeHBd8Q@mail.gmail.com> <024001ceb262$e87f9ea0$b97edbe0$@rewt.org.uk>

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

On 15 Sep 2013, at 23:28, "Joe Holden" <lists@rewt.org.uk> wrote:

> Are you still playing with this?  Reason I ask is that I tried to =
build
> world with clang for the crack and it bails with:
>=20
> /usr/obj/mips.mips64/pseudosrc/tmp/usr/bin/ld:
> /usr/obj/mips.mips64/pseudosrc/tmp/usr/lib/crtn.o: warning: linking =
PIC
> files with non-PIC files

This is an old bug in LLVM, where it didn't set the cpic bit in the =
e_flags field of the ELF header.  We fixed it a little while ago, but it =
hasn't been imported into head yet.

> exect.So: In function `exect':
> (.text+0x18): relocation truncated to fit: R_MIPS_PC16 against =
`__cerror'
> setjmp.So: In function `botch':
> (.text+0x124): relocation truncated to fit: R_MIPS_PC16 against =
`abort'
> _setjmp.So: In function `botch':
> (.text+0xac): relocation truncated to fit: R_MIPS_PC16 against `abort'
> _sigwait.So: In function `err':
> (.text+0x18): relocation truncated to fit: R_MIPS_PC16 against =
`__cerror'
> _getlogin.So: In function `err':
> (.text+0x18): relocation truncated to fit: R_MIPS_PC16 against =
`__cerror'
> aio_mlock.So: In function `err':
> (.text+0x18): relocation truncated to fit: R_MIPS_PC16 against =
`__cerror'
> pipe2.So: In function `err':
> (.text+0x18): relocation truncated to fit: R_MIPS_PC16 against =
`__cerror'
> accept4.So: In function `err':
> (.text+0x18): relocation truncated to fit: R_MIPS_PC16 against =
`__cerror'
> chflagsat.So: In function `err':
> (.text+0x18): relocation truncated to fit: R_MIPS_PC16 against =
`__cerror'
> connectat.So: In function `err':
> (.text+0x18): relocation truncated to fit: R_MIPS_PC16 against =
`__cerror'
> bindat.So: In function `err':
> (.text+0x18): additional relocation overflows omitted from the output

Most of these are due to our linker not being able to correctly insert =
PLT entries on MIPS (recent GNU binutils doesn't have this problem, but =
unfortunately also can't target FreeBSD.  I believe Warner is working on =
forward-porting our patches to a new binutils).  We might be able to =
hack LLVM to always emit 24-bit relocations, but that seems a bit of a =
hack.  I'm inclined to wait until we import MCLinker, which now has =
MIPS32/64 support, and should be much easier to fix if it has this kind =
of issue.

David




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AB0EC291-A1BF-4975-994C-560DD3B391F6>