Skip to content

Commit

Permalink
write/elf: add method to reserve null dynamic symbol table entry (#361)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewjcg authored Aug 20, 2021
1 parent 44bf52c commit 9271d2c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/write/elf/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,23 @@ impl<'a> Writer<'a> {
});
}

/// Reserve the null dynamic symbol table entry.
///
/// This will be stored in the `.dynsym` section.
///
/// The null dynamic symbol table entry is usually automatically reserved,
/// but this can be used to force an empty dynamic symbol table.
///
/// This must be called before [`Self::reserve_dynsym`].
pub fn reserve_null_dynamic_symbol_index(&mut self) -> SymbolIndex {
debug_assert_eq!(self.dynsym_offset, 0);
debug_assert_eq!(self.dynsym_num, 0);
self.dynsym_num = 1;
// The symtab must link to a strtab.
self.need_dynstr = true;
SymbolIndex(0)
}

/// Reserve a dynamic symbol table entry.
///
/// This will be stored in the `.dynsym` section.
Expand Down

0 comments on commit 9271d2c

Please sign in to comment.