I understand that even if we include the target name in the object file name (i.e. use obj/net/net/net.url_util.o) there may still be collision as there are many targets with the same name (as you mention the "test_support" targets fits in that category).
Renaming the files is a solution that is difficult to sustain however as the target is build downstream (thus cannot turn a bot red when a CL introducing a collision lands). Even with the previously mentioned caveat, including the target name in the object file name would make the name unique enough for us because our library does not depends on any test support library (it is a production library with "testonly = false") and it only depends on //ios/web and below.
If including the name in the library is not an option, and since fixing libtool is not possible (at least in the short term since we are using the version of libtool coming from Xcode for linking on iOS), can I add an option to static_library target to change the filenames before invocation of libtool? Something like this:
static_library("foo_standalone") {
deps = [ ... ]
complete_static_lib = true
ensure_unique_object_filenames = true
}
and then this pass a flag to the "alink" tool. The "alink" tool can then implement this however it wants. On iOS and Mac, I can then invoke the libtool wrapper and have rename the file to have unique names by creating symlinks, i.e. instead of this:
libtool -static -o libfoo_standalone.a obj/ios/web/web/url_util.o obj/url/url/url_util.o
then we'd end up with the wrapper doing
ln -s obj/ios/web/web/url_util.o obj:ios:web:web:url_util.o
ln -s obj/url/url/url_util.o obj:url:url:url_util.o
libtool -static -o libfoo_standalone.a obj:ios:web:web:url_util.o obj:url:url:url_util.o
If we consider this a bug of libtool, maybe we can even drop the "ensure_unique_object_filenames" flag and always perform the mangling on iOS/Mac in the libtool wrapper if "complete_static_lib" is true.
WDYT?
-- Sylvain