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

    <tr>
        <th>Summary</th>
        <td>
            [flang] `flang-new` build openmpi fail
        </td>
    </tr>

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

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

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

<pre>
    ```
$ cat conftest.c 
#include <stdio.h>
#include <stdlib.h>

void size_(char *a, char *b)
{
    int diff = (int) (b - a);
    FILE *f=fopen("conftestval", "w");
    if (!f) exit(1);
    fprintf(f, "%d\n", diff);
}

$ cat conftestf.f90 
program fsize

   external size
   CHARACTER :: x(2)
   call size(x(1),x(2))
end program
```
```
$ clang conftest.c -c
$ flang-new -flang-experimental-exec conftestf.f90 conftest.o -fPIE
/usr/bin/ld: /tmp/conftestf-e22a08.o: relocation R_X86_64_32 against `.bss' can not be used when making a PIE object; recompile with -fPIE
flang-new: error: linker command failed with exit code 1 (use -v to see invocation)
$ ld --version
GNU ld (GNU Binutils for Ubuntu) 2.34
Copyright (C) 2020 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
```
Is this because flang runtime static library built without `-fPIC`?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx1VNtu4zYQ_Rr5ZWBBpixfHvzgyPE2wKJI012gbwEpDi12adIgKcfu13coy5cGqSHIQ83tzOEhhZPnVTYrhqfYZMU6Y1NoeITGWRUxxLyBq6PUtjGdRMjKOkSpXd5m5fP_eI0Wj-7-fXRaQtD_4HvGFk3LPWRszTNWw3UhMrYcMuZPFwPop20EqZWi2hsKW9CaApMlYAw8JZUP4duX78-pmqJw5Q5oKTBj7DrSkRtapbb099Gb_83XCvqMiUpd8KSp22LyOUodPOGgkIUaamWskllV26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