Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Jan 2015 17:02:56 -0800
From:      Oleksandr Tymoshenko <gonzo@bluezbox.com>
To:        "freebsd-arm@freebsd.org List" <freebsd-arm@freebsd.org>
Subject:   xdev-links names and clang
Message-ID:  <2CBEDF87-5932-417B-99DB-19B476B0A032@bluezbox.com>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2CBEDF87-5932-417B-99DB-19B476B0A032>