[Flang] Driver is missing '--print-runtime-dir' (feature parity with Clang)
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
The flang-new driver currently lacks support for the --print-runtime-dir introspection flag.
In the Clang ecosystem, build systems and compiler wrappers routinely rely on clang --print-runtime-dir to dynamically discover the location of target-specific runtime libraries (e.g., compiler-rt). This is especially critical on platforms with unique layout heuristics, such as Darwin (which uses lib/darwin instead of standard target triples).
While Flang successfully implements --print-resource-dir, it explicitly rejects --print-runtime-dir, creating a feature parity gap that forces external build systems to hardcode OS-specific paths to locate flang-rt.
# Steps to Reproduce
1. Clang supports the flag and outputs the runtime directory:
``` Bash
$ clang --print-runtime-dir
/usr/lib/llvm-21/lib/clang/21/lib/darwin # (or target-triple on Linux)
```
2. Flang rejects the flag:
```Bash
$ flang-new --print-runtime-dir
flang-21: error: unknown argument: '--print-runtime-dir'
flang-21: error: no input files
```
(Note: Flang does support --print-resource-dir, but that only points to the base resource root, not the actual runtime library subdirectory).
# Expected Behavior
To maintain driver interface consistency and support agnostic build system integration, flang-new should implement --print-runtime-dir. It should output the fully qualified path to the Fortran runtime libraries (flang-rt), matching the behavioral contract of clang.
# Environment
OS: macOS / Linux
LLVM/Flang version: 21.0.0 (main)
Contributor guide
Research direction
Start in the flang-new driver by comparing its existing --print-resource-dir handling with Clang's --print-runtime-dir behavior. Trace how the target-specific runtime directory is selected on Darwin and Linux, then verify that flang-new accepts the flag and prints the fully qualified flang-rt directory.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100