Skip to content

motion: keep the kinematics type declaration optional for old modules - #4545

Merged
grandixximo merged 1 commit into
LinuxCNC:masterfrom
grandixximo:fix/kins-typeflags-weak
Sep 15, 2026
Merged

grandixximo merged 1 commit into
LinuxCNC:masterfrom
grandixximo:fix/kins-typeflags-weak

Conversation

@grandixximo

Copy link
Copy Markdown
Contributor

#4414 made motmod resolve kinematicsTypeFlags from the loaded kinematics module at dlopen time. Out-of-tree modules built before it export no such symbol, so the dlopen fails and the machine does not start.

Mark the reference weak; when the module does not answer, report -1 ("no information") for every type. The interpreter already treats that as the no-declarations state: numeric G12.1 switching is unchanged and G13.1 falls back to type 0.

Tested with a pre-#4414 out-of-tree binary switchkins module: failed to load before (motmod.so: undefined symbol: kinematicsTypeFlags), now loads, homes, runs and switches types numerically. The kins-switch test (a declaring module) still passes.

A kinematics module built before the type declarations exports no kinematicsTypeFlags, and motmod's hard reference kept it from loading: dlopen fails on the undefined symbol.  Mark the reference weak and report -1, no information, when the module does not answer.
@grandixximo
grandixximo merged commit bc3248e into LinuxCNC:master Sep 15, 2026
17 checks passed
@BsAtHome

Copy link
Copy Markdown
Contributor

What happens in emc/rs274ngc/interp_convert.cc:6637 with the assignment of -1?

@grandixximo

Copy link
Copy Markdown
Contributor Author

On master the outcome is the intended one: -1 matches every flag, so the loop stops at type 0, and the no-information fallback below would give the same 0; for a module that declares nothing, type 0 is the only answer G13.1 can give. The exclusion becomes load-bearing only once a second flag is tested: #4374's G43.4 tests KINSTYPE_PRIMARY, where an undeclared module would otherwise silently pass as primary instead of erroring, and there the test already excludes -1 (f >= 0 && (f & flag)).

I considered a docs note for old out-of-tree modules, but a module built before G13.1 existed cannot have G13.1 in its programs, so there is nothing to warn about.

@BsAtHome

Copy link
Copy Markdown
Contributor

Alright, then its settled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants