Commit 10221769 authored by Christopher Grant's avatar Christopher Grant Committed by Commit Bot

Orderfile: Force library re-link by touching a source file.

With partitioned libraries enabled, lib(mono)chrome.so is not the direct
result of a linker operation. Instead the linker creates a combined
library, and then libchrome.so (along with feature libraries) are
extracted to separate .so files in a subsequent step. The result is that
deleting libchrome.so won't necessarily cause the linker to re-run.

To be safe, touch a source file instead. This ensures that the entire
link process runs again, independent of the details.

Bug: None
Change-Id: Iceb6c4838bfbbc98154898c7e9ad8ed8277c63c2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1688958Reviewed-by: default avatarMatthew Cary (CET) <mattcary@chromium.org>
Commit-Queue: Christopher Grant <cjgrant@chromium.org>
Cr-Commit-Position: refs/heads/master@{#675007}
parent bc75ba17
...@@ -317,6 +317,19 @@ class ClankCompiler(object): ...@@ -317,6 +317,19 @@ class ClankCompiler(object):
['ninja', '-C', os.path.join(self._out_dir, 'Release'), ['ninja', '-C', os.path.join(self._out_dir, 'Release'),
'-j' + str(self._jobs), '-l' + str(self._max_load), target]) '-j' + str(self._jobs), '-l' + str(self._max_load), target])
def ForceRelink(self):
"""Forces libchrome.so or libmonochrome.so to be re-linked.
With partitioned libraries enabled, deleting these library files does not
guarantee they'll be recreated by the linker (they may simply be
re-extracted from a combined library). To be safe, touch a source file
instead. See http://crbug.com/972701 for more explanation.
"""
file_to_touch = os.path.join(constants.DIR_SOURCE_ROOT, 'chrome', 'browser',
'chrome_browser_main_android.cc')
assert os.path.exists(file_to_touch)
self._step_recorder.RunCommand(['touch', file_to_touch])
def CompileChromeApk(self, instrumented, use_call_graph, force_relink=False): def CompileChromeApk(self, instrumented, use_call_graph, force_relink=False):
"""Builds a Chrome.apk either with or without order_profiling on. """Builds a Chrome.apk either with or without order_profiling on.
...@@ -326,7 +339,7 @@ class ClankCompiler(object): ...@@ -326,7 +339,7 @@ class ClankCompiler(object):
force_relink: Whether libchromeview.so should be re-created. force_relink: Whether libchromeview.so should be re-created.
""" """
if force_relink: if force_relink:
self._step_recorder.RunCommand(['rm', '-rf', self.lib_chrome_so]) self.ForceRelink()
self.Build(instrumented, use_call_graph, self._apk_target) self.Build(instrumented, use_call_graph, self._apk_target)
def CompileLibchrome(self, instrumented, use_call_graph, force_relink=False): def CompileLibchrome(self, instrumented, use_call_graph, force_relink=False):
...@@ -338,7 +351,7 @@ class ClankCompiler(object): ...@@ -338,7 +351,7 @@ class ClankCompiler(object):
force_relink: (bool) Whether libchrome.so should be re-created. force_relink: (bool) Whether libchrome.so should be re-created.
""" """
if force_relink: if force_relink:
self._step_recorder.RunCommand(['rm', '-rf', self.lib_chrome_so]) self.ForceRelink()
self.Build(instrumented, use_call_graph, self._libchrome_target) self.Build(instrumented, use_call_graph, self._libchrome_target)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment