@@ -103,7 +103,7 @@ func NewTargetMachine(config *compileopts.Config) (llvm.TargetMachine, error) {
103103// violation. Eventually, this Compile function should only compile a single
104104// package and not the whole program, and loading of the program (including CGo
105105// processing) should be moved outside the compiler package.
106- func Compile (pkgName string , machine llvm.TargetMachine , config * compileopts.Config ) (llvm.Module , []string , []error ) {
106+ func Compile (pkgName string , machine llvm.TargetMachine , config * compileopts.Config ) (mod llvm.Module , extrafiles []string , extraldflags [] string , errors []error ) {
107107 c := & compilerContext {
108108 Config : config ,
109109 difiles : make (map [string ]llvm.Metadata ),
@@ -148,7 +148,7 @@ func Compile(pkgName string, machine llvm.TargetMachine, config *compileopts.Con
148148
149149 wd , err := os .Getwd ()
150150 if err != nil {
151- return c .mod , nil , []error {err }
151+ return c .mod , nil , nil , []error {err }
152152 }
153153 lprogram := & loader.Program {
154154 Build : & build.Context {
@@ -211,35 +211,35 @@ func Compile(pkgName string, machine llvm.TargetMachine, config *compileopts.Con
211211 if strings .HasSuffix (pkgName , ".go" ) {
212212 _ , err = lprogram .ImportFile (pkgName )
213213 if err != nil {
214- return c .mod , nil , []error {err }
214+ return c .mod , nil , nil , []error {err }
215215 }
216216 } else {
217217 _ , err = lprogram .Import (pkgName , wd , token.Position {
218218 Filename : "build command-line-arguments" ,
219219 })
220220 if err != nil {
221- return c .mod , nil , []error {err }
221+ return c .mod , nil , nil , []error {err }
222222 }
223223 }
224224
225225 _ , err = lprogram .Import ("runtime" , "" , token.Position {
226226 Filename : "build default import" ,
227227 })
228228 if err != nil {
229- return c .mod , nil , []error {err }
229+ return c .mod , nil , nil , []error {err }
230230 }
231231
232232 err = lprogram .Parse (c .TestConfig .CompileTestBinary )
233233 if err != nil {
234- return c .mod , nil , []error {err }
234+ return c .mod , nil , nil , []error {err }
235235 }
236236
237237 c .ir = ir .NewProgram (lprogram , pkgName )
238238
239239 // Run a simple dead code elimination pass.
240240 err = c .ir .SimpleDCE ()
241241 if err != nil {
242- return c .mod , nil , []error {err }
242+ return c .mod , nil , nil , []error {err }
243243 }
244244
245245 // Initialize debug information.
@@ -383,7 +383,7 @@ func Compile(pkgName string, machine llvm.TargetMachine, config *compileopts.Con
383383 }
384384 }
385385
386- return c .mod , extraFiles , c .diagnostics
386+ return c .mod , extraFiles , lprogram . LDFlags , c .diagnostics
387387}
388388
389389// getLLVMRuntimeType obtains a named type from the runtime package and returns
0 commit comments