about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm/back
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-10-29 07:38:50 +0000
committerbors <bors@rust-lang.org>2019-10-29 07:38:50 +0000
commiteb5ef813f0d6e3fe8edd3abb046a18f5b1a8cc48 (patch)
tree09f496e9fb2a3c149deb5c2e19b4f421a56b0a12 /src/librustc_codegen_llvm/back
parent2dd4e7320e620dc9a59423c55a7db3520ba8b553 (diff)
parenta63dfb3b82a44e31bdfadb13d240a5366f9979fb (diff)
Auto merge of #65435 - michaelwoerister:fix-issue-64153, r=alexcrichton
Fix #64153

This PR changes how the compiler detects if an object file from an upstream crate is a Rust object file or not. Instead of checking if the name starts with the crate name and ends with `.o` (which is not always the case, as described in #64153), it now just checks if the filename ends with `.rcgu.o`.

This fixes #64153. However, ideally we'd clean up the code around filename generation some more. Then this check could be made more robust.

r? @alexcrichton
Diffstat (limited to 'src/librustc_codegen_llvm/back')
-rw-r--r--src/librustc_codegen_llvm/back/archive.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/librustc_codegen_llvm/back/archive.rs b/src/librustc_codegen_llvm/back/archive.rs
index 68d3f90cd39..e169cfc4cc8 100644
--- a/src/librustc_codegen_llvm/back/archive.rs
+++ b/src/librustc_codegen_llvm/back/archive.rs
@@ -9,7 +9,9 @@ use std::str;
 
 use crate::llvm::archive_ro::{ArchiveRO, Child};
 use crate::llvm::{self, ArchiveKind};
-use rustc_codegen_ssa::{METADATA_FILENAME, RLIB_BYTECODE_EXTENSION};
+use rustc_codegen_ssa::{
+    METADATA_FILENAME, RLIB_BYTECODE_EXTENSION, looks_like_rust_object_file
+};
 use rustc_codegen_ssa::back::archive::{ArchiveBuilder, find_library};
 use rustc::session::Session;
 use syntax::symbol::Symbol;
@@ -141,7 +143,7 @@ impl<'a> ArchiveBuilder<'a> for LlvmArchiveBuilder<'a> {
             }
 
             // Don't include Rust objects if LTO is enabled
-            if lto && fname.starts_with(&obj_start) && fname.ends_with(".o") {
+            if lto && looks_like_rust_object_file(fname) {
                 return true
             }