Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Jan 2020 05:31:44 -0800
From:      John Baldwin <jhb@FreeBSD.org>
To:        Mark Millard <marklmi@yahoo.com>, svn-src-head@freebsd.org
Cc:        FreeBSD Toolchain <freebsd-toolchain@freebsd.org>
Subject:   Re: svn commit: r356289 - head
Message-ID:  <bc5e7153-7444-231b-82c6-ea4df14fd2dd@FreeBSD.org>
In-Reply-To: <C39C3A87-44E7-4F34-975D-D3078F275B3A@yahoo.com>
References:  <C39C3A87-44E7-4F34-975D-D3078F275B3A.ref@yahoo.com> <C39C3A87-44E7-4F34-975D-D3078F275B3A@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 1/3/20 2:34 AM, Mark Millard wrote:
> John Baldwin jhb at FreeBSD.org wrote on
> Thu Jan 2 21:41:07 UTC 2020 :
> 
>> On 1/2/20 1:34 PM, John Baldwin wrote:
>>> Author: jhb
>>> Date: Thu Jan  2 21:34:44 2020
>>> New Revision: 356289
>>> URL: https://svnweb.freebsd.org/changeset/base/356289
>>>
>>> Log:
>>>   Look for cross toolchain makefiles in /usr/share/toolchains.
>>>   
>>>   The freebsd-binutils and freebsd-gcc* packages install toolchain
>>>   makefiles to /usr/share/toolchains rather than LOCALBASE.
>>
>> The short version is that you can do something like this to use GCC
>> as the system compiler (/usr/bin/cc):
>>
>> cd /usr/ports/base/binutils ; make install clean
>> cd ../gcc6 ; make install clean
>>
>> Then 'make CROSS_TOOLCHAIN=freebsd-gcc6 buildworld', etc.  If you aren't
>> planning on doing cross-builds you can set CROSS_TOOLCHAIN in /etc/src.conf.
>>
>> As described elsewhere, the base/* packages can be cross-built (along
>> with pkg), so for any architectures not yet using clang we could fairly
>> easily provide a cross-built package repo (though that architecture list
>> is becoming rather small).  I will probably add a base/gcc9 port once we
>> can build a full system with gcc9.
> 
> Just an FYI from some experiments that I did recently:
> 
> devel/binutils@powerpc and devel/binutils@powerpc64 and
> base/binutils@powerpc and base_binutils@powerpc64 do
> not put out the same content as lld or the old
> toolchain's ld (still used normally for 32-bit powerpc).
> buildkernel runs to completion but the result
> crashes from the kernel sseflf-loading and what was
> produced not matching. For example, binutils put out
> very few ABS symbols compared to lld/old-ld and
> classifies the kernel as ET_EXEC, not ET_DYN, because
> of the non-zero VirtAddr in:
> 
> Program Headers:
>   Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
> . . .
>   LOAD           0x000000 0x00100000 0x00100000 0xd9786c 0x1083648 RWE 0x10000
> . . .
> 
> (I'm not claiming that is all there is that matters.)
> 
> 
> These points are true using system-clang as the
> compiler. (I've only cross-built so far.)
> 
> I do not know if other architectures have similar issues
> or not. But, it appears that in some cases, there is more
> work to allowing the GNU linker to be used, for at least
> buildkernel .
> 
> I do not know if there is an intent to support a (modern)
> GNU binutils ld (in addition to lld) or not. So it may be
> that the effort would not be put in. (I'm not claiming
> which side(s) would change if the effort was put in.)

I have only really tested amd64, mips, and risc-v with GCC.  Other platform
maintainers would have to work through any MD issues.  The expectation is
that GCC + ld.bfd should hopefully work as well as clang + lld.  Trying
to cross-thread those (GCC + lld or clang + ld.bfd) might also work in
theory, but is a bit harder to guarantee, especially GCC + lld.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bc5e7153-7444-231b-82c6-ea4df14fd2dd>