comparing .o files from different build trees

I'm trying to write a script for checking whether the compiler recursed properly.

rkotler@mipsswbrd002:~/slave/recurse3be/build$ find . -name "*.o" -exec cmp '{}' ../../recurse2be/build/'{}' \; |& tee foo.txt

Is anyone else doing this?

There 2 compilers, recurse 2 and recurse3 that in principle should be identical.

Obviously if there is date and time information, miscompares can occur.

foo.txt (12.7 KB)

I have a tool called 'diffdump' for pretty much exactly this:

https://github.com/garious/diffdump

I originally wrote it to compare the objdump output between every
object file in two directories, where one directory has objects
compiled with LLVM and the other with GCC. That usage is described
here:

https://github.com/garious/diffdump#more-diffdump-examples

Let me know if you have any questions.

-Greg

I've realized that it's necessary to build the recursed compiler in the same directory as it's previous generation (after moving the previous somewhere else) before doing the diff since the names of various generated files are embedded in the .o somtimes.

For example:

rkotler@mipsswbrd002:~/slave/recurse2be/build$ diff ../../tmp/1 ../../tmp/2
2c2
< ./tools/clang/lib/AST/Release+Asserts/ASTDumper.o: file format elf32-tradbigmips

Are you using different path names for src and/or build area?
That is going to introduce a lot of variance for __FILE__.
The build should *not* depend on time though.

Joerg

An alternative would be to only compare selected sections of the object files, for example you could skip rodata or other sections that are expected to change.

-Krzysztof

It only depends on time in one place.

CommandLine.cpp

you can remove the dependency by configuring with --disable-timestamps