Commit Graph

135 Commits

Author SHA1 Message Date
Ivan Tan 4cb564bc99 aarch64: align sp in _start 2023-07-07 18:58:42 +08:00
Noa df6f4678e8 Fix warnings 2023-05-30 13:46:17 -05:00
4lDO2 cdd0f67b23 Rustfmt. 2023-05-17 15:28:10 +02:00
Jeremy Soller f5651b22ea Do not overwrite static TCB 2023-02-13 08:31:59 -07:00
Jeremy Soller ee0193aa7e Add missing import 2022-11-11 17:06:50 -07: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
Jeremy Soller 976ca7893f Use current Tcb if it is set even if no linker objects are loaded 2022-09-11 14:07:05 -06:00
Jeremy Soller 367be58666 Set linker_ptr when using static TLS 2022-09-11 11:11:49 -06:00
Jeremy Soller 0250ea022f pte clone for aarch64 2022-08-26 20:16:58 -06:00
Jeremy Soller c59b94d102 Hacks to support aarch64 static TLS 2022-08-25 19:03:49 -06:00
Jeremy Soller b0d3e5b154 Correct instruction to read aarch64 thread pointer 2022-08-25 18:58:45 -06:00
Jeremy Soller 58ceae44e7 ld_so init for aarch64 2022-08-24 20:41:32 -06:00
Jeremy Soller 6591cf699d Set aarch64 tcb 2022-08-24 19:24:26 -06:00
Jeremy Soller c547f9677f Use GS for i686 thread pointer 2022-08-20 21:11:18 -06:00
Jeremy Soller c96b3114ab More fixes for x86 2022-08-20 20:56:42 -06:00
Jeremy Soller 8b629a562b Syntax error 2022-08-20 20:52:19 -06:00
Jeremy Soller a1d0b8fc35 More x86 fixes 2022-08-20 20:51:01 -06: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
4lDO2 1476cdeb8f Split fexec_impl into crate, used by escalated. 2022-07-26 21:34:46 +02:00
4lDO2 a7c817d81a WIP: Support setuid/setgid 2022-07-26 21:33:01 +02:00
4lDO2 2186cd1fbd Implement fexec in userspace. 2022-07-26 21:32:56 +02:00
Jeremy Soller 0bd81aa3d4 Update llvm_asm to asm for aarch64 2022-07-26 11:46:50 -06:00
Jeremy Soller 559387cc64 Initial support for x86 32-bit 2022-07-22 16:24:45 -06:00
4lDO2 ebd597f748 Update dependencies for rust 2022-03-18. 2022-03-24 17:12:02 +01:00
Jeremy Soller 8a2ff1ec4a Only try to set FS on x86_64 2022-02-13 15:05:07 -07:00
Jeremy Soller 824184a66c Make sure strong symbols are preferred by ld_so 2021-12-15 12:05:21 -07:00
Jeremy Soller ecd934951d R_X86_64_TPOFF64 does not require symbol, allow it to be unset 2021-12-14 14:53:16 -07:00
Jeremy Soller dbaeb8f067 Show ld.so expect message 2021-08-10 18:26:09 -06:00
4lDO2 a388b1ae4d Initialize TLS manually on Redox too. 2021-08-05 11:49:40 +02:00
Jeremy Soller b3d71ba8ba Make relibc_panic a weakly linked stub for crt and ld_so objects 2021-08-04 07:20:48 -06:00
Jeremy Soller b472cb87d1 trace ldso path and mmap address 2021-05-10 10:06:55 -06:00
Jeremy Soller 602fd9fe08 Fixes for TCB arch_read on aarch64 2021-04-28 21:29:09 -06:00
Peter Limkilde Svendsen 9e8cd0bf07 Centralize page size info in platform abstraction 2021-03-24 00:02:39 +01:00
Jeremy Soller e24d27a0b3 Use UTF-8 for redox paths 2021-02-14 14:06:52 -07:00
Jeremy Soller a16f535ee8 Merge branch 'aarch64-fixups' into 'master'
aarch64: TLS arch_read implementation

See merge request redox-os/relibc!330
2021-01-18 22:56:49 +00:00
Robin Randhawa 886f467a75 aarch64: TLS arch_read implementation 2021-01-18 22:01:32 +00:00
Mateusz Tabaka 910fb59006 Change ld.so linker script file name for x86_64 Linux to fix compilation issue 2021-01-14 19:50:36 +01:00
Jeremy Soller d94e445ae2 Remove Linux search paths from Redox ld_so 2021-01-11 08:52:57 -07:00
Jeremy Soller 3c1300e8ec Improvements for aarch64 support 2021-01-11 08:52:20 -07:00
Jeremy Soller ccee7eae5f Merge branch 'tlssym' into 'master'
Fix dlsym of TLS variables

See merge request redox-os/relibc!327
2021-01-05 23:03:10 +00:00
Mateusz Tabaka 6497d71d2f Fix dlsym of TLS variables 2021-01-05 22:33:22 +01:00
Mateusz Tabaka 6332828725 Call DSO destructors during exit() 2021-01-05 20:39:36 +01: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
Jeremy Soller 3e49323a3a Merge branch 'dlopen' into 'master'
Add support for dlopen(NULL, ...)

See merge request redox-os/relibc!315
2020-10-02 03:21:42 +00:00
Mateusz Tabaka eee9a80baa Fix tls tests for dynamic linker
* load TLS segment for executable - while we can skip PT_LOAD for executable,
  we still have to load TLS segment.
* set TCB address based on if elf is position independent
2020-10-01 15:45:55 +02:00
Mateusz Tabaka c11aad71b8 Add support for dlopen(NULL, ...) 2020-09-30 11:04:10 +02:00