From cd6d58d084a3789730ab2600faaafa8461807b2b Mon Sep 17 00:00:00 2001 From: William Woodruff Date: Tue, 29 Jun 2021 14:04:57 -0400 Subject: [PATCH] extractor: inject LLVM_LINK_FLAGS --- shared/extractor.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/shared/extractor.go b/shared/extractor.go index 9228ba6..27ac672 100644 --- a/shared/extractor.go +++ b/shared/extractor.go @@ -661,6 +661,10 @@ func linkBitcodeFilesIncrementally(ea ExtractionArgs, filesToLink []string, argM if ea.Verbose { linkArgs = append(linkArgs, "-v") } + + // Append any custom llvm-link flags requested by the user. + // We only do this for the last llvm-link invocation. + linkArgs = append(linkArgs, LLVMLINKFlags...) linkArgs = append(linkArgs, tmpFileList...) linkArgs = append(linkArgs, "-o", ea.OutputFile) @@ -682,10 +686,15 @@ func linkBitcodeFiles(ea ExtractionArgs, filesToLink []string) (success bool) { if ea.Verbose { linkArgs = append(linkArgs, "-v") } + if getsize(filesToLink) > argMax { //command line size too large for the OS (necessitated by chromium) return linkBitcodeFilesIncrementally(ea, filesToLink, argMax, linkArgs) } var err error + + // Append any custom llvm-link flags requested by the user. + // N.B. that we do this specially for the incremental link case. + linkArgs = append(linkArgs, LLVMLINKFlags...) linkArgs = append(linkArgs, "-o", ea.OutputFile) linkArgs = append(linkArgs, filesToLink...) success, err = execCmd(ea.LlvmLinkerName, linkArgs, "")