...
1
2
3
4
5
6
7 package ld
8
9 import (
10 "os"
11 "os/exec"
12 "path/filepath"
13 "syscall"
14 )
15
16 const syscallExecSupported = true
17
18
19
20
21 func (ctxt *Link) execArchive(argv []string) {
22 var err error
23 argv0 := argv[0]
24 if filepath.Base(argv0) == argv0 {
25 argv0, err = exec.LookPath(argv0)
26 if err != nil {
27 Exitf("cannot find %s: %v", argv[0], err)
28 }
29 }
30 if ctxt.Debugvlog != 0 {
31 ctxt.Logf("invoking archiver with syscall.Exec()\n")
32 }
33 err = syscall.Exec(argv0, argv, os.Environ())
34 if err != nil {
35 Exitf("running %s failed: %v", argv[0], err)
36 }
37 }
38
View as plain text