<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 - [CFI] Compilation error in Windows"
href="https://bugs.llvm.org/show_bug.cgi?id=41779">41779</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[CFI] Compilation error in Windows
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>8.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</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>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>xiaoyang.xu@utdallas.edu
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=21900" name="attach_21900" title="A C++ program that makes function calls through function pointers">attachment 21900</a> <a href="attachment.cgi?id=21900&action=edit" title="A C++ program that makes function calls through function pointers">[details]</a></span>
A C++ program that makes function calls through function pointers
I was testing LLVM Control Flow Integrity (CFI) on x64 Windows 10. The c++
source code attached makes a function call through a function pointer in an
intensive loop. Which function will be called is based on the parity of a
random integer. With CFI enabled (using flags -fsanitize=cfi and -flto), such
function calls should be compiled to indirect calls. This works perfectly in
Linux, but I got a compilation error in Windows using the same command:
C:\Users\Xiaoyang\Dropbox\CFIBenchmarks\fptr>clang++ -fsanitize=cfi -flto -o
fptr.exe fptr.cpp
C:\Users\Xiaoyang\AppData\Local\Temp\fptr-3c8ec9.o : fatal error LNK1107:
invalid or corrupt file: cannot read at 0x1CB0
clang++.exe: error: linker command failed with exit code 1107 (use -v to see
invocation)
If I remove the CFI and link-time optimization flags, I can successfully
compile and run this program:
C:\Users\Xiaoyang\Dropbox\CFIBenchmarks\fptr>clang++ fptr.cpp -o fptr.exe
C:\Users\Xiaoyang\Dropbox\CFIBenchmarks\fptr>fptr.exe
49893 odd numbers
50107 even numbers
I got this error in both LLVM 8.0.0 and 7.0.1.</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>