Skip to content

[build] E: Link libnvx_crt0.a into test ELF#74

Open
esaurez wants to merge 1 commit into
nanvix:nanvix/v2.12.9from
esaurez:feat/link-libnvx_crt0-for-PR11b-compat-upstream
Open

[build] E: Link libnvx_crt0.a into test ELF#74
esaurez wants to merge 1 commit into
nanvix:nanvix/v2.12.9from
esaurez:feat/link-libnvx_crt0-for-PR11b-compat-upstream

Conversation

@esaurez

@esaurez esaurez commented Jun 9, 2026

Copy link
Copy Markdown

Summary

nanvix/nanvix#2453 (already upstream) moved the _start entry point out of libposix.a into a new libnvx_crt0.a. Add libnvx_crt0.a to the test ELF link line so the linker resolves _start from it; without this the linker silently picks newlib's weak default _start and the test hangs at startup with no diagnostic output.

Dependencies

This PR assumes the following have already merged and the toolchain image has been republished:

  • nanvix/nanvix#2487sys-ffi crate split that removes the duplicate __kcall_* / _do_exit_thread / _do_start_thread strong symbols from libnvx_crt0.a.
  • nanvix/newlib#17 — declares newlib's _do_start as .weak so libnvx_crt0's strong SSE-aligned override wins cleanly without -Wl,--allow-multiple-definition.
  • nanvix/toolchain-gcc#14 — pins the new newlib commit and triggers a republish of ghcr.io/nanvix/toolchain-gcc.

If those have not landed, the link line will fail with multiple definition of __kcall_* errors against the unpatched toolchain image.

What changes

One line added to the test ELF link line: $(SYSROOT_PATH)/lib/libnvx_crt0.a placed inside the existing --start-group ahead of libposix.a, so the linker resolves _start from libnvx_crt0's strong symbol.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Nanvix build/test integration for this libxml2 repo. It adds libnvx_crt0.a to the test ELF link to ensure the correct _start is pulled on post-PR-11b sysroots, and it also expands the build to produce a shared libxml2.so plus packaging targets.

Changes:

  • Add libnvx_crt0.a (via $(wildcard ...)) to the test ELF link group and add --allow-multiple-definition to work around current duplicate symbols.
  • Extend the Nanvix build to produce .libs/libxml2.so from the PIC objects in .libs/libxml2.a, and add validation checks for the shared library in test-functional.
  • Add package / verify-package targets and adjust clean behavior (but removes prior install/staging behavior).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
.nanvix/z.py Updates tracked Docker copy-back outputs and staged artifacts list to include libxml2.so.
.nanvix/Makefile.nanvix Updates build/test rules: links libnvx_crt0.a into test ELF, adds .so build/validation, introduces packaging targets, and changes staging/clean behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .nanvix/z.py Outdated
Comment thread .nanvix/Makefile.nanvix Outdated
Comment thread .nanvix/Makefile.nanvix Outdated
Comment thread .nanvix/Makefile.nanvix Outdated
Comment thread .nanvix/Makefile.nanvix Outdated
@esaurez esaurez force-pushed the feat/link-libnvx_crt0-for-PR11b-compat-upstream branch from a2ad98f to 6117813 Compare June 9, 2026 21:03
@esaurez esaurez changed the title [build] E: Link libnvx_crt0.a into test ELF for PR-11b compatibility [build] E: Link libnvx_crt0.a into test ELF to keep _start resolution working Jun 9, 2026
nanvix/nanvix#2453 moved the `_start` entry point out of
`libposix.a` into a new `libnvx_crt0.a`.  Add `libnvx_crt0.a` to
the test ELF link line so `_start` is found at link time;
otherwise the linker silently picks newlib's weak fallback and
the test hangs at startup.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 9, 2026 21:29
@esaurez esaurez force-pushed the feat/link-libnvx_crt0-for-PR11b-compat-upstream branch from 6117813 to b290960 Compare June 9, 2026 21:29
@esaurez esaurez changed the title [build] E: Link libnvx_crt0.a into test ELF to keep _start resolution working [build] E: Link libnvx_crt0.a into test ELF Jun 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread .nanvix/Makefile.nanvix
Comment thread .nanvix/Makefile.nanvix
@esaurez

esaurez commented Jun 9, 2026

Copy link
Copy Markdown
Author

All prior review comments on this PR are stale and have been superseded by a rework.

The PR was originally filed as a much larger change that included Wave 3 .so build content plus a forward/backward-compat shim ($(wildcard ...) around libnvx_crt0.a, -Wl,--allow-multiple-definition as a safety flag, install/staging rework). All review comments above were filed against that larger version.

The PR has now been re-scoped to a single straightforward change: add libnvx_crt0.a to the test ELF link line (no wildcard, no safety flag). The diff is now 1-2 lines on a single file (see Files changed tab). The rework was done because we are only landing this work after Wave 1 + Wave 2 are fully merged and the toolchain image republished -- which makes all of the forward-compat machinery unnecessary.

Marking the prior comments as obsolete. If anything in the current 1-line diff still warrants discussion, please file a fresh comment.

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