Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 8 pull requests #70305

Merged
merged 27 commits into from
Mar 23, 2020
Merged
Changes from 2 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
24dc2cb
librustc_codegen_llvm: Replace deprecated API usage
tmiasko Mar 11, 2020
71f5aed
Rename add_lib_path to add_dylib_path
cuviper Mar 18, 2020
0536b8d
Ensure LLVM is in the link path for rustc tools
cuviper Mar 18, 2020
e1a6a30
Revert "Fix missing libLLVM.so in stage0 sysroot."
cuviper Mar 18, 2020
d1a4a57
Update the bundled wasi-libc with libstd
alexcrichton Mar 19, 2020
3a2a442
Avoid llvm-config in more situations, like bootstrap test runs
cuviper Mar 19, 2020
10f08ab
rustc: keep upvars tupled in {Closure,Generator}Substs.
eddyb Mar 13, 2020
3fd397b
rustc: make {Closure,Generator}Substs::split as cheap as possible.
eddyb Mar 18, 2020
d9a15cc
rustc_typeck: move comment about inference variables to where it make…
eddyb Mar 18, 2020
52fbd3e
Increase verbosity when suggesting subtle code changes
estebank Mar 12, 2020
94bbd46
Add span label to primary error span
estebank Mar 22, 2020
29df39b
remove UbExperimental variant
RalfJung Mar 22, 2020
854b78f
Normalize wording of privacy access labels
estebank Mar 22, 2020
9175940
Use more targetted span for error label
estebank Mar 22, 2020
7023948
rustc_codegen_llvm: don't generate "lexical block" scopes for -Cdebug…
eddyb Feb 11, 2020
c923f04
rustc_codegen_llvm: don't generate Self type debuginfo for methods fo…
eddyb Feb 11, 2020
d6f4a2f
rustc_codegen_llvm: don't generate static and vtable debuginfo for -C…
eddyb Feb 11, 2020
b5e78a2
rustc_llvm: don't use -g when LLVM_NDEBUG is set.
eddyb Feb 12, 2020
c3c0a09
resolve: Do not resolve visibilities on proc macro definitions twice
petrochenkov Mar 21, 2020
1980242
Rollup merge of #69080 - eddyb:one-billion-dwarves-walk-into-a-bar, r…
Centril Mar 23, 2020
61a56fb
Rollup merge of #69940 - tmiasko:llvm-api, r=hanna-kruppe
Centril Mar 23, 2020
906b399
Rollup merge of #69942 - estebank:sized-verbose-sugg, r=matthewjasper
Centril Mar 23, 2020
bee074f
Rollup merge of #69968 - eddyb:tupled-closure-captures, r=nikomatsakis
Centril Mar 23, 2020
9423c4f
Rollup merge of #70123 - cuviper:library-path, r=Mark-Simulacrum
Centril Mar 23, 2020
edbbb49
Rollup merge of #70159 - alexcrichton:update-wasi, r=pietroalbini
Centril Mar 23, 2020
bb85308
Rollup merge of #70233 - petrochenkov:superproc, r=ecstatic-morse
Centril Mar 23, 2020
07e1043
Rollup merge of #70286 - RalfJung:no-experiments, r=petrochenkov
Centril Mar 23, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/librustc_codegen_llvm/base.rs
Original file line number Diff line number Diff line change
@@ -71,8 +71,7 @@ pub fn write_compressed_metadata<'tcx>(
// flags, at least for ELF outputs, so that the
// metadata doesn't get loaded into memory.
let directive = format!(".section {}", section_name);
let directive = CString::new(directive).unwrap();
llvm::LLVMSetModuleInlineAsm(metadata_llmod, directive.as_ptr())
llvm::LLVMSetModuleInlineAsm2(metadata_llmod, directive.as_ptr().cast(), directive.len())
}
}

4 changes: 2 additions & 2 deletions src/librustc_codegen_llvm/consts.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::base;
use crate::common::CodegenCx;
use crate::debuginfo;
use crate::llvm::{self, SetUnnamedAddr, True};
use crate::llvm::{self, True};
use crate::type_::Type;
use crate::type_of::LayoutLlvmExt;
use crate::value::Value;
@@ -183,7 +183,7 @@ impl CodegenCx<'ll, 'tcx> {
};
llvm::LLVMSetInitializer(gv, cv);
set_global_alignment(&self, gv, align);
SetUnnamedAddr(gv, true);
llvm::SetUnnamedAddress(gv, llvm::UnnamedAddr::Global);
gv
}
}
4 changes: 2 additions & 2 deletions src/librustc_codegen_llvm/context.rs
Original file line number Diff line number Diff line change
@@ -166,7 +166,7 @@ pub unsafe fn create_module(
llvm::LLVMRustSetDataLayoutFromTargetMachine(llmod, tm);
llvm::LLVMRustDisposeTargetMachine(tm);

let llvm_data_layout = llvm::LLVMGetDataLayout(llmod);
let llvm_data_layout = llvm::LLVMGetDataLayoutStr(llmod);
let llvm_data_layout = str::from_utf8(CStr::from_ptr(llvm_data_layout).to_bytes())
.expect("got a non-UTF8 data-layout from LLVM");

@@ -458,7 +458,7 @@ impl CodegenCx<'b, 'tcx> {
self.type_variadic_func(&[], ret)
};
let f = self.declare_cfn(name, fn_ty);
llvm::SetUnnamedAddr(f, false);
llvm::SetUnnamedAddress(f, llvm::UnnamedAddr::No);
self.intrinsics.borrow_mut().insert(name, f);
f
}
2 changes: 1 addition & 1 deletion src/librustc_codegen_llvm/debuginfo/gdb.rs
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ pub fn get_or_insert_gdb_debug_scripts_section_global(cx: &CodegenCx<'ll, '_>) -
llvm::LLVMSetSection(section_var, section_name.as_ptr().cast());
llvm::LLVMSetInitializer(section_var, cx.const_bytes(section_contents));
llvm::LLVMSetGlobalConstant(section_var, llvm::True);
llvm::LLVMSetUnnamedAddr(section_var, llvm::True);
llvm::LLVMSetUnnamedAddress(section_var, llvm::UnnamedAddr::Global);
llvm::LLVMRustSetLinkage(section_var, llvm::Linkage::LinkOnceODRLinkage);
// This should make sure that the whole section is not larger than
// the string it contains. Otherwise we get a warning from GDB.
2 changes: 1 addition & 1 deletion src/librustc_codegen_llvm/declare.rs
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ fn declare_raw_fn(
llvm::SetFunctionCallConv(llfn, callconv);
// Function addresses in Rust are never significant, allowing functions to
// be merged.
llvm::SetUnnamedAddr(llfn, true);
llvm::SetUnnamedAddress(llfn, llvm::UnnamedAddr::Global);

if cx.tcx.sess.opts.cg.no_redzone.unwrap_or(cx.tcx.sess.target.target.options.disable_redzone) {
llvm::Attribute::NoRedZone.apply_llfn(Function, llfn);
6 changes: 3 additions & 3 deletions src/librustc_codegen_llvm/intrinsic.rs
Original file line number Diff line number Diff line change
@@ -1662,7 +1662,7 @@ fn generic_simd_intrinsic(
llvm_elem_vec_ty,
),
);
llvm::SetUnnamedAddr(f, false);
llvm::SetUnnamedAddress(f, llvm::UnnamedAddr::No);
let v = bx.call(f, &[args[1].immediate(), alignment, mask, args[0].immediate()], None);
return Ok(v);
}
@@ -1784,7 +1784,7 @@ fn generic_simd_intrinsic(
&llvm_intrinsic,
bx.type_func(&[llvm_elem_vec_ty, llvm_pointer_vec_ty, alignment_ty, mask_ty], ret_t),
);
llvm::SetUnnamedAddr(f, false);
llvm::SetUnnamedAddress(f, llvm::UnnamedAddr::No);
let v = bx.call(f, &[args[0].immediate(), args[1].immediate(), alignment, mask], None);
return Ok(v);
}
@@ -2083,7 +2083,7 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
let vec_ty = bx.cx.type_vector(elem_ty, in_len as u64);

let f = bx.declare_cfn(&llvm_intrinsic, bx.type_func(&[vec_ty, vec_ty], vec_ty));
llvm::SetUnnamedAddr(f, false);
llvm::SetUnnamedAddress(f, llvm::UnnamedAddr::No);
let v = bx.call(f, &[lhs, rhs], None);
return Ok(v);
}
14 changes: 11 additions & 3 deletions src/librustc_codegen_llvm/llvm/ffi.rs
Original file line number Diff line number Diff line change
@@ -73,6 +73,14 @@ pub enum Visibility {
Protected = 2,
}

/// LLVMUnnamedAddr
#[repr(C)]
pub enum UnnamedAddr {
No,
Local,
Global,
}

/// LLVMDLLStorageClass
#[derive(Copy, Clone)]
#[repr(C)]
@@ -727,11 +735,11 @@ extern "C" {
pub fn LLVMCloneModule(M: &Module) -> &Module;

/// Data layout. See Module::getDataLayout.
pub fn LLVMGetDataLayout(M: &Module) -> *const c_char;
pub fn LLVMGetDataLayoutStr(M: &Module) -> *const c_char;
pub fn LLVMSetDataLayout(M: &Module, Triple: *const c_char);

/// See Module::setModuleInlineAsm.
pub fn LLVMSetModuleInlineAsm(M: &Module, Asm: *const c_char);
pub fn LLVMSetModuleInlineAsm2(M: &Module, Asm: *const c_char, AsmLen: size_t);
pub fn LLVMRustAppendModuleInlineAsm(M: &Module, Asm: *const c_char, AsmLen: size_t);

/// See llvm::LLVMTypeKind::getTypeID.
@@ -1853,7 +1861,7 @@ extern "C" {
UniqueIdLen: size_t,
) -> &'a DIDerivedType;

pub fn LLVMSetUnnamedAddr(GlobalVar: &Value, UnnamedAddr: Bool);
pub fn LLVMSetUnnamedAddress(Global: &Value, UnnamedAddr: UnnamedAddr);

pub fn LLVMRustDIBuilderCreateTemplateTypeParameter(
Builder: &DIBuilder<'a>,
4 changes: 2 additions & 2 deletions src/librustc_codegen_llvm/llvm/mod.rs
Original file line number Diff line number Diff line change
@@ -106,9 +106,9 @@ pub fn UnsetComdat(val: &'a Value) {
}
}

pub fn SetUnnamedAddr(global: &'a Value, unnamed: bool) {
pub fn SetUnnamedAddress(global: &'a Value, unnamed: UnnamedAddr) {
unsafe {
LLVMSetUnnamedAddr(global, unnamed as Bool);
LLVMSetUnnamedAddress(global, unnamed);
}
}