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