Skip to content

Commit

Permalink
[ELF] Support object files with more than 2^19 symbols
Browse files Browse the repository at this point in the history
Previously, Symbol::sym_idx overflows if there are more than 524,288
symbols in a single file. That's a very large number but is not impossible.

Fixes #405
  • Loading branch information
rui314 committed Apr 28, 2022
1 parent a15b73a commit f1f2d40
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions elf/mold.h
Original file line number Diff line number Diff line change
Expand Up @@ -1919,15 +1919,15 @@ class Symbol {
u64 value = 0;

const char *nameptr = nullptr;
u64 namelen : 20 = 0;
i32 namelen = 0;

// Index into the symbol table of the owner file.
i64 sym_idx : 20 = -1;
i32 sym_idx = -1;

// shndx > 0 : symbol is in file's shndx'th section
// shndx == 0 : absolute symbol
// shndx < 0 : symbol is in the -shndx'th output section
i64 shndx : 20 = 0;
i32 shndx = 0;

i32 aux_idx = -1;
u16 ver_idx = 0;
Expand Down

0 comments on commit f1f2d40

Please sign in to comment.