Skip to content

Behavior of -rpath under llvm-mingw does not match gcc-mingw #102777

Closed
@tomager

Description

@tomager

The behavior of -rpath under llvm-mingw is different than in gcc-mingw. Please see mstorsjo/llvm-mingw#300 for more information. Briefly summarized here:

Here is the output of gcc-mingw (toolchain generated from crosstool-ng) compiling the simple program [1] with -rpath option:

# /xgcc-x86_64-w64-mingw32/bin/x86_64-w64-mingw32-g++ test.cc -Wl,-rpath,anything
<no error>

And here is the llvm-mingw toolchain failing on the same inputs:

# /xllvm-x86_64-w64-mingw32/bin/x86_64-w64-mingw32-g++ test.cc -Wl,-rpath,anything
lld: error: unknown argument: -rpath
clang: error: linker command failed with exit code 1 (use -v to see invocation)

It would be nice if lld behaved the same as gcc-mingw, to lower friction when porting mingw packages to clang/llvm.

Would there be objections to a patch that causes -rpath to be silently ignored?

[1]

#include <iostream>

int main(int argc, const char** argv) {
  std::cout<<"hello world!"<<std::endl;
  *(volatile int*)0 = 0;
  return 0;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions