When attempting to build devel/kyua on a rpi2b under projects/clang380-import -r295601 via portmaster -DK devel/kyua the attempt failed in lang/lua52 with:
--- lapi.o ---
/usr/bin/clang -target armv6--freebsd11.0-gnueabi -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=softfp -mno-unaligned-access -B/usr/local/arm-gnueabi-freebsd/bin/ -Wall -DLUA_COMPAT_ALL -pipe -mfloat-abi=softfp -isystem /usr/local/include -g -fno-strict-aliasing -I/usr/local/include -isystem /usr/local/include -DLUA_USE_LINUX -c lapi.c -o lapi.o
. . .
--- liblua-5.2.so ---
/usr/local/arm-gnueabi-freebsd/bin/ld: lapi.o: relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
lapi.o: error adding symbols: Bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)
*** [liblua-5.2.so] Error code 1
(Side note: Even buildworld/buildkernel used: -target armv6--freebsd11.0-gnueabi -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=softfp -mno-unaligned-access based on my src.conf for the rpi2.)
Confirmed, all the lua ports fail to build on armv6 when CPUTYPE or -march has been set to a non-default value. I think we need to use -fPIC on all arches, it's the right thing to do considering the files are being compiled into a shared lib, and only a couple arches can accidentally do that without -fPIC.
I'll get the change made in all 3 lua ports.
A commit references this bug:
Date: Sat Feb 20 19:19:51 UTC 2016
New revision: 409263
Use -fPIC on all arches; lua builds the object files into a shared lib.
Since the object files get built into a shared lib, using -fPIC on all
arches is the right thing to do, instead of adding it to each new arch that
comes along which doesn't accidentally allow non-PIC modules in shared libs.
Approved by: mat(mentor)
Differential Revision: https://reviews.freebsd.org/D5362