rust-lang / rust-lang/rust

Invalid local symbol errors linking shared library with rust-lld

Open
#128,938 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-linkage A-lld C-external-bug T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I have a project generating bindings for FMOD using bindgen: https://gitlab.com/spearman/fmod-rs/-/tree/master/fmod-sys

Trying to build and link an executable with rust-lld generates the following errors:

  = note: rust-lld: error: /home/spearman/rs/local/fmod-rs/fmod-sys/lib/x86_64/libfmod.so: invalid local symbol '__bss_start' in global part of symbol table
          rust-lld: error: /home/spearman/rs/local/fmod-rs/fmod-sys/lib/x86_64/libfmod.so: invalid local symbol '_end' in global part of symbol table
          rust-lld: error: /home/spearman/rs/local/fmod-rs/fmod-sys/lib/x86_64/libfmod.so: invalid local symbol '_edata' in global part of symbol table
          collect2: error: ld returned 1 exit status

For now I am using the rustflags option -Zlinker-features=-lld to avoid using rust-lld

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the executable link with rust-lld and fmod-sys/lib/x86_64/libfmod.so, using the reported invalid local symbol diagnostics as the baseline. Investigate rust-lld's handling of the shared library's symbol table; done means the library links successfully with rust-lld enabled without these errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.