Skip to content

Commit 3ef16f8

Browse files
---
yaml --- r: 117747 b: refs/heads/auto c: c7426cf h: refs/heads/master i: 117745: 9ff7201 117743: f35c669 v: v3
1 parent f0dfacb commit 3ef16f8

File tree

4 files changed

+25
-7
lines changed

4 files changed

+25
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 0a98a4e422bd2d80ee7910b00c0286f1eefde9c5
16+
refs/heads/auto: c7426cf05a166fca8aa76a690bad17111ea0dea4
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/librustc/lib/llvm.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1809,6 +1809,7 @@ pub mod llvm {
18091809
pub fn LLVMRustDestroyArchive(AR: ArchiveRef);
18101810

18111811
pub fn LLVMRustSetDLLExportStorageClass(V: ValueRef);
1812+
pub fn LLVMVersionMajor() -> c_int;
18121813
pub fn LLVMVersionMinor() -> c_int;
18131814

18141815
pub fn LLVMRustGetSectionName(SI: SectionIteratorRef,

branches/auto/src/librustc/middle/trans/debuginfo.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ use std::collections::HashSet;
179179
use std::gc::Gc;
180180
use std::ptr;
181181
use std::rc::{Rc, Weak};
182-
use std::sync::atomics;
183182
use syntax::util::interner::Interner;
184183
use syntax::codemap::{Span, Pos};
185184
use syntax::{abi, ast, codemap, ast_util, ast_map};
@@ -2356,9 +2355,22 @@ fn set_members_of_composite_type(cx: &CrateContext,
23562355
let mut composite_types_completed =
23572356
debug_context(cx).composite_types_completed.borrow_mut();
23582357
if composite_types_completed.contains(&composite_type_metadata) {
2359-
cx.sess().span_bug(definition_span, "debuginfo::set_members_of_composite_type() - \
2360-
Already completed forward declaration \
2361-
re-encountered.");
2358+
let (llvm_version_major, llvm_version_minor) = unsafe {
2359+
(llvm::LLVMVersionMajor(), llvm::LLVMVersionMinor())
2360+
};
2361+
2362+
let actual_llvm_version = llvm_version_major * 1000000 + llvm_version_minor * 1000;
2363+
let min_supported_llvm_version = 3 * 1000000 + 4 * 1000;
2364+
2365+
if actual_llvm_version < min_supported_llvm_version {
2366+
cx.sess().warn(format!("This version of rustc was built with LLVM {}.{}. \
2367+
Rustc just ran into a known debuginfo corruption problem that \
2368+
often occurs with LLVM versions below 3.4. Please use a rustc built with a \
2369+
newer version of LLVM.", llvm_version_major, llvm_version_minor).as_slice());
2370+
} else {
2371+
cx.sess().bug("debuginfo::set_members_of_composite_type() - \
2372+
Already completed forward declaration re-encountered.");
2373+
}
23622374
} else {
23632375
composite_types_completed.insert(composite_type_metadata);
23642376
}

branches/auto/src/rustllvm/RustWrapper.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ extern "C" LLVMValueRef LLVMDIBuilderCreateStructType(
318318
unwrapDI<DIArray>(Elements),
319319
RunTimeLang,
320320
unwrapDI<DIType>(VTableHolder)
321-
#if LLVM_VERSION_MINOR >= 5
321+
#if LLVM_VERSION_MINOR >= 4
322322
,UniqueId
323323
#endif
324324
));
@@ -510,7 +510,7 @@ extern "C" LLVMValueRef LLVMDIBuilderCreateUnionType(
510510
Flags,
511511
unwrapDI<DIArray>(Elements),
512512
RunTimeLang
513-
#if LLVM_VERSION_MINOR >= 5
513+
#if LLVM_VERSION_MINOR >= 4
514514
,UniqueId
515515
#endif
516516
));
@@ -734,6 +734,11 @@ LLVMVersionMinor() {
734734
return LLVM_VERSION_MINOR;
735735
}
736736

737+
extern "C" int
738+
LLVMVersionMajor() {
739+
return LLVM_VERSION_MAJOR;
740+
}
741+
737742
// Note that the two following functions look quite similar to the
738743
// LLVMGetSectionName function. Sadly, it appears that this function only
739744
// returns a char* pointer, which isn't guaranteed to be null-terminated. The

0 commit comments

Comments
 (0)