xdev-links names and clang

Oleksandr Tymoshenko gonzo at bluezbox.com
Sun Jan 11 01:03:37 UTC 2015


Hello,

I got bit by weird problem when tried to run application built with CC
set to armv6-freebsd-cc. It crashed in qsort's compare function and
when I tried to debug it it started crashing in all weird places.

The same app built with CC set to "cc" in buldenv worked fine. 

Turned out that clang determines it's target triplet based on the name
of executable file. And armv6-freebsd-cc generated by xdev-links does not
match the default one. 

ln -s /usr/armv6-freebsd/usr/bin/cc cc
ln -s /usr/armv6-freebsd/usr/bin/cc armv6-frebsd-cc
ln -s /usr/armv6-freebsd/usr/bin/cc armv6-gnueabi-freebsd11.0-cc

default target for these three links would be different

% ./cc -v
FreeBSD clang version 3.5.0 (tags/RELEASE_350/final 216957) 20141124
Target: armv6--freebsd11.0-gnueabi
Thread model: posix
% ./armv6-freebsd-cc -v
FreeBSD clang version 3.5.0 (tags/RELEASE_350/final 216957) 20141124
Target: armv6--freebsd
Thread model: posix
% ./armv6-gnueabi-freebsd11.0-cc -v
FreeBSD clang version 3.5.0 (tags/RELEASE_350/final 216957) 20141124
Target: armv6--freebsd11.0-gnueabi
Thread model: posix

I generated default #defines for them using "$CC -dM -E - < /dev/null"
and they look different enough to mess things up

Full diff between second and first: http://pastebin.com/GLtsQfuv

Default includes for armv6-freebsd-cc have __FreeBSD__ set to 8,
__ARM_EABI__ is undefined and wchar_t defines are different too. 

Should we update xdev-links logic to match clang's target triplets?

-- 
gonzo



More information about the freebsd-arm mailing list