From 64a7a67f0099c656f74ec53083c77674228379fa Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Sat, 5 Oct 2024 10:16:45 -0400 Subject: update mld comments --- mld/link.h | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'mld/link.h') diff --git a/mld/link.h b/mld/link.h index 3c9ca42..ef3a4af 100644 --- a/mld/link.h +++ b/mld/link.h @@ -92,11 +92,6 @@ struct symbol_table { struct symbol_table_mapping *map; }; -/// -/// symbol table map -/// (metadata for each symbol) -/// - int symtab_init(struct symbol_table *symtab); void symtab_free(struct symbol_table *symtab); @@ -104,6 +99,13 @@ int symtab_push(struct symbol_table *symtab, const Elf32_Sym *sym); int symtab_get(struct symbol_table *symtab, Elf32_Sym **sym, const char *name, int32_t obj_idx); +/// +/// symbol table map +/// (metadata for each symbol) +/// stores each object that a symbol +/// is in +/// + struct symbol_table_mapping { uint32_t len; uint32_t size; @@ -163,6 +165,9 @@ int segment_load(struct object *object, struct segment *segment, size_t index); /// /// segment table +/// holds each segment that +/// share the same name +/// (i.e. all .text segments) /// struct segment_table_entry { @@ -172,6 +177,7 @@ struct segment_table_entry { uint32_t off; uint32_t vaddr; // weak segment pointers. we do not own these!!! + // (but we own the array) struct segment **parts; }; @@ -181,9 +187,10 @@ void segtab_ent_free(struct segment_table_entry *ent); int segtab_ent_push(struct segment_table_entry *ent, struct segment *seg); uint32_t segtab_ent_size(struct segment_table_entry *ent); -// holds each segment by name -// and all the segment parts from each of the -// object files +/// +/// segment table +/// holds each segment table entry by name +/// struct segment_table { uint32_t len; uint32_t size; @@ -215,14 +222,16 @@ struct object { Elf32_Ehdr *ehdr; // section header table - Elf32_Shdr *shdr; + Elf32_Shdr *shdr; // weak size_t shdr_len; // program table - Elf32_Phdr *phdr; + Elf32_Phdr *phdr; // owned size_t phdr_len; // phdr <=> shdr mappings + // need a way to find any assoiciated + // phdr with a shdr, and also reverse uint32_t *phdr_to_shdr_mapping; // object meta -- cgit v1.2.3-freya