[build] F: Pin newlib to _do_start-weak commit#1
Conversation
The `-Wl,--allow-multiple-definition` flag was added in the previous
commit to silently coalesce 37 duplicate strong symbols that appeared
in BOTH `libnvx_crt0.a` and `libposix.a`:
* 34 `__kcall_*` FFI wrappers (`__kcall_lock_mutex`,
`__kcall_signal_cond`, `__kcall_send`, ...)
* `_do_exit_thread` (thread-exit handler)
* `_do_start_thread` (asm thread-bootstrap stub)
* `_do_start` (process-entry stub)
These have now been resolved structurally upstream:
* 36 of 37 by the `sys-ffi` crate split that moves the
`#[no_mangle]` FFI exports out of `sys` into a dedicated crate
that only `libposix.a` links. See nanvix/nanvix#TBD (esaurez/nanvix#30).
* The remaining `_do_start` by declaring newlib's stub `.weak`
so libnvx_crt0's strong SSE-aligned override wins cleanly.
See nanvix/newlib#TBD (esaurez/newlib#5).
With those upstream and a toolchain image republished from
nanvix/toolchain-gcc#TBD (esaurez/toolchain-gcc#1) that bundles the
new newlib commit, the link line no longer needs the flag.
Validated end-to-end with the patched toolchain
(`local-nanvix/toolchain-gcc:do_start-weak`):
* posix-tests: 18 binaries built, 12 integration suites pass
* libxml2 functional test: PASS
* `_do_start` at the entry point is libnvx_crt0's SSE-aligned
variant (`and $0xfffffff0, %esp ; sub $0x8, %esp ; push ; push ;
call _start`), not newlib's 9-byte unaligned stub.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The `-Wl,--allow-multiple-definition` flag was added in the previous
commit to silently coalesce 37 duplicate strong symbols that appeared
in BOTH `libnvx_crt0.a` and `libposix.a`:
* 34 `__kcall_*` FFI wrappers (`__kcall_lock_mutex`,
`__kcall_signal_cond`, `__kcall_send`, ...)
* `_do_exit_thread` (thread-exit handler)
* `_do_start_thread` (asm thread-bootstrap stub)
* `_do_start` (process-entry stub)
These have now been resolved structurally upstream:
* 36 of 37 by the `sys-ffi` crate split that moves the
`#[no_mangle]` FFI exports out of `sys` into a dedicated crate
that only `libposix.a` links. See nanvix/nanvix#TBD (esaurez/nanvix#30).
* The remaining `_do_start` by declaring newlib's stub `.weak`
so libnvx_crt0's strong SSE-aligned override wins cleanly.
See nanvix/newlib#TBD (esaurez/newlib#5).
With those upstream and a toolchain image republished from
nanvix/toolchain-gcc#TBD (esaurez/toolchain-gcc#1) that bundles the
new newlib commit, the link line no longer needs the flag.
Validated end-to-end with the patched toolchain
(`local-nanvix/toolchain-gcc:do_start-weak`):
* posix-tests: 18 binaries built, 12 integration suites pass
* libxml2 functional test: PASS
* `_do_start` at the entry point is libnvx_crt0's SSE-aligned
variant (`and $0xfffffff0, %esp ; sub $0x8, %esp ; push ; push ;
call _start`), not newlib's 9-byte unaligned stub.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The `-Wl,--allow-multiple-definition` flag was added in the previous
commit to silently coalesce 37 duplicate strong symbols that appeared
in BOTH `libnvx_crt0.a` and `libposix.a`:
* 34 `__kcall_*` FFI wrappers (`__kcall_lock_mutex`,
`__kcall_signal_cond`, `__kcall_send`, ...)
* `_do_exit_thread` (thread-exit handler)
* `_do_start_thread` (asm thread-bootstrap stub)
* `_do_start` (process-entry stub)
These have now been resolved structurally upstream:
* 36 of 37 by the `sys-ffi` crate split that moves the
`#[no_mangle]` FFI exports out of `sys` into a dedicated crate
that only `libposix.a` links. See nanvix/nanvix#TBD (esaurez/nanvix#30).
* The remaining `_do_start` by declaring newlib's stub `.weak`
so libnvx_crt0's strong SSE-aligned override wins cleanly.
See nanvix/newlib#TBD (esaurez/newlib#5).
With those upstream and a toolchain image republished from
nanvix/toolchain-gcc#TBD (esaurez/toolchain-gcc#1) that bundles the
new newlib commit, the link line no longer needs the flag.
Validated end-to-end with the patched toolchain
(`local-nanvix/toolchain-gcc:do_start-weak`):
* posix-tests: 18 binaries built, 12 integration suites pass
* libxml2 functional test: PASS
* `_do_start` at the entry point is libnvx_crt0's SSE-aligned
variant (`and $0xfffffff0, %esp ; sub $0x8, %esp ; push ; push ;
call _start`), not newlib's 9-byte unaligned stub.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The `-Wl,--allow-multiple-definition` flag was added in the previous
commit to silently coalesce 37 duplicate strong symbols that appeared
in BOTH `libnvx_crt0.a` and `libposix.a`:
* 34 `__kcall_*` FFI wrappers (`__kcall_lock_mutex`,
`__kcall_signal_cond`, `__kcall_send`, ...)
* `_do_exit_thread` (thread-exit handler)
* `_do_start_thread` (asm thread-bootstrap stub)
* `_do_start` (process-entry stub)
These have now been resolved structurally upstream:
* 36 of 37 by the `sys-ffi` crate split that moves the
`#[no_mangle]` FFI exports out of `sys` into a dedicated crate
that only `libposix.a` links. See nanvix/nanvix#TBD (esaurez/nanvix#30).
* The remaining `_do_start` by declaring newlib's stub `.weak`
so libnvx_crt0's strong SSE-aligned override wins cleanly.
See nanvix/newlib#TBD (esaurez/newlib#5).
With those upstream and a toolchain image republished from
nanvix/toolchain-gcc#TBD (esaurez/toolchain-gcc#1) that bundles the
new newlib commit, the link line no longer needs the flag.
Validated end-to-end with the patched toolchain
(`local-nanvix/toolchain-gcc:do_start-weak`):
* posix-tests: 18 binaries built, 12 integration suites pass
* libxml2 functional test: PASS
* `_do_start` at the entry point is libnvx_crt0's SSE-aligned
variant (`and $0xfffffff0, %esp ; sub $0x8, %esp ; push ; push ;
call _start`), not newlib's 9-byte unaligned stub.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The `-Wl,--allow-multiple-definition` flag was added in the previous
commit to silently coalesce 37 duplicate strong symbols that appeared
in BOTH `libnvx_crt0.a` and `libposix.a`:
* 34 `__kcall_*` FFI wrappers (`__kcall_lock_mutex`,
`__kcall_signal_cond`, `__kcall_send`, ...)
* `_do_exit_thread` (thread-exit handler)
* `_do_start_thread` (asm thread-bootstrap stub)
* `_do_start` (process-entry stub)
These have now been resolved structurally upstream:
* 36 of 37 by the `sys-ffi` crate split that moves the
`#[no_mangle]` FFI exports out of `sys` into a dedicated crate
that only `libposix.a` links. See nanvix/nanvix#TBD (esaurez/nanvix#30).
* The remaining `_do_start` by declaring newlib's stub `.weak`
so libnvx_crt0's strong SSE-aligned override wins cleanly.
See nanvix/newlib#TBD (esaurez/newlib#5).
With those upstream and a toolchain image republished from
nanvix/toolchain-gcc#TBD (esaurez/toolchain-gcc#1) that bundles the
new newlib commit, the link line no longer needs the flag.
Validated end-to-end with the patched toolchain
(`local-nanvix/toolchain-gcc:do_start-weak`):
* posix-tests: 18 binaries built, 12 integration suites pass
* libxml2 functional test: PASS
* `_do_start` at the entry point is libnvx_crt0's SSE-aligned
variant (`and $0xfffffff0, %esp ; sub $0x8, %esp ; push ; push ;
call _start`), not newlib's 9-byte unaligned stub.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The `-Wl,--allow-multiple-definition` flag was added in the previous
commit to silently coalesce 37 duplicate strong symbols that appeared
in BOTH `libnvx_crt0.a` and `libposix.a`:
* 34 `__kcall_*` FFI wrappers (`__kcall_lock_mutex`,
`__kcall_signal_cond`, `__kcall_send`, ...)
* `_do_exit_thread` (thread-exit handler)
* `_do_start_thread` (asm thread-bootstrap stub)
* `_do_start` (process-entry stub)
These have now been resolved structurally upstream:
* 36 of 37 by the `sys-ffi` crate split that moves the
`#[no_mangle]` FFI exports out of `sys` into a dedicated crate
that only `libposix.a` links. See nanvix/nanvix#TBD (esaurez/nanvix#30).
* The remaining `_do_start` by declaring newlib's stub `.weak`
so libnvx_crt0's strong SSE-aligned override wins cleanly.
See nanvix/newlib#TBD (esaurez/newlib#5).
With those upstream and a toolchain image republished from
nanvix/toolchain-gcc#TBD (esaurez/toolchain-gcc#1) that bundles the
new newlib commit, the link line no longer needs the flag.
Validated end-to-end with the patched toolchain
(`local-nanvix/toolchain-gcc:do_start-weak`):
* posix-tests: 18 binaries built, 12 integration suites pass
* libxml2 functional test: PASS
* `_do_start` at the entry point is libnvx_crt0's SSE-aligned
variant (`and $0xfffffff0, %esp ; sub $0x8, %esp ; push ; push ;
call _start`), not newlib's 9-byte unaligned stub.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The `-Wl,--allow-multiple-definition` flag was added in the previous
commit to silently coalesce 37 duplicate strong symbols that appeared
in BOTH `libnvx_crt0.a` and `libposix.a`:
* 34 `__kcall_*` FFI wrappers (`__kcall_lock_mutex`,
`__kcall_signal_cond`, `__kcall_send`, ...)
* `_do_exit_thread` (thread-exit handler)
* `_do_start_thread` (asm thread-bootstrap stub)
* `_do_start` (process-entry stub)
These have now been resolved structurally upstream:
* 36 of 37 by the `sys-ffi` crate split that moves the
`#[no_mangle]` FFI exports out of `sys` into a dedicated crate
that only `libposix.a` links. See nanvix/nanvix#TBD (esaurez/nanvix#30).
* The remaining `_do_start` by declaring newlib's stub `.weak`
so libnvx_crt0's strong SSE-aligned override wins cleanly.
See nanvix/newlib#TBD (esaurez/newlib#5).
With those upstream and a toolchain image republished from
nanvix/toolchain-gcc#TBD (esaurez/toolchain-gcc#1) that bundles the
new newlib commit, the link line no longer needs the flag.
Validated end-to-end with the patched toolchain
(`local-nanvix/toolchain-gcc:do_start-weak`):
* posix-tests: 18 binaries built, 12 integration suites pass
* libxml2 functional test: PASS
* `_do_start` at the entry point is libnvx_crt0's SSE-aligned
variant (`and $0xfffffff0, %esp ; sub $0x8, %esp ; push ; push ;
call _start`), not newlib's 9-byte unaligned stub.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…newlib checkout Bumps NEWLIB_COMMIT to incorporate the `_do_start` weakening from nanvix/newlib#TBD (esaurez/newlib#5) so that consumers linking Nanvix's libnvx_crt0.a no longer need `-Wl,--allow-multiple-definition` on their test ELF link lines. Also restores reproducibility of the newlib checkout: the prior `git clone --depth=1 --branch dev` step silently used the tip of `dev` regardless of the declared `NEWLIB_COMMIT` pin, making toolchain builds non-deterministic. Removing `--depth=1` and adding an explicit `git checkout \` restores the pin. Companion Dockerfile.localpatch-do_start is added for fast local validation of the newlib fix without a full toolchain rebuild -- useful for reviewers who want to confirm the symbol topology and SSE alignment effects before the full image is republished. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
84f7da2 to
08ad1af
Compare
The `-Wl,--allow-multiple-definition` flag was added in the previous
commit to silently coalesce 37 duplicate strong symbols that appeared
in BOTH `libnvx_crt0.a` and `libposix.a`:
* 34 `__kcall_*` FFI wrappers (`__kcall_lock_mutex`,
`__kcall_signal_cond`, `__kcall_send`, ...)
* `_do_exit_thread` (thread-exit handler)
* `_do_start_thread` (asm thread-bootstrap stub)
* `_do_start` (process-entry stub)
These have now been resolved structurally upstream:
* 36 of 37 by the `sys-ffi` crate split that moves the
`#[no_mangle]` FFI exports out of `sys` into a dedicated crate
that only `libposix.a` links. See nanvix/nanvix#TBD (esaurez/nanvix#30).
* The remaining `_do_start` by declaring newlib's stub `.weak`
so libnvx_crt0's strong SSE-aligned override wins cleanly.
See nanvix/newlib#TBD (esaurez/newlib#5).
With those upstream and a toolchain image republished from
nanvix/toolchain-gcc#TBD (esaurez/toolchain-gcc#1) that bundles the
new newlib commit, the link line no longer needs the flag.
Validated end-to-end with the patched toolchain
(`local-nanvix/toolchain-gcc:do_start-weak`):
* posix-tests: 18 binaries built, 12 integration suites pass
* libxml2 functional test: PASS
* `_do_start` at the entry point is libnvx_crt0's SSE-aligned
variant (`and $0xfffffff0, %esp ; sub $0x8, %esp ; push ; push ;
call _start`), not newlib's 9-byte unaligned stub.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Superseded by upstream PR nanvix#14 (draft, depends on nanvix/newlib#17 merging first), which carries the cleaned-up version of this PR. Changes vs the original fork PR: (a) rebased onto current upstream/main; (b) |
Summary (DRAFT — do not merge until upstream newlib lands)
Bumps
NEWLIB_COMMITto point at the upstream merge of esaurez/newlib#5 (_do_startweakening), and restores reproducible newlib checkouts.Why this is filed as a draft
The current
NEWLIB_COMMITvalue (881840f880350e6fd929629cef9a5a3d1708bbf4) is the fork commit onesaurez/newlib. Before this PR is merged, the SHA must be updated to the upstream merge commit onnanvix/newlib(otherwisegit clone https://github.com/nanvix/newlib && git checkout 881840f88would fail).Filing now so the diff is reviewable and ready to flip from draft to ready-for-review the moment esaurez/newlib#5 lands at
nanvix/newlib.Changes
NEWLIB_COMMITto the new newlib SHA.git clone --depth=1 --branch devstep ignored theNEWLIB_COMMITpin entirely (nogit checkoutafter the shallow clone), so the toolchain was actually built against whatever happened to be at the tip ofdevat image-build time. Drop--depth=1and add an explicitgit checkout \.Dockerfile.localpatch-do_start— fast local validation. Reassembles justcrt0.Sfrom a patched newlib tree and overlays the resultingcrt0.oonto the existingtoolchain-gcc:sha-34a3641image, no full rebuild needed.Dependency chain
\
esaurez/nanvix#30 (sys-ffi split, removes 36 of 37 duplicate symbols)
esaurez/newlib#5 (.weak _do_start, removes the 37th)
|
v
THIS PR (NEWLIB_COMMIT bump to pick up newlib#5)
|
v
ghcr.io/nanvix/toolchain-gcc:sha- (image republished by CI)
|
v
F: fixup commits on the 6 Tier 0 PRs
esaurez/{posix-tests#4, libxml2#2, libxslt#2, lxml#2, libffi#2, openssl#2}
drop -Wl,--allow-multiple-definition
\\
Validation
Validated locally with
Dockerfile.localpatch-do_startoverlaid on the current toolchain image:\
$ docker run --rm local-nanvix/toolchain-gcc:do_start-weak nm /opt/nanvix/i686-nanvix/lib/crt0.o
00000000 W _do_start # was: T _do_start
U _start
\\
posix-tests (18 binaries, 12 integration suites) and libxml2 functional test both built without
-Wl,--allow-multiple-definitionand ran to PASS, using libnvx_crt0's SSE-aligned_do_startat the entry point.References
nanvix-todo/newlib-do_start-collision.md