Fix apelink reproducible deterministic build bug

Thank you @dinosaure for reporting this issue and doing all the analysis
that made this simple and easy to fix. Be sure to check out his projects
like: https://github.com/dinosaure/esperanto, which lets you build OCaml
programs as Actually Portable Executables using cosmocc.

See https://github.com/jart/cosmopolitan/discussions/1265
This commit is contained in:
Justine Tunney 2024-09-05 19:37:51 -07:00
parent 1e9902af8b
commit 41fc76c2b8
No known key found for this signature in database
GPG key ID: BE714B4575D6E328

View file

@ -679,6 +679,8 @@ static void LoadSymbols(Elf64_Ehdr *e, Elf64_Off size, const char *path) {
struct SymbolTable *st = OpenSymbolTable(path);
if (!st)
Die(path, "could not load elf symbol table");
st->names = 0; // make this deterministic
st->name_base = 0; // ready for serialization
size_t data_size;
void *data = Deflate(st, st->size, &data_size);
uint32_t crc = crc32_z(0, st, st->size);