Commit Graph

78 Commits

Author SHA1 Message Date
Wildan M e41052d307 Minor ld_so init improvement 2026-03-29 07:48:37 +07:00
auronandace a01313467e tackle some clippy lints in ld_so 2026-03-14 14:20:22 +00:00
auronandace 1421463dac assorted cleanups and add some lints 2026-03-02 10:01:05 +00:00
Anhad Singh 5568bb5a8a Revert "fix(ld.so): temporary rollback"
This reverts commit 5cf865189d.
2026-02-18 10:57:08 +11:00
Anhad Singh 5cf865189d fix(ld.so): temporary rollback
See the "Redox OS/Support" channel. This commit temporarily fixes the
issue by rolling back the changes to preload the executable.

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2026-02-18 02:36:03 +11:00
Anhad Singh e3abf808f3 misc(ld.so): remove no_mangle for stage2
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2026-02-17 00:47:36 +11:00
Anhad Singh d234e81fc9 fix(ld.so): debug build
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2026-02-17 00:15:10 +11:00
Anhad Singh f5ebd7882d misc(ld.so): minor cleanup
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2026-02-16 22:51:14 +11:00
Anhad Singh 0c3f88f462 misc(ld.so): fix logging
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2026-02-16 22:46:45 +11:00
Anhad Singh 371540d2ae fix(ld.so/i586): build
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2026-02-16 17:04:01 +11:00
Anhad Singh 0430081f4a feat(redox-rt): preload the executable
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2026-02-16 12:29:19 +11:00
Anhad Singh 8cb41ed4e2 feat(ld.so): shared library
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2026-02-15 19:14:07 +11:00
Anhad Singh f9487321c0 fix(ld.so): base_addr
Not guaranteed that the program headers immediately follow the ELF
header.

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2026-02-15 15:47:02 +11:00
Jeremy Soller 3a8f64aa14 Merge branch 'namespace-improvement' into 'master'
Introduce namespace fd and related features

See merge request redox-os/relibc!797
2026-01-20 20:43:06 -07:00
Ibuki Omatsu 1bcb6dff78 Introduce namespace fd and related features 2026-01-20 20:43:05 -07:00
Jeremy Soller 4a50c8f313 Merge branch 'p12' into 'master'
fix(libc): use `ld.so`'s allocator

See merge request redox-os/relibc!882
2026-01-20 20:35:12 -07:00
sourceturner defd2ce7c3 Deny deny-unsafe_op_in_unsafe_fn on the crate level 2026-01-21 00:41:57 +01:00
Anhad Singh bbc86d8027 fix(libc): use ld.so's allocator
Previously, this was implemented incorrectly because `tcb.mspace` was
set just *before* jumping to the program's entry point. However,
`alloc_init` is called when the init functions are run for `libc.so`, so
`tcb.mspace` must be initialized *before* the init functions are
run.

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2026-01-20 14:00:29 +11:00
Anhad Singh df647941c5 misc(pthread): remove the need for tid_mutex
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2026-01-09 22:55:58 +11:00
Anhad Singh a7918b108d misc(ld_so/start): consistent log formatting
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2025-12-22 19:06:10 +11:00
Jeremy Soller 0844e6fc90 WIP: use upper fd table 2025-11-15 07:55:37 -07:00
Josh Megnauth e39b27664f unsafe_op_in_unsafe_fn: ld_so, generic/redox-rt
There are a few functions where I allowed the lint. The lower level and
FFI nature of relibc means that there are areas with a lot of unsafe.
Some functions are basically long blocks of unsafe or contain lots of
small blocks of unsafe. unsafe_op_in_unsafe_fn doesn't add clarity to
these functions. Instead, it reduces readability by adding an indent or
small "unsafe { .. }" clutter.
2025-10-04 21:36:51 -04:00
Jeremy Soller ced734c162 Add RawCell::unsafe_set 2025-10-04 07:50:16 -06:00
Jeremy Soller 82084440ad Support nightly-2025-10-03 2025-10-03 21:51:10 -06:00
elle 5d77f617f5 ld_so: use mutex for _r_debug
Uses a `spin::Mutex` for the global static `_r_debug` instance to remove
warning about a global mutable static.

Guarantees exclusive mutable access to the `_r_debug` variable.
2025-09-08 20:23:36 +00:00
4lDO2 e6c06a7cf7 Fix signals for spawned threads, and async signal waiting. 2025-04-19 19:27:03 +02:00
4lDO2 59090a83f4 Fix thread+proc fd init in ld.so 2025-04-19 19:26:59 +02:00
4lDO2 779c1e60c5 Add todo!() to fix compilation. 2025-04-19 19:26:58 +02:00
Anhad Singh aae27c5e0c feat(ld.so): switch to object crate
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2025-01-08 16:50:47 +11:00
Anhad Singh 42d884c6a3 fix(ld.so): errors UB
Currently, how ld.so errors are handled by functions in dlfcn is wrong.
dlopen calls `linker.load_library` which returns a
`Result<ObjectHandler, goblin::Error>`. Now `goblin::Error` may have
variants that are heap allocated. For example:
`Error::Malformed(format!("invalid path: '{}': {}", path, err))`. The
error string would be allocated by ld.so's allocator but will be dropped
inside libc. This is UB.

After this patch, we now return a custom `DlError` instead. To get more
information about the error, `LD_DEBUG=all` can be set.

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-31 18:35:20 +11:00
Anhad Singh c25292ae21 misc(ld.so): clippy fixes
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-31 15:25:40 +11:00
Anhad Singh 1612c78774 fix(ld.so): disable lazy binding on non-x86_64
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-24 20:51:53 +11:00
Anhad Singh 023a005688 fix(ld.so): non-pie lazy
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-24 20:51:53 +11:00
Anhad Singh 0a0ecb018f fix(ld.so: adjust_stack): remove dead code
Does not do anything.

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-24 20:51:53 +11:00
Anhad Singh cc5e0ceebc fix(ld.so): function signature
No longer expects a self TLS.

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-24 20:51:53 +11:00
Anhad Singh eb82f9afeb misc(lint): unused variables and imports
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-24 20:51:53 +11:00
Anhad Singh 500848bc76 fix(ld.so): remove unreachable loop {}
_exit() is noreturn

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-24 20:51:53 +11:00
Anhad Singh de9e8a6177 feat(ld.so): config
Currently supported options are `LD_DEBUG` and `LD_LIBRARY_PATH`.

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-17 01:07:17 +11:00
Anhad Singh c286ad2868 fix(ld.so): do not depend on TLS at all
In the next big refactor (next PR), all of the platform functionality
used by both relibc and ld.so will be moved into a `platform`/`sysdeps`
crate and then ld.so would be moved out of relibc and not link with it.

I think doing it in a seperate PR would make it more managable, as when
I did half of it, the diff was pretty huge and that way it would be
easier to review too :)

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-05 23:11:59 +11:00
Anhad Singh f6fa4e8246 feat(ld_so): setup sighandler
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-11-30 00:02:33 +11:00
Anhad Singh 1a7726541a fix TCB and TLS
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-11-29 18:40:16 +11:00
4lDO2 57f098931a Remove ld.so's now unnecessary access() wrapper. 2024-09-30 16:55:27 +02:00
4lDO2 f6761407e5 Pass si_pid to all realtime signals. 2024-09-24 19:34:51 +02:00
Darley Barreto ce1e31d567 Replace C dlmalloc 2023-12-12 15:04:17 +00:00
Jeremy Soller 16abc91341 cargo fmt and cargo fix 2022-11-11 13:27:18 -07:00
Jeremy Soller d1a86c850e Hack to use the correct TLS size for the first TLS module 2022-11-11 10:08:00 -07:00
Jeremy Soller b13e96ffb8 Ensure there is a stub Tcb for dynamically linked binaries 2022-11-11 09:42:47 -07:00
4lDO2 5e74d173ab Fix ld.so access function on Redox. 2022-08-13 19:16:48 +02:00
4lDO2 54b3f873f8 Move cwd from kernel to relibc. 2022-08-13 19:16:45 +02:00
4lDO2 4e5ccbffd1 Allow constructors to access env vars. 2022-07-26 21:34:48 +02:00