Skip to content

Commit

Permalink
vault backup: 2023-11-06 12:32:03
Browse files Browse the repository at this point in the history
Affected files:
content/2023-11-03.md
  • Loading branch information
pietraferreira committed Nov 6, 2023
1 parent 27246c8 commit 65dc7cd
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions content/2023-11-03.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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.

Expand All @@ -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[] = {
Expand Down Expand Up @@ -166,7 +170,7 @@ riscv_elf_custom_relocid (bfd *abfd,
}
```
NOTE: put it in the WIKI for vendor specific relocation!
## Commands
- Test case:
Expand Down Expand Up @@ -484,4 +488,18 @@ if [ $? -ne 0 ]; then
fi
echo "Build completed successfully."
```
```
## 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.

0 comments on commit 65dc7cd

Please sign in to comment.