Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Aug 2018 12:46:24 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        Dimitry Andric <dim@freebsd.org>, FreeBSD Toolchain <freebsd-toolchain@freebsd.org>, FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>
Subject:   projects/clang700 and powerpc64 (or powerpc): What is the goal? Is the Lex/Lexer.cpp altivec.h problem to be handled?
Message-ID:  <6F1CF8C0-84ED-49B2-8FC3-C566AEB15810@yahoo.com>

next in thread | raw e-mail | index | archive | help
[I experiment with targeting powerpc family via modern
toolchains. So this is outside the official range for
FreeBSD. I've not tried clang 7 yet. The below is
relative to system clang 6 behavior.]

As stands amd64 -> powerpc64 cross builds fail building clang
via the system clang because of errors like (from the bootstrap
clang build here):

--- Lex/Lexer.o ---
/usr/src/contrib/llvm/tools/clang/lib/Lex/Lexer.cpp:2401:10: fatal =
error: 'altivec.h' file not found
#include <altivec.h>
      ^~~~~~~~~~~
1 error generated.
*** [Lex/Lexer.o] Error code 1

where it should be finding the clang/6.0.1/include/altivec.h listed in
the below (clang's own altivec.h):

# find /usr/obj/powerpc64vtsc_clang_altbinutils -name altivec.h -print
=
/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/powerpc=
.powerpc64/tmp/usr/include/machine/altivec.h
=
/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/powerpc=
.powerpc64/tmp/usr/lib/clang/6.0.1/include/altivec.h
=
/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/powerpc=
.powerpc64/obj-lib32/tmp/usr/include/machine/altivec.h

clang's altivec.h serves a very different purpose than the freebsd ones
and so is the right one to find for the above.

The code that reports the error is:

#ifdef __SSE2__
#include <emmintrin.h>
#elif __ALTIVEC__
#include <altivec.h>
#undef bool
#endif

Note: the clang altivec.h involvement is an example of clang not being
a generic cross compiler as built for FreeBSD as far as I can tell: the
involved code only is compiled into clang when explicitly targeting
powerpc contexts if I understand right. SSE2 may have a similar status?


Is projects/clang700 going to try to have the right altivec.h found
or to avoid having the build try to find it? (Either would allow
the build to get past the above point of failure.)


Note: As stands cross-builds via devel/powerpc64-gcc and the like
build clang without __ALTIVEC__ defined and <altivec.h> is not
used. But, like FreeBSD, GCC has its own alitvec.h file to avoid
finding in this context if __ALTVEC__ was defined at some point.
As stands, overall the system tries to build differently depending
on the tool chain used for this clang altivec.h material.

(The official llvm based xtoolchain still needs lld to work to
be used. So I'll not comment about __ALTIVEC__ based on my mixing in
devel/powerpc64-binutils use instead. I've not looked into if an
altivec.h is or is not in use by that above include for this
context.)

=3D=3D=3D
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6F1CF8C0-84ED-49B2-8FC3-C566AEB15810>