Commit Graph

10 Commits

Author SHA1 Message Date
Anhad Singh b69672cf80 misc(.gitignore): add .vscode
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2026-02-13 22:00:20 +11:00
4lDO2 b9f19f4326 Get pcid to work using this pthread impl. 2023-05-06 17:02:51 +02: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
Ahmed Abd El Mawgood 40328a0d09 Modify ld_script so that it works on linux.
Honestly, I have no idea why are these modifications needed, but it
seams they are needed
2020-08-12 10:19:32 +00:00
Jeremy Soller 59653ee290 Support use of new cross compiler 2019-03-16 20:16:00 -06:00
Jeremy Soller 82b9715f41 Fix makefile for tests, add sysroot target 2018-08-27 13:02:13 -06:00
jD91mZM2 e9484e4d60 Ignore *all* target directories 2018-07-22 10:21:14 +02:00
Timothy Bess f60fafe8fb * create basic strtok
* add test and expected output
2018-03-17 02:58:08 -04:00
Jeremy Soller 78e421cb72 Implement some functions on Linux 2018-03-03 14:31:28 -07:00
Jeremy Soller a01ff6baf8 Add overarching staticlib 2018-03-03 08:44:18 -07:00