Skip to content

Commit 0fd050a

Browse files
authored
Ensure objects within library files are sorted (#15780)
We saw an odd issue recently where clearing the cache and rebuilding generated different result. Looking that the library files I notices that orders of the object files with each library did not match. This change means the order will be fixed regardless of ordering of the files in the directories of the host machine. See #15762
1 parent 3dbfca3 commit 0fd050a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/system_libs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def files_in_path(path, filenames):
3636
def glob_in_path(path, glob_pattern, excludes=()):
3737
srcdir = utils.path_from_root(path)
3838
files = iglob(os.path.join(srcdir, glob_pattern), recursive=True)
39-
return [f for f in files if os.path.basename(f) not in excludes]
39+
return sorted(f for f in files if os.path.basename(f) not in excludes)
4040

4141

4242
def get_base_cflags(force_object_files=False):
@@ -75,6 +75,7 @@ def run_build_commands(commands):
7575
def create_lib(libname, inputs):
7676
"""Create a library from a set of input objects."""
7777
suffix = shared.suffix(libname)
78+
inputs = sorted(inputs, key=lambda x: os.path.basename(x))
7879
if suffix in ('.bc', '.o'):
7980
if len(inputs) == 1:
8081
if inputs[0] != libname:

0 commit comments

Comments
 (0)