Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Aug 2016 17:06:05 -0700
From:      Mark Millard <markmi@dsl-only.net>
To:        FreeBSD Toolchain <freebsd-toolchain@freebsd.org>
Subject:   Re: Update on using LLVM's lld linker in the FreeBSD base system
Message-ID:  <2854CBD7-0DA7-4363-967B-6A1566156D4C@dsl-only.net>

next in thread | raw e-mail | index | archive | help
Warner Losh imp at bsdimp.com wrote on Aug 1 22:27:19 UTC 2016 :

> On Mon, Aug 1, 2016 at 3:40 PM, Ed Maste <emaste at freebsd.org> =
wrote:
>=20
> > There is (some) support for mips and powerpc in lld, but I'm not =
sure
> > how well tested it is. RISC-V is not yet supported but there is a
> > desire to have a full LLVM-based RISC-V toolchain. I'm not aware of
> > any plan with respect to sparc64 in lld. In any case, I do not plan =
to
> > address these architectures in the initial lld work. In the near =
term
> > they will continue to use GNU ld 2.17.50.
>=20
> OK. How does this square up against the gcc 4.2 removal timelines and
> plans? Once gcc is gone, we'll have to use an external toolchain =
anyway
> to build mips at least (though clang is close, it isn't there yet =
despite Sean
> Bruno's wonderful work).

This note is about the status for TARGET_ARCH=3Dpowerpc and =
TARGET_ARCH=3Dpowerpc64.

clang 3.8.0 is not ready for TARGET_ARCH=3Dpowerpc or =
TARGET_ARCH=3Dpowerpc64 yet.
(I do not know about clang/clang++ 3.9 or later.) So this is another =
external
tool chain family (so far).

clang/clang++ for TARET_ARCH=3Dpowerpc does not even generate code for =
the FreeBSD
specified ABI's stack handling properties: It requires a so-called =
red-zone for
signal handling because of when the stack pointer is adjusted for both =
directions.

clang also does not handle some of the assembler notation that is used =
in the kernel.

Neither TARGET_ARCH variant handles C++ exceptions correctly for things =
built via
clang++ 3.8.0.

TARGET_ARCH=3Dpowerpc64 is missing soft-float support, blocking building =
libstand as
I remember.

There is more wrong. See https://llvm.org/bugs/show_bug.cgi?id=3D25780 :

      [META] Using Clang as the FreeBSD/ppc system compiler

And its "Depends on" list. There are about 6 reports pending.


Additional clang related notes:

TARGET_ARCH=3Dpowerpc notes: with a kernel modified to have signal =
handling provide a
red-zone I've been able to use clang for buildworld and run a system =
that is a
mix of a gcc 4.2.1 based kernel and a clang 3.8.0 based world. But I =
have to avoid
using things that would use C++ exception handling if built via the =
system clang++
3.8.0.

TARGET_ARCH=3Dpowerpc64 note: I've never got that far with clang 3.8.0.


xtoolchain related notes:

There is no external toolchain in place for TARGET_ARCH=3Dpowerpc that I =
know of.

I do build TARGET_ARCH=3Dpowerpc64 via devel/powerpc64-gcc and
devel/powerpc64-xtoolchain-gcc . But I've never gotten lib32 to work
when built from that toolchain so I normally do not build lib32:
crtbeginS code problem(s) from not matching the register usage.




Where my mostly TARGET_ARCH=3Dpowerpc and TARGET_ARCH=3Dpowerpc64 source =
changes
are:

# svnlite status /usr/src/
M       =
/usr/src/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
M       /usr/src/lib/csu/powerpc64/Makefile
?       /usr/src/sys/amd64/conf/GENERIC-NODBG
?       /usr/src/sys/amd64/include/include
?       /usr/src/sys/arm/conf/RPI2-NODBG
?       /usr/src/sys/arm/include/include
M       /usr/src/sys/boot/ofw/Makefile.inc
M       /usr/src/sys/boot/powerpc/Makefile.inc
M       /usr/src/sys/boot/powerpc/kboot/Makefile
M       /usr/src/sys/boot/uboot/Makefile.inc
M       /usr/src/sys/conf/Makefile.powerpc
M       /usr/src/sys/conf/kern.mk
M       /usr/src/sys/conf/kmod.mk
?       /usr/src/sys/powerpc/conf/GENERIC64-NODBG
?       /usr/src/sys/powerpc/conf/GENERIC64vtsc
?       /usr/src/sys/powerpc/conf/GENERIC64vtsc-NODEBUG
?       /usr/src/sys/powerpc/conf/GENERICvtsc
?       /usr/src/sys/powerpc/conf/GENERICvtsc-NODEBUG
?       /usr/src/sys/powerpc/include/include
M       /usr/src/sys/powerpc/ofw/ofw_machdep.c
M       /usr/src/sys/powerpc/powerpc/exec_machdep.c
?       /usr/src/sys/x86/include/include

(Something along the way made the include/include's, with the nested
one pointing to its parent one. I did not explicitly do this.)

Some of the .c source changes are tied to my making PowerMac G5's boot
reliably when they have lots of RAM. (Just experimentally derived and
observed on the G5 examples that I sometimes have access to.)

I build with both vt and sc enabled and PS3 disabled.

=3D=3D=3D
Mark Millard
markmi at dsl-only.net




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2854CBD7-0DA7-4363-967B-6A1566156D4C>