Skip to content

Commit 9df043b

Browse files
committed
Auto merge of #57675 - cuviper:llvm-monorepo, r=alexcrichton
Rebase to the llvm-project monorepo The new git submodule src/llvm-project is a monorepo replacing src/llvm and src/tools/{clang,lld,lldb}. This also serves as a rebase for these projects to the new 8.x branch from trunk. The src/llvm-emscripten fork is unchanged for now. r? @alexcrichton
2 parents 37d51aa + 059ed4f commit 9df043b

File tree

21 files changed

+224
-76
lines changed

21 files changed

+224
-76
lines changed

.gitmodules

+5-16
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
[submodule "src/llvm"]
2-
path = src/llvm
3-
url = https://github.com/rust-lang/llvm.git
4-
branch = master
51
[submodule "src/rust-installer"]
62
path = src/tools/rust-installer
73
url = https://github.com/rust-lang/rust-installer.git
@@ -38,20 +34,13 @@
3834
[submodule "src/stdsimd"]
3935
path = src/stdsimd
4036
url = https://github.com/rust-lang-nursery/stdsimd.git
41-
[submodule "src/tools/lld"]
42-
path = src/tools/lld
43-
url = https://github.com/rust-lang/lld.git
44-
[submodule "src/tools/lldb"]
45-
path = src/tools/lldb
46-
url = https://github.com/rust-lang-nursery/lldb.git
47-
branch = rust-release-80-v2
48-
[submodule "src/tools/clang"]
49-
path = src/tools/clang
50-
url = https://github.com/rust-lang-nursery/clang.git
51-
branch = rust-release-80-v2
5237
[submodule "src/doc/rustc-guide"]
5338
path = src/doc/rustc-guide
5439
url = https://github.com/rust-lang/rustc-guide.git
5540
[submodule "src/doc/edition-guide"]
5641
path = src/doc/edition-guide
57-
url = https://github.com/rust-lang-nursery/edition-guide
42+
url = https://github.com/rust-lang-nursery/edition-guide.git
43+
[submodule "src/llvm-project"]
44+
path = src/llvm-project
45+
url = https://github.com/rust-lang/llvm-project.git
46+
branch = rustc/8.0-2019-01-16

COPYRIGHT

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The Rust Project includes packages written by third parties.
2323
The following third party packages are included, and carry
2424
their own copyright notices and license terms:
2525

26-
* LLVM. Code for this package is found in src/llvm.
26+
* LLVM. Code for this package is found in src/llvm-project.
2727

2828
Copyright (c) 2003-2013 University of Illinois at
2929
Urbana-Champaign. All rights reserved.
@@ -73,8 +73,8 @@ their own copyright notices and license terms:
7373
OTHER DEALINGS WITH THE SOFTWARE.
7474

7575
* Additional libraries included in LLVM carry separate
76-
BSD-compatible licenses. See src/llvm/LICENSE.txt for
77-
details.
76+
BSD-compatible licenses. See src/llvm-project/llvm/LICENSE.TXT
77+
for details.
7878

7979
* compiler-rt, in src/compiler-rt is dual licensed under
8080
LLVM's license and MIT:

Cargo.lock

+6-6
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ dependencies = [
713713

714714
[[package]]
715715
name = "dlmalloc"
716-
version = "0.1.1"
716+
version = "0.1.2"
717717
source = "registry+https://github.com/rust-lang/crates.io-index"
718718
dependencies = [
719719
"compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1969,7 +1969,7 @@ name = "rand_chacha"
19691969
version = "0.1.0"
19701970
source = "registry+https://github.com/rust-lang/crates.io-index"
19711971
dependencies = [
1972-
"rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
1972+
"rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
19731973
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
19741974
]
19751975

@@ -1991,7 +1991,7 @@ name = "rand_hc"
19911991
version = "0.1.0"
19921992
source = "registry+https://github.com/rust-lang/crates.io-index"
19931993
dependencies = [
1994-
"rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
1994+
"rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
19951995
]
19961996

19971997
[[package]]
@@ -2016,7 +2016,7 @@ name = "rand_xorshift"
20162016
version = "0.1.0"
20172017
source = "registry+https://github.com/rust-lang/crates.io-index"
20182018
dependencies = [
2019-
"rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
2019+
"rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
20202020
]
20212021

20222022
[[package]]
@@ -3073,7 +3073,7 @@ dependencies = [
30733073
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
30743074
"compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
30753075
"core 0.0.0",
3076-
"dlmalloc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
3076+
"dlmalloc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
30773077
"fortanix-sgx-abi 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
30783078
"libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
30793079
"panic_abort 0.0.0",
@@ -3816,7 +3816,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
38163816
"checksum diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3c2b69f912779fbb121ceb775d74d51e915af17aaebc38d28a592843a2dd0a3a"
38173817
"checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
38183818
"checksum directories 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "72d337a64190607d4fcca2cb78982c5dd57f4916e19696b48a575fa746b6cb0f"
3819-
"checksum dlmalloc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4c46c65de42b063004b31c67a98abe071089b289ff0919c660ed7ff4f59317f8"
3819+
"checksum dlmalloc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d56ad71b31043818d0ee10a7fb9664882f8e45849c81647585e6a3124f185517"
38203820
"checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0"
38213821
"checksum elasticlunr-rs 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a99a310cd1f9770e7bf8e48810c7bcbb0e078c8fb23a8c7bcf0da4c2bf61a455"
38223822
"checksum ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f56c93cc076508c549d9bb747f79aa9b4eb098be7b8cad8830c3137ef52d1e00"

src/bootstrap/bootstrap.py

+2-10
Original file line numberDiff line numberDiff line change
@@ -701,21 +701,13 @@ def update_submodules(self):
701701
filtered_submodules = []
702702
submodules_names = []
703703
for module in submodules:
704-
if module.endswith("llvm"):
705-
if self.get_toml('llvm-config'):
704+
if module.endswith("llvm-project"):
705+
if self.get_toml('llvm-config') and self.get_toml('lld') != 'true':
706706
continue
707707
if module.endswith("llvm-emscripten"):
708708
backends = self.get_toml('codegen-backends')
709709
if backends is None or not 'emscripten' in backends:
710710
continue
711-
if module.endswith("lld"):
712-
config = self.get_toml('lld')
713-
if config is None or config == 'false':
714-
continue
715-
if module.endswith("lldb") or module.endswith("clang"):
716-
config = self.get_toml('lldb')
717-
if config is None or config == 'false':
718-
continue
719711
check = self.check_submodule(module, slow_submodules)
720712
filtered_submodules.append((module, check))
721713
submodules_names.append(module)

src/bootstrap/dist.rs

+21-4
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,24 @@ fn copy_src_dirs(builder: &Builder, src_dirs: &[&str], exclude_dirs: &[&str], ds
788788
if spath.ends_with("~") || spath.ends_with(".pyc") {
789789
return false
790790
}
791-
if (spath.contains("llvm/test") || spath.contains("llvm\\test")) &&
791+
792+
const LLVM_PROJECTS: &[&str] = &[
793+
"llvm-project/clang", "llvm-project\\clang",
794+
"llvm-project/lld", "llvm-project\\lld",
795+
"llvm-project/lldb", "llvm-project\\lldb",
796+
"llvm-project/llvm", "llvm-project\\llvm",
797+
];
798+
if spath.contains("llvm-project") && !spath.ends_with("llvm-project")
799+
&& !LLVM_PROJECTS.iter().any(|path| spath.contains(path))
800+
{
801+
return false;
802+
}
803+
804+
const LLVM_TEST: &[&str] = &[
805+
"llvm-project/llvm/test", "llvm-project\\llvm\\test",
806+
"llvm-emscripten/test", "llvm-emscripten\\test",
807+
];
808+
if LLVM_TEST.iter().any(|path| spath.contains(path)) &&
792809
(spath.ends_with(".ll") ||
793810
spath.ends_with(".td") ||
794811
spath.ends_with(".s")) {
@@ -2076,7 +2093,7 @@ impl Step for LlvmTools {
20762093
}
20772094

20782095
builder.info(&format!("Dist LlvmTools stage{} ({})", stage, target));
2079-
let src = builder.src.join("src/llvm");
2096+
let src = builder.src.join("src/llvm-project/llvm");
20802097
let name = pkgname(builder, "llvm-tools");
20812098

20822099
let tmp = tmpdir(builder);
@@ -2135,7 +2152,7 @@ impl Step for Lldb {
21352152
const DEFAULT: bool = true;
21362153

21372154
fn should_run(run: ShouldRun) -> ShouldRun {
2138-
run.path("src/tools/lldb")
2155+
run.path("src/llvm-project/lldb").path("src/tools/lldb")
21392156
}
21402157

21412158
fn make_run(run: RunConfig) {
@@ -2160,7 +2177,7 @@ impl Step for Lldb {
21602177
}
21612178

21622179
builder.info(&format!("Dist Lldb ({})", target));
2163-
let src = builder.src.join("src/tools/lldb");
2180+
let src = builder.src.join("src/llvm-project/lldb");
21642181
let name = pkgname(builder, "lldb");
21652182

21662183
let tmp = tmpdir(builder);

src/bootstrap/native.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ impl Step for Llvm {
3636
const ONLY_HOSTS: bool = true;
3737

3838
fn should_run(run: ShouldRun) -> ShouldRun {
39-
run.path("src/llvm").path("src/llvm-emscripten")
39+
run.path("src/llvm-project")
40+
.path("src/llvm-project/llvm")
41+
.path("src/llvm")
42+
.path("src/llvm-emscripten")
4043
}
4144

4245
fn make_run(run: RunConfig) {
@@ -97,7 +100,7 @@ impl Step for Llvm {
97100
t!(fs::create_dir_all(&out_dir));
98101

99102
// http://llvm.org/docs/CMake.html
100-
let root = if self.emscripten { "src/llvm-emscripten" } else { "src/llvm" };
103+
let root = if self.emscripten { "src/llvm-emscripten" } else { "src/llvm-project/llvm" };
101104
let mut cfg = cmake::Config::new(builder.src.join(root));
102105

103106
let profile = match (builder.config.llvm_optimize, builder.config.llvm_release_debuginfo) {
@@ -189,10 +192,10 @@ impl Step for Llvm {
189192
}
190193

191194
if want_lldb {
192-
cfg.define("LLVM_EXTERNAL_CLANG_SOURCE_DIR", builder.src.join("src/tools/clang"));
193-
cfg.define("LLVM_EXTERNAL_LLDB_SOURCE_DIR", builder.src.join("src/tools/lldb"));
195+
cfg.define("LLVM_ENABLE_PROJECTS", "clang;lldb");
194196
// For the time being, disable code signing.
195197
cfg.define("LLDB_CODESIGN_IDENTITY", "");
198+
cfg.define("LLDB_NO_DEBUGSERVER", "ON");
196199
} else {
197200
// LLDB requires libxml2; but otherwise we want it to be disabled.
198201
// See https://github.com/rust-lang/rust/pull/50104
@@ -411,7 +414,7 @@ impl Step for Lld {
411414
const ONLY_HOSTS: bool = true;
412415

413416
fn should_run(run: ShouldRun) -> ShouldRun {
414-
run.path("src/tools/lld")
417+
run.path("src/llvm-project/lld").path("src/tools/lld")
415418
}
416419

417420
fn make_run(run: RunConfig) {
@@ -441,7 +444,7 @@ impl Step for Lld {
441444
let _time = util::timeit(&builder);
442445
t!(fs::create_dir_all(&out_dir));
443446

444-
let mut cfg = cmake::Config::new(builder.src.join("src/tools/lld"));
447+
let mut cfg = cmake::Config::new(builder.src.join("src/llvm-project/lld"));
445448
configure_cmake(builder, target, &mut cfg);
446449

447450
// This is an awful, awful hack. Discovered when we migrated to using

src/ci/init_repo.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ function fetch_submodule {
4545
rm $cached
4646
}
4747

48-
included="src/llvm src/llvm-emscripten src/doc/book src/doc/rust-by-example"
49-
included="$included src/tools/lld src/tools/clang src/tools/lldb"
48+
included="src/llvm-project src/llvm-emscripten src/doc/book src/doc/rust-by-example"
5049
modules="$(git config --file .gitmodules --get-regexp '\.path$' | cut -d' ' -f2)"
5150
modules=($modules)
5251
use_git=""

src/librustc_codegen_llvm/debuginfo/metadata.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use value::Value;
1313

1414
use llvm;
1515
use llvm::debuginfo::{DIArray, DIType, DIFile, DIScope, DIDescriptor,
16-
DICompositeType, DILexicalBlock, DIFlags};
16+
DICompositeType, DILexicalBlock, DIFlags, DebugEmissionKind};
1717
use llvm_util;
1818

1919
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
@@ -846,6 +846,7 @@ pub fn compile_unit_metadata(tcx: TyCtxt,
846846
let producer = CString::new(producer).unwrap();
847847
let flags = "\0";
848848
let split_name = "\0";
849+
let kind = DebugEmissionKind::from_generic(tcx.sess.opts.debuginfo);
849850

850851
unsafe {
851852
let file_metadata = llvm::LLVMRustDIBuilderCreateFile(
@@ -859,7 +860,8 @@ pub fn compile_unit_metadata(tcx: TyCtxt,
859860
tcx.sess.opts.optimize != config::OptLevel::No,
860861
flags.as_ptr() as *const _,
861862
0,
862-
split_name.as_ptr() as *const _);
863+
split_name.as_ptr() as *const _,
864+
kind);
863865

864866
if tcx.sess.opts.debugging_opts.profile {
865867
let cu_desc_metadata = llvm::LLVMRustMetadataAsValue(debug_context.llcontext,

src/librustc_codegen_llvm/debuginfo/mod.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use self::source_loc::InternalDebugLocation::{self, UnknownLocation};
1212

1313
use llvm;
1414
use llvm::debuginfo::{DIFile, DIType, DIScope, DIBuilder, DISubprogram, DIArray, DIFlags,
15-
DILexicalBlock};
15+
DISPFlags, DILexicalBlock};
1616
use rustc::hir::CodegenFnAttrFlags;
1717
use rustc::hir::def_id::{DefId, CrateNum, LOCAL_CRATE};
1818
use rustc::ty::subst::{Substs, UnpackedKind};
@@ -283,7 +283,6 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
283283
let linkage_name = mangled_name_of_instance(self, instance);
284284

285285
let scope_line = span_start(self, span).line;
286-
let is_local_to_unit = is_node_local_to_unit(self, def_id);
287286

288287
let function_name = CString::new(name).unwrap();
289288
let linkage_name = SmallCStr::new(&linkage_name.as_str());
@@ -300,6 +299,14 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
300299
flags |= DIFlags::FlagNoReturn;
301300
}
302301

302+
let mut spflags = DISPFlags::SPFlagDefinition;
303+
if is_node_local_to_unit(self, def_id) {
304+
spflags |= DISPFlags::SPFlagLocalToUnit;
305+
}
306+
if self.sess().opts.optimize != config::OptLevel::No {
307+
spflags |= DISPFlags::SPFlagOptimized;
308+
}
309+
303310
let fn_metadata = unsafe {
304311
llvm::LLVMRustDIBuilderCreateFunction(
305312
DIB(self),
@@ -309,11 +316,9 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
309316
file_metadata,
310317
loc.line as c_uint,
311318
function_type_metadata,
312-
is_local_to_unit,
313-
true,
314319
scope_line as c_uint,
315320
flags,
316-
self.sess().opts.optimize != config::OptLevel::No,
321+
spflags,
317322
llfn,
318323
template_parameters,
319324
None)

0 commit comments

Comments
 (0)