<html>
<head>
<base href="http://llvm.org/bugs/" />
</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 --- - [PATCH] Undefined reference in Nolibc build of sanitizers"
href="http://llvm.org/bugs/show_bug.cgi?id=17025">17025</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[PATCH] Undefined reference in Nolibc build of sanitizers
</td>
</tr>
<tr>
<th>Product</th>
<td>compiler-rt
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>willdtz@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=11111" name="attach_11111" title="Proposed patch to avoid compiler-generated memset">attachment 11111</a> <a href="attachment.cgi?id=11111&action=edit" title="Proposed patch to avoid compiler-generated memset">[details]</a></span>
Proposed patch to avoid compiler-generated memset
Looks like my compiler finds sanitizer code to rewrite to memset() which
results in an undefined reference when attempting to build without libc:
FAILED: cd
/home/will/llvm/34-obj/projects/compiler-rt/lib/sanitizer_common/tests &&
/home/will/llvm/34-obj/bin/clang sanitizer_nolibc_test_main.x86_64.o
-Wl,-whole-archive libRTSanitizerCommon.test.nolibc.x86_64.a
-Wl,-no-whole-archive -o
/home/will/llvm/34-obj/projects/compiler-rt/lib/sanitizer_common/tests/Sanitizer-x86_64-Test-Nolibc
-nostdlib -m64
libRTSanitizerCommon.test.nolibc.x86_64.a(sanitizer_libc.cc.o): In function
`__sanitizer::internal_strncpy(char*, char const*, unsigned long)':
/home/will/llvm/34-src/projects/compiler-rt/lib/sanitizer_common/sanitizer_libc.cc:156:
undefined reference to `memset'
clang-3.3: error: linker command failed with exit code 1 (use -v to see
invocation)
The attached patch resolves the issue by leveraging the existing
internal_memset implementation.</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>