-
Notifications
You must be signed in to change notification settings - Fork 0
Discarded GOs are emitted during the second build. #55
Comments
A small example, two files:
Compile 'a.c' (first time) and dump the compilation of 'a.o':
We could see: there is only one compilation member ( Compile 'b.c'.
The function ( Compile 'a.c' again (second time) and dump the compilation of 'a.o':
We could see: there are two compilation members ('f0' and 'f1') in the compilation. Since the function |
A possible solution is mentioned in #22 (comment). The functions/variables, which have internal, private or linkonce linkage type, are only emitted into the compilation file if they are referenced. |
After I fixed the issue by only emitting the referenced local variables/functions into the compilation file, I found another issue: there are fewer compilation members in the ticket file in the second time build compared to the first time build. The unreferenced local variables/functions have been emitted into the compilation build during the first time build targeted on repo. Please see the issue #57 for the details. |
I have implemented this possible solution in the https://github.com/SNSystems/llvm-project-prepo/tree/issue102_ObjectWriter. However, it does not resolve the case mentioned in issue #102 since Note: I called Reason: I used the print-after-all flag to print IR code after each pass. Since the Since we want to generate the same ticket file when compiled the same source file with or without existing database, the above solution does not work |
Perhaps I’m stating the obvious, but a fix for this bug doesn’t necessarily have to also fix another problem. Unless, of course, they’re the same problem. However, I don’t think we’re yet able to reach that conclusion because the underlying cause of #102 in is not yet understood in detail. |
This is spin-off from bug #22 (comment) (“The hash values of an object file are different between two builds without any changes”).
The definition of some global objects may be discarded if not used in its compilation unit.
A discardable GO might have linkonce, internal, private or available externally linkage type.
Any pruned function will always be emitted in the repo object file. Therefore, the discarded GOs are emitted into the object file during the second time build if they are pruned.
The text was updated successfully, but these errors were encountered: