[llvmlinux] Adding assert()

Behan Webster behanw at converseincode.com
Wed Aug 21 20:31:18 UTC 2013


On 08/21/13 15:46, Salim Bansal wrote:
> Hi,
>
> I am following this how-to 
> http://llvm.linuxfoundation.org/index.php/Nexus_7 to
> build Android kernel with LLVM.
>
> I modified this file
> llvmlinux/targets/nexu7/src/android_kernel_nexus7/arch/arm/common/fiq_debugger.c
> to include <assert.h> but compilation failed as the file is not 
> present inside any "include"
> directory under llvmlinux directory and it's not looking in the system 
> include directories.
>
> What can I do to include assert.h and use assert()?
assert.h is part of the userspace C. You can't use it in kernel code.

If you did the equivalent of an assert in the kernel, you'd panic the 
kernel if it was ever wrong.

As a rule bear in mind that kernel code (or any bare metal system code 
for that matter) written in C can't use anything from the C libraries, 
nor from any of the userspace C headers.

What is it that you're trying to do?

Behan

-- 
Behan Webster
behanw at converseincode.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfoundation.org/pipermail/llvmlinux/attachments/20130821/cd7b710a/attachment.html>


More information about the LLVMLinux mailing list