I start to hiting clang build warnings on macOS 12/15 sometime earlier this year:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: warning same member name (AMDGPU.cpp.o) in output file used for input files: tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/TargetBuiltins/AMDGPU.cpp.o and: tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/Targets/AMDGPU.cpp.o (due to use of basename, truncation, blank padding or duplicate input files)
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: warning same member name (ARM.cpp.o) in output file used for input files: tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/TargetBuiltins/ARM.cpp.o and: tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/Targets/ARM.cpp.o (due to use of basename, truncation, blank padding or duplicate input files)
.....
I’d like to see some sort of discussion here. For me, I don’t think the name change really bothers me, though I have a slight preference for TargetBuiltinXXX.cpp rather than TargetBuiltinsXXX.cpp
For the most part I don’t have a problem with it, but I fear it is papering over a more significant problem: that our output files are being named with JUST the file name, instead of directory names/etc.
That said, is there reasonable justification for that diagnostic? I find myself wondering: Whats the harm?
I have only seen this warning on macOS and not on Linux or Windows. IIUC, seems the root cause is macOS libtool, and libtool emit diagnostics based only on the file name but not the full path.
I have a slight preference for TargetBuiltinXXX.cpp rather than TargetBuiltinsXXX.cpp
These two all looks good to me, or a shorter name? I have no preference for these.
In addition to clang/lib/CodeGen/TargetBuiltins, should the files in clang/lib/CodeGen/Target/ also be renamed to CGX86.cpp, CGArm.cpp, etc., just like the file names in other CodeGen directories?
This appears to be specific to MacOS Xcode, and it appears to be complaining because there are 2 object files both called AMDGPU.cpp.o (ditto for other architectures) but in different directories. Searching the web, this warning has been present for over 20 years, and there don’t appear to be alternatives to renaming the files to avoid this warning.
I wasn’t aware of this issue when I merged the PR, since there isn’t a MacOS builbot builder, so I didn’t see this warning. If renaming these files, a shorter prefix is preferable to a longer name.
Could we just rename them to BuiltinARM.cpp, etc? Or TargetARM.cpp?
This only affects people who are BUILDING LLVM/Clang, right? I don’t really see a reason to cherry-pick it into the branch if that is the case. This is one of those ‘annoys llvm/clang devs’, which aren’t cherry-pick worthy.