Skip to content

Commit 6864166

Browse files
mi-acCommit Bot
authored andcommitted
[build] Always keep gold plugin in sync with clang version
The old logic made the cfi build fail on each clang update. Bug: chromium:726584 Change-Id: Ia24181d3bc92eb18116c2ac2b42ac2c68f02ce25 Reviewed-on: https://chromium-review.googlesource.com/518185 Reviewed-by: Jochen Eisinger <jochen@chromium.org> Commit-Queue: Michael Achenbach <machenbach@chromium.org> Cr-Commit-Position: refs/heads/master@{#45601}
1 parent a402dd6 commit 6864166

3 files changed

Lines changed: 21 additions & 18 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
/base
3737
/build
3838
/buildtools
39+
/gypfiles/.gold_plugin
3940
/gypfiles/win_toolchain.json
4041
/hydrogen.cfg
4142
/obj

DEPS

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -262,20 +262,19 @@ hooks = [
262262
'v8/third_party/binutils/download.py',
263263
],
264264
},
265-
{
266-
# Pull gold plugin if needed or requested via GYP_DEFINES.
267-
# Note: This must run before the clang update.
268-
'name': 'gold_plugin',
269-
'pattern': '.',
270-
'action': ['python', 'v8/gypfiles/download_gold_plugin.py'],
271-
},
272265
{
273266
# Pull clang if needed or requested via GYP_DEFINES.
274267
# Note: On Win, this should run after win_toolchain, as it may use it.
275268
'name': 'clang',
276269
'pattern': '.',
277270
'action': ['python', 'v8/tools/clang/scripts/update.py', '--if-needed'],
278271
},
272+
{
273+
# Pull gold plugin if needed or requested via GYP_DEFINES.
274+
'name': 'gold_plugin',
275+
'pattern': '.',
276+
'action': ['python', 'v8/gypfiles/download_gold_plugin.py'],
277+
},
279278
{
280279
# A change to a .gyp, .gypi, or to GYP itself should run the generator.
281280
"pattern": ".",

gypfiles/download_gold_plugin.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,25 +41,25 @@
4141

4242
GOLD_PLUGIN_PATH = os.path.join(LLVM_BUILD_PATH, 'lib', 'LLVMgold.so')
4343

44-
sys.path.insert(0, os.path.join(CHROME_SRC, 'tools', 'clang', 'scripts'))
45-
46-
import update
44+
GOLD_PLUGIN_VERSION_FILE = os.path.join(CHROME_SRC, 'gypfiles', '.gold_plugin')
4745

4846
def main():
4947
if not re.search(r'cfi_vptr=1', os.environ.get('GYP_DEFINES', '')):
5048
# Bailout if this is not a cfi build.
5149
print 'Skipping gold plugin download for non-cfi build.'
5250
return 0
53-
if (os.path.exists(GOLD_PLUGIN_PATH) and
54-
update.ReadStampFile().strip() == update.PACKAGE_VERSION):
55-
# Bailout if clang is up-to-date. This requires the script to be run before
56-
# the clang update step! I.e. afterwards clang would always be up-to-date.
57-
print 'Skipping gold plugin download. File present and clang up to date.'
51+
previous_version = ''
52+
if os.path.exists(GOLD_PLUGIN_VERSION_FILE):
53+
with open(GOLD_PLUGIN_VERSION_FILE) as f:
54+
previous_version = f.read().strip()
55+
if (os.path.exists(GOLD_PLUGIN_PATH) and previous_version == CLANG_REVISION):
56+
# Bailout if gold plugin is up-to-date. This requires the script to be run
57+
# after the clang update step.
58+
print 'Skipping gold plugin download (up to date).'
5859
return 0
5960

60-
# Make sure this works on empty checkouts (i.e. clang not downloaded yet).
61-
if not os.path.exists(LLVM_BUILD_PATH):
62-
os.makedirs(LLVM_BUILD_PATH)
61+
# Make sure clang has been downloaded already.
62+
assert os.path.exists(LLVM_BUILD_PATH)
6363

6464
targz_name = 'llvmgold-%s.tgz' % CLANG_REVISION
6565
remote_path = '%s/%s' % (CLANG_BUCKET, targz_name)
@@ -75,6 +75,9 @@ def main():
7575
stderr=open('/dev/null', 'w'))
7676
subprocess.check_call(['tar', 'xzf', targz_name])
7777
os.remove(targz_name)
78+
79+
with open(GOLD_PLUGIN_VERSION_FILE, 'w') as f:
80+
f.write(CLANG_REVISION)
7881
return 0
7982

8083
if __name__ == '__main__':

0 commit comments

Comments
 (0)