We have had issues with the build system using mtune=native to compile the libsac2c and the runtime libraries, making it impossible to create distributable packages without it breaking due to ISA incompatibilities.
Changing the build system to not use mtune=native is doable, but involves having to filter out the mtune=native flag at the right points in the build. Additionally, when using different C compilers (such as with NVCC) we need to account for this, which may require a different solution for each compiler. This is non-trivial to achieve as in some instances the compiler is not applicable to build sac2c, but only a runtime lib or two.
This MR uses a different method, which encodes the mtune=native flag
into sac2crc and adds a sac2c flag (-generic
) to toggle the effect.
The advantage here is that we can define different flags for different
SBIs, without affecting the build system. Furthermore, the changes to
the build system are minimal, which involves propagating the flags to
sac2crc and change whether libsac2c is built with mtune=native or not.