<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Baremetal builds fail as standard C library headers are imported"
href="https://bugs.llvm.org/show_bug.cgi?id=49994">49994</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Baremetal builds fail as standard C library headers are imported
</td>
</tr>
<tr>
<th>Product</th>
<td>compiler-rt
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</td>
</tr>
<tr>
<th>OS</th>
<td>other
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>compiler-rt
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>eblot.ml@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Hi,
I've noticed two issues while building compiler-rt for baremetal targets with
LLVM 12.0 final [sorry, no way to specify this version in the bugzilla]
I've tried to build RISCV targets, but the issues are not tied to a peculiar
baremetal architecture.
1. clearcache.c, which requires <abort.h> header is built on baremetal targets.
Something weird is that compiler-rt/lib/builtins/CMakeLists.txt does not
exclude this file from the baremetal builds, while the GN alternative does
exclude it:
CMake:
if (NOT FUCHSIA)
set(GENERIC_SOURCES
${GENERIC_SOURCES}
clear_cache.c
GN:
if (current_os != "fuchsia" && !compiler_rt_baremetal_build) {
sources += [ "clear_cache.c" ]
}
A simple patch such as
diff --git a/compiler-rt/lib/builtins/CMakeLists.txt
b/compiler-rt/lib/builtins/CMakeLists.txt
index 73b6bead8424..b46a3bfa4af2 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -244,7 +244,7 @@ if (HAVE_UNWIND_H)
)
endif ()
-if (NOT FUCHSIA)
+if (NOT FUCHSIA AND NOT COMPILER_RT_BAREMETAL_BUILD)
set(GENERIC_SOURCES
${GENERIC_SOURCES}
clear_cache.c
seems to fix this issue, but I'm not sure it is the proper fix. Maybe
COMPILER_RT_BAREMETAL_BUILD is not longer the proper CMake definition to use?
2. Another C lib dependency appears in int_util.c, where <stdlib.h> is imported
even for baremetal builds, around line 57. I'm not sure how to work around this
one.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>