Commit 73ee721
[build] F: Use --allow-multiple-definition for libnvx_crt0 link
End-to-end validation surfaced a hard linker error in the original
--whole-archive approach: libnvx_crt0.a and libposix.a both bundle the
`sys` crate (Rust monomorphizes the FFI `__kcall_*` symbols into both
archives), so --whole-archive on libnvx_crt0 produces "multiple
definition of __kcall_*" errors against libposix.
Switch to:
-Wl,--allow-multiple-definition
-Wl,--start-group
$(wildcard $(SYSROOT_PATH)/lib/libnvx_crt0.a)
libposix.a libc.a [libm.a]
-Wl,--end-group
With libnvx_crt0.a inside the start-group and ahead of libposix.a, the
linker resolves the entry-point `_start` from libnvx_crt0 (strong T
symbol) over newlib's weak `_start` fallback. The remaining
__kcall_* duplicates from the two `sys` monomorphizations are
byte-identical (same Rust source, same release profile, same compiler
options) and silently coalesced by --allow-multiple-definition.
The $(wildcard ...) trick preserves backward compatibility: on
pre-PR-11b sysroots libnvx_crt0.a is absent, the wildcard expands to
empty, and the link line collapses to the original behavior.
Validated by building + running the test ELF via nanvixd.exe against
a locally-built nanvix-dev sysroot that includes PR-11b.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent fbd0330 commit 73ee721
1 file changed
Lines changed: 9 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
64 | 69 | | |
65 | | - | |
66 | | - | |
| 70 | + | |
| 71 | + | |
67 | 72 | | |
68 | 73 | | |
69 | 74 | | |
| |||
0 commit comments