This repository was archived by the owner on Jun 24, 2026. It is now read-only.
[build] E: Link libnvx_crt0.a into test ELFs#178
Closed
esaurez wants to merge 1 commit into
Closed
Conversation
980ad7d to
d1821b9
Compare
nanvix/nanvix#2453 moved the `_start` entry point out of `libposix.a` into a new `libnvx_crt0.a`. Add `libnvx_crt0.a` to both the `LIBRARIES` and `LIBRARIES_CXX` link wrappers so every posix-tests test ELF gets `_start` 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>
d1821b9 to
975898c
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the POSIX tests build system to explicitly link Nanvix’s new libnvx_crt0.a into every test ELF so the correct strong _start entry point is resolved at link time (preventing silent fallback to newlib’s weak _start and subsequent test hangs).
Changes:
- Export a new
LIBNVX_CRT0pointing at$(NANVIX_SYSROOT)/lib/libnvx_crt0.a. - Prepend
$(LIBNVX_CRT0)to bothLIBRARIESandLIBRARIES_CXXwithin the existing--start-group/--end-grouplink wrapper.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ppenna
added a commit
that referenced
this pull request
Jun 11, 2026
Since Nanvix 0.16.19, process startup (_start / __nanvix_main) was moved out of libposix.a into libnvx_crt0.a. After pinning nanvix to 0.16.32, linking only libposix.a left __nanvix_main undefined and the test ELFs failed to link (ld returned 1). Link libnvx_crt0.a first in both the C and C++ library groups so its strong symbols win, and add -Wl,--allow-multiple-definition to resolve the kcall objects (_start, environ, Rust allocator shims) shared between libnvx_crt0.a and libposix.a. Combines the nanvix 0.16.32 bump with the crt0 startup fix (supersedes the standalone crt0 PR #178). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
nanvix/nanvix#2453 (already upstream) moved the
_startentry point out oflibposix.ainto a newlibnvx_crt0.a. Addlibnvx_crt0.ato both theLIBRARIESandLIBRARIES_CXXlink wrappers insrc/Makefileso every posix-tests test ELF gets_startat link time. Without this the linker silently picks newlib's weak default_startand 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:
sys-fficrate split that removes the duplicate__kcall_*/_do_exit_thread/_do_start_threadstrong symbols fromlibnvx_crt0.a._do_startas.weaksolibnvx_crt0's strong SSE-aligned override wins cleanly without-Wl,--allow-multiple-definition.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
A new
LIBNVX_CRT0variable is exported alongsideLIBPOSIXandLIBC, and added inside the existing--start-groupahead ofLIBPOSIXin bothLIBRARIESandLIBRARIES_CXXso every test ELF gets_startresolved from libnvx_crt0's strong symbol.