rust icon indicating copy to clipboard operation
rust copied to clipboard

crash: "UNREACHABLE executed at ObjectFile.cpp:52"

Open elly opened this issue 15 years ago • 9 comments

If you accidentally feed rustc --ls a non-object file (as I just did), you get this assertion failure:

Unknown Object File Type UNREACHABLE executed at ObjectFile.cpp:52! Aborted (core dumped)

You may also just get a plain segfault. For example, try an empty file :).

elly avatar Jul 26 '11 05:07 elly

We probably need to sanity check libraries before handing them to llvm. Is there a way to get llvm to do the sanity check without tripping an assert?

msullivan avatar Jul 26 '11 05:07 msullivan

Looks like we should call IdentifyFileType (for which I don't see a C wrapper) before doing whatever we're doing.

brson avatar Mar 06 '12 01:03 brson

An empty file is now handled correctly (error "could not find metadata in empty.") But the original bug still holds (for example, with rustc --ls ~/rust/README.txt

catamorphism avatar Jun 22 '12 00:06 catamorphism

Fixing this is blocked on the lack of a binding to LLVM's IdentifyFileType, but I also don't see a Rust library function that gets the size of a file (which is needed because IdentifyFileType takes a length), either. So if someone implements those two things, this should be pretty easy to fix.

catamorphism avatar Jun 22 '12 01:06 catamorphism

Is is still problem? it shows me correct error message "could not find metadata in /home/sammy.kim/rust/src/README.txt" with rustc --ls ~/rust/src/README.txt

sammykim avatar Apr 05 '13 06:04 sammykim

I get this when using --ls on an LLVM bitcode file.

pcwalton avatar Apr 20 '13 05:04 pcwalton

Still broken for LLVM bitcode files, though it is line 57 now.

emberian avatar Jun 25 '13 20:06 emberian

Not an issue with empty files. Steps to reproduce for llvm bitcode:

rustc --emit-llvm foo.rs
rustc --ls foo.bc

bblum avatar Jul 03 '13 22:07 bblum

This appears to be fixed; rustc --ls foo.bc now prints "could not find metadata in foo.bc". Closing.

catamorphism avatar Sep 23 '13 19:09 catamorphism