Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raising Go binary - Assertion failed: No called function prototype found while determining return type #65

Open
xaionaro opened this issue Mar 6, 2020 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@xaionaro
Copy link

xaionaro commented Mar 6, 2020

$ cat > hello.go <<EOF
package main
import "fmt"
func main() {
        fmt.Println("Hello, world!")
}
$ go version && go build
go version go1.13 linux/amd64
$ ~/src/llvm-project/build/bin/llvm-mctoll -d helloworld 
llvm-mctoll: /home/xaionaro/src/llvm-project/llvm/tools/llvm-mctoll/X86/X86FuncPrototypeDiscovery.cpp:612: llvm::Type* X86MachineInstructionRaiser::getReturnTypeFromMBB(const llvm::MachineBasicBlock&, bool&): Assertion `(CalledFunc != nullptr) && "No called function prototype found while determining return type"' failed.
 #0 0x000000000102061a llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home/xaionaro/src/llvm-project/build/bin/llvm-mctoll+0x102061a)
 #1 0x000000000101e604 llvm::sys::RunSignalHandlers() (/home/xaionaro/src/llvm-project/build/bin/llvm-mctoll+0x101e604)
 #2 0x000000000101eb0d SignalHandler(int) (/home/xaionaro/src/llvm-project/build/bin/llvm-mctoll+0x101eb0d)
 #3 0x00007fdcbaf00b20 __restore_rt (/lib64/libpthread.so.0+0x14b20)
 #4 0x00007fdcba9a7625 raise (/lib64/libc.so.6+0x3c625)
 #5 0x00007fdcba9908d9 abort (/lib64/libc.so.6+0x258d9)
 #6 0x00007fdcba9907a9 _nl_load_domain.cold (/lib64/libc.so.6+0x257a9)
 #7 0x00007fdcba99fa66 (/lib64/libc.so.6+0x34a66)
 #8 0x0000000001046b3c X86MachineInstructionRaiser::getReturnTypeFromMBB(llvm::MachineBasicBlock const&, bool&) (/home/xaionaro/src/llvm-project/build/bin/llvm-mctoll+0x1046b3c)
 #9 0x0000000001046b8e X86MachineInstructionRaiser::getReachingReturnType(llvm::MachineBasicBlock const&) (/home/xaionaro/src/llvm-project/build/bin/llvm-mctoll+0x1046b8e)
#10 0x0000000001047d25 X86MachineInstructionRaiser::getFunctionReturnType() (/home/xaionaro/src/llvm-project/build/bin/llvm-mctoll+0x1047d25)
#11 0x0000000001048d78 X86MachineInstructionRaiser::getRaisedFunctionPrototype() (/home/xaionaro/src/llvm-project/build/bin/llvm-mctoll+0x1048d78)
#12 0x00000000004896ba ModuleRaiser::runMachineFunctionPasses() (/home/xaionaro/src/llvm-project/build/bin/llvm-mctoll+0x4896ba)
#13 0x000000000044fbc6 DisassembleObject(llvm::object::ObjectFile const*, bool) (.constprop.0) (/home/xaionaro/src/llvm-project/build/bin/llvm-mctoll+0x44fbc6)
#14 0x000000000040c5a4 main (/home/xaionaro/src/llvm-project/build/bin/llvm-mctoll+0x40c5a4)
#15 0x00007fdcba9921a3 __libc_start_main (/lib64/libc.so.6+0x271a3)
#16 0x000000000043cede _start (/home/xaionaro/src/llvm-project/build/bin/llvm-mctoll+0x43cede)
Stack dump:
0.      Program arguments: /home/xaionaro/src/llvm-project/build/bin/llvm-mctoll -d helloworld 
Aborted (core dumped)
$ ~/src/llvm-project/build/bin/llvm-mctoll --version
LLVM (http://llvm.org/):
  LLVM version 11.0.0git
  Optimized build with assertions.
  Default target: x86_64-unknown-linux-gnu
  Host CPU: skylake

  Registered Targets:
    arm     - ARM
    armeb   - ARM (big endian)
    thumb   - Thumb
    thumbeb - Thumb (big endian)
    x86     - 32-bit X86: Pentium-Pro and above
    x86-64  - 64-bit X86: EM64T and AMD64
@bharadwajy bharadwajy changed the title Assertion failed: No called function prototype found while determining return type Raising Go binary - Assertion failed: No called function prototype found while determining return type Mar 6, 2020
@bharadwajy
Copy link
Contributor

Thank you very much for trying out the tool and for the bug report.

It is really encouraging to get a scenario that attempts to raise a Go binary - which we have not yet tried.

Look forward fixing this bug as time permits, but would welcome any kind help with a patch from anyone interested.

Thanks!

PS: I modified the bug title to indicate that this is a failure on Go binary.

@bharadwajy bharadwajy added the help wanted Extra attention is needed label Jul 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants