When linking a multi-file program with `-save-stats=obj`, `clang` will save internal statistics during the link-time code generation to `<obj_dir>/xxx.stats` where `xxx` is the first filename of inputs. This behavior is strange. Additionally, naming conflicts will occur when multiple binaries placed in the same directory depend on the same input (e.g., https://github.com/martinus/map_benchmark).
This patch uses the output filename as the base name instead of the first input when `-save-stats=obj`.