Skip to content

Fix/2.9 lld fix#3945

Open
grandixximo wants to merge 2 commits intoLinuxCNC:2.9from
grandixximo:fix/2.9-lld-fix
Open

Fix/2.9 lld fix#3945
grandixximo wants to merge 2 commits intoLinuxCNC:2.9from
grandixximo:fix/2.9-lld-fix

Conversation

@grandixximo
Copy link
Copy Markdown

Cherry-pick of #3925 for 2.9, seems cherry-pick applied cleanly...

@NTULINUX @andypugh @BsAtHome

Luca Toniolo added 2 commits April 17, 2026 09:41
rtapi_app.h unconditionally declares EXPORT_SYMBOL for both
rtapi_app_main and rtapi_app_exit, so every module is expected to
provide both entry points. enum.c only implemented rtapi_app_main,
which slipped past GNU ld but trips lld 17+'s default
--no-undefined-version (LLVM D135402) when the generated version
script references the missing symbol:

    ld.lld: error: version script assignment of 'global' to symbol
    'rtapi_app_exit' failed: symbol not defined

Provide an empty rtapi_app_exit so enum.c satisfies the contract.
Builds clean with clang 19 / ld.lld 19 for a uspace configuration.

Fixes LinuxCNC#3191.
rtapi_app.h mandates that every component exports both rtapi_app_main
and rtapi_app_exit, but do_load_cmd() only checked for main and
do_unload_cmd() silently skipped the exit call when it was absent.
That let enum.c slip into the tree without rtapi_app_exit for years
(Fixes LinuxCNC#3191), visible only once lld 17+'s default
--no-undefined-version made it a hard link error.

Check for rtapi_app_exit in do_load_cmd() alongside rtapi_app_main
and refuse to load the component otherwise, so future omissions
surface immediately at load time with a clear error message.

While here, also correct the dlsym cast for rtapi_app_exit in both
do_load_cmd() and do_unload_cmd() from int(*)(void) to void(*)(void)
to match the component's actual declaration. The int version was
copy-pasted from the rtapi_app_main lookup and while harmless in
practice (the return value was never read) it misrepresents the
function signature.
Copy link
Copy Markdown
Contributor

@NTULINUX NTULINUX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! :D

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