From fd913546287ac1ec0eb0eb2a4ac38b2a4920b1d4 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Wed, 21 Feb 2024 10:17:13 +0000 Subject: [PATCH] [DOC] Comment about logic to care about static/dynamic hetero build The condition is rarely met in usual cases, so it's worth to note about the situation and the reason why we care about it. --- template/exts.mk.tmpl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/template/exts.mk.tmpl b/template/exts.mk.tmpl index 29c29df37c..e04fb50bbe 100644 --- a/template/exts.mk.tmpl +++ b/template/exts.mk.tmpl @@ -69,6 +69,13 @@ Dir.glob("{ext,.bundle/gems}/*/exts.mk") do |e| end end deps.uniq! + +# NOTE: Only if extensions are configured as static and dynamic heterogeneously +# (e.g. --with-static-linked-ext=foo or ext/Setup can mix static and dynamic +# extensions), EXTOBJS may contain both extinit.o and dmyext.o. In such case, +# prefer extinit.o, which does actual Init_${ext} function calls for statically +# linked extensions, and drop dmyext.o, which does nothing but just to make the +# linker happy. if objs = macros["EXTOBJS"] and objs.any? {|e|e.start_with?("ext/extinit.")} objs.delete_if {|e|e.start_with?("dmyext.")} end