Browse Source

Disable "-Wl,-plugin-opt,-import-instr-limit=5" on MacOS

This option is unsupported on the MacOS ld used in Android, leading to
compilation errors when LTO is enabled for binaries.

In particular the error includes:
```
ld64.lld: error: unknown argument '-plugin-opt'
ld64.lld: error: unknown argument '-import-instr-limit=5'
```

Test: m libc++ on a Mac OS machine
Bug: 288983988
Change-Id: I1873e0a77777832f833f211beb42633d462f04d5
A. Cody Schuffelen 11 months ago
parent
commit
7188b90e69
1 changed files with 1 additions and 1 deletions
  1. 1 1
      cc/lto.go

+ 1 - 1
cc/lto.go

@@ -109,7 +109,7 @@ func (lto *lto) flags(ctx BaseModuleContext, flags Flags) Flags {
 
 		// If the module does not have a profile, be conservative and limit cross TU inline
 		// limit to 5 LLVM IR instructions, to balance binary size increase and performance.
-		if !ctx.isPgoCompile() && !ctx.isAfdoCompile() {
+		if !ctx.Darwin() && !ctx.isPgoCompile() && !ctx.isAfdoCompile() {
 			flags.Local.LdFlags = append(flags.Local.LdFlags,
 				"-Wl,-plugin-opt,-import-instr-limit=5")
 		}