-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
debuginfo: LLDB segfaults for some archives containing padding bytes at the end. #15950
Comments
Update: Padding all archives entries to an even size seems to prevent the crash in LLDB and I have not seen any detrimental side effects to this approach so far. |
I'm not familiar enough with the format of object files or bytecode files to know whether an extra byte or two at the end would corrupt them, but if it's working ok currently then I'd just ship it! |
I doubt that the containing archive will care about the padding byte, but either the decompression algorithm or the LLVM bitcode reader could trip over it. The safe way to do this would probably be to prepend the actual size of the compressed data, so we always know how much data to pass to |
Thinking about it, changing the format here is not as so trivial since the compiler must handle libs with the old format differently from libs with the new format. I think I'd favor option (2). |
Is this only a problem for the bytecode in archives, or is it also a problem for object files? |
So far it has only occurred for bytecode. All object files I came across had a size dividable by 2. I don't know if that's a coincidence... |
Interesting! I'm all for putting the bytecode in whatever format we want (it's already just a huge deflated stream) |
I'll come up with something and then we can discuss the matter further when we have some code to look at in a PR, OK? |
Sounds good to me! |
…excrichton Before this commit, the LLVM IR of exported items was simply zip-compressed and stored as an object file inside rlib archives. This commit adds a header to this "object" containing a file identifier and a format version number so the compiler can deal with changes in the way bytecode objects are stored within rlibs. While updating the format of bytecode objects, this commit also worksaround a problem in LLDB which could not handle odd-sized objects within archives before mid-2014. Fixes #15950.
There's another bug in LLDB that causes it to segfault when reading archive files. This one has already been fixed in May (llvm-mirror/lldb@e7e7a50) but it still exists in a lot of LLDB binaries out there.
As far as I can tell, the bug occurs when a number of object files are stored in an archive and the last one ends at an uneven byte offset. This often seems to be the case for compressed byte-code archives in rlibs (maybe regular object files are always padded to an even size?).
I'm currently compiling a possible workaround (pad the bytecode objects to an even size). It would be good if we could allow for rust code to be debugged with older LLDB versions too.
The text was updated successfully, but these errors were encountered: