Hi,
the LLVM build has ".export" files that lists a bunch of symbols. They're converted to a platform-specific file in a build step (for example a .def file on Windows or version script on Linux), and then the path to that generated file is passed to the linker (for example using /DEF:$file on Windows, or -Wl,--version-script,$file on Linux).
In the GN build, I'm modeling this with a template that has an action() to do the conversion, and a config() that adds the right ldflags, and the config() is a public_config on the action. That way, clients only have to use the template to create a target, add a dep on that in a shared_library() target, and things work. (Details:
https://reviews.llvm.org/D102843)
However, if the .export file is touched and nothing else changes, then the build will correctly re-create the platform-specific linker input, but it won't actually re-run the link: The shared_library() target considers the dep on the action creating the linker input as an order-only dep. Is there some way to make this work?
(I tried adding `inputs = get_target_outputs(":exports")` to the shared_library target. With that, the target does re-link when the .exports file is touched. But all of the target's sources also get recompiled, and it means using the template requires adding both the dep and that line. So that approach isn't ideal.)
Looking around a bit I found:
These suggest that there's no good way for doing that. Is that still correct? I like the idea in the second bug that suggests having the linker write a depfile. That would address this nicely.
Thanks,
Nico