[PATCH] D118052: [X86] Fix CodeGen Module Flag for -mibt-seal

Joao Moreira via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 23 02:14:34 PDT 2022


joaomoreira added a comment.

I did track down the problem to clang/lib/Frontend/CompilerInvocation.cpp -- RoundTrip method. There, we can se the following statement:

  #ifndef NDEBUG
    bool DoRoundTripDefault = true;
  #else
    bool DoRoundTripDefault = false;
  #endif

Comment in the file says: "By default, the round-trip is enabled in assert builds... During round-trip, the command line arguments are parsed into a dummy instance of CompilerInvocation which is used to generate the command line arguments again. The real CompilerInvocation instance is then created by parsing the generated arguments, not the original ones.". Then, because the arguments set through this latest patch were not being generated, they would be missing in the dummy instance of CompilerInvocation and then not repassed into the real instance.

Given the above, my understanding is that there was never an actual bug that made ibt-seal stop working. The patch was just not tested enough and a confusion in different build setups blinded me against what was really happening.

Thank you for pushing me into looking into this @aaron.ballman. Also, with all this said, I'm no expert in clang/front-end, so it would be great if you could give an additional look into it and confirm the above.

If all is right, the patch remains correct and there are no hidden bugs. I'll update the patch shortly to add the test requested by @pengfei.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118052/new/

https://reviews.llvm.org/D118052



More information about the cfe-commits mailing list