Commit Graph

24 Commits

Author SHA1 Message Date
auronandace 0920fefe3b cleanup _aio header 2026-05-25 14:36:56 +01:00
auronandace 714a1b6766 sys_epoll and dl-tls header cleanup 2026-01-28 11:21:43 +00:00
Wildan M 7b9402783d Add log crate, use it to all trace cmd 2026-01-24 22:39:05 +07:00
sourceturner defd2ce7c3 Deny deny-unsafe_op_in_unsafe_fn on the crate level 2026-01-21 00:41:57 +01:00
auronandace 0a9902d78f re-add the global_asm macro import for i586 2025-12-31 09:53:06 +00:00
Anhad Singh 75f6b9d64e fix(dl-tls): TLS overallocation
* `offset` is the offset in TLS to copy initial data to NOT the segment
  size
* Only zero the region which is required to be zeroed

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2025-12-29 17:13:23 +11:00
Jeremy Soller 82084440ad Support nightly-2025-10-03 2025-10-03 21:51:10 -06:00
Jeremy Soller 84bbf90ce1 Fix ___tls_get_addr on x86 2025-07-03 10:52:46 -06:00
Jeremy Soller 02520b194e Fix compilation with trace feature 2025-01-09 12:23:23 -07: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
Josh Megnauth a7cb1c4176 Unsafe blocks: dl-tls, dlfcn 2024-12-10 02:13:32 -05:00
Anhad Singh d8f7590848 fix(__tls_get_addr): NULL check
Has to be done before adding the offsets.

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-05 15:00:35 +11:00
Anhad Singh 43301848b9 Apply 1 suggestion(s) to 1 file(s)
Co-authored-by: Andrey Turkin <andrey.turkin+redox@gmail.com>
2024-12-05 02:55:34 +00:00
Anhad Singh 1a7726541a fix TCB and TLS
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-11-29 18:40:16 +11:00
Andrey Turkin a4122753e6 Initial RISC-V64 support 2024-10-11 06:44:54 +03:00
Jeremy Soller afb5094cda Add triple underscore tls_get_addr for x86 2022-07-22 19:35:59 -06:00
Mateusz Tabaka a7480ea656 Fix global symbols relocations
Instead of a single source of symbols, now linker keeps a list of DSO (former Library) objects
with their own symbols map. That helps to process R_X86_64_COPY relocations correctly.
For example, if 'a.out' executable with dependencies ['libstdc++.so', 'libc.so'] is being loaded
and 'a.out' uses 'stdout' symbol from 'libc.so', its relocation process goes as follows:
- linker processes relocation entry 'stdout' of type R_X86_64_GLOB_DAT from 'libc.so',
- it goes through object list ['a.out', 'libstdc++.so', 'libc.so'] to find first object
  that exports 'stdout' symbol. The symbol is in 'a.out' with the value e.g. '0x404070',
- linker sets 'stdout' symbol GOT entry in 'libc.so' to '0x404070',
....
- linker processes relocation entry 'stdout' of type R_X86_64_COPY from 'a.out',
- it goes through object list excluding 'a.out': ['libstdc++.so', 'libc.so']. The symbol is found in 'libc.so',
- linker copies the 'stdout' symbol content from 'libc.so' to memory at address '0x404070' (in 'a.out' object).

Objects are relocated in reverse order they were loaded. So in the example above, linker starts with relocating
'libc.so' and ends with 'a.out'. It is necessary e.g. when linking with 'libstdc++.so' - there are many
relocations which symbols are found in 'libstdc++.so', so they need to be resolved before their contents are
copied to 'a.out'. That also matches GNU ld.so behavior.
2021-01-03 16:04:40 +01:00
jD91mZM2 b8c50c7c64 Format 2019-08-04 19:05:45 +02:00
jD91mZM2 c7d499d4f2 Upgrade to the 2018 edition
I didn't think it'd be this useful first, but thank god for `cargo fix --edition`!
2019-08-04 19:05:45 +02:00
Mateusz Mikuła 63a1319e50 Cbindgen update 2019-07-10 10:08:39 +00:00
Jeremy Soller 7bde036031 Remove va_list submodule, format 2019-04-21 15:45:55 -06:00
Jeremy Soller b9e03cbaed Implement __tls_get_addr 2019-04-14 19:09:10 -06:00
Jeremy Soller 30aef27c76 Correctly set up TLS on Redox and other fixes for pthread_clone 2019-04-14 19:08:58 -06:00
Jeremy Soller d5eb1e2732 Add dl-tls.h, required for shared libraries 2019-04-12 09:30:02 -06:00