Skip to content

Commit

Permalink
SERVER-48348 Do not sort dwo files in ahead of object files during Ni…
Browse files Browse the repository at this point in the history
…nja generation
  • Loading branch information
acmorrow authored and Evergreen Agent committed May 26, 2020
1 parent da5f391 commit 18cbf0d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions site_scons/site_tools/ninja_next.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,16 @@ def generate(self, ninja_file):
# use for the "real" builder and multiple phony targets that
# match the file names of the remaining outputs. This way any
# build can depend on any output from any build.
build["outputs"].sort()
#
# We assume that the first listed output is the 'key'
# output and is stably presented to us by SCons. For
# instance if -gsplit-dwarf is in play and we are
# producing foo.o and foo.dwo, we expect that outputs[0]
# from SCons will be the foo.o file and not the dwo
# file. If instead we just sorted the whole outputs array,
# we would find that the dwo file becomes the
# first_output, and this breaks, for instance, header
# dependency scanning.
if rule is not None and (rule.get("deps") or rule.get("rspfile")):
first_output, remaining_outputs = (
build["outputs"][0],
Expand All @@ -659,7 +668,7 @@ def generate(self, ninja_file):

if remaining_outputs:
ninja.build(
outputs=remaining_outputs, rule="phony", implicit=first_output,
outputs=sorted(remaining_outputs), rule="phony", implicit=first_output,
)

build["outputs"] = first_output
Expand Down

0 comments on commit 18cbf0d

Please sign in to comment.