New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CFI tests using ThinLTO on Windows all fail with unsupported X86 relocation #32117
Comments
ThinLTO + CFI may use 8-bit relocations (R_X86_64_8 in ELF) to absolute symbols whose values are in range 0-255. Absolute symbols exist in COFF, but there is no direct analog for the relocation. That is what I suspect the cause of the assertion failure to be. The solution I had in mind was to use IMAGE_REL_AMD64_SECREL7, and have LLD extend its meaning to allow for 8-bit values and absolute symbols (this may not work with /msvclto though). |
Disabled the tests for now in r301235 |
I got test failures at r301243 still: https://codereview.chromium.org/2843513003 And it looks like the bot from #0 is still red. |
Ouch. r301257. I love CMake. |
It looks like the MSVC linker rejects SECRELs pointing to absolute symbols, so this probably won't work with /msvclto. C:\src\secrel7>type 1.s C:\src\secrel7>type 2.s C:\src\secrel7>\src\llvm-project\ra\bin\llvm-mc -filetype=obj -o 1.obj 1.s C:\src\secrel7>\src\llvm-project\ra\bin\llvm-mc -filetype=obj -o 2.obj 2.s C:\src\secrel7>link 1.obj 2.obj /entry:ExitProcess kernel32.lib /subsystem:console 1.obj : error LNK2016: absolute symbol 'i' used as target of SECREL relocation in section 2 |
I ended up fixing this another way at least for now, by avoiding the use of absolute symbols on everything except x86 + ELF. https://reviews.llvm.org/D37883 should re-enable the tests. |
The change to re-enable the tests landed in r313379. |
mentioned in issue llvm/llvm-bugzilla-archive#32776 |
Extended Description
This was found after Evgeniy's refactoring of the CFI tests in r301016.
The failing tests:
Failing Tests (4):
cfi-devirt-lld-thinlto :: simple-pass.cpp
cfi-devirt-thinlto :: simple-pass.cpp
cfi-standalone-lld-thinlto :: simple-pass.cpp
cfi-standalone-thinlto :: simple-pass.cpp
Example build:
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/10028/
LLD crashes when attempting to emit a COFF object after ThinLTO optimization:
$ "C:/b/slave/sanitizer-windows/build/./bin/clang.exe" "-fuse-ld=lld" "-Wl,-nopdb" "-flto=thin" "-fsanitize=cfi" "-fvisibility=hidden" "-o" "C:\b\slave\sanitizer-windows\build\projects\compiler-rt\test\cfi\Standalone-thinlto\Output\simple-pass.cpp.tmp" "C:\b\slave\sanitizer-windows\llvm\projects\compiler-rt\test\cfi\simple-pass.cpp"
command stderr:
unsupported relocation type
UNREACHABLE executed at C:\b\slave\sanitizer-windows\llvm\lib\Target\X86\MCTargetDesc\X86WinCOFFObjectWriter.cpp:92!
The text was updated successfully, but these errors were encountered: