Currently, section indices may be passed uninitialized by value if writing the section fails. Removes section indices form class initialization and returns them from the write{Code,Data}Section function calls instead.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
How about one of these two options:
- initialing CodeSectionIndex and DataSectionIndex to 0 in the class declaration? (and in reset() I guess too?). You can treat 0 as invalid for both of them.
- Remove CodeSectionIndex and DataSectionIndex completely from the class and just return the index value from writeCodeSection and writeDataSection (again with 0 meaning none).
Either of those I think would be fine.
Comment Actions
The second option sounds good to me! I'll make the change tomorrow.
I've been working on stricter msan checks to flag uninit data crossing function boundaries (as it's UB in C++). You can find that change pending at https://reviews.llvm.org/D81699.
Comment Actions
I guess its not easy to write a test for this since its a use of uninitialized data which can be non-deterministic?
Comment Actions
Yeah, but I think the current check-clang tests (under msan once the changes go through) will be useful for that.
Comment Actions
Ah, no I don't have commit access yet. Would you mind helping me land this? Thanks so much!