rustc: Avoid 16-byte filenames in rlibs
In addition to avoiding 16-byte filenames with bytecode files, this commit also avoids 16-byte filenames with object files pulled in from native libraries.
This commit is contained in:
parent
6a43af3f84
commit
2290dbb8cc
|
@ -166,6 +166,15 @@ impl<'a> Archive<'a> {
|
|||
if filename.contains(".SYMDEF") { continue }
|
||||
|
||||
let filename = format!("r-{}-{}", name, filename);
|
||||
// LLDB (as mentioned in back::link) crashes on filenames of exactly
|
||||
// 16 bytes in length. If we're including an object file with
|
||||
// exactly 16-bytes of characters, give it some prefix so that it's
|
||||
// not 16 bytes.
|
||||
let filename = if filename.len() == 16 {
|
||||
format!("lldb-fix-{}", filename)
|
||||
} else {
|
||||
filename
|
||||
};
|
||||
let new_filename = file.with_filename(filename);
|
||||
try!(fs::rename(file, &new_filename));
|
||||
inputs.push(new_filename);
|
||||
|
|
|
@ -958,10 +958,11 @@ fn link_rlib<'a>(sess: &'a Session,
|
|||
|
||||
// For LTO purposes, the bytecode of this library is also inserted
|
||||
// into the archive.
|
||||
// Note that we make sure that the bytecode filename in the archive is always at least
|
||||
// 16 bytes long by adding a 16 byte extension to it. This is to work around a bug in
|
||||
// LLDB that would cause it to crash if the name of a file in an archive was exactly
|
||||
// 16 bytes.
|
||||
//
|
||||
// Note that we make sure that the bytecode filename in the archive
|
||||
// is never exactly 16 bytes long by adding a 16 byte extension to
|
||||
// it. This is to work around a bug in LLDB that would cause it to
|
||||
// crash if the name of a file in an archive was exactly 16 bytes.
|
||||
let bc = obj_filename.with_extension("bc");
|
||||
let bc_deflated = obj_filename.with_extension("bytecode.deflate");
|
||||
match fs::File::open(&bc).read_to_end().and_then(|data| {
|
||||
|
|
Loading…
Reference in New Issue