File tree 2 files changed +18
-0
lines changed
2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -215,6 +215,7 @@ impl<'a> Object<'a> {
215
215
216
216
// Calculate index of symbols and add symbol strings to strtab.
217
217
let mut symbol_offsets = vec ! [ SymbolOffsets :: default ( ) ; self . symbols. len( ) ] ;
218
+ writer. reserve_null_symbol_index ( ) ;
218
219
// Local symbols must come before global.
219
220
for ( index, symbol) in self . symbols . iter ( ) . enumerate ( ) {
220
221
if symbol. is_local ( ) {
Original file line number Diff line number Diff line change @@ -699,6 +699,23 @@ impl<'a> Writer<'a> {
699
699
} ) ;
700
700
}
701
701
702
+ /// Reserve the null symbol table entry.
703
+ ///
704
+ /// This will be stored in the `.symtab` section.
705
+ ///
706
+ /// The null symbol table entry is usually automatically reserved,
707
+ /// but this can be used to force an empty symbol table.
708
+ ///
709
+ /// This must be called before [`Self::reserve_symtab`].
710
+ pub fn reserve_null_symbol_index ( & mut self ) -> SymbolIndex {
711
+ debug_assert_eq ! ( self . symtab_offset, 0 ) ;
712
+ debug_assert_eq ! ( self . symtab_num, 0 ) ;
713
+ self . symtab_num = 1 ;
714
+ // The symtab must link to a strtab.
715
+ self . need_strtab = true ;
716
+ SymbolIndex ( 0 )
717
+ }
718
+
702
719
/// Reserve a symbol table entry.
703
720
///
704
721
/// This will be stored in the `.symtab` section.
You can’t perform that action at this time.
0 commit comments