[flang-commits] [flang] [flang][Driver] Support -rpath, -shared, and -static in the frontend (PR #66702)

Leandro Lupori via flang-commits flang-commits at lists.llvm.org
Tue Oct 17 05:42:39 PDT 2023


luporl wrote:

Adding `--target=x86_64-linux-gnu`, as @MaskRay suggests, fixes the test on Windows. But then we are not actually testing linking on Windows.

On my Windows machine, the test output is practically the same as that reported by buildkite, as mentioned by @tarunprabhu above. I see no differences in the output with or without `-static`. Using `-shared` adds `-dll -implib:a.lib` and the output becomes a `dll` instead of an `exe`, which makes sense, according to MSVC documentation (https://learn.microsoft.com/en-us/cpp/build/reference/dll-build-a-dll?view=msvc-170).

I've also tried linking a hello world program with and without `-static` and it runs fine. With `-shared`, it also produces an `a.exe` file (`-o a.dll` is needed to create the output file with the right extension), but that doesn't run, because it's actually a `dll` it seems, although I didn't try to use it as such.

In short, when using MSVC linker, `-rpath` is passed to it, `-static` doesn't change its invocation and `-shared` is translated to `-dll`.

https://github.com/llvm/llvm-project/pull/66702


More information about the flang-commits mailing list