https://bugs.llvm.org/show_bug.cgi?id=41779
Bug ID: 41779
Summary: [CFI] Compilation error in Windows
Product: new-bugs
Version: 8.0
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedb...@nondot.org
Reporter: xiaoyang...@utdallas.edu
CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org
Created attachment 21900
--> https://bugs.llvm.org/attachment.cgi?id=21900&action=edit
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs