--- mesonbuild/compilers/mixins/gnu.py.orig 2026-07-11 14:43:17.000000000 +0800 +++ mesonbuild/compilers/mixins/gnu.py 2026-08-04 20:12:06.000000000 +0800 @@ -554,6 +554,17 @@ self._has_lto_auto_support = mesonlib.version_compare(self.version, self._LTO_AUTO_VERSION) self._has_lto_cache_support = mesonlib.version_compare(self.version, self._LTO_CACHE_VERSION) + def get_lto_obj_cache_path(self, path: str) -> T.List[str]: + # -object_path_lto is a Clang/Apple-ld64 mechanism for caching + # intermediate per-object LTO bitcode files. GCC's own LTO + # implementation does not use/understand this concept, and simply + # forwarding it to whatever linker GCC happens to be driving can + # break the build if that linker is (or is detected as) Apple's + # ld64, e.g. `ld: unknown option: -object_path_lto` on some GCC + # toolchains that still shell out to the system linker on macOS. + # Only Clang-family compilers should request this. + return [] + def get_colorout_args(self, colortype: str) -> T.List[str]: if self._has_color_support: return gnu_color_args[colortype][:]