Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Unwinding fails when linking object file produced by rustc #24212

Closed Quuxplusone closed 3 years ago

Quuxplusone commented 9 years ago
Bugzilla Link PR24213
Status RESOLVED WONTFIX
Importance P normal
Reported by tamird@gmail.com
Reported on 2015-07-22 10:26:11 -0700
Last modified on 2021-02-19 15:58:48 -0800
Version unspecified
Hardware Macintosh MacOS X
CC jezreel@gmail.com, kledzik@apple.com, lhames@gmail.com, llvm-bugs@lists.llvm.org, willdtz@gmail.com
Fixed by commit(s)
Attachments hello_world_dynamic.o (3744 bytes, application/octet-stream)
hello_world_static.o (3744 bytes, application/octet-stream)
Blocks
Blocked by
See also

Full repro is here: https://github.com/tamird/rust_lld, but you'll need a working rust compiler and might need to massage build.sh for your system.

TL;DR unwinding fails with fatal runtime error: Could not unwind stack, error = 5.

Here's the symbol table diff between what ld produces vs lld: https://gist.github.com/tamird/1af0c8d9a7132fd9915e

Quuxplusone commented 9 years ago
Hi Tamir,

How big are the rust libraries? Would it be possible for you to attach the raw
*.o files and libraries you're linking?

Cheers,
Lang.
Quuxplusone commented 9 years ago
There are 5 rust libraries involved, and they range from 2.3M to 19M. The
attachment limit is 1M, so I can't attach those.

I'll attach the resulting *.o files.
Quuxplusone commented 9 years ago

Attached hello_world_dynamic.o (3744 bytes, application/octet-stream): dynamically linked: https://raw.githubusercontent.com/tamird/rust_lld/master/hello_world.rs

Quuxplusone commented 9 years ago

Attached hello_world_static.o (3744 bytes, application/octet-stream): statically linked: https://raw.githubusercontent.com/tamird/rust_lld/master/hello_world.rs

Quuxplusone commented 9 years ago

Any news on this? I just tested with LLD HEAD and the problem appears to persist.

Quuxplusone commented 8 years ago

Moving to more specific "MachO" LLD component (instead of generic "All Bugs").

Quuxplusone commented 6 years ago

This repro is much easier with a rust compiler that includes https://github.com/rust-lang/rust/pull/46255/commits/c30d8f2f1f2d904544af0b6eab89f0e3bb586c75.

With that compiler, given hello_world.rs:

fn main() {
    println!("hello world!");
    panic!("goodbye world!");
}

Using ld64:

$ ld -v
@(#)PROGRAM:ld  PROJECT:ld64-302.3.1
configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em (tvOS)
LTO support using: LLVM version 9.0.0, (clang-900.0.38) (static support for 21, runtime is 21)
TAPI support using: Apple TAPI version 900.0.14 (tapi-900.0.14)

$ ./build/x86_64-apple-darwin/stage1/bin/rustc hello_world.rs && ./hello_world
hello world!
thread 'main' panicked at 'goodbye world!', hello_world.rs:3:4
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Using LLD 6.0.0 (https://llvm.org/git/lld.git 70cb0908a7a1efc8b81f7a0848e36e2dfcf05d1e):

$ ./build/x86_64-apple-darwin/stage1/bin/rustc -Z linker-flavor=ld -C linker=$(brew --prefix llvm)/bin/ld64.lld hello_world.rs && ./hello_world
hello world!

thread 'main' has overflowed its stack
fatal runtime error: stack overflow
Abort trap: 6
Quuxplusone commented 3 years ago

Closing this as it applies to the old iteration of LLD-MachO which is not being developed. (The new one is named ld64.lld.darwinnew, and will be receiving active feature development and bug fixes.)