Skip to content

Fix #23745 - inline: scan local symbols in a deterministic order - #23746

Open
bmwiedemann wants to merge 1 commit into
dlang:masterfrom
bmwiedemann:sort
Open

Fix #23745 - inline: scan local symbols in a deterministic order#23746
bmwiedemann wants to merge 1 commit into
dlang:masterfrom
bmwiedemann:sort

Conversation

@bmwiedemann

Copy link
Copy Markdown

The symbol table iterates in bucket order, which follows the addresses of the Identifier keys and so varies between runs with ASLR. The order matters because inlining one nested function changes the inline cost of the others, so different runs inlined different functions, making builds unreproducible: compiling dmd's own ob.d gave a different .o almost every run.

Sort the symbols by name before visiting them, as dtoh.d already does for module members.

Fixes #23745

Comment thread compiler/src/dmd/inline.d
The symbol table iterates in bucket order, which follows the addresses
of the Identifier keys and so varies between runs with ASLR. The order
matters because inlining one nested function changes the inline cost of
the others, so different runs inlined different functions, making
builds unreproducible: compiling dmd's own ob.d gave a different .o
almost every run.

Sort the symbols by name before visiting them, as dtoh.d already does
for module members.

The dshell test compiles an order-sensitive module ten times and
requires bit-identical objects; without the fix each run gives a
different object file.

Fixes dlang#23745
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dmd reproducible builds

2 participants