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

LLD crash when linking on Mac #55565

Closed
ilovepi opened this issue May 18, 2022 · 7 comments
Closed

LLD crash when linking on Mac #55565

ilovepi opened this issue May 18, 2022 · 7 comments
Labels
bug Indicates an unexpected problem or unintended behavior crash Prefer [crash-on-valid] or [crash-on-invalid] lld:MachO

Comments

@ilovepi
Copy link
Contributor

ilovepi commented May 18, 2022

Fuchsia's CI build is seeing crashes in LLD when linking for x86 Mac.

The crash first shows up here: https://luci-milo.appspot.com/ui/p/fuchsia/builders/ci/clang_toolchain.ci.core.x64-host_test_only-mac/b8813899019497873137/overview

Crash report:

[9568/37372] RUST host_x64/json_validator_valico host_x64/exe.unstripped/json_validator_valico
FAILED: host_x64/json_validator_valico host_x64/exe.unstripped/json_validator_valico
mkdir -p host_x64/exe.unstripped &&  RUST_BACKTRACE=1 ../../prebuilt/third_party/rust/mac-x64/bin/rustc --color=always --crate-name json_validator_valico ../../build/tools/json_validator/src/main.r...
error: linking with `../../../recipe_cleanup/clanglv2g9ecu/bin/clang++` failed: exit status: 254
  |
  = note: "../../../recipe_cleanup/clanglv2g9ecu/bin/clang++" "-m64" "-arch" "x86_64" "/opt/s/w/ir/x/t/rustcnEZTxW/symbols.o" "host_x64/exe.unstripped/json_validator_valico.json_validator_valico.85...
  = note: Assertion failed: (isLive() && "this should only be called for live symbols"), function getVA, file lld/MachO/Symbols.cpp, line 77.
          PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
          Stack dump:
          0.	Program arguments: /opt/s/w/ir/x/w/fuchsia/out/not-default/../../../recipe_cleanup/clanglv2g9ecu/bin/ld64.lld -demangle -dynamic -arch x86_64 -platform_version macos 10.13.0 10.13.0 -s...
          Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
          0  ld64.lld                 0x000000010d054beb llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 43
          1  ld64.lld                 0x000000010d0538f8 llvm::sys::RunSignalHandlers() + 248
          2  ld64.lld                 0x000000010d055250 SignalHandler(int) + 272
          3  libsystem_platform.dylib 0x00007fff6b8755fd _sigtramp + 29
          4  ld64.lld                 0x00000001115970d2 xla::RunId::RunId()::counter + 555466
          5  libsystem_c.dylib        0x00007fff6b74b808 abort + 120
          6  libsystem_c.dylib        0x00007fff6b74aac6 err + 0
          7  ld64.lld                 0x000000010d38f7e8 lld::macho::Defined::getVA() const + 104
          8  ld64.lld                 0x000000010d3942b7 lld::macho::NonLazyPointerSectionBase::writeTo(unsigned char*) const + 119
          9  ld64.lld                 0x000000010d3bdc30 (anonymous namespace)::Writer::writeOutputFile() + 368
          10 ld64.lld                 0x000000010d3b80cd void lld::macho::writeResult<lld::macho::LP64>() + 3917
          11 ld64.lld                 0x000000010d3539ee lld::macho::link(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&, bool, bool) + 31982
          12 ld64.lld                 0x000000010cf8d61a lldMain(int, char const**, llvm::raw_ostream&, llvm::raw_ostream&, bool) + 1818
          13 ld64.lld                 0x000000010cf8cda7 main + 263
          14 libdyld.dylib            0x00007fff6b67ccc9 start + 1
          clang-15: error: unable to execute command: Abort trap: 6
          clang-15: error: linker command failed due to signal (use -v to see invocation)


error: aborting due to previous error

Unfortunately, LLD does not output a reproducer. This is more motivation for https://reviews.llvm.org/D120201

We are working on bisecting the issue, but that will take a while.

@ilovepi ilovepi added bug Indicates an unexpected problem or unintended behavior lld:MachO crash Prefer [crash-on-valid] or [crash-on-invalid] and removed new issue labels May 18, 2022
@llvmbot
Copy link
Member

llvmbot commented May 18, 2022

@llvm/issue-subscribers-lld-macho

@llvmbot
Copy link
Member

llvmbot commented May 18, 2022

@llvm/issue-subscribers-bug

@ilovepi
Copy link
Contributor Author

ilovepi commented May 18, 2022

Also note that the cause of the crash is an assertion failure.

Assertion failed: (isLive() && "this should only be called for live symbols"), function getVA, file lld/MachO/Symbols.cpp, line 77.

@int3
Copy link
Contributor

int3 commented May 18, 2022

Unfortunately, LLD does not output a reproducer.

We do have the --reproduce flag though. Or are you saying that LLD crashes even before it gets to the point where it can emit the repro tar?

@ilovepi
Copy link
Contributor Author

ilovepi commented May 18, 2022

We do have the --reproduce flag though. Or are you saying that LLD crashes even before it gets to the point where it can emit the repro tar?

What I mean is that unlike Clang, LLD doesn't automatically output one.

@petrhosek
Copy link
Member

@ilovepi
Copy link
Contributor Author

ilovepi commented May 20, 2022

@abrachet has a proposed fix in https://reviews.llvm.org/D126072

mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this issue Oct 7, 2022
The <internal> symbol was tripping an assertion in getVA() because it
was not marked as used. Per the comment above that symbols creation,
dead stripping has already occurred so marking this symbol as used is
accurate.

Fixes llvm/llvm-project#55565

Differential revision: https://reviews.llvm.org/D126072
gbaraldi pushed a commit to JuliaLang/llvm-project that referenced this issue Jan 6, 2023
The <internal> symbol was tripping an assertion in getVA() because it
was not marked as used. Per the comment above that symbols creation,
dead stripping has already occurred so marking this symbol as used is
accurate.

Fixes llvm#55565

Differential revision: https://reviews.llvm.org/D126072
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior crash Prefer [crash-on-valid] or [crash-on-invalid] lld:MachO
Projects
None yet
Development

No branches or pull requests

4 participants