llvm/flang/runtime
Michael Kruse 84e1258feb [flang] Use CMake to determine endianness.
The preprocessor definitions __BYTE_ORDER__, __ORDER_BIG_ENDIAN__, and
__ORDER_LITTLE_ENDIAN__ are gcc extensions (also supported by clang),
but msvc (and others) do not define them. As a result __BYTE_ORDER__
and __ORDER_BIG_ENDIAN__ both evaluate to 0 by the prepreprocessor,
and __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__, the first `#if` condition
to 1, hence assuming the wrong byte order for x86(_64).

This patch instead uses CMake's TestBigEndian module to determine
target architecture's endianness at configure-time.

Note this also uses the same mechanism for the runtime. If compiling
flang as a cross-compiler, the runtime for the compile-target must be
built separately (Flang does not support the LLVM_ENABLE_RUNTIMES
mechanism yet).

Fixes llvm.org/PR51597

Reviewed By: ijan1, Leporacanthicus

Differential Revision: https://reviews.llvm.org/D109108
2021-09-03 15:44:51 -05:00
..
allocatable.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
assign.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
buffer.cpp [flang] Remove *- C++ -* incantation from runtime .cpp files. NFC 2021-09-03 07:17:45 +00:00
buffer.h [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
character.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
CMakeLists.txt [flang] COMMAND_ARGUMENT_COUNT runtime implementation 2021-09-03 07:29:39 +00:00
command.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
complex-reduction.c [flang] Implement DOT_PRODUCT in the runtime 2021-05-13 10:40:07 -07:00
complex-reduction.h [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
config.h.cmake
connection.cpp [flang] Remove *- C++ -* incantation from runtime .cpp files. NFC 2021-09-03 07:17:45 +00:00
connection.h [flang] Fix regression from recent runtime input fix 2021-08-17 10:12:56 -07:00
copy.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
copy.h [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
derived-api.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
derived.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
derived.h [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
descriptor-io.cpp [flang] Fix legitimate warning from latest GCC 2021-07-20 11:40:34 -07:00
descriptor-io.h [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
descriptor.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
dot-product.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
edit-input.cpp [flang] Remove *- C++ -* incantation from runtime .cpp files. NFC 2021-09-03 07:17:45 +00:00
edit-input.h
edit-output.cpp [flang] Remove *- C++ -* incantation from runtime .cpp files. NFC 2021-09-03 07:17:45 +00:00
edit-output.h
environment.cpp [flang] Remove *- C++ -* incantation from runtime .cpp files. NFC 2021-09-03 07:17:45 +00:00
environment.h [flang] Use CMake to determine endianness. 2021-09-03 15:44:51 -05:00
extrema.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
file.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
file.h [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
findloc.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
format-implementation.h [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
format.cpp [flang] Remove *- C++ -* incantation from runtime .cpp files. NFC 2021-09-03 07:17:45 +00:00
format.h [flang] Fix "non-advancing" I/O, support $ in FORMAT 2021-06-28 12:18:25 -07:00
internal-unit.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
internal-unit.h [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
io-api.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
io-error.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
io-error.h [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
io-stmt.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
io-stmt.h [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
iostat.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
ISO_Fortran_binding.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
lock.h
main.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
matmul.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
memory.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
misc-intrinsic.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
namelist.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
namelist.h [flang] Implement NAMELIST I/O in the runtime 2021-05-06 11:18:36 -07:00
numeric.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
pointer.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
product.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
random.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
reduction-templates.h [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
reduction.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
stat.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
stat.h [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
stop.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
sum.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
terminator.cpp [flang] Remove *- C++ -* incantation from runtime .cpp files. NFC 2021-09-03 07:17:45 +00:00
terminator.h [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
time-intrinsic.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
tools.cpp [flang] Remove *- C++ -* incantation from runtime .cpp files. NFC 2021-09-03 07:17:45 +00:00
tools.h [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
transformational.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
type-code.cpp [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
type-info.cpp [flang] Implement runtime Assign() 2021-08-09 09:31:32 -07:00
type-info.h [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
unit-map.cpp [flang] Remove *- C++ -* incantation from runtime .cpp files. NFC 2021-09-03 07:17:45 +00:00
unit-map.h [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00
unit.cpp [flang] Remove *- C++ -* incantation from runtime .cpp files. NFC 2021-09-03 07:17:45 +00:00
unit.h [flang] Move runtime API headers to flang/include/flang/Runtime 2021-09-03 11:08:34 -07:00