From owner-freebsd-current@freebsd.org Sun Sep 30 12:20:35 2018 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2FD5010BE46C for ; Sun, 30 Sep 2018 12:20:35 +0000 (UTC) (envelope-from meka@tilda.center) Received: from mail.tilda.center (srv02.tilda.center [199.247.21.11]) by mx1.freebsd.org (Postfix) with ESMTP id CAC2380B65 for ; Sun, 30 Sep 2018 12:20:34 +0000 (UTC) (envelope-from meka@tilda.center) Received: from hal9000.home.meka.rs (unknown [87.116.180.128]) by mail.tilda.center (Postfix) with ESMTPSA id EE3A524C59 for ; Sun, 30 Sep 2018 14:20:26 +0200 (CEST) Date: Sun, 30 Sep 2018 14:20:26 +0200 From: Goran =?utf-8?B?TWVracSH?= To: freebsd-current@freebsd.org Subject: Clang cross-compiling to Cortex-M4 (ARM) Message-ID: <20180930122026.em7hxzjvnwudaa2l@hal9000.home.meka.rs> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="spngx56dujrftatf" Content-Disposition: inline User-Agent: NeoMutt/20180716 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Sep 2018 12:20:35 -0000 --spngx56dujrftatf Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Hello, With Clang 4.0 cross-compiling works, but any later versions (I tried 5.0, 6.0 and 7.0 from packages) fails. This is the simple test program: #include int main() { return 0; } These are the results: clang -fno-builtin -nostdlib -ffreestanding -target arm-none-eabi -march=armv7-m -mcpu=cortex-m4 -o test test.c test.c:1:10: fatal error: 'stdio.h' file not found #include ^~~~~~~~~ 1 error generated. clang40 -fno-builtin -nostdlib -ffreestanding -target arm-none-eabi -march=armv7-m -mcpu=cortex-m4 -o test test.c /usr/local/bin/arm-none-eabi-ld: warning: cannot find entry symbol _start; defaulting to 0000000000008000 System clang is 6.0.1, but it's the same with the one from packages (to be precise, clang60 command). I suppose this is more suitable for LLVM mailing list, but I wanted to check if there's something specific on FreeBSD I should know about before I write there? Also, this does compile: clang -fno-builtin -nostdlib -ffreestanding -target arm-none-eabi -march=armv7-m -mcpu=cortex-m4 -isystem /usr/include -o test test.c /usr/bin/ld.lld: warning: cannot find entry symbol _start; defaulting to 0x11000 Besides a course on compilers at University, I don't have much experience in this field, so feel free to point me to proper documentation/literature if what I just described is known. Regards, meka --spngx56dujrftatf Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEE1WIFkXy2ZeMKjjKEWj1TknovrLYFAluwv4cACgkQWj1Tknov rLbFkg/+KSE3TFxiXxx0SZX+gZgI0JhjamLzQRJXbKnIxDg18nX4pDT8PSXXeFTa 1aaX2qHllThD6HDH+tuADyM9X9XSBepOLor2cWB+a0+pyNpVOdvivHACX11bnM++ V26lXKbbwfWoVuV6k9XjGMVeceLSYqpqNkRenGEsFmbat6PUkBEueZE5oih2GehZ gmCjfGCOyUo+guzCoftdfdhKDrf6EXJdu+DFFBfGQ0jFbWTtfK+1fE0FyTSkuuIJ 8ZOBO6EK99lg55JEAcV9z7xzn7mBnTsUuXstiUmJ7GkFLfd1eNfImXLly20cNQ0I ZM1dwSHNDf56lLYb6eXzDV7xKfRZTLw0v7U62/cKrV9OILG3aB2AUesX5Oak4mCZ jrfwV71c+0yf+HIr02SWM5kIc68Bu0xL5W/2OpVCnMKFXSAkVc8x00BSkUUbqiF2 aiaNKIEpecxDLI09V3shikxoARntaY5ouLR1fGCsCoey+q5A+/PooaenfvYn1DIc buo6OQ/pGn77jTH1hJl3krkBIkfE4jHACSatNzXdpTkMu62pPo0iU8W3E+zHTRZV N3TPytRvvWPkfzmL6L+o+URXRAbELE0T70ngd7TJua1Uqj+4Rm9cBq+rtEl1rV/h /771xQTEP7sZrtPeqTyOYcwg+qnyPosiNJ9BSUzXd1BK20GkhLI= =R+hT -----END PGP SIGNATURE----- --spngx56dujrftatf--