Terence
Terence

Reputation: 11

Beam file format for "FunT"

We are using Erlang version 22. We rebuild the Beam file multiple times. Inside the Beam file, we found out that the last 4 bytes in "FunT" and before "LitT" are always changing (different between each build). Is there any explanation on how the last 4 bytes are generated? Because of those changing 4 bytes, the checksums of the Beam image are always different build after build.

    00000260: 4675 6e54 0000 001c 0000 0001 0000 0013  FunT............
    00000270: 0000 0001 0000 0011 0000 0000 0000 0001  ................
    00000280: 0432 95c1 4c69 7454 0000 00c3 0000 00f6  .2..LitT........

Upvotes: 1

Views: 112

Answers (1)

legoscia
legoscia

Reputation: 41548

The best reference for the BEAM file format that I know of is this one. Those four bytes are the "old unique" value for each lambda function. It's being generated here, using part of the MD5 sum of the module.

It's odd that this bit would change if nothing else in the module changes. My best guess would be to pass the deterministic option to the compiler and hope that fixes things.

Upvotes: 2

Related Questions