diff options
| author | Russ Cox <rsc@golang.org> | 2013-12-17 21:43:33 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2013-12-17 21:43:33 -0500 |
| commit | b02233402961621e1cd705d79dcf63387daadea2 (patch) | |
| tree | a9cd225a70bc87fc9f64700b94f1f7630b51b93d /src/cmd/ld/lib.c | |
| parent | deb554934c0c2a87b24f4eb29cdcbbd4ea68a6d6 (diff) | |
| download | go-b02233402961621e1cd705d79dcf63387daadea2.tar.xz | |
cmd/gc: implement -pack flag
The -pack flag causes 5g, 6g, 8g to write a Go archive directly,
instead of requiring the use of 'go tool pack' to convert the .5/.6/.8
to .a format.
Writing directly avoids the copy and also avoids having the
export data stored twice in the archive (once in __.PKGDEF,
once in .5/.6/.8).
A separate CL will enable the use of this flag by cmd/go.
Other build systems that do not know about -pack will be unaffected.
The changes to cmd/ld handle a minor simplification to the format:
an unused section is removed.
R=iant, r
CC=golang-dev
https://golang.org/cl/42880043
Diffstat (limited to 'src/cmd/ld/lib.c')
| -rw-r--r-- | src/cmd/ld/lib.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/cmd/ld/lib.c b/src/cmd/ld/lib.c index 76a3a1393a..f4ac30a571 100644 --- a/src/cmd/ld/lib.c +++ b/src/cmd/ld/lib.c @@ -327,25 +327,22 @@ objfile(char *file, char *pkg) return; } - /* skip over __.GOSYMDEF */ + /* skip over optional __.GOSYMDEF and process __.PKGDEF */ off = Boffset(f); if((l = nextar(f, off, &arhdr)) <= 0) { diag("%s: short read on archive file symbol header", file); goto out; } - if(strncmp(arhdr.name, symname, strlen(symname))) { - diag("%s: first entry not symbol header", file); - goto out; - } - off += l; - - /* skip over (or process) __.PKGDEF */ - if((l = nextar(f, off, &arhdr)) <= 0) { - diag("%s: short read on archive file symbol header", file); - goto out; + if(strncmp(arhdr.name, symname, strlen(symname)) == 0) { + off += l; + if((l = nextar(f, off, &arhdr)) <= 0) { + diag("%s: short read on archive file symbol header", file); + goto out; + } } + if(strncmp(arhdr.name, pkgname, strlen(pkgname))) { - diag("%s: second entry not package header", file); + diag("%s: cannot find package header", file); goto out; } off += l; |
