Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Sep 2018 14:20:26 +0200
From:      Goran =?utf-8?B?TWVracSH?= <meka@tilda.center>
To:        freebsd-current@freebsd.org
Subject:   Clang cross-compiling to Cortex-M4 (ARM)
Message-ID:  <20180930122026.em7hxzjvnwudaa2l@hal9000.home.meka.rs>

next in thread | raw e-mail | index | archive | help

--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 <stdio.h>

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 <stdio.h>
         ^~~~~~~~~
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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180930122026.em7hxzjvnwudaa2l>