Jacob Lorentzon
9c5f11fbc8
Add Out<T> wrapper
2025-09-21 14:36:12 +02:00
Wildan M
b541ee43be
Change PATH separator to double colon
2025-09-19 21:48:38 +07:00
elle
a5c41f77d0
ld_so: remove access dead code
2025-09-08 21:03:27 +00: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
elle
09015a218e
ld_so: remove unsafe transmute in mmap_and_copy
...
Refactors casting the `raw` address as a byte array to use idiomatic
Rust APIs instead of the unsafe call to `transmute`.
2025-09-08 20:23:36 +00:00
Wildan Mubarok
c7a1966a67
Fix trace feature
2025-08-08 23:41:07 +00:00
Jeremy Soller
84bbf90ce1
Fix ___tls_get_addr on x86
2025-07-03 10:52:46 -06:00
Jeremy Soller
0bd38ac2ad
Fix DTPMOD relocation
2025-05-09 10:06:06 -06:00
Jeremy Soller
b887ad1ce6
Fix DTPOFF relocation
2025-05-07 21:04:31 -06:00
Jeremy Soller
0b1133a965
ld_so: do relocations before TLS
2025-05-07 16:27:00 -06:00
Jeremy Soller
4daade9721
log where unresolved symbol was required
2025-05-07 10:38:21 -06:00
Jeremy Soller
2b06118d5f
Fix deadlock when logging scopes
2025-05-06 21:50:38 -06:00
Jeremy Soller
78bab94ee0
Add end of dynamic library mapping to debug messages
2025-05-06 20:45:39 -06: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
4lDO2
ad5efd0f11
Reach init fork
2025-04-19 19:26:57 +02:00
Anhad Singh
c64058c8b7
tcb: aarch64
2025-04-20 02:41:35 +10:00
Jeremy Soller
228d53dcd5
More improvements for relocation handling
2025-04-18 16:03:09 -06:00
Jeremy Soller
03f863d742
ld_so: better support for other arches
2025-04-18 14:26:39 -06:00
Jeremy Soller
310b097da6
Fix check for Sym size
2025-04-18 12:39:27 -06:00
Josh Megnauth
51c04d2470
Use C string literals & deprecate c_str!
2025-03-14 21:17:53 -04:00
Jeremy Soller
da174f9626
Fixes for 32-bit builds
2025-02-07 09:18:56 -07:00
Anhad Singh
d3073fdad4
feat(ld.so): more debug info for scopes
...
When scopes is set for `LD_DEBUG`, more debug information is displayed
now,
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2025-01-19 00:11:51 +11:00
Anhad Singh
99449094d4
chore: formatting
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2025-01-19 00:03:07 +11:00
Anhad Singh
4a08220664
fix(ld.so): copy relocations
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2025-01-18 23:51:53 +11:00
Anhad Singh
e3dc5d0617
chore(dso): remove unused members
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2025-01-18 21:20:10 +11:00
Anhad Singh
3440985729
fix(dso): 32-bit
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2025-01-15 21:32:40 +11:00
Anhad Singh
07ff79069e
feat(ld.so): add support for DT_RELR
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2025-01-15 13:49:27 +11:00
Jeremy Soller
a3c12e27e4
Fix build for i686
2025-01-14 18:01:26 -07:00
Anhad Singh
b9e0505715
fix(ld.so): less locks
...
Acquire the global scope lock at the start of relocate.
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2025-01-13 23:48:03 +11:00
Jeremy Soller
af50d18d16
Return error instead of panic when load_library cannot find root DSO
2025-01-09 13:33:29 -07:00
Jeremy Soller
02520b194e
Fix compilation with trace feature
2025-01-09 12:23:23 -07: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
e49072655c
feat(ld.so): partially switch to object
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2025-01-08 16:50:10 +11:00
Anhad Singh
e219f9768e
feat(ld.so): GNU hash table
...
Note that the ELF specification mandates the presence of either the GNU
hash table or SysV hash table. See Figure 2-7. Dynamic Array Tags.
Also both can be present, though that is not currently handled.
BLAZINGLY FAST!
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2025-01-08 16:48:26 +11:00
Anhad Singh
bfe1c0b545
fix(ld.so): redox build
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-31 19:30:37 +11:00
Anhad Singh
01e6eda258
misc(dlfcn): cleanup
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-31 19:03:05 +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
9cf72fd0b2
feat(ld.so): add all option for LD_DEBUG
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-31 18:00:45 +11:00
Anhad Singh
60f700fb50
chore(linker): remove todo
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-31 15:26:23 +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
cfe89f828a
feat: rwlock instead of mutex for global scope
...
* Rwlock -> InnerRwLock
* RwLock makes use of InnerRwLock.
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-31 00:54:52 +11:00
Anhad Singh
2be4316aec
feat(dlfcn): return DSO as the handle
...
Fine because:
> The value of this handle should not be interpreted in any way by the
> caller.
From: https://pubs.opengroup.org/onlinepubs/009696599/functions/dlopen.html
* Add tests for unload
* Implement NOLOAD so we can test that the loaded object has been
destroyed.
* Minor cleanup.
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-25 16:17:51 +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
1db68ab978
feat(ld.so): scopes
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-24 20:51:53 +11:00
Anhad Singh
13d819ac89
misc(ld.so: __plt_resolve_inner): println -> trace
...
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2024-12-24 20:51:53 +11:00
Anhad Singh
e3587017f6
fix(ld.so): stub plt stub for non-x86_64
...
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