kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #18360
Re: [MacOS] compiling with link-time optimization
Hi,
On 23.05.2015 18:48, Bernhard Stegmaier wrote:
> I guess this is due to LTO not even being used on OS X, if I understand your cmake change correctly:
> find_program(CMAKE_GCC_AR NAMES ${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar${_CMAKE_TOOLCHAIN_SUFFIX} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
> find_program(CMAKE_GCC_NM NAMES ${_CMAKE_TOOLCHAIN_PREFIX}gcc-nm HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
> find_program(CMAKE_GCC_RANLIB NAMES ${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
> if( CMAKE_GCC_AR AND CMAKE_GCC_NM AND CMAKE_GCC_RANLIB )
> On my OS X using clang there is nothing like *gcc-ar*… or any of the other two.
> Why do you have to change/set CMAKE_AR and the other two anyway?
Indeed, it seems this fails on OS X, so it falls back to non-LTO.
This is needed because regular binutils ar/nm/ranlib fail to work with
the LTO objects generated by gcc, so gcc ships extra wrappers.
Presumably, the correct approach would be
- if MSYS, disable LTO (because it's broken)
- if gcc, look for gcc-ar/gcc-nm/gcc-ranlib
- if llvm, look for llvm-ar/llvm-nm/llvm-ranlib
- if no toolchain specific tools were found, try whether the regular
ones work.
I still have to look into the problems jp had on Ubuntu -- that
shouldn't happen.
For me, it's quite a bit of a size difference on gcc (25%).
without LTO:
-rwxr-xr-x 1 geier geier 14995616 Mai 23 18:56
textsize is 12950112
with LTO:
-rwxr-xr-x 1 geier geier 11152184 Mai 23 05:53 _pcbnew.kiface
textsize is 9422117
with LLVM, the effect is a bit more pronounced IIRC, but I'd need to
rebuild for actual numbers.
Simon
Attachment:
signature.asc
Description: OpenPGP digital signature
Follow ups
References