Skip to content

Commit c040578

Browse files
authoredJan 2, 2025··
Always enable deterministic_paths (#23256)
This removes `deterministic_paths` option by turning it on all the time, in order to produce reproducible builds, both for `__FILE__` macro and debug info paths. This is an alternative to #23212, which did not remove `deterministic_paths` but always set only `-fmacro-prefix-map` on. This PR is what was suggested in #23195 (comment) and #23212 (comment). Fixes #23195.
1 parent a7dc5cd commit c040578

6 files changed

+11
-14
lines changed
 

‎embuilder.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def main():
293293
if USE_NINJA:
294294
library.generate()
295295
else:
296-
library.build(deterministic_paths=True)
296+
library.build()
297297
elif what == 'sysroot':
298298
if do_clear:
299299
cache.erase_file('sysroot_install.stamp')
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
170928
1+
170950
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
142143
1+
142154
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
144730
1+
144741
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
232437
1+
232468

‎tools/system_libs.py

+6-9
Original file line numberDiff line numberDiff line change
@@ -422,17 +422,15 @@ def erase(self):
422422
def get_path(self, absolute=False):
423423
return cache.get_lib_name(self.get_filename(), absolute=absolute)
424424

425-
def build(self, deterministic_paths=False):
425+
def build(self):
426426
"""
427427
Gets the cached path of this library.
428428
429429
This will trigger a build if this library is not in the cache.
430430
"""
431-
self.deterministic_paths = deterministic_paths
432431
return cache.get(self.get_path(), self.do_build, force=USE_NINJA == 2, quiet=USE_NINJA)
433432

434433
def generate(self):
435-
self.deterministic_paths = False
436434
return cache.get(self.get_path(), self.do_generate, force=USE_NINJA == 2, quiet=USE_NINJA,
437435
deferred=True)
438436

@@ -600,12 +598,11 @@ def get_cflags(self):
600598
if self.includes:
601599
cflags += ['-I' + utils.path_from_root(i) for i in self._inherit_list('includes')]
602600

603-
if self.deterministic_paths:
604-
source_dir = utils.path_from_root()
605-
relative_source_dir = os.path.relpath(source_dir, self.build_dir)
606-
cflags += [f'-ffile-prefix-map={relative_source_dir}={DETERMINISITIC_PREFIX}']
607-
cflags += [f'-ffile-prefix-map={source_dir}={DETERMINISITIC_PREFIX}',
608-
f'-fdebug-compilation-dir={DETERMINISITIC_PREFIX}']
601+
source_dir = utils.path_from_root()
602+
relative_source_dir = os.path.relpath(source_dir, self.build_dir)
603+
cflags += [f'-ffile-prefix-map={source_dir}={DETERMINISITIC_PREFIX}',
604+
f'-ffile-prefix-map={relative_source_dir}={DETERMINISITIC_PREFIX}',
605+
f'-fdebug-compilation-dir={DETERMINISITIC_PREFIX}']
609606
return cflags
610607

611608
def get_base_name_prefix(self):

0 commit comments

Comments
 (0)
Please sign in to comment.