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

    <tr>
        <th>Summary</th>
        <td>
            [flang] external procedure name generated not consistent with `flang-new` and `bbc + tco`
        </td>
    </tr>

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

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

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

<pre>
    ```
$ cat conftest.f90 
program main
 external testfunc
 call testfunc(1)
end
$ flang-new -fc1 -emit-llvm conftest.f90 
$ cat conftest.ll 
...
define void @_QQmain() !dbg !3 {
  %1 = alloca i32, i64 1, align 4, !dbg !7
  store i32 1, ptr %1, align 4, !dbg !7
  call void @testfunc_(ptr %1), !dbg !7
  ret void, !dbg !9
}
```
The external procedure name `testfunc_` can be interoperated with C.
```
$ bbc -emit-fir conftest.f90
$ tco conftest.mlir 
...
define void @_QQmain() !dbg !3 {
  %1 = alloca i32, i64 1, align 4, !dbg !7
  store i32 1, ptr %1, align 4, !dbg !9
  call void @_QPtestfunc(ptr %1), !dbg !10
  ret void, !dbg !11
}
```
The external procedure name `_QPtestfunc` cannot be interoperated with C.

Is this designed on purpose? The `flang-new` in `fir-dev` does not support this. Is this new supported feature somewhere in llvm main?
@jeanPerier @schweitzpgi 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzVU01vnDAQ_TXmYi0CzLLhwCHJKlJvWan3yNgD6whsZJts21_fsWFL0ibNoadKFozn8828cWvk94ZU2XqyI8luSVFSwT0VRncenE-7OqOLabKmt3ykI1d60VD45sFqPtDg2s1arHrBh1e64iYnRb2YQMutUDdw3e80XOiuEzndwaj8bhhexvfK_4EMSyyWNE0XQUKnNNAXoyQlZfZ0OkWsxQ2Wp6TIZduHH6PkcLcixfs-p4QdKUI2glPFClLcU1WVNA8CH1SvaRnELcPhGu28sRBiFufJ25jw88A4oSvQ66SeEOqWov4g1IKPkW_N63zJ4bgKb3n9eoaNLWRSgJwRueYjUHTaEFQZYtO0xa40upsJLPcg6UX5M71P300eqGlbsRLYKfuGv83HC7NZxgH9_jsC63cJfDo9vtr2DynMs79zmOf_ROJrFAuN2vjPmIzfL476s3JUgsOe0cdoOs12Mg4Ie6ChLmb89VxDdqWjStmdhJegkAYcDQXdPE3G-pgxpdfU4ZWvFszfAfcBujMjXM4QKNA0vvxIOHtY0ZXZM3D9CFaBDYN24nwB5X9MvaKJbJisWc0Tr_wADdnfRYRkf_xwSj3odQoBKe6iU86D9stQfu-Raxl0YbVJcRfWF2_JbIfm7P3kCMOtfsDTY_DcpsKMeAldrL8dVn8G4fGqnJvBobCvcnaTnBvZdmUtWQ2sLos2E8BZWVVdxoWo60rKZOAtDC50RYpiaYzdKosXbDBRTZEVRVaFpSmyfZmK9tAxVnXVAfasbjkOC3CWQxqApMb2iW0ipnbuHRoHbNxtRu4i83GKIT-f_dnY5hHUN6VPipskdtBE-D8BjhvY_g">