OSDev.org https://forum.osdev.org/ |
|
Rate my object format and ABI https://forum.osdev.org/viewtopic.php?f=15&t=33605 |
Page 1 of 1 |
Author: | Korona [ Sun Mar 24, 2019 2:43 am ] |
Post subject: | Re: Rate my object format and ABI |
Looks mostly good. I did not read the entire relocation process though. Some comments:
EDIT: To demonstrate why the second point is an issue, let's look at the seemingly lightweight gedit application, check how many DSOs it requires and how many relocations need to be done: Code: $ ldd /usr/bin/gedit | wc -l 78 $ ldd /usr/bin/gedit | cut '-d ' -f3 | xargs readelf -r | grep R_X86_64_GLOB_DAT | wc -l # Looking at GLOB_DAT should be enough, although this misses some other relocation types that also refer to symbols. 8745 In the worst case, those 8745 relocations need to be looked up in all 78 DSOs! If DSOs are part of the symbol name, this cost is decreased considerably. |
Author: | Korona [ Sun Mar 24, 2019 9:34 am ] |
Post subject: | Re: Rate my object format and ABI |
If you generate the prologues etc. correctly, __init() should work of course. I think I'd still consider .init_array slightly cleaner as it requires no linker magic or correct order of input files. But that might be mostly personal taste. For the hash function: this StackOverflow post has some comparison. AFAIK Python used FNV in the past with reasonably good results. DJB2 probably offers a good tradeoff between simplicity and quality. SipHash (SSE/AVX implementation by Google) is a high quality hash function while still performing surprisingly good (~3 cycles per byte for 64-byte strings, according to the original paper). However, its resistance against denial-of-service (by producing strings that intentionally hash to the same value) requires storing a key and is not needed in this context. Out of curiosity, how many symbols does your libc contain in this example with 512 buckets? |
Page 1 of 1 | All times are UTC - 6 hours |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |