@@ -1582,11 +1582,11 @@ val commonCFlags: List<String> = listOf(
15821582val commonLinkerOptions: List <String > = listOf ()
15831583
15841584// CFlags for release mode.
1585- val releaseCFlags: List <String > = listOf (
1585+ val releaseCFlags: List <String > = listOfNotNull (
15861586 " -O$nativeOptMode " ,
15871587 " -fPIC" ,
15881588 " -fPIE" ,
1589- // "-flto",
1589+ onlyIf(enableLto, " -flto" ) ,
15901590).plus(
15911591 listOf (" -fuse-linker-plugin" ).onlyIf(enableLto && ! enableClang && ! isClang && ! HostManager .hostIsMac && ! enableStatic)
15921592).plus(
@@ -1777,7 +1777,7 @@ val darwinOnlyArgs = defaultPlatformArgs.plus(listOfNotNull(
17771777 " --gc=$effectiveGc " ,
17781778 " -R:MaximumHeapSizePercent=80" ,
17791779 " --initialize-at-build-time=sun.awt.resources.awtosx" ,
1780- " -H:NativeLinkerOption=-flto" ,
1780+ onlyIf(enableLto, " -H:NativeLinkerOption=-flto" ) ,
17811781 " -H:NativeLinkerOption=$nativesPath /libdiag.a" ,
17821782 " -H:NativeLinkerOption=$nativesPath /libsqlitejdbc.a" ,
17831783 " -H:NativeLinkerOption=$nativesPath /libumbrella.a" ,
@@ -1815,7 +1815,7 @@ val muslHome = System.getenv("MUSL_HOME") ?: "/opt/musl/1.2.5/lib"
18151815val linuxOnlyArgs = defaultPlatformArgs.plus(
18161816 listOfNotNull(
18171817 " -g" , // always generate debug info on linux
1818- " -H:NativeLinkerOption=-flto" ,
1818+ onlyIf(enableLto, " -H:NativeLinkerOption=-flto" ) ,
18191819 " -H:NativeLinkerOption=-Wl,--gc-sections" ,
18201820 " -H:NativeLinkerOption=-Wl,--emit-relocs" ,
18211821 " -H:NativeLinkerOption=$nativesPath /libdiag.a" ,
0 commit comments