summaryrefslogtreecommitdiff
path: root/chromium/tools/clang
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-08-30 10:22:43 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-08-30 12:36:28 +0000
commit271a6c3487a14599023a9106329505597638d793 (patch)
treee040d58ffc86c1480b79ca8528020ca9ec919bf8 /chromium/tools/clang
parent7b2ffa587235a47d4094787d72f38102089f402a (diff)
downloadqtwebengine-chromium-271a6c3487a14599023a9106329505597638d793.tar.gz
BASELINE: Update Chromium to 77.0.3865.59
Change-Id: I1e89a5f3b009a9519a6705102ad65c92fe736f21 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/tools/clang')
-rw-r--r--chromium/tools/clang/OWNERS1
-rw-r--r--chromium/tools/clang/blink_gc_plugin/BlinkGCPluginConsumer.cpp2
-rw-r--r--chromium/tools/clang/blink_gc_plugin/CheckFinalizerVisitor.cpp46
-rw-r--r--chromium/tools/clang/blink_gc_plugin/CheckFinalizerVisitor.h8
-rw-r--r--chromium/tools/clang/blink_gc_plugin/Config.cpp1
-rw-r--r--chromium/tools/clang/blink_gc_plugin/Config.h1
-rw-r--r--chromium/tools/clang/blink_gc_plugin/DiagnosticsReporter.cpp22
-rw-r--r--chromium/tools/clang/blink_gc_plugin/DiagnosticsReporter.h2
-rw-r--r--chromium/tools/clang/blink_gc_plugin/RecordInfo.cpp20
-rw-r--r--chromium/tools/clang/blink_gc_plugin/RecordInfo.h2
-rwxr-xr-xchromium/tools/clang/scripts/build.py254
-rwxr-xr-xchromium/tools/clang/scripts/package.py39
-rwxr-xr-xchromium/tools/clang/scripts/update.py37
-rw-r--r--chromium/tools/clang/stack_maps/OWNERS4
-rw-r--r--chromium/tools/clang/stack_maps/README4
15 files changed, 284 insertions, 159 deletions
diff --git a/chromium/tools/clang/OWNERS b/chromium/tools/clang/OWNERS
index 0da75e8fd25..9601fa4cfbc 100644
--- a/chromium/tools/clang/OWNERS
+++ b/chromium/tools/clang/OWNERS
@@ -1,4 +1,5 @@
hans@chromium.org
+inglorion@chromium.org
pcc@chromium.org
thakis@chromium.org
rnk@chromium.org
diff --git a/chromium/tools/clang/blink_gc_plugin/BlinkGCPluginConsumer.cpp b/chromium/tools/clang/blink_gc_plugin/BlinkGCPluginConsumer.cpp
index 3df46a3c413..7069f89ad51 100644
--- a/chromium/tools/clang/blink_gc_plugin/BlinkGCPluginConsumer.cpp
+++ b/chromium/tools/clang/blink_gc_plugin/BlinkGCPluginConsumer.cpp
@@ -425,7 +425,7 @@ void BlinkGCPluginConsumer::CheckFinalization(RecordInfo* info) {
// For finalized classes, check the finalization method if possible.
if (info->IsGCFinalized()) {
if (dtor && dtor->hasBody()) {
- CheckFinalizerVisitor visitor(&cache_, info->IsEagerlyFinalized());
+ CheckFinalizerVisitor visitor(&cache_);
visitor.TraverseCXXMethodDecl(dtor);
if (!visitor.finalized_fields().empty()) {
reporter_.FinalizerAccessesFinalizedFields(
diff --git a/chromium/tools/clang/blink_gc_plugin/CheckFinalizerVisitor.cpp b/chromium/tools/clang/blink_gc_plugin/CheckFinalizerVisitor.cpp
index 699b740e247..b435b00c7e5 100644
--- a/chromium/tools/clang/blink_gc_plugin/CheckFinalizerVisitor.cpp
+++ b/chromium/tools/clang/blink_gc_plugin/CheckFinalizerVisitor.cpp
@@ -12,50 +12,25 @@ namespace {
// during finalization.
class MightBeCollectedVisitor : public EdgeVisitor {
public:
- explicit MightBeCollectedVisitor(bool is_eagerly_finalized);
-
bool might_be_collected() const;
- bool as_eagerly_finalized() const;
void VisitMember(Member* edge) override;
void VisitCollection(Collection* edge) override;
private:
- bool might_be_collected_;
- bool is_eagerly_finalized_;
- bool as_eagerly_finalized_;
+ bool might_be_collected_ = false;
};
-MightBeCollectedVisitor::MightBeCollectedVisitor(bool is_eagerly_finalized)
- : might_be_collected_(false),
- is_eagerly_finalized_(is_eagerly_finalized),
- as_eagerly_finalized_(false) {
-}
-
bool MightBeCollectedVisitor::might_be_collected() const {
return might_be_collected_;
}
-bool MightBeCollectedVisitor::as_eagerly_finalized() const {
- return as_eagerly_finalized_;
-}
-
void MightBeCollectedVisitor::VisitMember(Member* edge) {
- if (is_eagerly_finalized_) {
- if (edge->ptr()->IsValue()) {
- Value* member = static_cast<Value*>(edge->ptr());
- if (member->value()->IsEagerlyFinalized()) {
- might_be_collected_ = true;
- as_eagerly_finalized_ = true;
- }
- }
- return;
- }
might_be_collected_ = true;
}
void MightBeCollectedVisitor::VisitCollection(Collection* edge) {
- if (edge->on_heap() && !is_eagerly_finalized_) {
+ if (edge->on_heap()) {
might_be_collected_ = true;
} else {
edge->AcceptMembers(this);
@@ -64,11 +39,9 @@ void MightBeCollectedVisitor::VisitCollection(Collection* edge) {
} // namespace
-CheckFinalizerVisitor::CheckFinalizerVisitor(RecordCache* cache,
- bool is_eagerly_finalized)
+CheckFinalizerVisitor::CheckFinalizerVisitor(RecordCache* cache)
: blacklist_context_(false),
- cache_(cache),
- is_eagerly_finalized_(is_eagerly_finalized) {
+ cache_(cache) {
}
CheckFinalizerVisitor::Errors& CheckFinalizerVisitor::finalized_fields() {
@@ -114,20 +87,17 @@ bool CheckFinalizerVisitor::VisitMemberExpr(MemberExpr* member) {
if (seen_members_.find(member) != seen_members_.end())
return true;
- bool as_eagerly_finalized = false;
if (blacklist_context_ &&
- MightBeCollected(&it->second, &as_eagerly_finalized)) {
+ MightBeCollected(&it->second)) {
finalized_fields_.push_back(
- Error(member, as_eagerly_finalized, &it->second));
+ Error(member, &it->second));
seen_members_.insert(member);
}
return true;
}
-bool CheckFinalizerVisitor::MightBeCollected(FieldPoint* point,
- bool* as_eagerly_finalized) {
- MightBeCollectedVisitor visitor(is_eagerly_finalized_);
+bool CheckFinalizerVisitor::MightBeCollected(FieldPoint* point) {
+ MightBeCollectedVisitor visitor;
point->edge()->Accept(&visitor);
- *as_eagerly_finalized = visitor.as_eagerly_finalized();
return visitor.might_be_collected();
}
diff --git a/chromium/tools/clang/blink_gc_plugin/CheckFinalizerVisitor.h b/chromium/tools/clang/blink_gc_plugin/CheckFinalizerVisitor.h
index f926a0d14b0..74dfb1f1ca1 100644
--- a/chromium/tools/clang/blink_gc_plugin/CheckFinalizerVisitor.h
+++ b/chromium/tools/clang/blink_gc_plugin/CheckFinalizerVisitor.h
@@ -22,20 +22,17 @@ class CheckFinalizerVisitor
public:
struct Error {
Error(clang::MemberExpr* member,
- bool as_eagerly_finalized,
FieldPoint* field)
: member(member),
- as_eagerly_finalized(as_eagerly_finalized),
field(field) {}
clang::MemberExpr* member;
- bool as_eagerly_finalized;
FieldPoint* field;
};
typedef std::vector<Error> Errors;
- CheckFinalizerVisitor(RecordCache* cache, bool is_eagerly_finalized);
+ explicit CheckFinalizerVisitor(RecordCache* cache);
Errors& finalized_fields();
@@ -45,13 +42,12 @@ class CheckFinalizerVisitor
bool VisitMemberExpr(clang::MemberExpr* member);
private:
- bool MightBeCollected(FieldPoint* point, bool* as_eagerly_finalized);
+ bool MightBeCollected(FieldPoint* point);
bool blacklist_context_;
Errors finalized_fields_;
std::set<clang::MemberExpr*> seen_members_;
RecordCache* cache_;
- bool is_eagerly_finalized_;
};
#endif // TOOLS_BLINK_GC_PLUGIN_CHECK_FINALIZER_VISITOR_H_
diff --git a/chromium/tools/clang/blink_gc_plugin/Config.cpp b/chromium/tools/clang/blink_gc_plugin/Config.cpp
index df8867a9b29..f2206660d70 100644
--- a/chromium/tools/clang/blink_gc_plugin/Config.cpp
+++ b/chromium/tools/clang/blink_gc_plugin/Config.cpp
@@ -22,7 +22,6 @@ const char kVisitorDispatcherName[] = "VisitorDispatcher";
const char kVisitorVarName[] = "visitor";
const char kAdjustAndMarkName[] = "AdjustAndMark";
const char kIsHeapObjectAliveName[] = "IsHeapObjectAlive";
-const char kIsEagerlyFinalizedName[] = "IsEagerlyFinalizedMarker";
const char kConstIteratorName[] = "const_iterator";
const char kIteratorName[] = "iterator";
const char kConstReverseIteratorName[] = "const_reverse_iterator";
diff --git a/chromium/tools/clang/blink_gc_plugin/Config.h b/chromium/tools/clang/blink_gc_plugin/Config.h
index f60594a5220..8aa85779f9b 100644
--- a/chromium/tools/clang/blink_gc_plugin/Config.h
+++ b/chromium/tools/clang/blink_gc_plugin/Config.h
@@ -29,7 +29,6 @@ extern const char kVisitorDispatcherName[];
extern const char kVisitorVarName[];
extern const char kAdjustAndMarkName[];
extern const char kIsHeapObjectAliveName[];
-extern const char kIsEagerlyFinalizedName[];
extern const char kConstIteratorName[];
extern const char kIteratorName[];
extern const char kConstReverseIteratorName[];
diff --git a/chromium/tools/clang/blink_gc_plugin/DiagnosticsReporter.cpp b/chromium/tools/clang/blink_gc_plugin/DiagnosticsReporter.cpp
index 1fa70aa7693..a1f9e08fada 100644
--- a/chromium/tools/clang/blink_gc_plugin/DiagnosticsReporter.cpp
+++ b/chromium/tools/clang/blink_gc_plugin/DiagnosticsReporter.cpp
@@ -49,9 +49,6 @@ const char kClassDoesNotRequireFinalization[] =
const char kFinalizerAccessesFinalizedField[] =
"[blink-gc] Finalizer %0 accesses potentially finalized field %1.";
-const char kFinalizerAccessesEagerlyFinalizedField[] =
- "[blink-gc] Finalizer %0 accesses eagerly finalized field %1.";
-
const char kRawPtrToGCManagedClassNote[] =
"[blink-gc] Raw pointer field %0 to a GC managed class declared here:";
@@ -108,9 +105,6 @@ const char kMissingFinalizeDispatch[] =
const char kFinalizedFieldNote[] =
"[blink-gc] Potentially finalized field %0 declared here:";
-const char kEagerlyFinalizedFieldNote[] =
- "[blink-gc] Field %0 having eagerly finalized value, declared here:";
-
const char kUserDeclaredDestructorNote[] =
"[blink-gc] User-declared destructor declared here:";
@@ -204,8 +198,6 @@ DiagnosticsReporter::DiagnosticsReporter(
DiagnosticsEngine::Warning, kClassDoesNotRequireFinalization);
diag_finalizer_accesses_finalized_field_ = diagnostic_.getCustomDiagID(
getErrorLevel(), kFinalizerAccessesFinalizedField);
- diag_finalizer_eagerly_finalized_field_ = diagnostic_.getCustomDiagID(
- getErrorLevel(), kFinalizerAccessesEagerlyFinalizedField);
diag_overridden_non_virtual_trace_ = diagnostic_.getCustomDiagID(
getErrorLevel(), kOverriddenNonVirtualTrace);
diag_missing_trace_dispatch_method_ = diagnostic_.getCustomDiagID(
@@ -262,8 +254,6 @@ DiagnosticsReporter::DiagnosticsReporter(
DiagnosticsEngine::Note, kFieldContainsGCRootNote);
diag_finalized_field_note_ = diagnostic_.getCustomDiagID(
DiagnosticsEngine::Note, kFinalizedFieldNote);
- diag_eagerly_finalized_field_note_ = diagnostic_.getCustomDiagID(
- DiagnosticsEngine::Note, kEagerlyFinalizedFieldNote);
diag_user_declared_destructor_note_ = diagnostic_.getCustomDiagID(
DiagnosticsEngine::Note, kUserDeclaredDestructorNote);
diag_user_declared_finalizer_note_ = diagnostic_.getCustomDiagID(
@@ -404,16 +394,10 @@ void DiagnosticsReporter::FinalizerAccessesFinalizedFields(
CXXMethodDecl* dtor,
const CheckFinalizerVisitor::Errors& errors) {
for (auto& error : errors) {
- bool as_eagerly_finalized = error.as_eagerly_finalized;
- unsigned diag_error = as_eagerly_finalized ?
- diag_finalizer_eagerly_finalized_field_ :
- diag_finalizer_accesses_finalized_field_;
- unsigned diag_note = as_eagerly_finalized ?
- diag_eagerly_finalized_field_note_ :
- diag_finalized_field_note_;
- ReportDiagnostic(error.member->getBeginLoc(), diag_error)
+ ReportDiagnostic(error.member->getBeginLoc(),
+ diag_finalizer_accesses_finalized_field_)
<< dtor << error.field->field();
- NoteField(error.field, diag_note);
+ NoteField(error.field, diag_finalized_field_note_);
}
}
diff --git a/chromium/tools/clang/blink_gc_plugin/DiagnosticsReporter.h b/chromium/tools/clang/blink_gc_plugin/DiagnosticsReporter.h
index 2d8b0c7ade1..b4e96d298d5 100644
--- a/chromium/tools/clang/blink_gc_plugin/DiagnosticsReporter.h
+++ b/chromium/tools/clang/blink_gc_plugin/DiagnosticsReporter.h
@@ -114,7 +114,6 @@ class DiagnosticsReporter {
unsigned diag_class_requires_finalization_;
unsigned diag_class_does_not_require_finalization_;
unsigned diag_finalizer_accesses_finalized_field_;
- unsigned diag_finalizer_eagerly_finalized_field_;
unsigned diag_overridden_non_virtual_trace_;
unsigned diag_missing_trace_dispatch_method_;
unsigned diag_missing_finalize_dispatch_method_;
@@ -142,7 +141,6 @@ class DiagnosticsReporter {
unsigned diag_part_object_contains_gc_root_note_;
unsigned diag_field_contains_gc_root_note_;
unsigned diag_finalized_field_note_;
- unsigned diag_eagerly_finalized_field_note_;
unsigned diag_user_declared_destructor_note_;
unsigned diag_user_declared_finalizer_note_;
unsigned diag_base_requires_finalization_note_;
diff --git a/chromium/tools/clang/blink_gc_plugin/RecordInfo.cpp b/chromium/tools/clang/blink_gc_plugin/RecordInfo.cpp
index b86bb37aa74..487aa99f343 100644
--- a/chromium/tools/clang/blink_gc_plugin/RecordInfo.cpp
+++ b/chromium/tools/clang/blink_gc_plugin/RecordInfo.cpp
@@ -22,7 +22,6 @@ RecordInfo::RecordInfo(CXXRecordDecl* record, RecordCache* cache)
does_need_finalization_(kNotComputed),
has_gc_mixin_methods_(kNotComputed),
is_declaring_local_trace_(kNotComputed),
- is_eagerly_finalized_(kNotComputed),
determined_trace_methods_(false),
trace_method_(0),
trace_dispatch_method_(0),
@@ -198,25 +197,6 @@ bool RecordInfo::IsGCAllocated() {
return IsGCDerived() || IsHeapAllocatedCollection();
}
-bool RecordInfo::IsEagerlyFinalized() {
- if (is_eagerly_finalized_ != kNotComputed)
- return is_eagerly_finalized_;
-
- is_eagerly_finalized_ = kFalse;
- if (!IsGCFinalized())
- return is_eagerly_finalized_;
-
- for (Decl* decl : record_->decls()) {
- if (TypedefDecl* typedef_decl = dyn_cast<TypedefDecl>(decl)) {
- if (typedef_decl->getNameAsString() != kIsEagerlyFinalizedName)
- continue;
- is_eagerly_finalized_ = kTrue;
- break;
- }
- }
- return is_eagerly_finalized_;
-}
-
bool RecordInfo::HasDefinition() {
return record_->hasDefinition();
}
diff --git a/chromium/tools/clang/blink_gc_plugin/RecordInfo.h b/chromium/tools/clang/blink_gc_plugin/RecordInfo.h
index ec510f38680..6f1c31be482 100644
--- a/chromium/tools/clang/blink_gc_plugin/RecordInfo.h
+++ b/chromium/tools/clang/blink_gc_plugin/RecordInfo.h
@@ -103,7 +103,6 @@ class RecordInfo {
bool IsStackAllocated();
bool IsNonNewable();
bool IsOnlyPlacementNewable();
- bool IsEagerlyFinalized();
bool HasDefinition();
@@ -148,7 +147,6 @@ class RecordInfo {
CachedBool does_need_finalization_;
CachedBool has_gc_mixin_methods_;
CachedBool is_declaring_local_trace_;
- CachedBool is_eagerly_finalized_;
bool determined_trace_methods_;
clang::CXXMethodDecl* trace_method_;
diff --git a/chromium/tools/clang/scripts/build.py b/chromium/tools/clang/scripts/build.py
index 7849efd0cc1..4637e56d80d 100755
--- a/chromium/tools/clang/scripts/build.py
+++ b/chromium/tools/clang/scripts/build.py
@@ -24,9 +24,9 @@ import sys
from update import (CDS_URL, CHROMIUM_DIR, CLANG_REVISION, LLVM_BUILD_DIR,
FORCE_HEAD_REVISION_FILE, PACKAGE_VERSION, RELEASE_VERSION,
- STAMP_FILE, CopyFile, CopyDiaDllTo, DownloadAndUnpack,
- EnsureDirExists, GetWinSDKDir, ReadStampFile, RmTree,
- WriteStampFile)
+ STAMP_FILE, CopyFile, CopyDiaDllTo, DownloadUrl,
+ DownloadAndUnpack, EnsureDirExists, GetWinSDKDir,
+ ReadStampFile, RmTree, WriteStampFile)
# Path constants. (All of these should be absolute paths.)
@@ -36,6 +36,8 @@ COMPILER_RT_DIR = os.path.join(LLVM_DIR, 'compiler-rt')
LLVM_BOOTSTRAP_DIR = os.path.join(THIRD_PARTY_DIR, 'llvm-bootstrap')
LLVM_BOOTSTRAP_INSTALL_DIR = os.path.join(THIRD_PARTY_DIR,
'llvm-bootstrap-install')
+LLVM_INSTRUMENTED_DIR = os.path.join(THIRD_PARTY_DIR, 'llvm-instrumented')
+LLVM_PROFDATA_FILE = os.path.join(LLVM_INSTRUMENTED_DIR, 'profdata.prof')
CHROME_TOOLS_SHIM_DIR = os.path.join(LLVM_DIR, 'llvm', 'tools', 'chrometools')
THREADS_ENABLED_BUILD_DIR = os.path.join(THIRD_PARTY_DIR,
'llvm-threads-enabled')
@@ -47,7 +49,8 @@ ANDROID_NDK_DIR = os.path.join(
FUCHSIA_SDK_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'fuchsia-sdk',
'sdk')
-BUG_REPORT_URL = ('https://crbug.com and run tools/clang/scripts/upload_crash.py'
+BUG_REPORT_URL = ('https://crbug.com and run'
+ ' tools/clang/scripts/process_crashreports.py'
' (only works inside Google) which will upload a report')
@@ -95,8 +98,8 @@ def CopyDirectoryContents(src, dst):
def CheckoutLLVM(commit, dir):
"""Checkout the LLVM monorepo at a certain git commit in dir. Any local
modifications in dir will be lost."""
- print("Checking out LLVM monorepo %s into '%s'" % (commit, dir))
+ print('Checking out LLVM monorepo %s into %s' % (commit, dir))
git_dir = os.path.join(dir, '.git')
fetch_cmd = ['git', '--git-dir', git_dir, 'fetch']
checkout_cmd = ['git', 'checkout', commit]
@@ -116,7 +119,7 @@ def CheckoutLLVM(commit, dir):
# Otherwise, do a fresh clone.
if os.path.isdir(dir):
- print("Removing %s." % dir)
+ print('Removing %s.' % dir)
RmTree(dir)
if RunCommand(clone_cmd, fail_hard=False):
os.chdir(dir)
@@ -209,7 +212,7 @@ def AddGnuWinToPath():
return
gnuwin_dir = os.path.join(LLVM_BUILD_TOOLS_DIR, 'gnuwin')
- GNUWIN_VERSION = '11'
+ GNUWIN_VERSION = '12'
GNUWIN_STAMP = os.path.join(gnuwin_dir, 'stamp')
if ReadStampFile(GNUWIN_STAMP) == GNUWIN_VERSION:
print('GNU Win tools already up to date.')
@@ -232,6 +235,16 @@ def AddGnuWinToPath():
f.write('group: files\n')
+def MaybeDownloadHostGcc(args):
+ """Download a modern GCC host compiler on Linux."""
+ if not sys.platform.startswith('linux') or args.gcc_toolchain:
+ return
+ gcc_dir = os.path.join(LLVM_BUILD_TOOLS_DIR, 'gcc510trusty')
+ if not os.path.exists(gcc_dir):
+ DownloadAndUnpack(CDS_URL + '/tools/gcc510trusty.tgz', gcc_dir)
+ args.gcc_toolchain = gcc_dir
+
+
def SetMacXcodePath():
"""Set DEVELOPER_DIR to the path to hermetic Xcode.app on Mac OS X."""
if sys.platform != 'darwin':
@@ -258,6 +271,37 @@ def VerifyVersionOfBuiltClangMatchesVERSION():
sys.exit(1)
+def CopyLibstdcpp(args, build_dir):
+ if not args.gcc_toolchain:
+ return
+ # Find libstdc++.so.6
+ libstdcpp = subprocess.check_output(
+ [os.path.join(args.gcc_toolchain, 'bin', 'g++'),
+ '-print-file-name=libstdc++.so.6']).rstrip()
+
+ # Copy libstdc++.so.6 into the build dir so that the built binaries can find
+ # it. Binaries get their rpath set to $origin/../lib/. For clang, lld,
+ # etc. that live in the bin/ directory, this means they expect to find the .so
+ # in their neighbouring lib/ dir. For other tools however, this doesn't work
+ # since those exeuctables are spread out into different directories.
+ # TODO(hans): Unit tests don't get rpath set at all, unittests/ copying
+ # below doesn't help at the moment.
+ for d in ['lib',
+ 'test/tools/llvm-isel-fuzzer/lib',
+ 'test/tools/llvm-opt-fuzzer/lib',
+ 'unittests/CodeGen/lib',
+ 'unittests/DebugInfo/lib',
+ 'unittests/ExecutionEngine/lib',
+ 'unittests/Support/lib',
+ 'unittests/Target/lib',
+ 'unittests/Transforms/lib',
+ 'unittests/lib',
+ 'unittests/tools/lib',
+ 'unittests/tools/llvm-exegesis/lib']:
+ EnsureDirExists(os.path.join(build_dir, d))
+ CopyFile(libstdcpp, os.path.join(build_dir, d))
+
+
def gn_arg(v):
if v == 'True':
return True
@@ -273,9 +317,12 @@ def main():
help='first build clang with CC, then with itself.')
parser.add_argument('--disable-asserts', action='store_true',
help='build with asserts disabled')
- parser.add_argument('--gcc-toolchain', help='(no longer used)')
+ parser.add_argument('--gcc-toolchain', help='what gcc toolchain to use for '
+ 'building; --gcc-toolchain=/opt/foo picks '
+ '/opt/foo/bin/gcc')
parser.add_argument('--lto-lld', action='store_true',
help='build lld with LTO (only applies on Linux)')
+ parser.add_argument('--pgo', action='store_true', help='build with PGO')
parser.add_argument('--llvm-force-head-revision', action='store_true',
help='build the latest revision')
parser.add_argument('--run-tests', action='store_true',
@@ -301,6 +348,15 @@ def main():
default=sys.platform in ('linux2', 'darwin'))
args = parser.parse_args()
+ # TODO(crbug.com/985289): Remove when rolling past r366427.
+ if args.llvm_force_head_revision:
+ global RELEASE_VERSION
+ RELEASE_VERSION = '10.0.0'
+ old_lib_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang', '9.0.0')
+ if (os.path.isdir(old_lib_dir)):
+ print('Removing old lib dir: ' + old_lib_dir)
+ RmTree(old_lib_dir)
+
if args.lto_lld and not args.bootstrap:
print('--lto-lld requires --bootstrap')
return 1
@@ -308,6 +364,9 @@ def main():
# TODO(hans): Use it on Windows too.
print('--lto-lld is only effective on Linux. Ignoring the option.')
args.lto_lld = False
+ if args.pgo and not args.bootstrap:
+ print('--pgo requires --bootstrap')
+ return 1
if args.with_android and not os.path.exists(ANDROID_NDK_DIR):
print('Android NDK not found at ' + ANDROID_NDK_DIR)
print('The Android NDK is needed to build a Clang whose -fsanitize=address')
@@ -337,6 +396,10 @@ def main():
# move this down to where we fetch other build tools.
AddGnuWinToPath()
+ # TODO(crbug.com/929645): Remove once we build on host systems with a modern
+ # enough GCC to build Clang.
+ MaybeDownloadHostGcc(args)
+
global CLANG_REVISION, PACKAGE_VERSION
if args.llvm_force_head_revision:
CLANG_REVISION = GetLatestLLVMCommit()
@@ -363,7 +426,20 @@ def main():
if args.skip_build:
return 0
- cc, cxx = None, None
+ # The variable "lld" is only used on Windows because only there does setting
+ # CMAKE_LINKER have an effect: On Windows, the linker is called directly,
+ # while elsewhere it's called through the compiler driver, and we pass
+ # -fuse-ld=lld there to make the compiler driver call the linker (by setting
+ # LLVM_ENABLE_LLD).
+ cc, cxx, lld = None, None, None
+
+ if args.gcc_toolchain:
+ # Use the specified gcc installation for building.
+ cc = os.path.join(args.gcc_toolchain, 'bin', 'gcc')
+ cxx = os.path.join(args.gcc_toolchain, 'bin', 'g++')
+ if not os.access(cc, os.X_OK):
+ print('Invalid --gcc-toolchain: ' + args.gcc_toolchain)
+ return 1
cflags = []
cxxflags = []
@@ -390,13 +466,20 @@ def main():
'-DCLANG_PLUGIN_SUPPORT=OFF',
'-DCLANG_ENABLE_STATIC_ANALYZER=OFF',
'-DCLANG_ENABLE_ARCMT=OFF',
- # TODO(crbug.com/929645): Use newer toolchain to host.
- '-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON',
'-DBUG_REPORT_URL=' + BUG_REPORT_URL,
# See PR41956: Don't link libcxx into libfuzzer.
'-DCOMPILER_RT_USE_LIBCXX=NO',
+ # Don't run Go bindings tests; PGO makes them confused.
+ '-DLLVM_INCLUDE_GO_TESTS=OFF',
]
+ if args.gcc_toolchain:
+ # Don't use the custom gcc toolchain when building compiler-rt tests; those
+ # tests are built with the just-built Clang, and target both i386 and x86_64
+ # for example, so should ust the system's libstdc++.
+ base_cmake_args.append(
+ '-DCOMPILER_RT_TEST_COMPILER_CFLAGS=--gcc-toolchain=')
+
if sys.platform == 'win32':
base_cmake_args.append('-DLLVM_USE_CRT_RELEASE=MT')
@@ -418,7 +501,10 @@ def main():
os.chdir(LLVM_BOOTSTRAP_DIR)
projects = 'clang'
- if args.lto_lld:
+ if args.pgo:
+ # Need libclang_rt.profile
+ projects += ';compiler-rt'
+ if sys.platform != 'darwin' or args.lto_lld:
projects += ';lld'
if sys.platform == 'darwin':
# Need libc++ and compiler-rt for the bootstrap compiler on mac.
@@ -447,41 +533,131 @@ def main():
'-DCOMPILER_RT_BUILD_BUILTINS=ON',
'-DCOMPILER_RT_BUILD_CRT=OFF',
'-DCOMPILER_RT_BUILD_LIBFUZZER=OFF',
- '-DCOMPILER_RT_BUILD_PROFILE=OFF',
'-DCOMPILER_RT_BUILD_SANITIZERS=OFF',
'-DCOMPILER_RT_BUILD_XRAY=OFF',
'-DCOMPILER_RT_ENABLE_IOS=OFF',
'-DCOMPILER_RT_ENABLE_WATCHOS=OFF',
'-DCOMPILER_RT_ENABLE_TVOS=OFF',
])
+ elif args.pgo:
+ # PGO needs libclang_rt.profile but none of the other compiler-rt stuff.
+ bootstrap_args.extend([
+ '-DCOMPILER_RT_BUILD_BUILTINS=OFF',
+ '-DCOMPILER_RT_BUILD_CRT=OFF',
+ '-DCOMPILER_RT_BUILD_LIBFUZZER=OFF',
+ '-DCOMPILER_RT_BUILD_PROFILE=ON',
+ '-DCOMPILER_RT_BUILD_SANITIZERS=OFF',
+ '-DCOMPILER_RT_BUILD_XRAY=OFF',
+ ])
+
if cc is not None: bootstrap_args.append('-DCMAKE_C_COMPILER=' + cc)
if cxx is not None: bootstrap_args.append('-DCMAKE_CXX_COMPILER=' + cxx)
+ if lld is not None: bootstrap_args.append('-DCMAKE_LINKER=' + lld)
RunCommand(['cmake'] + bootstrap_args + [os.path.join(LLVM_DIR, 'llvm')],
msvc_arch='x64')
+ CopyLibstdcpp(args, LLVM_BOOTSTRAP_DIR)
+ CopyLibstdcpp(args, LLVM_BOOTSTRAP_INSTALL_DIR)
RunCommand(['ninja'], msvc_arch='x64')
if args.run_tests:
+ test_targets = [ 'check-all' ]
+ if sys.platform == 'darwin':
+ # TODO(crbug.com/731375): Run check-all on Darwin too.
+ test_targets = [ 'check-llvm', 'check-clang', 'check-builtins' ]
if sys.platform == 'win32':
CopyDiaDllTo(os.path.join(LLVM_BOOTSTRAP_DIR, 'bin'))
- RunCommand(['ninja', 'check-all'], msvc_arch='x64')
+ RunCommand(['ninja'] + test_targets, msvc_arch='x64')
RunCommand(['ninja', 'install'], msvc_arch='x64')
if sys.platform == 'win32':
cc = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang-cl.exe')
cxx = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang-cl.exe')
+ lld = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'lld-link.exe')
# CMake has a hard time with backslashes in compiler paths:
# https://stackoverflow.com/questions/13050827
cc = cc.replace('\\', '/')
cxx = cxx.replace('\\', '/')
+ lld = lld.replace('\\', '/')
else:
cc = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang')
cxx = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang++')
+ if sys.platform.startswith('linux'):
+ base_cmake_args.append('-DLLVM_ENABLE_LLD=ON')
+
+ if args.gcc_toolchain:
+ # Tell the bootstrap compiler where to find the standard library headers
+ # and shared object files.
+ cflags.append('--gcc-toolchain=' + args.gcc_toolchain)
+ cxxflags.append('--gcc-toolchain=' + args.gcc_toolchain)
+
+ print('Bootstrap compiler installed.')
+
+ if args.pgo:
+ print('Building instrumented compiler')
+ if os.path.exists(LLVM_INSTRUMENTED_DIR):
+ RmTree(LLVM_INSTRUMENTED_DIR)
+ EnsureDirExists(LLVM_INSTRUMENTED_DIR)
+ os.chdir(LLVM_INSTRUMENTED_DIR)
+
+ projects = 'clang'
+ if sys.platform == 'darwin':
+ projects += ';libcxx;compiler-rt'
- print('Bootstrap compiler installed; building final compiler.')
+ instrument_args = base_cmake_args + [
+ '-DLLVM_ENABLE_THREADS=OFF',
+ '-DLLVM_ENABLE_PROJECTS=' + projects,
+ '-DCMAKE_C_FLAGS=' + ' '.join(cflags),
+ '-DCMAKE_CXX_FLAGS=' + ' '.join(cxxflags),
+ # Build with instrumentation.
+ '-DLLVM_BUILD_INSTRUMENTED=IR',
+ ]
+ # Build with the bootstrap compiler.
+ if cc is not None: instrument_args.append('-DCMAKE_C_COMPILER=' + cc)
+ if cxx is not None: instrument_args.append('-DCMAKE_CXX_COMPILER=' + cxx)
+ if lld is not None: instrument_args.append('-DCMAKE_LINKER=' + lld)
+ RunCommand(['cmake'] + instrument_args + [os.path.join(LLVM_DIR, 'llvm')],
+ msvc_arch='x64')
+ CopyLibstdcpp(args, LLVM_INSTRUMENTED_DIR)
+ RunCommand(['ninja'], msvc_arch='x64')
+ print('Instrumented compiler built.')
+
+ # Train by building some C++ code.
+ #
+ # pgo_training-1.ii is a preprocessed (on Linux) version of
+ # src/third_party/blink/renderer/core/layout/layout_object.cc, selected
+ # because it's a large translation unit in Blink, which is normally the
+ # slowest part of Chromium to compile. Using this, we get ~20% shorter
+ # build times for Linux, Android, and Mac, which is also what we got when
+ # training by actually building a target in Chromium. (For comparison, a
+ # C++-y "Hello World" program only resulted in 14% faster builds.)
+ # See https://crbug.com/966403#c16 for all numbers.
+ #
+ # TODO(hans): Enhance the training, perhaps by including preprocessed code
+ # from more platforms, and by doing some linking so that lld can benefit
+ # from PGO as well. Perhaps the training could be done asynchronously by
+ # dedicated buildbots that upload profiles to the cloud.
+ training_source = 'pgo_training-1.ii'
+ with open(training_source, 'w') as f:
+ DownloadUrl(CDS_URL + '/' + training_source, f)
+ train_cmd = [os.path.join(LLVM_INSTRUMENTED_DIR, 'bin', 'clang++'),
+ '-target', 'x86_64-unknown-unknown', '-O2', '-g', '-std=c++14',
+ '-fno-exceptions', '-fno-rtti', '-w', '-c', training_source]
+ if sys.platform == 'darwin':
+ train_cmd.extend(['-stdlib=libc++', '-isysroot',
+ subprocess.check_output(['xcrun',
+ '--show-sdk-path']).rstrip()])
+ RunCommand(train_cmd, msvc_arch='x64')
+
+ # Merge profiles.
+ profdata = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'llvm-profdata')
+ RunCommand([profdata, 'merge', '-output=' + LLVM_PROFDATA_FILE] +
+ glob.glob(os.path.join(LLVM_INSTRUMENTED_DIR, 'profiles',
+ '*.profraw')), msvc_arch='x64')
+ print('Profile generated.')
compiler_rt_args = [
'-DCOMPILER_RT_BUILD_CRT=OFF',
- '-DCOMPILER_RT_BUILD_LIBFUZZER=ON',
+ '-DCOMPILER_RT_BUILD_LIBFUZZER=OFF',
'-DCOMPILER_RT_BUILD_PROFILE=ON',
'-DCOMPILER_RT_BUILD_SANITIZERS=ON',
'-DCOMPILER_RT_BUILD_XRAY=OFF',
@@ -501,12 +677,6 @@ def main():
])
else:
compiler_rt_args.append('-DCOMPILER_RT_BUILD_BUILTINS=OFF')
- if sys.platform.startswith('linux'):
- # Only build the 64-bit runtime, we don't need the 32-bit one.
- compiler_rt_args.extend([
- '-DCMAKE_C_COMPILER_TARGET=x86_64-unknown-linux-gnu',
- '-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON',
- ])
# LLVM uses C++11 starting in llvm 3.5. On Linux, this means libstdc++4.7+ is
# needed, on OS X it requires libc++. clang only automatically links to libc++
@@ -544,6 +714,7 @@ def main():
# Build lld and code coverage tools. This is done separately from the rest of
# the build because these tools require threading support.
+ print('Building thread-enabled tools.')
tools_with_threading = [ 'dsymutil', 'lld', 'llvm-cov', 'llvm-profdata' ]
print('Building the following tools with threading support: %s' %
str(tools_with_threading))
@@ -563,6 +734,8 @@ def main():
threads_enabled_cmake_args.append('-DCMAKE_C_COMPILER=' + cc)
if cxx is not None:
threads_enabled_cmake_args.append('-DCMAKE_CXX_COMPILER=' + cxx)
+ if lld is not None:
+ threads_enabled_cmake_args.append('-DCMAKE_LINKER=' + lld)
if args.lto_lld:
# Build lld with LTO. That speeds up the linker by ~10%.
@@ -578,17 +751,21 @@ def main():
'-DCMAKE_AR=' + ar,
'-DCMAKE_RANLIB=' + ranlib,
'-DLLVM_ENABLE_LTO=thin',
- '-DLLVM_USE_LINKER=lld']
+ ]
RunCommand(['cmake'] + threads_enabled_cmake_args +
[os.path.join(LLVM_DIR, 'llvm')],
msvc_arch='x64', env=deployment_env)
+ CopyLibstdcpp(args, THREADS_ENABLED_BUILD_DIR)
RunCommand(['ninja'] + tools_with_threading, msvc_arch='x64')
+ print('Building final compiler.')
+
default_tools = ['plugins', 'blink_gc_plugin', 'translation_unit']
chrome_tools = list(set(default_tools + args.extra_tools))
if cc is not None: base_cmake_args.append('-DCMAKE_C_COMPILER=' + cc)
if cxx is not None: base_cmake_args.append('-DCMAKE_CXX_COMPILER=' + cxx)
+ if lld is not None: base_cmake_args.append('-DCMAKE_LINKER=' + lld)
cmake_args = base_cmake_args + compiler_rt_args + [
'-DLLVM_ENABLE_THREADS=OFF',
'-DCMAKE_C_FLAGS=' + ' '.join(cflags),
@@ -599,6 +776,8 @@ def main():
'-DCMAKE_INSTALL_PREFIX=' + LLVM_BUILD_DIR,
'-DCHROMIUM_TOOLS_SRC=%s' % os.path.join(CHROMIUM_DIR, 'tools', 'clang'),
'-DCHROMIUM_TOOLS=%s' % ';'.join(chrome_tools)]
+ if args.pgo:
+ cmake_args.append('-DLLVM_PROFDATA_FILE=' + LLVM_PROFDATA_FILE)
if sys.platform == 'darwin':
cmake_args += ['-DCOMPILER_RT_ENABLE_IOS=ON',
'-DSANITIZER_MIN_OSX_VERSION=10.7']
@@ -612,6 +791,7 @@ def main():
os.chdir(LLVM_BUILD_DIR)
RunCommand(['cmake'] + cmake_args + [os.path.join(LLVM_DIR, 'llvm')],
msvc_arch='x64', env=deployment_env)
+ CopyLibstdcpp(args, LLVM_BUILD_DIR)
RunCommand(['ninja'], msvc_arch='x64')
# Copy in the threaded versions of lld and other tools.
@@ -724,12 +904,12 @@ def main():
'-DCMAKE_C_FLAGS=' + ' '.join(cflags),
'-DCMAKE_CXX_FLAGS=' + ' '.join(cflags),
'-DCMAKE_ASM_FLAGS=' + ' '.join(cflags),
- "-DCOMPILER_RT_BUILD_BUILTINS=OFF",
- "-DCOMPILER_RT_BUILD_CRT=OFF",
- "-DCOMPILER_RT_BUILD_LIBFUZZER=OFF",
- "-DCOMPILER_RT_BUILD_PROFILE=ON",
- "-DCOMPILER_RT_BUILD_SANITIZERS=ON",
- "-DCOMPILER_RT_BUILD_XRAY=OFF",
+ '-DCOMPILER_RT_BUILD_BUILTINS=OFF',
+ '-DCOMPILER_RT_BUILD_CRT=OFF',
+ '-DCOMPILER_RT_BUILD_LIBFUZZER=OFF',
+ '-DCOMPILER_RT_BUILD_PROFILE=ON',
+ '-DCOMPILER_RT_BUILD_SANITIZERS=ON',
+ '-DCOMPILER_RT_BUILD_XRAY=OFF',
'-DSANITIZER_CXX_ABI=libcxxabi',
'-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-u__cxa_demangle',
'-DANDROID=1']
@@ -775,12 +955,12 @@ def main():
'-DCMAKE_SYSTEM_NAME=Fuchsia',
'-DCMAKE_C_COMPILER_TARGET=%s-fuchsia' % target_arch,
'-DCMAKE_ASM_COMPILER_TARGET=%s-fuchsia' % target_arch,
- "-DCOMPILER_RT_BUILD_BUILTINS=ON",
- "-DCOMPILER_RT_BUILD_CRT=OFF",
- "-DCOMPILER_RT_BUILD_LIBFUZZER=OFF",
- "-DCOMPILER_RT_BUILD_PROFILE=OFF",
- "-DCOMPILER_RT_BUILD_SANITIZERS=OFF",
- "-DCOMPILER_RT_BUILD_XRAY=OFF",
+ '-DCOMPILER_RT_BUILD_BUILTINS=ON',
+ '-DCOMPILER_RT_BUILD_CRT=OFF',
+ '-DCOMPILER_RT_BUILD_LIBFUZZER=OFF',
+ '-DCOMPILER_RT_BUILD_PROFILE=OFF',
+ '-DCOMPILER_RT_BUILD_SANITIZERS=OFF',
+ '-DCOMPILER_RT_BUILD_XRAY=OFF',
'-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON',
'-DCMAKE_SYSROOT=%s' % toolchain_dir,
# TODO(thakis|scottmg): Use PER_TARGET_RUNTIME_DIR for all platforms.
@@ -801,10 +981,10 @@ def main():
# And copy it into the main build tree.
fuchsia_lib_dst_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang',
- RELEASE_VERSION, target_spec, 'lib')
+ RELEASE_VERSION, 'lib', target_spec)
if not os.path.exists(fuchsia_lib_dst_dir):
os.makedirs(fuchsia_lib_dst_dir)
- CopyFile(os.path.join(build_dir, target_spec, 'lib', builtins_a),
+ CopyFile(os.path.join(build_dir, 'lib', target_spec, builtins_a),
fuchsia_lib_dst_dir)
# Run tests.
diff --git a/chromium/tools/clang/scripts/package.py b/chromium/tools/clang/scripts/package.py
index 0af8d1666bc..68ccd3046bd 100755
--- a/chromium/tools/clang/scripts/package.py
+++ b/chromium/tools/clang/scripts/package.py
@@ -15,7 +15,7 @@ import subprocess
import sys
import tarfile
-from update import RELEASE_VERSION
+from update import RELEASE_VERSION, STAMP_FILE
# Path constants.
THIS_DIR = os.path.dirname(__file__)
@@ -30,7 +30,6 @@ LLVM_BUILD_DIR = os.path.join(THIRD_PARTY_DIR, 'llvm-build')
LLVM_RELEASE_DIR = os.path.join(LLVM_BUILD_DIR, 'Release+Asserts')
EU_STRIP = os.path.join(BUILDTOOLS_DIR, 'third_party', 'eu-strip', 'bin',
'eu-strip')
-STAMP_FILE = os.path.join(LLVM_BUILD_DIR, 'cr_build_revision')
def Tee(output, logfile):
@@ -193,12 +192,14 @@ def main():
shutil.rmtree(LLVM_BOOTSTRAP_INSTALL_DIR, ignore_errors=True)
shutil.rmtree(LLVM_BUILD_DIR, ignore_errors=True)
- opt_flags = []
- if sys.platform.startswith('linux'):
- opt_flags += ['--lto-lld']
build_cmd = [sys.executable, os.path.join(THIS_DIR, 'build.py'),
'--bootstrap', '--disable-asserts',
- '--run-tests'] + opt_flags
+ '--run-tests']
+ if sys.platform != 'win32':
+ # TODO(hans): Use --pgo for the Windows package too.
+ build_cmd.append('--pgo')
+ if sys.platform.startswith('linux'):
+ build_cmd.append('--lto-lld')
TeeCmd(build_cmd, log)
stamp = open(STAMP_FILE).read().rstrip()
@@ -231,8 +232,8 @@ def main():
'bin/clang',
# Include libclang_rt.builtins.a for Fuchsia targets.
- 'lib/clang/$V/aarch64-fuchsia/lib/libclang_rt.builtins.a',
- 'lib/clang/$V/x86_64-fuchsia/lib/libclang_rt.builtins.a',
+ 'lib/clang/$V/lib/aarch64-fuchsia/libclang_rt.builtins.a',
+ 'lib/clang/$V/lib/x86_64-fuchsia/libclang_rt.builtins.a',
])
if sys.platform == 'darwin':
want.extend([
@@ -240,9 +241,6 @@ def main():
'lib/clang/$V/lib/darwin/libclang_rt.asan_iossim_dynamic.dylib',
'lib/clang/$V/lib/darwin/libclang_rt.asan_osx_dynamic.dylib',
- # Fuzzing instrumentation (-fsanitize=fuzzer-no-link).
- 'lib/clang/$V/lib/darwin/libclang_rt.fuzzer_no_main_osx.a',
-
# OS X and iOS builtin libraries (iossim is lipo'd into ios) for the
# _IsOSVersionAtLeast runtime function.
'lib/clang/$V/lib/darwin/libclang_rt.ios.a',
@@ -254,16 +252,25 @@ def main():
])
elif sys.platform.startswith('linux'):
want.extend([
+ # Copy the stdlibc++.so.6 we linked the binaries against.
+ 'lib/libstdc++.so.6',
+
+ # Add LLD.
'bin/lld',
# Add llvm-ar for LTO.
'bin/llvm-ar',
+ # Add llvm-objcopy for partition extraction on Android.
+ 'bin/llvm-objcopy',
+
# AddressSanitizer C runtime (pure C won't link with *_cxx).
+ 'lib/clang/$V/lib/linux/libclang_rt.asan-i386.a',
'lib/clang/$V/lib/linux/libclang_rt.asan-x86_64.a',
'lib/clang/$V/lib/linux/libclang_rt.asan-x86_64.a.syms',
# AddressSanitizer C++ runtime.
+ 'lib/clang/$V/lib/linux/libclang_rt.asan_cxx-i386.a',
'lib/clang/$V/lib/linux/libclang_rt.asan_cxx-x86_64.a',
'lib/clang/$V/lib/linux/libclang_rt.asan_cxx-x86_64.a.syms',
@@ -272,9 +279,6 @@ def main():
'lib/clang/$V/lib/linux/libclang_rt.asan-arm-android.so',
'lib/clang/$V/lib/linux/libclang_rt.asan-i686-android.so',
- # Fuzzing instrumentation (-fsanitize=fuzzer-no-link).
- 'lib/clang/$V/lib/linux/libclang_rt.fuzzer_no_main-x86_64.a',
-
# HWASAN Android runtime.
'lib/clang/$V/lib/linux/libclang_rt.hwasan-aarch64-android.so',
@@ -287,6 +291,7 @@ def main():
'lib/clang/$V/lib/linux/libclang_rt.msan_cxx-x86_64.a.syms',
# Profile runtime (used by profiler and code coverage).
+ 'lib/clang/$V/lib/linux/libclang_rt.profile-i386.a',
'lib/clang/$V/lib/linux/libclang_rt.profile-x86_64.a',
'lib/clang/$V/lib/linux/libclang_rt.profile-aarch64-android.a',
'lib/clang/$V/lib/linux/libclang_rt.profile-arm-android.a',
@@ -300,10 +305,12 @@ def main():
'lib/clang/$V/lib/linux/libclang_rt.tsan_cxx-x86_64.a.syms',
# UndefinedBehaviorSanitizer C runtime (pure C won't link with *_cxx).
+ 'lib/clang/$V/lib/linux/libclang_rt.ubsan_standalone-i386.a',
'lib/clang/$V/lib/linux/libclang_rt.ubsan_standalone-x86_64.a',
'lib/clang/$V/lib/linux/libclang_rt.ubsan_standalone-x86_64.a.syms',
# UndefinedBehaviorSanitizer C++ runtime.
+ 'lib/clang/$V/lib/linux/libclang_rt.ubsan_standalone_cxx-i386.a',
'lib/clang/$V/lib/linux/libclang_rt.ubsan_standalone_cxx-x86_64.a',
'lib/clang/$V/lib/linux/libclang_rt.ubsan_standalone_cxx-x86_64.a.syms',
@@ -322,9 +329,6 @@ def main():
# AddressSanitizer C++ runtime.
'lib/clang/$V/lib/windows/clang_rt.asan_cxx-x86_64.lib',
- # Fuzzing instrumentation (-fsanitize=fuzzer-no-link).
- 'lib/clang/$V/lib/windows/clang_rt.fuzzer_no_main-x86_64.lib',
-
# Thunk for AddressSanitizer needed for static build of a shared lib.
'lib/clang/$V/lib/windows/clang_rt.asan_dll_thunk-x86_64.lib',
@@ -384,6 +388,7 @@ def main():
if sys.platform.startswith('linux'):
stripped_binaries.append('lld')
stripped_binaries.append('llvm-ar')
+ stripped_binaries.append('llvm-objcopy')
for f in stripped_binaries:
if sys.platform != 'win32':
subprocess.call(['strip', os.path.join(pdir, 'bin', f)])
diff --git a/chromium/tools/clang/scripts/update.py b/chromium/tools/clang/scripts/update.py
index 082dc5ec7ac..614e9573639 100755
--- a/chromium/tools/clang/scripts/update.py
+++ b/chromium/tools/clang/scripts/update.py
@@ -14,6 +14,7 @@ near-tip-of-tree clang version:
# TODO: Running stand-alone won't work on Windows due to the dia dll copying.
+from __future__ import division
from __future__ import print_function
import argparse
import os
@@ -25,10 +26,10 @@ import tempfile
import time
try:
- import urllib2 as urllib
+ from urllib2 import HTTPError, URLError, urlopen
except ImportError: # For Py3 compatibility
- import urllib.request as urllib
- import urllib.error as urllib
+ from urllib.error import HTTPError, URLError
+ from urllib.request import urlopen
import zipfile
@@ -36,12 +37,13 @@ import zipfile
# Do NOT CHANGE this if you don't know what you're doing -- see
# https://chromium.googlesource.com/chromium/src/+/master/docs/updating_clang.md
# Reverting problematic clang rolls is safe, though.
-CLANG_REVISION = '67510fac36d27b2e22c7cd955fc167136b737b93'
-CLANG_SVN_REVISION = '361212'
-CLANG_SUB_REVISION = 4
+CLANG_REVISION = 'f7e52fbdb5a7af8ea0808e98458b497125a5eca1'
+CLANG_SVN_REVISION = '365097'
+CLANG_SUB_REVISION = 8
PACKAGE_VERSION = '%s-%s-%s' % (CLANG_SVN_REVISION, CLANG_REVISION[:8],
CLANG_SUB_REVISION)
+# TODO(crbug.com/985289): Bump when rolling past r366427.
RELEASE_VERSION = '9.0.0'
@@ -55,7 +57,7 @@ LLVM_BUILD_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm-build',
'Release+Asserts')
STAMP_FILE = os.path.normpath(
- os.path.join(LLVM_BUILD_DIR, '..', 'cr_build_revision'))
+ os.path.join(LLVM_BUILD_DIR, 'cr_build_revision'))
FORCE_HEAD_REVISION_FILE = os.path.normpath(os.path.join(LLVM_BUILD_DIR, '..',
'force_head_revision'))
@@ -99,8 +101,8 @@ def DownloadUrl(url, output_file):
try:
sys.stdout.write('Downloading %s ' % url)
sys.stdout.flush()
- response = urllib.urlopen(url)
- total_size = int(response.info().getheader('Content-Length').strip())
+ response = urlopen(url)
+ total_size = int(response.info().get('Content-Length').strip())
bytes_done = 0
dots_printed = 0
while True:
@@ -109,19 +111,19 @@ def DownloadUrl(url, output_file):
break
output_file.write(chunk)
bytes_done += len(chunk)
- num_dots = TOTAL_DOTS * bytes_done / total_size
+ num_dots = TOTAL_DOTS * bytes_done // total_size
sys.stdout.write('.' * (num_dots - dots_printed))
sys.stdout.flush()
dots_printed = num_dots
if bytes_done != total_size:
- raise urllib.URLError("only got %d of %d bytes" %
- (bytes_done, total_size))
+ raise URLError("only got %d of %d bytes" %
+ (bytes_done, total_size))
print(' Done.')
return
- except urllib.URLError as e:
+ except URLError as e:
sys.stdout.write('\n')
print(e)
- if num_retries == 0 or isinstance(e, urllib.HTTPError) and e.code == 404:
+ if num_retries == 0 or isinstance(e, HTTPError) and e.code == 404:
raise e
num_retries -= 1
print('Retrying in %d s ...' % retry_wait_s)
@@ -171,7 +173,7 @@ def DownloadAndUnpackClangPackage(platform, output_dir, runtimes_only=False):
if runtimes_only:
path_prefix = 'lib/clang/' + RELEASE_VERSION + '/lib/'
DownloadAndUnpack(cds_full_url, output_dir, path_prefix)
- except urllib.URLError:
+ except URLError:
print('Failed to download prebuilt clang %s' % cds_file)
print('Use --force-local-build if you want to build locally.')
print('Exiting.')
@@ -281,6 +283,11 @@ def main():
help='Verify that clang has the passed-in version.')
args = parser.parse_args()
+ # TODO(crbug.com/985289): Remove when rolling past r366427.
+ if args.llvm_force_head_revision:
+ global RELEASE_VERSION
+ RELEASE_VERSION = '10.0.0'
+
if args.force_local_build:
print(('update.py --force-local-build is no longer used to build clang; '
'use build.py instead.'))
diff --git a/chromium/tools/clang/stack_maps/OWNERS b/chromium/tools/clang/stack_maps/OWNERS
new file mode 100644
index 00000000000..2212c5146b3
--- /dev/null
+++ b/chromium/tools/clang/stack_maps/OWNERS
@@ -0,0 +1,4 @@
+mlippautz@chromium.org
+
+# TEAM: v8-dev@chromium.org
+# COMPONENT: Blink>JavaScript>GC
diff --git a/chromium/tools/clang/stack_maps/README b/chromium/tools/clang/stack_maps/README
new file mode 100644
index 00000000000..c7219f88f89
--- /dev/null
+++ b/chromium/tools/clang/stack_maps/README
@@ -0,0 +1,4 @@
+Prototype and playground for generating stack maps to garbage-collected objects
+using clang/llvm infrastructure.
+
+Design doc: https://bit.ly/chromium-stack-maps