<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/86521>86521</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Using flang for external tools requires specifying host endianness
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
tarunprabhu
</td>
</tr>
</table>
<pre>
Several headers in flang require `FLANG_BIG_ENDIAN` or `FLANG_LITTLE_ENDIAN` to be defined. This causes compile-time errors when using the headers, for example in an out-of-tree flang-based tool. A minimum reproducer is the file below
```
#include <flang/Frontend/CompilerInvocation.h>
```
Compiling this in the most straightforward way produces this compile-time error.
```
include/flang/Common/uint128.h:269:2: error: #error host endianness is not known
```
This is not ideal. Tools should not be required to specify the host endianness themselves.
I have a draft PR [here](https://github.com/llvm/llvm-project/pull/86516) which replaces these preprocessor defines with equivalents from LLVM.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUlM2O4zYMx59GvhAxbGnsSQ4-ZD68CJAOinba60K26EitLLmilHTevvBHsIttMUCBQJEtmvyRf1KSyFwcYsOqJ1a9ZDJF7UMTZUhuCrLTKeu8-mh-xSsGaUGjVBgIjIPBSneBgH8lExBYXbTn49uXr0-nL19f315OxzdWF-DDt5Pz6f39_PrdYfTQISgcjEOVw7s2BL1MhAS9HydjcRfNiIAh-EBw0-ggkXEXiBrvKIw_w-AD4N9ynCzOZNKBT3Hnh10MiCvorpOECqL3NocjjMaZMY0QcApepR4DGFrcDsYidGj9jRUvrDhua11sv_WRC-N6mxQCE89LAMbbNngX0SnG2-eVP5zc1fcyGu9yzcTrfztb1vWLNTmzFHimGT1FoBikueg4-HCTQcFNfsCGTav1v8uVf0K_oTPe3smf_Th6x3ibjIsl38-wR14f5pWJ4-py3jAulj3oGQydMtI5JJqr53yEP52_uU-yXDTebI1CaXN4994SkPbJquV9h_eumvUCmrA3w8eq-Q9Ro8aR0F6Rcvg-zAm0vCJIUEEOEX7-BVj1pDEgq14Y3-sYJ2LiyHjLeHsxUacu7_3IeGvt9f63m4L_A_vIeDslaxlv93VV1owf4KZNr-fmsXLVAAlhWpqpRyIftq4muJmoYc7mKi26SDAEP8L5_PtPm0KZaoQ6iIPMsCkfy1LseVHyTDcSe64eO9ErVRf7QjzWWO3loRaqK2Uvqsw0vOAPheBVWVVC8FyJQTziQyGHvq4lInsocJTG5nM2uQ-XzBAlbPZ1xcvMyg4tLYPP-dYIfL4DQrNk36ULsYfCGor0zUM00WLz2zKF6w2wDl_E4KRd5ovu8tFdu9n4B-myFGzzv3VY-GlVgpf_BAAA___ntYym">