Skip to content

Compiling with -Clink-arg=-fuse-ld=lld fails #574

Closed
@antoyo

Description

@antoyo

It gives the following error:

  = note: rust-lld: error: relocation R_X86_64_64 cannot be used against local symbol; recompile with -fPIC
          >>> defined in /home/user/projects/rustc_codegen_gcc/test-backend/target/debug/deps/test_rust-48376029011c759c.test_rust.e423519ea9e9089e-cgu.0.rcgu.o
          >>> referenced by fake.c
          >>>               /home/user/projects/rustc_codegen_gcc/test-backend/target/debug/deps/test_rust-48376029011c759c.test_rust.e423519ea9e9089e-cgu.0.rcgu.o:(global.0)

Command:

y cargo rustc --bin test-rust -- -Clink-arg=-fuse-ld=lld

This also happens when using -Clinker-flavor=gnu-lld-cc which is used by Rust for Linux.

Command:

./y.sh cargo rustc --bin test-rust -- -Z unstable-options -Clinker-flavor=gnu-lld-cc

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions