-
Notifications
You must be signed in to change notification settings - Fork 0
[Umbrella Issue] The hash values of an object file are different between two builds without any changes. #22
Comments
I will explain why the object files are different between two builds (with the same source file). Assuming:
Build A.cpp twice:
Database changes after each build steps:
The second time that A.cpp is compiled, the repo pruning pass will check the global functions |
The key sentence here seems to be "The pruned functions will be written into the database." Is it true to say that at the moment, any pruned function will always be emitted? |
Yes, it is. |
You say that A.cpp and B.cpp both contain two global functions. Just to clarify: do you mean that these must be functions with external linkage? A small example of these two files might be useful. |
Sorry to use the wrong word ('global'). No, the linkage type of functions doesn't have to be the external linkage type. |
Two c files:
Compile 'a.c' (first time) and dump the compilation of 'a.o':
We could see: there is only one compilation member ('f1') in the compilation.
We could see: there are two compilation members ('f0' and 'f1') in the compilation. It is different from the first time build. |
Would it be sufficient to simply only emit functions/variables with internal linkage if they are referenced? That would mean that unreferenced statics wouldn't be emitted even at -O0. |
It make sense for the above simple examples. However, a lot of additional functions/variables with linkonce linkage have been added during the LLVM second time build. |
Could you post an example of a case where this would resolve the problem, please? |
Compiled the llvm-mc.cpp file twice using the repo toolchain. Firstly, compiling the llvm-mc.cpp file:
Secondly, compiling the BugDriver.cpp file:
Finally, compiling the llvm-mc.cpp file again:
Compared the compilation files between
We could see that the _ZN4llvm6TripleD1Ev only exists in the second time build. When first time build the llvm-mc.cpp, the function |
The compilation files between two builds are different because the order of the compilation members in the compilation files is different. Compiled the |
As described before, there were several different cases which caused the different compilation files between two builds. I will use this issue as an umbrella bug and create an issue for each individual case. |
This is spin-off from issue #7 (“Build the llvm-project-prepo project using the built llvm-project-prepo toolchain”).
The build steps are mentioned in Build-LLVM-with-the-Repo-Compiler . During the second build (targeted on Repo), there shouldn’t be any database transaction happen since all source files keep the same. However, there are a lot of files have difference hash values between two builds.
After the first-time build, run the following command:
Run the second-time build without modifying the source files:
You could find all the different object files by comparing these two build logs.
The text was updated successfully, but these errors were encountered: