summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-06-27 22:56:04 +0800
committerruki <[email protected]>2025-06-27 22:56:04 +0800
commit825b796f81a6c5f13fbfcd64490f715fab3c6f65 (patch)
tree2ae9047a75794c70426375568a4c6613c4f1b2dc
parent0720b2309a011c26e341dafb50877622e7bb8f17 (diff)
fix link object only binary
-rw-r--r--xmake/modules/private/action/build/build_binary.lua14
1 files changed, 9 insertions, 5 deletions
diff --git a/xmake/modules/private/action/build/build_binary.lua b/xmake/modules/private/action/build/build_binary.lua
index 3863b8550..a29ed4f60 100644
--- a/xmake/modules/private/action/build/build_binary.lua
+++ b/xmake/modules/private/action/build/build_binary.lua
@@ -28,11 +28,15 @@ function main(jobgraph, target, opt)
jobgraph:group(objects_group, function ()
build_object(jobgraph, target, opt)
end)
- if jobgraph:size() > jobsize then
- local link_group = target:fullname() .. "/link"
- jobgraph:group(link_group, function ()
- target_buildutils.add_linkjobs(jobgraph, target, opt)
- end)
+ local has_object_jobs = jobgraph:size() > jobsize
+
+ -- @note We always need the link task, even if the current target does not have any object files
+ -- https://github.com/xmake-io/xmake-repo/pull/7479#issuecomment-3007049158
+ local link_group = target:fullname() .. "/link"
+ jobgraph:group(link_group, function ()
+ target_buildutils.add_linkjobs(jobgraph, target, opt)
+ end)
+ if has_object_jobs then
jobgraph:add_orders(objects_group, link_group)
end
end