universal-ctags / ctags

A maintained ctags implementation
https://ctags.io
GNU General Public License v2.0
6.51k stars 622 forks source link

build-sys: enable LTO #3922

Closed masatake closed 8 months ago

masatake commented 8 months ago

Close #2885.

codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (94d7724) 85.36% compared to head (28d7248) 85.36%. Report is 4 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #3922 +/- ## ======================================= Coverage 85.36% 85.36% ======================================= Files 234 234 Lines 56123 56125 +2 ======================================= + Hits 47907 47909 +2 Misses 8216 8216 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

masatake commented 8 months ago

https://stackoverflow.com/questions/40374061/autoconf-recipe-to-use-gcc-ar-and-gcc-ranlib https://gcc.gnu.org/wiki/LinkTimeOptimizationFAQ#ar.2C_nm_and_ranlib

leleliu008 commented 8 months ago

doesn't consider adding a configure option like --enable-lto ? We could enable LTO by default in release mode. We also allow user to disable it.

leleliu008 commented 8 months ago

Why not enable LTO when cross compiling?

masatake commented 8 months ago

@leleliu008 Thank you. I added --enable-lto/--disable-lto.

Why not enable LTO when cross compiling?

I don't know whether my change works well with cross-compiling. Do you think just removing it?

AS_IF([test "x$cross_compiling" != "xyes" -a "x$enable_lto" != "xno"],[

is enough?

AC_CHECK_PROGS([LTO_AR], [gcc-ar ar]

this may be too simple to make my change work well with cross-compiling.

leleliu008 commented 8 months ago

LTO is nothing to do with whether cross compiling or not. I guess it would work if you just removing the cross compiling checking condition, I am on a journey, and didn't bring my laptop, I can't confirm it right now.

masatake commented 8 months ago

LTO is nothing to do with whether cross compiling or not. I guess it would work if you just removing the cross compiling checking condition, I am on a journey, and didn't bring my laptop, I can't confirm it right now.

O.K. I will merge this pull request that disables LTO when cross-compiling. You can make a pull request to enable LTO + cross-compiling after merging this.