Issue 1:
$ make check-notidy TESTNAME='sepcomp-lib-lto'
cfg: version 1.1.0-dev (3906edf41 2015-05-09) (built 2015-05-10)
cfg: build triple x86_64-pc-windows-gnu
cfg: host triples x86_64-pc-windows-gnu
cfg: target triples x86_64-pc-windows-gnu
cfg: enabling debug assertions (CFG_ENABLE_DEBUG_ASSERTIONS)
cfg: enabling debuginfo (CFG_ENABLE_DEBUGINFO)
cfg: host for x86_64-pc-windows-gnu is x86_64
cfg: os for x86_64-pc-windows-gnu is pc-windows-gnu
cfg: good valgrind for x86_64-pc-windows-gnu is
cfg: using CC=gcc (CFG_CC)
cfg: disabling valgrind run-pass tests
cfg: no xelatex found, disabling LaTeX docs
cfg: no pandoc found, omitting PDF and EPUB docs
cfg: including test rules
cfg: javac not available, skipping lexer test...
run rpass [x86_64-pc-windows-gnu]: x86_64-pc-windows-gnu/stage2/bin/compiletest.exe

running 1 test
test [run-pass] run-pass/sepcomp-lib-lto.rs ... FAILED

failures:

---- [run-pass] run-pass/sepcomp-lib-lto.rs stdout ----

error: compilation failed!
status: exit code: 3
command: PATH="x86_64-pc-windows-gnu/stage2/bin;C:\msys64\home\rust\x86_64-pc-windows-gnu\stage2\bin;C:\msys64\mingw64\bin;C:\msys64\usr\local\bin;C:\msys64\usr\bin;C:\msys64\usr\bin" x86_64-pc-windows-gnu/stage2/bin/rustc.exe C:/msys64/home/rust/src/test/run-pass/sepcomp-lib-lto.rs -L x86_64-pc-windows-gnu/test/run-pass/ --target=x86_64-pc-windows-gnu -L x86_64-pc-windows-gnu/test/run-pass\sepcomp-lib-lto.stage2-x86_64-pc-windows-gnu.run-pass.libaux -o x86_64-pc-windows-gnu/test/run-pass\sepcomp-lib-lto.stage2-x86_64-pc-windows-gnu.exe --cfg rtopt --cfg debug -O -L x86_64-pc-windows-gnu/rt -C lto
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
Assertion failed!

Program: C:\msys64\home\rust\x86_64-pc-windows-gnu\stage2\bin\rustc.exe
File: C:/msys64/home/rust/src/llvm/lib/CodeGen/LexicalScopes.cpp, Line 179

Expression: DISubprogram(Scope).describes(MF->getFunction())

------------------------------------------

thread '[run-pass] run-pass/sepcomp-lib-lto.rs' panicked at 'explicit panic', C:/msys64/home/rust/src/compiletest\runtest.rs:1525

failures:
[run-pass] run-pass/sepcomp-lib-lto.rs

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured

I'm using msys2 x64 on Windows 7 and a fresh clone of Rust.

cc #23566

Issue 2:
When compiling with --enable-debug, the sepcomp-lib-lto test fails. It passes if I build without --enable-debug. Relevant build output:

$ git rev-parse HEAD
a9515698fa456390386087ccb6123ce741f18527
$ uname -a
Linux dev 3.19.0-18-generic #18-Ubuntu SMP Tue May 19 18:31:35 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
$ ./configure --enable-debug
$ make -j12 check-stage1-rpass TESTNAME=sepcomp-lib-lto

...

running 1 test
test [run-pass] run-pass/sepcomp-lib-lto.rs ... FAILED

failures:

---- [run-pass] run-pass/sepcomp-lib-lto.rs stdout ----

error: compilation failed!
status: signal: 6
command: x86_64-unknown-linux-gnu/stage1/bin/rustc /home/ubuntu/rust/src/test/run-pass/sepcomp-lib-lto.rs -L x86_64-unknown-linux-gnu/test/run-pass/ --target=x86_64-unknown-linux-gnu -L x86_64-unknown-linux-gnu/test/run-pass/sepcomp-lib-lto.stage1-x86_64-unknown-linux-gnu.run-pass.libaux -o x86_64-unknown-linux-gnu/test/run-pass/sepcomp-lib-lto.stage1-x86_64-unknown-linux-gnu -O -L x86_64-unknown-linux-gnu/rt -C lto
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
rustc: /home/ubuntu/rust/src/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp:708: llvm::DIE* llvm::DwarfUnit::getOrCreateTypeDIE(const llvm::MDNode*): Assertion `Ty == resolve(Ty->getRef()) && "type was not uniqued, possible ODR violation."' failed.

------------------------------------------

thread '[run-pass] run-pass/sepcomp-lib-lto.rs' panicked at 'explicit panic', /home/ubuntu/rust/src/compiletest/runtest.rs:1497

failures:
[run-pass] run-pass/sepcomp-lib-lto.rs

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured

thread '<main>' panicked at 'Some tests failed', /home/ubuntu/rust/src/compiletest/compiletest.rs:252
/home/ubuntu/rust/mk/tests.mk:756: recipe for target 'tmp/check-stage1-T-x86_64-unknown-linux-gnu-H-x86_64-unknown-linux-gnu-rpass.ok' failed
make: *** [tmp/check-stage1-T-x86_64-unknown-linux-gnu-H-x86_64-unknown-linux-gnu-rpass.ok] Error 101

Backtrace:

#0 0x00007ffff6cb0267 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:55
#1 0x00007ffff6cb1eca in __GI_abort () at abort.c:89
#2 0x00007ffff6ca903d in __assert_fail_base (fmt=0x7ffff6e0b028 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
assertion=assertion@entry=0x7ffff1e75ca8 "Ty == resolve(Ty->getRef()) && \"type was not uniqued, possible ODR violation.\"", file=file@entry=0x7ffff1e75878 "/home/ubuntu/rust/src/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp",
line=line@entry=708,
function=function@entry=0x7ffff1e78300 <llvm::DwarfUnit::getOrCreateTypeDIE(llvm::MDNode const*)::__PRETTY_FUNCTION__> "llvm::DIE* llvm::DwarfUnit::getOrCreateTypeDIE(const llvm::MDNode*)") at assert.c:92
#3 0x00007ffff6ca90f2 in __GI___assert_fail (
assertion=0x7ffff1e75ca8 "Ty == resolve(Ty->getRef()) && \"type was not uniqued, possible ODR violation.\"",
file=0x7ffff1e75878 "/home/ubuntu/rust/src/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp", line=708,
function=0x7ffff1e78300 <llvm::DwarfUnit::getOrCreateTypeDIE(llvm::MDNode const*)::__PRETTY_FUNCTION__> "llvm::DIE* llvm::DwarfUnit::getOrCreateTypeDIE(const llvm::MDNode*)") at assert.c:101
#4 0x00007ffff0dcdd6e in llvm::DwarfUnit::getOrCreateTypeDIE(llvm::MDNode const*) ()
from x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm-d8ace771.so
#5 0x00007ffff0dcddb9 in llvm::DwarfUnit::addType(llvm::DIE&, llvm::DIType const*, llvm::dwarf::Attribute) ()
from x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm-d8ace771.so
#6 0x00007ffff0dce59a in llvm::DwarfUnit::constructTypeDIE(llvm::DIE&, llvm::DISubroutineType const*) ()
from x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm-d8ace771.so
#7 0x00007ffff0dcdc7a in llvm::DwarfUnit::getOrCreateTypeDIE(llvm::MDNode const*) ()
from x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm-d8ace771.so
#8 0x00007ffff0dcddb9 in llvm::DwarfUnit::addType(llvm::DIE&, llvm::DIType const*, llvm::dwarf::Attribute) ()
from x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm-d8ace771.so
#9 0x00007ffff0dcd3af in llvm::DwarfUnit::applySubprogramAttributes(llvm::DISubprogram const*, llvm::DIE&, bool) ()
from x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm-d8ace771.so
#10 0x00007ffff0da7962 in llvm::DwarfCompileUnit::applySubprogramAttributesToDefinition(llvm::DISubprogram const*, llvm::DIE&) () from x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm-d8ace771.so
#11 0x00007ffff0daebd2 in llvm::DwarfCompileUnit::constructAbstractSubprogramScopeDIE(llvm::LexicalScope*) ()
from x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm-d8ace771.so
#12 0x00007ffff0dbc4f5 in llvm::DwarfDebug::constructAbstractSubprogramScopeDIE(llvm::LexicalScope*) ()
from x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm-d8ace771.so
#13 0x00007ffff0dc210b in llvm::DwarfDebug::endFunction(llvm::MachineFunction const*) ()
from x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm-d8ace771.so
#14 0x00007ffff0d8dbe5 in llvm::AsmPrinter::EmitFunctionBody() ()
from x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm-d8ace771.so
#15 0x00007ffff0a925c6 in llvm::X86AsmPrinter::runOnMachineFunction(llvm::MachineFunction&) ()
from x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm-d8ace771.so
#16 0x00007ffff16b71a8 in llvm::FPPassManager::runOnFunction(llvm::Function&) ()
from x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm-d8ace771.so
#17 0x00007ffff16b7893 in llvm::legacy::PassManagerImpl::run(llvm::Module&) ()
from x86_64-unknown-linux-gnu/stage1/lib/librustc_llvm-d8ace771.so
#18 0x00007ffff047d095 in LLVMRustWriteOutputFile (Target=0x7fffe8085580, PMR=0x7fffe80211f0, M=0x7fffe8006220,
path=0x7fffed3f4b20 "x\326\034\356\377\177", FileType=llvm::TargetMachine::CGFT_ObjectFile)
at /home/ubuntu/rust/src/rustllvm/PassWrapper.cpp:249
#19 0x00007ffff55de42a in rustc_trans::back::write::write_output_file (handler=0x7fffed3f84c8, target=0x7fffe8085580,
pm=0x7fffe80211f0, m=0x7fffe8006220, output=0x7fffec4e2d80, file_type=ObjectFileType)
at src/librustc_trans/back/write.rs:72
#20 0x00007ffff55eb33f in fnfn (cpm=0x7fffe80211f0) at src/librustc_trans/back/write.rs:565
#21 0x00007ffff55eb26e in rustc_trans::back::write::optimize_and_codegen::with_codegen<closure> (tm=0x7fffe8085580,
llmod=0x7fffe8006220, no_builtins=false, f={void (struct (*mut rustc_llvm::PassManager_opaque))} 0x7fffed3f4e68)
at src/librustc_trans/back/write.rs:533
#22 0x00007ffff55ea9cb in fnfn () at src/librustc_trans/back/write.rs:564
#23 0x00007ffff55ea0ed in rustc_trans::util::common::time<(),(),closure> (do_it=false, what=..., u=0,
f={void (struct (()))} 0x7fffed3f5460) at src/librustc/util/common.rs:39
#24 0x00007ffff55e80ea in rustc_trans::back::write::optimize_and_codegen (cgcx=0x7fffed3f63c0, mtrans=..., config=...,
name_extra=..., output_names=...) at src/librustc_trans/back/write.rs:543
#25 0x00007ffff55f2864 in rustc_trans::back::write::execute_work_item (cgcx=0x7fffed3f63c0, work_item=...)
at src/librustc_trans/back/write.rs:906
#26 0x00007ffff55ef155 in rustc_trans::back::write::run_work_singlethreaded (sess=0x7fffed3f7c88, reachable=...,
work_items=...) at src/librustc_trans/back/write.rs:919
#27 0x00007ffff55ebe6f in rustc_trans::back::write::run_passes (sess=0x7fffed3f7c88, trans=0x7fffed3f7968,
output_types=..., crate_output=0x7fffed3f7a10) at src/librustc_trans/back/write.rs:677
#28 0x00007ffff7a6c7fe in fnfn () at src/librustc_driver/driver.rs:767
#29 0x00007ffff7a6c432 in rustc_driver::util::common::time<(),(),closure> (do_it=false, what=..., u=0,
f={void (struct (()))} 0x7fffed3f74e8) at src/librustc/util/common.rs:39
#30 0x00007ffff78ed1fd in rustc_driver::driver::phase_5_run_llvm_passes (sess=0x7fffed3f7c88, trans=0x7fffed3f7968,
outputs=0x7fffed3f7a10) at src/librustc_driver/driver.rs:766
#31 0x00007ffff7844144 in rustc_driver::driver::compile_input (sess=..., cfg=..., input=0x7fffed3fdf98,
outdir=0x7fffed3fe110, output=0x7fffed3fe0f0, addl_plugins=..., control=...) at src/librustc_driver/driver.rs:168
#32 0x00007ffff7b096df in rustc_driver::run_compiler (args=..., callbacks=...) at src/librustc_driver/lib.rs:156
#33 0x00007ffff7b060fc in fnfn () at src/librustc_driver/lib.rs:99
#34 0x00007ffff7b052c9 in fnfn () at src/librustc_driver/lib.rs:806
#35 0x00007ffff7b051a6 in rustc_driver::boxed::F.FnBox<A>::call_box (self=0x7fffed43a060, args=0)
at src/liballoc/boxed.rs:398
#36 0x00007ffff7b04a6f in rustc_driver::boxed::Box<FnBox<A, Output = R>+ Send + 'a>.FnOnce<A>::call_once (self=...,
args=0) at src/liballoc/boxed.rs:414
#37 0x00007ffff7b044cc in fnfn () at src/libstd/thread/mod.rs:349
#38 0x00007ffff7b0444f in rustc_driver::rt::unwind::try::try_fn<closure> (opt_closure=0x7fffed3fe8e8)
at src/libstd/rt/unwind/mod.rs:158
#39 0x00007ffff7b043ea in rt::unwind::try::try_fn::h17428172142314623289 ()
from x86_64-unknown-linux-gnu/stage1/lib/librustc_driver-d8ace771.so
#40 0x00007ffff7332de9 in rust_try_inner () from x86_64-unknown-linux-gnu/stage1/lib/libstd-d8ace771.so
#41 0x00007ffff7332dd6 in rust_try () from x86_64-unknown-linux-gnu/stage1/lib/libstd-d8ace771.so
#42 0x00007ffff718fa30 in std::rt::unwind::try::inner_try (f={void (enum class c_void *)} 0x7fffed3fe8a8,
data=0x7fffed3fe8e8) at src/libstd/rt/unwind/mod.rs:147
#43 0x00007ffff7b04385 in rustc_driver::rt::unwind::try<closure> (f={void (())} 0x7fffed3fe900)
at src/libstd/rt/unwind/mod.rs:130
#44 0x00007ffff7b0419d in fnfn () at src/libstd/thread/mod.rs:349
#45 0x00007ffff7b04ca1 in rustc_driver::boxed::F.FnBox<A>::call_box (self=0x7fffed424180, args=0)
at src/liballoc/boxed.rs:398
#46 0x00007ffff71b0eaf in std::boxed::Box<FnBox<A, Output = R>+ 'a>.FnOnce<A>::call_once (self=..., args=0)
at src/liballoc/boxed.rs:406
#47 0x00007ffff71b0de7 in std::sys_common::thread::start_thread (main=0x7fffed43b000)
at src/libstd/sys/common/thread.rs:30
#48 0x00007ffff71e2d05 in std::sys::thread::Thread::new::thread_start (main=0x7fffed43b000)
at src/libstd/sys/unix/thread.rs:77
#49 0x00007ffff71e2c85 in sys::thread::Thread::new::thread_start::hfcb7277d7665b775tKv ()
from x86_64-unknown-linux-gnu/stage1/lib/libstd-d8ace771.so
#50 0x00007fffef6db6aa in start_thread (arg=0x7fffed3ff700) at pthread_create.c:333
#51 0x00007ffff6d81eed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109