Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Dec 2016 21:26:22 -0800
From:      Mark Millard <markmi@dsl-only.net>
To:        Kevin Bowling <kevin.bowling@kev009.com>, Roman Divacky <rdivacky@freebsd.org>
Cc:        FreeBSD Toolchain <freebsd-toolchain@freebsd.org>, FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>, Dimitry Andric <dim@freebsd.org>, Justin Hibbits <chmeeedalf@gmail.com>
Subject:   Re: Cross built head -r309179 TARGET_ARCH=powerpc64 with clang 3.9.0/powerpc64-binutils based buildworld operates; but fails "self-hosted buildworld" for undefined references
Message-ID:  <456C1CB0-F194-4C0A-A74E-9482549B2A13@dsl-only.net>
In-Reply-To: <CAK7dMtA1ydTJhZC5r=f3rWiXUz_3FLHW5z%2B7KQkb9qpzLA_-rw@mail.gmail.com>
References:  <0BC8D9FA-2822-41CA-8CAE-89DCF9C4918F@dsl-only.net> <CAK7dMtA1ydTJhZC5r=f3rWiXUz_3FLHW5z%2B7KQkb9qpzLA_-rw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2016-Dec-2, at 7:38 PM, Kevin Bowling <kevin.bowling at kev009.com> =
wrote:

> Interesting, that is quite a lot of progress if it boots with a =
crossbuild.  I wonder if editing =
/usr/src/contrib/llvm/lib/Support/Atomic.cpp so the GNU_ATOMICS path is =
taken will work around these errors until someone more knowledgeable can =
comment.

This is only buildworld, not buildkernel.

Roman Divacky privately sent a note:

> On 2016-Dec-2, at 2:52 AM, Roman Divacky <rdivacky at freebsd.org> =
wrote:
>=20
> Can you try to add Atomic.cpp to lib/clang/libllvmminimal/Makefile ?

I have a buildworld (WITHOUT_LIB32=3D )on the powerpc64 that
just finished while editing this note. It is based on the
following change:

# svnlite diff /usr/src/lib/clang/libllvmminimal/Makefile
Index: /usr/src/lib/clang/libllvmminimal/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- /usr/src/lib/clang/libllvmminimal/Makefile	(revision 309179)
+++ /usr/src/lib/clang/libllvmminimal/Makefile	(working copy)
@@ -7,6 +7,7 @@
=20
 SRCDIR=3D		lib
 SRCS+=3D		Support/APInt.cpp
+SRCS+=3D		Support/Atomic.cpp
 SRCS+=3D		Support/CommandLine.cpp
 SRCS+=3D		Support/ConvertUTF.c
 SRCS+=3D		Support/ConvertUTFWrapper.cpp

(So those "X86..." names might not be what the names
suggested to me.)

I'll try installing and rebooting somewhat later.

One known area is the need to use WITHOUT_LIB32=3D because
it rejects assembler notation that is in use. (I wonder
of those "X86" file names might be associated with this.)

Another known area is needing to avoid things that depend
on C++ exception handling (for any exceptions that actually
occur). Even:

#include <exception>

int main(void)
{
    try { throw std::exception(); }
    catch (std::exception& e) {}
    return 0;
}

fails (calls abort). The buildworld's that I've
done are based on implicit WITHOUT_LLVM_LIBUNWIND
so far.

clang 3.9.0 builds of devel/kyua are not able to run
usefully yet because of the extensive C++ exception
usage.

The assembler notation issue is also involved if one
tries to buildkernel as I remember.

I had to use src.conf material to force clang 3.9.0
to use devel/binutils (powerpc64) or
devel/powerpc64-binutils (amd64, possibly an
alternative on powerpc64 as well) instead of using=20
bootstrapped system utils. This involved making
sure that -B would make internal util use in
clang/clang++ also redirect.

Based on other's reports of having to revert them
I've got:

-r416639 of devel/binutils
-r407342 of devel/powerpc64-binutils
-r413189 of devel/powerpc64-gcc

(devel/binutils used on powerpc64,
devel/powerpc64-binutils used on amd64,
devel/powerpc64-gcc not used in this
activity but I have it around, both on
amd64 and on powerpc64.)

These reverts avoid 4.27 vintage materials for them.
I'm not sure of the powerpc vs. powerpc64 vs. both
status for this and simply decided to avoid the
issue for now, testing other aspects of things
since the binutils vintage issue was known to
others and already public.


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

Older material. . .

On Mon, Nov 28, 2016 at 4:02 AM, Mark Millard <markmi@dsl-only.net> =
wrote:
> [The powerpc64 self-hosted buildworld failure is for undefined
> references to llvm::sys::CompareAndSwap and
> llvm::sys::MemoryFence. See later below.]
>=20
>=20
> I cross built TARGET_ARCH=3Dpowerpc64 head -r309179 via . . .
> (has workaround matching -r309201 and my PowerMac G5 booting hack)
>=20
> buildworld via clang 3.9.0 and it using powerpc64-binutils
> buildkernel via powerpc-xtoolchain-gcc (and so powerpc64-binutils)
>=20
> and installed and booted the combination:
>=20
> > # uname -apKU
> > FreeBSD FBSDG5L 12.0-CURRENT FreeBSD 12.0-CURRENT #1 r309179M: Mon =
Nov 28 01:23:26 PST 2016     =
markmi@FreeBSDx64:/usr/obj/powerpc64vtsc_xtoolchain_kernel/powerpc.powerpc=
64/usr/src/sys/GENERIC64vtsc-NODBG  powerpc powerpc64 1200017 1200017
>=20
>=20
> > # clang --version
> > FreeBSD clang version 3.9.0 (tags/RELEASE_390/final 280324) (based =
on LLVM 3.9.0)
> > Target: powerpc64-unknown-freebsd12.0
> > Thread model: posix
> > InstalledDir: /usr/bin
>=20
>=20
> I then attempted a self-hosted buildworld but it failed with:
>=20
> > Building =
/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src/t=
mp/usr/src/usr.bin/clang/clang-tblgen/clang-tblgen.full
> > --- clang-tblgen.full ---
> > =
/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src/t=
mp/usr/src/lib/clang/libllvmminimal/libllvmminimal.a(ManagedStatic.o): =
In function `getManagedStaticMutex()':
> > /usr/src/contrib/llvm/lib/Support/ManagedStatic.cpp:(.text+0x1c4): =
undefined reference to `llvm::sys::CompareAndSwap(unsigned int =
volatile*, unsigned int, unsigned int)'
> > /usr/src/contrib/llvm/lib/Support/ManagedStatic.cpp:(.text+0x1d8): =
undefined reference to `llvm::sys::MemoryFence()'
> > /usr/src/contrib/llvm/lib/Support/ManagedStatic.cpp:(.text+0x220): =
undefined reference to `llvm::sys::MemoryFence()'
> > clang++: error: linker command failed with exit code 1 (use -v to =
see invocation)
> > *** [clang-tblgen.full] Error code 1
> >
> > make[3]: stopped in /usr/src/usr.bin/clang/clang-tblgen
> > .ERROR_TARGET=3D'clang-tblgen.full'
> > =
.ERROR_META_FILE=3D'/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc=
.powerpc64/usr/src/tmp/usr/src/usr.bin/clang/clang-tblgen/clang-tblgen.ful=
l.meta'
> > .MAKE.LEVEL=3D'3'
> > MAKEFILE=3D''
> > .MAKE.MODE=3D'meta missing-filemon=3Dyes missing-meta=3Dyes =
silent=3Dyes verbose'
> > .CURDIR=3D'/usr/src/usr.bin/clang/clang-tblgen'
> > .MAKE=3D'make'
> > =
.OBJDIR=3D'/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc6=
4/usr/src/tmp/usr/src/usr.bin/clang/clang-tblgen'
> > .TARGETS=3D'all'
> > DESTDIR=3D''
> > LD_LIBRARY_PATH=3D''
> > MACHINE=3D'powerpc'
> > MACHINE_ARCH=3D'powerpc64'
> > =
MAKEOBJDIRPREFIX=3D'/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc=
.powerpc64/usr/src/tmp'
> > MAKESYSPATH=3D'/usr/src/share/mk'
> > MAKE_VERSION=3D'20160818'
> > =
PATH=3D'/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/u=
sr/src/tmp/legacy/usr/sbin:/usr/obj/powerpc64vtsc_clang_altbinutils_world/=
powerpc.powerpc64/usr/src/tmp/legacy/usr/bin:/usr/obj/powerpc64vtsc_clang_=
altbinutils_world/powerpc.powerpc64/usr/src/tmp/legacy/bin:/sbin:/bin:/usr=
/sbin:/usr/bin'
> > SRCTOP=3D'/usr/src'
> > =
OBJTOP=3D'/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64=
/usr/src/tmp/usr/src'
> > .MAKE.MAKEFILES=3D'/usr/src/share/mk/sys.mk =
/usr/src/share/mk/local.sys.env.mk /usr/src/share/mk/src.sys.env.mk =
/root/src.configs/src.conf.powerpc64-clang_altbinutils-bootstrap.powerpc64=
-host /usr/src/share/mk/bsd.mkopt.mk /usr/src/share/mk/bsd.suffixes.mk =
/root/src.configs/make.conf /usr/src/share/mk/local.sys.mk =
/usr/src/share/mk/src.sys.mk /dev/null =
/usr/src/usr.bin/clang/clang-tblgen/Makefile =
/usr/src/usr.bin/clang/llvm.prog.mk /usr/src/lib/clang/llvm.pre.mk =
/usr/src/lib/clang/llvm.build.mk /usr/src/tools/build/mk/bsd.prog.mk =
/usr/src/share/mk/bsd.prog.mk /usr/src/share/mk/bsd.init.mk =
/usr/src/share/mk/bsd.opts.mk /usr/src/share/mk/bsd.cpu.mk =
/usr/src/share/mk/local.init.mk /usr/src/share/mk/src.init.mk =
/usr/src/usr.bin/clang/clang-tblgen/../Makefile.inc =
/usr/src/usr.bin/clang/clang-tblgen/../../Makefile.inc =
/usr/src/share/mk/bsd.own.mk /usr/src/share/mk/bsd.compiler.mk =
/usr/src/share/mk/bsd.compiler.mk /usr/src/share/mk/bsd.libnames.mk =
/usr/src/share/mk/src.libnames.mk /usr/src/
>  share/mk/src.opts.mk /usr/src/share/mk/bsd.nls.mk =
/usr/src/share/mk/bsd.confs.mk /usr/src/share/mk/bsd.files.mk =
/usr/src/share/mk/bsd.incs.mk /usr/src/share/mk/bsd.links.mk =
/usr/src/share/mk/bsd.dep.mk /usr/src/share/mk/bsd.clang-analyze.mk =
/usr/src/share/mk/bsd.obj.mk /usr/src/share/mk/bsd.subdir.mk =
/usr/src/share/mk/bsd.sys.mk /usr/src/tools/build/mk/Makefile.boot'
> > .PATH=3D'. /usr/src/usr.bin/clang/clang-tblgen =
/usr/src/contrib/llvm/tools/clang/utils/TableGen'
> > 1 error
>=20
> . . .
>=20
>=20
>=20
>=20
> > # less =
/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src/t=
mp/usr/src/usr.bin/clang/clang-tblgen/clang-tblgen.full.meta
> > # Meta data file =
/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src/t=
mp/usr/src/usr.bin/clang/clang-tblgen/clang-tblgen.full.meta
> > CMD /usr/bin/clang++ -B /usr/local/powerpc64-freebsd/bin/ -O2 -pipe =
-I/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src=
/tmp/usr/src/lib/clang/libllvm -I/usr/src/lib/clang/include =
-I/usr/src/contrib/llvm/include -DLLVM_ON_UNIX -DLLVM_ON_FREEBSD =
-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS =
-DLLVM_DEFAULT_TARGET_TRIPLE=3D\"powerpc64-unknown-freebsd12.0\" =
-DLLVM_HOST_TRIPLE=3D\"powerpc64-unknown-freebsd12.0\" =
-DDEFAULT_SYSROOT=3D\"/usr/obj/powerpc64vtsc_clang_altbinutils_world/power=
pc.powerpc64/usr/src/tmp\" -g -Qunused-arguments =
-I/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src=
/tmp/legacy/usr/include -std=3Dc++11 -fno-exceptions -fno-rtti =
-stdlib=3Dlibc++ -Wno-c++11-extensions  -static =
-L/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src=
/tmp/legacy/usr/lib -o clang-tblgen.full  ClangASTNodesEmitter.o =
ClangAttrEmitter.o ClangCommentCommandInfoEmitter.o =
ClangCommentHTMLNamedCharacterReferenceEmitter.o =
ClangCommentHTMLTagsEmit
>  ter.o ClangDiagnosticsEmitter.o ClangSACheckersEmitter.o =
NeonEmitter.o TableGen.o =
/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src/t=
mp/usr/src/lib/clang/libllvmminimal/libllvmminimal.a  -lncursesw  =
-lpthread -legacy
> > CWD =
/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src/t=
mp/usr/src/usr.bin/clang/clang-tblgen
> > TARGET clang-tblgen.full
> > -- command output --
> > =
/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src/t=
mp/usr/src/lib/clang/libllvmminimal/libllvmminimal.a(ManagedStatic.o): =
In function `getManagedStaticMutex()':
> > /usr/src/contrib/llvm/lib/Support/ManagedStatic.cpp:(.text+0x1c4): =
undefined reference to `llvm::sys::CompareAndSwap(unsigned int =
volatile*, unsigned int, unsigned int)'
> > /usr/src/contrib/llvm/lib/Support/ManagedStatic.cpp:(.text+0x1d8): =
undefined reference to `llvm::sys::MemoryFence()'
> > /usr/src/contrib/llvm/lib/Support/ManagedStatic.cpp:(.text+0x220): =
undefined reference to `llvm::sys::MemoryFence()'
> > clang++: error: linker command failed with exit code 1 (use -v to =
see invocation)
> > *** Error code 1
> . . .
>=20
>=20
>=20
> > # svnlite info /usr/src/ | grep "Re[lpv]"
> > Relative URL: ^/head
> > Repository Root: https://svn0.us-west.freebsd.org/base
> > Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
> > Revision: 309179
> > Last Changed Rev: 309179
>=20
>=20
> =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?456C1CB0-F194-4C0A-A74E-9482549B2A13>