Yet another luajit.cmake unwind detection fix #614
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For reference, this is the logic we're trying to copy from LuaJIT's makefile:
https://github.com/LuaJIT/LuaJIT/blob/03080b795aa3496ed62d4a0697c9f4767e7ca7e5/src/Makefile#L339
Previously, CMake would only read up to the first NUL or control character (for me that meant it would only read "ELF" from tmpunwind.o). This was making CMake think there was no
eh_frame
/__unwind_info
string in the file even if there actually was one.Now, CMake skips binary data in tmpunwind.o and just reads all the ASCII strings from the file, which is fine for what we need to do with it.
This fixes:
for me on Linux x86_64 when trying to build Luv (unsure why this wasn't being hit in CI)
CMake
MESSAGE
output from when I was debugging:Before (incorrect,
TMPUNWIND_O
should include more than justELF
andEH_FRAME_FOUND
should not be -1):After (correct,
eh_frame
does exist in tmpunwind.o):