Skip to content

Commit

Permalink
Auto merge of rust-lang#57675 - cuviper:llvm-monorepo, r=alexcrichton
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed Jan 26, 2019
2 parents 37d51aa + 059ed4f commit 9df043b
Show file tree
Hide file tree
Showing 21 changed files with 224 additions and 76 deletions.
21 changes: 5 additions & 16 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[submodule "src/llvm"]
path = src/llvm
url = https://github.com/rust-lang/llvm.git
branch = master
[submodule "src/rust-installer"]
path = src/tools/rust-installer
url = https://github.com/rust-lang/rust-installer.git
Expand Down Expand Up @@ -38,20 +34,13 @@
[submodule "src/stdsimd"]
path = src/stdsimd
url = https://github.com/rust-lang-nursery/stdsimd.git
[submodule "src/tools/lld"]
path = src/tools/lld
url = https://github.com/rust-lang/lld.git
[submodule "src/tools/lldb"]
path = src/tools/lldb
url = https://github.com/rust-lang-nursery/lldb.git
branch = rust-release-80-v2
[submodule "src/tools/clang"]
path = src/tools/clang
url = https://github.com/rust-lang-nursery/clang.git
branch = rust-release-80-v2
[submodule "src/doc/rustc-guide"]
path = src/doc/rustc-guide
url = https://github.com/rust-lang/rustc-guide.git
[submodule "src/doc/edition-guide"]
path = src/doc/edition-guide
url = https://github.com/rust-lang-nursery/edition-guide
url = https://github.com/rust-lang-nursery/edition-guide.git
[submodule "src/llvm-project"]
path = src/llvm-project
url = https://github.com/rust-lang/llvm-project.git
branch = rustc/8.0-2019-01-16
6 changes: 3 additions & 3 deletions COPYRIGHT
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The Rust Project includes packages written by third parties.
The following third party packages are included, and carry
their own copyright notices and license terms:

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

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

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

* compiler-rt, in src/compiler-rt is dual licensed under
LLVM's license and MIT:
Expand Down
12 changes: 6 additions & 6 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ dependencies = [

[[package]]
name = "dlmalloc"
version = "0.1.1"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
Expand Down Expand Up @@ -1969,7 +1969,7 @@ name = "rand_chacha"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
]

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

[[package]]
Expand All @@ -2016,7 +2016,7 @@ name = "rand_xorshift"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
Expand Down Expand Up @@ -3073,7 +3073,7 @@ dependencies = [
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
"compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"core 0.0.0",
"dlmalloc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"dlmalloc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"fortanix-sgx-abi 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
"panic_abort 0.0.0",
Expand Down Expand Up @@ -3816,7 +3816,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3c2b69f912779fbb121ceb775d74d51e915af17aaebc38d28a592843a2dd0a3a"
"checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
"checksum directories 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "72d337a64190607d4fcca2cb78982c5dd57f4916e19696b48a575fa746b6cb0f"
"checksum dlmalloc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4c46c65de42b063004b31c67a98abe071089b289ff0919c660ed7ff4f59317f8"
"checksum dlmalloc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d56ad71b31043818d0ee10a7fb9664882f8e45849c81647585e6a3124f185517"
"checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0"
"checksum elasticlunr-rs 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a99a310cd1f9770e7bf8e48810c7bcbb0e078c8fb23a8c7bcf0da4c2bf61a455"
"checksum ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f56c93cc076508c549d9bb747f79aa9b4eb098be7b8cad8830c3137ef52d1e00"
Expand Down
12 changes: 2 additions & 10 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,21 +701,13 @@ def update_submodules(self):
filtered_submodules = []
submodules_names = []
for module in submodules:
if module.endswith("llvm"):
if self.get_toml('llvm-config'):
if module.endswith("llvm-project"):
if self.get_toml('llvm-config') and self.get_toml('lld') != 'true':
continue
if module.endswith("llvm-emscripten"):
backends = self.get_toml('codegen-backends')
if backends is None or not 'emscripten' in backends:
continue
if module.endswith("lld"):
config = self.get_toml('lld')
if config is None or config == 'false':
continue
if module.endswith("lldb") or module.endswith("clang"):
config = self.get_toml('lldb')
if config is None or config == 'false':
continue
check = self.check_submodule(module, slow_submodules)
filtered_submodules.append((module, check))
submodules_names.append(module)
Expand Down
25 changes: 21 additions & 4 deletions src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,24 @@ fn copy_src_dirs(builder: &Builder, src_dirs: &[&str], exclude_dirs: &[&str], ds
if spath.ends_with("~") || spath.ends_with(".pyc") {
return false
}
if (spath.contains("llvm/test") || spath.contains("llvm\\test")) &&

const LLVM_PROJECTS: &[&str] = &[
"llvm-project/clang", "llvm-project\\clang",
"llvm-project/lld", "llvm-project\\lld",
"llvm-project/lldb", "llvm-project\\lldb",
"llvm-project/llvm", "llvm-project\\llvm",
];
if spath.contains("llvm-project") && !spath.ends_with("llvm-project")
&& !LLVM_PROJECTS.iter().any(|path| spath.contains(path))
{
return false;
}

const LLVM_TEST: &[&str] = &[
"llvm-project/llvm/test", "llvm-project\\llvm\\test",
"llvm-emscripten/test", "llvm-emscripten\\test",
];
if LLVM_TEST.iter().any(|path| spath.contains(path)) &&
(spath.ends_with(".ll") ||
spath.ends_with(".td") ||
spath.ends_with(".s")) {
Expand Down Expand Up @@ -2076,7 +2093,7 @@ impl Step for LlvmTools {
}

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

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

fn should_run(run: ShouldRun) -> ShouldRun {
run.path("src/tools/lldb")
run.path("src/llvm-project/lldb").path("src/tools/lldb")
}

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

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

let tmp = tmpdir(builder);
Expand Down
15 changes: 9 additions & 6 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ impl Step for Llvm {
const ONLY_HOSTS: bool = true;

fn should_run(run: ShouldRun) -> ShouldRun {
run.path("src/llvm").path("src/llvm-emscripten")
run.path("src/llvm-project")
.path("src/llvm-project/llvm")
.path("src/llvm")
.path("src/llvm-emscripten")
}

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

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

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

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

fn should_run(run: ShouldRun) -> ShouldRun {
run.path("src/tools/lld")
run.path("src/llvm-project/lld").path("src/tools/lld")
}

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

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

// This is an awful, awful hack. Discovered when we migrated to using
Expand Down
3 changes: 1 addition & 2 deletions src/ci/init_repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ function fetch_submodule {
rm $cached
}

included="src/llvm src/llvm-emscripten src/doc/book src/doc/rust-by-example"
included="$included src/tools/lld src/tools/clang src/tools/lldb"
included="src/llvm-project src/llvm-emscripten src/doc/book src/doc/rust-by-example"
modules="$(git config --file .gitmodules --get-regexp '\.path$' | cut -d' ' -f2)"
modules=($modules)
use_git=""
Expand Down
6 changes: 4 additions & 2 deletions src/librustc_codegen_llvm/debuginfo/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use value::Value;

use llvm;
use llvm::debuginfo::{DIArray, DIType, DIFile, DIScope, DIDescriptor,
DICompositeType, DILexicalBlock, DIFlags};
DICompositeType, DILexicalBlock, DIFlags, DebugEmissionKind};
use llvm_util;

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

unsafe {
let file_metadata = llvm::LLVMRustDIBuilderCreateFile(
Expand All @@ -859,7 +860,8 @@ pub fn compile_unit_metadata(tcx: TyCtxt,
tcx.sess.opts.optimize != config::OptLevel::No,
flags.as_ptr() as *const _,
0,
split_name.as_ptr() as *const _);
split_name.as_ptr() as *const _,
kind);

if tcx.sess.opts.debugging_opts.profile {
let cu_desc_metadata = llvm::LLVMRustMetadataAsValue(debug_context.llcontext,
Expand Down
15 changes: 10 additions & 5 deletions src/librustc_codegen_llvm/debuginfo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use self::source_loc::InternalDebugLocation::{self, UnknownLocation};

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

let scope_line = span_start(self, span).line;
let is_local_to_unit = is_node_local_to_unit(self, def_id);

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

let mut spflags = DISPFlags::SPFlagDefinition;
if is_node_local_to_unit(self, def_id) {
spflags |= DISPFlags::SPFlagLocalToUnit;
}
if self.sess().opts.optimize != config::OptLevel::No {
spflags |= DISPFlags::SPFlagOptimized;
}

let fn_metadata = unsafe {
llvm::LLVMRustDIBuilderCreateFunction(
DIB(self),
Expand All @@ -309,11 +316,9 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
file_metadata,
loc.line as c_uint,
function_type_metadata,
is_local_to_unit,
true,
scope_line as c_uint,
flags,
self.sess().opts.optimize != config::OptLevel::No,
spflags,
llfn,
template_parameters,
None)
Expand Down
Loading

0 comments on commit 9df043b

Please sign in to comment.