Browse Source

some notes

assembler
Zack Marvel 1 year ago
parent
commit
607818d351
2 changed files with 37 additions and 0 deletions
  1. +27
    -0
      TODO.md
  2. +10
    -0
      notes/elf.md

+ 27
- 0
TODO.md View File

@@ -0,0 +1,27 @@

# TODO

## Assembler

- Relocation sections--I had prototyped an implementation but removed it because
the implementatiof of the symbol table in `ELF` was wrong. There should be a
relocation section for every other section (e.g. ".reltext").
- Lots more directives.
- More instruction types--currently partial support only.

## Testing

There are already lots of test programs and the expected tokenizer output for
each one. For at least a subset of these programs, develop a method for
providing them to the parser as input and checking the resulting AST. Then,
check that the object file produced by the assembler is correct as well.

For the parser, this could mean writing code to load an AST represented by
s-expressions into a tree of `Node`s. The code already exists in
`assembler_test.cpp` to compare ASTs.

For the assembler, I guess this means constructing some ELF files by hand. The
more flexible approach would be to define some notion of equality between two
ELF files so that two sections, each defining the same symbols but in a
different order, are considered "the same." The simpler approach would be a
bytewise comparison of the two files.

+ 10
- 0
notes/elf.md View File

@@ -0,0 +1,10 @@

# ELF files

## Relocation sections

- Relocation sections are tables of relocation entries. These store the offset
of a symbol's data within its section *and* the index of the symbol in its
symbol table.
- The relocation section's header stores the index of the corresponding symbol
table's header in its `sh_link` member.

Loading…
Cancel
Save