Re: clang toolchain doesn't failing to compile properly

Sigvart Hovland

Pretty sure it was around here. Could be that I'm wrong(haven't found the code that worked I think I deleted the branch) where start_of_main_stack would disappear when I used Clang in combination with GNU tools.
Or it was one of _current = main_thread; since it worked when you turned of multi-threading.

My biggest gut feeling is that it is start_of_main_stack since it only has assignments and would be viewed from the compiler as never used if it does not look at the assembly.

-----Original Message-----
From: Kumar Gala <>
Sent: Thursday, February 6, 2020 4:58 PM
To: Hovland, Sigvart <>
Subject: Re: [Zephyr-devel] clang toolchain doesn't failing to compile properly


I’d really appreciate if you could try and remember where you might have added that print to deal with the in-line asm getting optimized away.

- k

On Jan 31, 2020, at 5:54 AM, Sigvart Hovland <> wrote:

What target are you trying to compile for?

From the stack overflow thread I find
Target: x86_64-pc-linux-gnu

Then some references to the Nordic HAL. So I’m just going to assume you are trying to target nrf52xx so what should be noted is that you can’t use the LLVM linker also I think you need to use the arm-none-eabi assembler also if you are targeting an ARM cortex-m platform.

I got it to compile with LLVM and GCC/GNU assembler/linker. You will have to add an config in the /home/zephyrproject/modules/hal/nordic/nrfx/mdk/compiler_abstraction.h:66 that you are using Clang (ARMCC > 6 is an ARM version of Clang) I think it’s something like __CLANG or it could be __llvm__ or __clang__.

Some discussion on it here:

Some of the changes are added here

Based on I believe.

I don’t have my old branch where I got it to build unfortunately so I don’t have anything direct to link too but was able to build and run hello world with clang + arm-none-eabi linker and assembler. Also I don’t remember the exact point in the code where I had to add a print for it to work. There was some in-line assembly which was optimized out by clang if it was not used so I added a print and it would work. Sorry for not being very helpful thought I would just give you some information.

From: <> On
Behalf Of Akira Kato via Lists.Zephyrproject.Org
Sent: Thursday, January 30, 2020 7:13 PM
Subject: [Zephyr-devel] clang toolchain doesn't failing to compile

I don't know if this is the proper place to ask technical question
about zephyr but I have tried stackoverflow and started github issue
with no help. I am new to zephyr so I followed the getting started
guide. Here's the post I made:
orks-fine-with-default-toolchain The problem is described there with
the error logs.

Join to automatically receive all group messages.