x11/pixman vs. clang 5 arm assembler handling: "error: unknown directive" and the like

Mark Millard markmi at dsl-only.net
Tue Sep 5 20:01:09 UTC 2017


In an experiment with building some arm ports via poudriere
cross building on amd64 I got the following. It appears that
clang does not handle all the assembler notation and a
different assembler might need to be used for x11/pixman .
(The x11/pixman usage is indirect from having specified
x11/lumina and x11/xscreensaver ).

--- pixman-arm-simd-asm.lo ---
/bin/sh ../libtool     --mode=compile /nxb-bin/usr/bin/cc -DHAVE_CONFIG_H  -I. -I..   -mcpu=cortex-a7   -O2 -pipe -mcpu=cortex-a7  -g -fno-strict-aliasing -MT pixman-arm-simd-asm.lo -MD -MP -MF .deps/pixman-arm-simd-asm.Tpo -c -o pixman-arm-simd-asm.lo pixman-arm-simd-asm.S
libtool: compile:  /nxb-bin/usr/bin/cc -DHAVE_CONFIG_H -I. -I.. -mcpu=cortex-a7 -O2 -pipe -mcpu=cortex-a7 -g -fno-strict-aliasing -MT pixman-arm-simd-asm.lo -MD -MP -MF .deps/pixman-arm-simd-asm.Tpo -c pixman-arm-simd-asm.S  -fPIC -DPIC -o .libs/pixman-arm-simd-asm.o
<instantiation>:1:1: error: unknown directive
. . .
--- pixman-arm-simd-asm.lo ---
.func fname
^
./pixman-arm-simd-asm.h:599:5: note: while in macro instantiation
    pixman_asm_function fname
    ^
/tmp/pixman-arm-simd-asm-b59328.s:910:1: note: while in macro instantiation
generate_composite_function pixman_composite_src_8888_8888_asm_armv6, 32, 0, 32, FLAG_DST_WRITEONLY | FLAG_COND_EXEC | FLAG_SPILL_LINE_VARS_WIDE | FLAG_PROCESS_PRESERVES_SCRATCH, 4, blit_init, nop_macro, nop_macro, blit_process_head, nop_macro, blit_inner_loop
^
./pixman-arm-simd-asm.h:614:6: error: expected absolute expression
 .if prefetch_distance == 0
     ^
/tmp/pixman-arm-simd-asm-b59328.s:910:1: note: while in macro instantiation
generate_composite_function pixman_composite_src_8888_8888_asm_armv6, 32, 0, 32, FLAG_DST_WRITEONLY | FLAG_COND_EXEC | FLAG_SPILL_LINE_VARS_WIDE | FLAG_PROCESS_PRESERVES_SCRATCH, 4, blit_init, nop_macro, nop_macro, blit_process_head, nop_macro, blit_inner_loop
^
./pixman-arm-simd-asm.h:620:6: error: expected absolute expression
 .if src_bpp == 32
     ^
. . .

(I've omitted much later material continuing to reject notation.)
(A variant build without the -mcpu=cortex-a7 usage got the same.)


The context for the above is from a
poudriere/qemu-user-static/native_xtools based cross build from
amd64:

poudriere jail -c -j zrFBSDx64CjailArmV7 -a arm.armv6 -x -m null -M /usr/obj/DESTDIRs/clang-armv7-installworld-poud -S /usr/src -v 12.0-CURRENT

poudriere bulk -j zrFBSDx64CjailArmV7 -w -f /root/armv7-origins.txt

The -x use was enabled for -m null via:

/usr/local/share/poudriere/jail.sh having a "build_native_xtools"
added:

       null)
               JAILFS=none
               FCT=build_native_xtools
               ;;


# uname -apKU
FreeBSD FreeBSDx64OPC 12.0-CURRENT FreeBSD 12.0-CURRENT  r323147M  amd64 amd64 1200043 1200043

/usr/obj/DESTDIRs/clang-armv7-installworld-poud is from an arm/armv6
build of the same sources using -mcpu=cortex-a7 , installed via
installworld distrib-dirs distribution DB_FROM_SRC=1 DESTDIR=. . . :

# more ~/src.configs/src.conf.armv7-clang-bootstrap.amd64-host 
TO_TYPE=armv6
#
KERNCONF=GENERIC-NODBG
TARGET=arm
.if ${.MAKE.LEVEL} == 0
TARGET_ARCH=${TO_TYPE}
.export TARGET_ARCH
.endif
#
WITH_CROSS_COMPILER=
WITHOUT_SYSTEM_COMPILER=
#
#CPUTYPE=soft
WITH_LIBCPLUSPLUS=
WITH_BINUTILS_BOOTSTRAP=
WITH_ELFTOOLCHAIN_BOOTSTRAP=
WITH_CLANG_BOOTSTRAP=
WITH_CLANG=
WITH_CLANG_IS_CC=
WITH_CLANG_FULL=
WITH_CLANG_EXTRAS=
WITH_LLD=
#
# Linking lldb fails for armv6(/v7)
WITHOUT_LLDB=
#
WITH_BOOT=
WITHOUT_LIB32=
WITHOUT_LIBSOFT=
#
WITHOUT_GCC_BOOTSTRAP=
WITHOUT_GCC=
WITHOUT_GCC_IS_CC=
WITHOUT_GNUCXX=
#
NO_WERROR=
#WERROR=
MALLOC_PRODUCTION=
#
WITH_REPRODUCIBLE_BUILD=
WITH_DEBUG_FILES=
#
XCFLAGS+= -mcpu=cortex-a7
XCXXFLAGS+= -mcpu=cortex-a7
# There is no XCPPFLAGS but XCPP gets XCFLAGS content.


The source variations are almost all for powerpc family
explorations:

# svnlite status /usr/src/ | sort
?       /usr/src/sys/amd64/conf/GENERIC-DBG
?       /usr/src/sys/amd64/conf/GENERIC-NODBG
?       /usr/src/sys/arm/conf/GENERIC-DBG
?       /usr/src/sys/arm/conf/GENERIC-NODBG
?       /usr/src/sys/arm64/conf/GENERIC-DBG
?       /usr/src/sys/arm64/conf/GENERIC-NODBG
?       /usr/src/sys/powerpc/conf/GENERIC64vtsc-DBG
?       /usr/src/sys/powerpc/conf/GENERIC64vtsc-NODBG
?       /usr/src/sys/powerpc/conf/GENERICvtsc-DBG
?       /usr/src/sys/powerpc/conf/GENERICvtsc-NODBG
M       /usr/src/contrib/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
M       /usr/src/contrib/llvm/tools/lld/ELF/Arch/PPC64.cpp
M       /usr/src/crypto/openssl/crypto/armcap.c
M       /usr/src/lib/Makefile
M       /usr/src/lib/libkvm/kvm_powerpc.c
M       /usr/src/lib/libkvm/kvm_private.c
M       /usr/src/sys/boot/ofw/Makefile.inc
M       /usr/src/sys/boot/powerpc/Makefile.inc
M       /usr/src/sys/boot/powerpc/boot1.chrp/Makefile
M       /usr/src/sys/boot/powerpc/kboot/Makefile
M       /usr/src/sys/boot/uboot/Makefile.inc
M       /usr/src/sys/conf/kmod.mk
M       /usr/src/sys/conf/ldscript.powerpc
M       /usr/src/sys/kern/subr_pcpu.c
M       /usr/src/sys/powerpc/aim/mmu_oea64.c
M       /usr/src/sys/powerpc/ofw/ofw_machdep.c
M       /usr/src/sys/powerpc/powerpc/interrupt.c
M       /usr/src/sys/powerpc/powerpc/mp_machdep.c
M       /usr/src/sys/powerpc/powerpc/trap.c


# svnlite info /usr/ports/ | grep "Re[plv]"
Relative URL: ^/head
Repository Root: svn://svn.freebsd.org/ports
Repository UUID: 35697150-7ecd-e111-bb59-0022644237b5
Revision: 449165
Last Changed Rev: 449165


# svnlite status /usr/ports/ | sort
M       /usr/ports/Mk/bsd.port.mk
M       /usr/ports/base/gcc/Makefile
M       /usr/ports/base/gcc/distinfo
M       /usr/ports/base/gcc/pkg-plist
M       /usr/ports/devel/libunwind/Makefile
M       /usr/ports/sysutils/cdrdao/Makefile


# more /usr/local/etc/poudriere.d/make.conf
WANT_QT_VERBOSE_CONFIGURE=1
#
DEFAULT_VERSIONS+=perl5=5.24 gcc=7
#
# From a local /usr/ports/Mk/bsd.port.mk extension:
ALLOW_OPTIMIZATIONS_FOR_WITH_DEBUG=
#
.if ${.CURDIR:M*/devel/llvm*}
#WITH_DEBUG=
.elif ${.CURDIR:M*/www/webkit-qt5*}
#WITH_DEBUG=
.else
WITH_DEBUG=
.endif
MALLOC_PRODUCTION=


# more /usr/local/etc/poudriere.d/zrFBSDx64CjailArmV7-make.conf                                                                                                                         
CFLAGS+= -mcpu=cortex-a7
CXXFLAGS+= -mcpu=cortex-a7
CPPFLAGS+= -mcpu=cortex-a7


As for that "ALLOW_OPTIMIZATIONS_FOR_WITH_DEBUG" I have
in /usr/ports/Mk/bsd.port.mk :

 STRIP_CMD=	${TRUE}
 .endif
 DEBUG_FLAGS?=	-g
+.if defined(ALLOW_OPTIMIZATIONS_FOR_WITH_DEBUG)
+CFLAGS:=		${CFLAGS} ${DEBUG_FLAGS}
+.else
 CFLAGS:=		${CFLAGS:N-O*:N-fno-strict*} ${DEBUG_FLAGS}
+.endif
 .if defined(INSTALL_TARGET)
 INSTALL_TARGET:=	${INSTALL_TARGET:S/^install-strip$/install/g}
 .endif


I've also had trouble in some contexts with where bad.port.mk
uses ${UNAME} (empty string results) and so have forced the
expected content to match the context that this is in:

 # Get the architecture
 .if !defined(ARCH)
-ARCH!=	${UNAME} -p
+ARCH!=	echo amd64
 .endif
 _EXPORTED_VARS+=	ARCH
 
 # Get the operating system type
 .if !defined(OPSYS)
-OPSYS!=	${UNAME} -s
+OPSYS!=	echo FreeBSD
 .endif
 _EXPORTED_VARS+=	OPSYS
 
 .if !defined(_OSRELEASE)
-_OSRELEASE!=	${UNAME} -r
+_OSRELEASE!=	echo 12.0-CURRENT
 .endif
 _EXPORTED_VARS+=	_OSRELEASE
 


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



More information about the freebsd-ports mailing list