<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/112330>112330</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            flang: instrument function flags missing with misleading error
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            flang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Thyre
      </td>
    </tr>
</table>

<pre>
    Some tools, for example performance tools, use instrument function flags to get information about called functions in a user code. This feature is supported in Clang for quite some time. Almost every compiler has some flag for this. In Score-P, we check for some of them, together with other instrumentation methods like compiler plug-ins (see [here](https://gitlab.com/score-p/scorep/-/blob/master/build-config/m4/scorep_compiler_instrumentation_flags.m4?ref_type=heads#L160)).

However, as far as I'm aware of `flang` / `flang-new` does not support these flags. Using a very basic test file, these are the results I'm getting when trying function instrumentation:

```console
$ cat test.f90
program main

end program main
$ flang --version
flang version 20.0.0git (https://github.com/llvm/llvm-project.git 77f8297c6fdaa62121ddb108043dcaad5c45c7ad)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/apps/software/Clang/trunk/bin
Build config: +assertions
$ flang -finstrument-functions test.f90
flang-20: error: unknown argument '-finstrument-functions'; did you mean '-Xclang -finstrument-functions'?
$ flang -Xclang -finstrument-functions test.f90
flang-20: error: unknown argument '-Xclang'; did you mean '-Xflang'?
flang-20: error: unknown argument '-finstrument-functions'; did you mean '-Xclang -finstrument-functions'?
$ flang -Xflang -finstrument-functions test.f90
error: unknown argument: '-finstrument-functions'
```

Is there any other instrumentation flag I'm missing here? I ran into this issue because someone wanted to build Score-P without our LLVM plug-in and still wanted to have function instrumentation. The old `flang` used `cyg_profile_func via -g -Mx,129,0x800`, but this flag also doesn't work.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVktv4zYQ_jX0ZSBBomzLPviQB4QG2AUK7LbozRiRI4kNRaokF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