From 65dc7cd4ce402608dbdd91ab63d2b0d2d7b5f5e8 Mon Sep 17 00:00:00 2001 From: Pietra Ferreira Date: Mon, 6 Nov 2023 12:32:03 -0300 Subject: [PATCH] vault backup: 2023-11-06 12:32:03 Affected files: content/2023-11-03.md --- content/2023-11-03.md | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/content/2023-11-03.md b/content/2023-11-03.md index 5942e28caa48..b0fdf56f09a3 100644 --- a/content/2023-11-03.md +++ b/content/2023-11-03.md @@ -36,6 +36,8 @@ In the `perform_relocation` function (`elfnn-riscv.c`), we introduce a variable We then check the accompanying relocation and its value (ID) in `R_RISCV_CVPCREL_UI12` (`elfnn-riscv.c`): ```c +// add reloc def +// vendor generic case R_RISCV_CVPCREL_UI12: if (next_reloc != R_RISCV_RELOCID) abort(); @@ -59,7 +61,7 @@ In the case of `0x100`, we handle it as follows: break; ``` -\newpage +how to do the numbering in a explainable way? how to standardise it? ## Challenges and Next Steps The main challenge in this project is handling the `howto` table. @@ -83,6 +85,8 @@ if (type == R_RISCV_CALL The next step involves exploring the `howto` table entry for the set ID, but there is a limitation in writing additional `howto` table entries as the IDs overlap with existing ones. To address this, a secondary `howto` table has been introduced. +NOTES: reloc + 64 * vendor id (inefficient), stick it in a map of some sort? + ```c /* Prototype not currently being used, relates to RELOCID */ static reloc_howto_type SECONDARYhowto_table[] = { @@ -166,7 +170,7 @@ riscv_elf_custom_relocid (bfd *abfd, } ``` - +NOTE: put it in the WIKI for vendor specific relocation! ## Commands - Test case: @@ -484,4 +488,18 @@ if [ $? -ne 0 ]; then fi echo "Build completed successfully." -``` \ No newline at end of file +``` + +## REL vs RELA + +if you have a function call, the target of you relocation is some symbol + +now in ELF files, there are two ways of encoding that + +either: asymbol, index into the symbol table (rel) + +asymbol table + offset (rela) (a for addend) + +mostly everyone uses rela because they are more flexible and you end up with a smaller symbol table. + +fuschia is google's new micro kernel for stuff, at some point could replace linux. it needs to work with both rela and rel. make sure to note it supports only rela relocation, and note how to support rel. \ No newline at end of file