From: Olivier MARTIN <olivier@labapart.com>
To: newlib@sourceware.org
Cc: olivier@labapart.com
Subject: Building newlib for Cortex-M with LLVM
Date: Thu, 12 Nov 2015 04:11:00 -0000 [thread overview]
Message-ID: <8473a04381ff7d35caa7ea1e8eb08772@labapart.com> (raw)
Hello all,
recently I found a warning generated by Clang while building my project
that is based on Newlib (see
https://sourceware.org/ml/newlib/2015/msg00714.html).
I was curious... and I was wondering whether I could build newlib with
Clang.
The answer is probably the one you were expected, no!
I am not really familiar with newlib build configuration, I went for the
basic steps I found on the Internet:
mkdir build-newlib-llvm
cd build-newlib-llvm
export
AS_FOR_TARGET=/home/olivier/Toolchains/gcc-arm-none-eabi-4_9-2014q4/bin/arm-none-eabi-as
export CC_FOR_TARGET=/usr/bin/clang-3.6
export CFLAGS_FOR_TARGET="-target arm-none-eabi"
export
PATH=/home/olivier/Toolchains/gcc-arm-none-eabi-4_9-2014q4/bin:$PATH
../configure --target=arm-none-eabi
--prefix=/home/olivier/Toolchains/gcc-arm-none-eabi-4_9-2014q4
--disable-newlib-supplied-syscalls --with-cpu=armv7m --with-mode=thumb
--enable-interwork
make all
There are two issues I manage to isolate.
* The first one can be solved. The space in the call of CONCAT2(a, b) by
CONCAT() is propagated into the subsequent calls. It means when the
strings 'a' and 'b' are concatenated, the space is inserted between both
strings - which is not the expected behaviour.
The fix would be:
--- a/newlib/libc/machine/arm/setjmp.S
+++ b/newlib/libc/machine/arm/setjmp.S
@@ -3,7 +3,7 @@
Nick Clifton, Cygnus Solutions, 13 June 1997. */
/* ANSI concatenation macros. */
-#define CONCAT(a, b) CONCAT2(a, b)
+#define CONCAT(a, b) CONCAT2(a,b)
* The second issue is what I believe to be a Clang issue. Clang does not
support when macros are defined into inline assembly and used later on.
Assembly macros are quite used in the ARM string functions (eg:
'RETURN', 'optpld' macros).
I raised a Clang bug for this one:
https://llvm.org/bugs/show_bug.cgi?id=25495
I had other issues but they might come from the fact I have not
correctly configured newlib for Cortex-M...
For instance, the following errors:
- libgloss/arm/linux-crt0.c:34:2: error: non-ASM statement in naked
function is not supported
register int *sp asm("sp");
- libgloss/libnosys/chown.c
<inline asm>:1:8: error: unsupported directive '.stabs'
.stabs "_chown is not implemented and will always fail",30,0,0,0
- '.syntax divided' is not supported - it is used in
newlib/libc/machine/arm/*.S
Note: I cannot see the armv7m/thumb/interwork flags to be propagated
into the build commands.
Any feedback or comment on my investigation are welcome. I am quite
happy to try few things.
Thanks,
---
Olivier MARTIN
http://labapart.com - Lab A Part
next reply other threads:[~2015-11-11 23:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-12 4:11 Olivier MARTIN [this message]
2015-11-12 11:17 ` Marcus Shawcroft
2015-11-12 12:39 ` Clemens Ladisch
2015-11-12 13:46 ` Olivier MARTIN
2015-11-12 14:22 ` Richard Earnshaw
2015-11-12 15:33 ` Olivier MARTIN
2015-11-12 15:50 ` Richard Earnshaw
2015-11-12 15:56 ` Olivier MARTIN
2015-11-12 15:59 ` Richard Earnshaw
2015-11-12 22:42 ` Jonathan Roelofs
2017-06-15 10:52 ` Emmanuel Blot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8473a04381ff7d35caa7ea1e8eb08772@labapart.com \
--to=olivier@labapart.com \
--cc=newlib@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).