Commits

Aram Hăvărneanu  committed a144d1f Merge

merge upstream

  • Participants
  • Parent commits f11a278, ff8459d

Comments (0)

Files changed (91)

 Micah Stetson <micah.stetson@gmail.com>
 Michael Chaten <mchaten@gmail.com>
 Michael Elkins <michael.elkins@gmail.com>
-Michael Gehring <mg@ebfe.org>
+Michael Gehring <mg@ebfe.org> <gnirheg.leahcim@gmail.com>
 Michael Hoisie <hoisie@gmail.com>
 Michael Lewis <mikelikespie@gmail.com>
 Michael Stapelberg <michael@stapelberg.de>

File CONTRIBUTORS

 Micah Stetson <micah.stetson@gmail.com>
 Michael Chaten <mchaten@gmail.com>
 Michael Elkins <michael.elkins@gmail.com>
-Michael Gehring <mg@ebfe.org>
+Michael Gehring <mg@ebfe.org> <gnirheg.leahcim@gmail.com>
 Michael Hoisie <hoisie@gmail.com>
 Michael Hudson-Doyle <michael.hudson@linaro.org>
+Michael Kelly <mjk@google.com>
 Michael Lewis <mikelikespie@gmail.com>
 Michael Matloob <matloob@google.com>
 Michael Piatek <piatek@google.com>

File api/next.txt

 pkg sync, method (*Pool) Put(interface{})
 pkg sync, type Pool struct
 pkg sync, type Pool struct, New func() interface{}
+pkg syscall (freebsd-386), type Termios struct
+pkg syscall (freebsd-386), type Termios struct, Cc [20]uint8
+pkg syscall (freebsd-386), type Termios struct, Cflag uint32
+pkg syscall (freebsd-386), type Termios struct, Iflag uint32
+pkg syscall (freebsd-386), type Termios struct, Ispeed uint32
+pkg syscall (freebsd-386), type Termios struct, Lflag uint32
+pkg syscall (freebsd-386), type Termios struct, Oflag uint32
+pkg syscall (freebsd-386), type Termios struct, Ospeed uint32
+pkg syscall (freebsd-386-cgo), type Termios struct
+pkg syscall (freebsd-386-cgo), type Termios struct, Cc [20]uint8
+pkg syscall (freebsd-386-cgo), type Termios struct, Cflag uint32
+pkg syscall (freebsd-386-cgo), type Termios struct, Iflag uint32
+pkg syscall (freebsd-386-cgo), type Termios struct, Ispeed uint32
+pkg syscall (freebsd-386-cgo), type Termios struct, Lflag uint32
+pkg syscall (freebsd-386-cgo), type Termios struct, Oflag uint32
+pkg syscall (freebsd-386-cgo), type Termios struct, Ospeed uint32
+pkg syscall (freebsd-amd64), type Termios struct
+pkg syscall (freebsd-amd64), type Termios struct, Cc [20]uint8
+pkg syscall (freebsd-amd64), type Termios struct, Cflag uint32
+pkg syscall (freebsd-amd64), type Termios struct, Iflag uint32
+pkg syscall (freebsd-amd64), type Termios struct, Ispeed uint32
+pkg syscall (freebsd-amd64), type Termios struct, Lflag uint32
+pkg syscall (freebsd-amd64), type Termios struct, Oflag uint32
+pkg syscall (freebsd-amd64), type Termios struct, Ospeed uint32
+pkg syscall (freebsd-amd64-cgo), type Termios struct
+pkg syscall (freebsd-amd64-cgo), type Termios struct, Cc [20]uint8
+pkg syscall (freebsd-amd64-cgo), type Termios struct, Cflag uint32
+pkg syscall (freebsd-amd64-cgo), type Termios struct, Iflag uint32
+pkg syscall (freebsd-amd64-cgo), type Termios struct, Ispeed uint32
+pkg syscall (freebsd-amd64-cgo), type Termios struct, Lflag uint32
+pkg syscall (freebsd-amd64-cgo), type Termios struct, Oflag uint32
+pkg syscall (freebsd-amd64-cgo), type Termios struct, Ospeed uint32
 pkg syscall (netbsd-386), const CLONE_CSIGNAL = 255
 pkg syscall (netbsd-386), const CLONE_CSIGNAL ideal-int
 pkg syscall (netbsd-386), const CLONE_FILES = 1024
 pkg syscall (netbsd-amd64-cgo), const PROT_READ ideal-int
 pkg syscall (netbsd-amd64-cgo), const PROT_WRITE = 2
 pkg syscall (netbsd-amd64-cgo), const PROT_WRITE ideal-int
-pkg syscall (windows-386), func NewCallbackCDecl(interface{}) uintptr
-pkg syscall (windows-amd64), func NewCallbackCDecl(interface{}) uintptr
 pkg syscall (openbsd-386), const BIOCGRTIMEOUT = 1074545262
 pkg syscall (openbsd-386), const BIOCSRTIMEOUT = 2148287085
 pkg syscall (openbsd-386), const IPPROTO_DIVERT_INIT = 2
 pkg syscall (openbsd-386), const IPV6_RECVDSTPORT ideal-int
 pkg syscall (openbsd-386), const IP_DIVERTFL = 4130
 pkg syscall (openbsd-386), const IP_DIVERTFL ideal-int
+pkg syscall (openbsd-386), const MADV_DONTNEED = 4
+pkg syscall (openbsd-386), const MADV_DONTNEED ideal-int
+pkg syscall (openbsd-386), const MADV_FREE = 6
+pkg syscall (openbsd-386), const MADV_FREE ideal-int
+pkg syscall (openbsd-386), const MADV_NORMAL = 0
+pkg syscall (openbsd-386), const MADV_NORMAL ideal-int
+pkg syscall (openbsd-386), const MADV_RANDOM = 1
+pkg syscall (openbsd-386), const MADV_RANDOM ideal-int
+pkg syscall (openbsd-386), const MADV_SEQUENTIAL = 2
+pkg syscall (openbsd-386), const MADV_SEQUENTIAL ideal-int
+pkg syscall (openbsd-386), const MADV_SPACEAVAIL = 5
+pkg syscall (openbsd-386), const MADV_SPACEAVAIL ideal-int
+pkg syscall (openbsd-386), const MADV_WILLNEED = 3
+pkg syscall (openbsd-386), const MADV_WILLNEED ideal-int
+pkg syscall (openbsd-386), const MAP_ANON = 4096
+pkg syscall (openbsd-386), const MAP_ANON ideal-int
+pkg syscall (openbsd-386), const MAP_COPY = 4
+pkg syscall (openbsd-386), const MAP_COPY ideal-int
+pkg syscall (openbsd-386), const MAP_FILE = 0
+pkg syscall (openbsd-386), const MAP_FILE ideal-int
+pkg syscall (openbsd-386), const MAP_FIXED = 16
+pkg syscall (openbsd-386), const MAP_FIXED ideal-int
+pkg syscall (openbsd-386), const MAP_FLAGMASK = 8183
+pkg syscall (openbsd-386), const MAP_FLAGMASK ideal-int
+pkg syscall (openbsd-386), const MAP_HASSEMAPHORE = 512
+pkg syscall (openbsd-386), const MAP_HASSEMAPHORE ideal-int
+pkg syscall (openbsd-386), const MAP_INHERIT = 128
+pkg syscall (openbsd-386), const MAP_INHERIT ideal-int
+pkg syscall (openbsd-386), const MAP_INHERIT_COPY = 1
+pkg syscall (openbsd-386), const MAP_INHERIT_COPY ideal-int
+pkg syscall (openbsd-386), const MAP_INHERIT_DONATE_COPY = 3
+pkg syscall (openbsd-386), const MAP_INHERIT_DONATE_COPY ideal-int
+pkg syscall (openbsd-386), const MAP_INHERIT_NONE = 2
+pkg syscall (openbsd-386), const MAP_INHERIT_NONE ideal-int
+pkg syscall (openbsd-386), const MAP_INHERIT_SHARE = 0
+pkg syscall (openbsd-386), const MAP_INHERIT_SHARE ideal-int
+pkg syscall (openbsd-386), const MAP_NOEXTEND = 256
+pkg syscall (openbsd-386), const MAP_NOEXTEND ideal-int
+pkg syscall (openbsd-386), const MAP_NORESERVE = 64
+pkg syscall (openbsd-386), const MAP_NORESERVE ideal-int
+pkg syscall (openbsd-386), const MAP_PRIVATE = 2
+pkg syscall (openbsd-386), const MAP_PRIVATE ideal-int
+pkg syscall (openbsd-386), const MAP_RENAME = 32
+pkg syscall (openbsd-386), const MAP_RENAME ideal-int
+pkg syscall (openbsd-386), const MAP_SHARED = 1
+pkg syscall (openbsd-386), const MAP_SHARED ideal-int
+pkg syscall (openbsd-386), const MAP_TRYFIXED = 1024
+pkg syscall (openbsd-386), const MAP_TRYFIXED ideal-int
+pkg syscall (openbsd-386), const MCL_CURRENT = 1
+pkg syscall (openbsd-386), const MCL_CURRENT ideal-int
+pkg syscall (openbsd-386), const MCL_FUTURE = 2
+pkg syscall (openbsd-386), const MCL_FUTURE ideal-int
+pkg syscall (openbsd-386), const MS_ASYNC = 1
+pkg syscall (openbsd-386), const MS_ASYNC ideal-int
+pkg syscall (openbsd-386), const MS_INVALIDATE = 4
+pkg syscall (openbsd-386), const MS_INVALIDATE ideal-int
+pkg syscall (openbsd-386), const MS_SYNC = 2
+pkg syscall (openbsd-386), const MS_SYNC ideal-int
+pkg syscall (openbsd-386), const PROT_EXEC = 4
+pkg syscall (openbsd-386), const PROT_EXEC ideal-int
+pkg syscall (openbsd-386), const PROT_NONE = 0
+pkg syscall (openbsd-386), const PROT_NONE ideal-int
+pkg syscall (openbsd-386), const PROT_READ = 1
+pkg syscall (openbsd-386), const PROT_READ ideal-int
+pkg syscall (openbsd-386), const PROT_WRITE = 2
+pkg syscall (openbsd-386), const PROT_WRITE ideal-int
 pkg syscall (openbsd-386), const RTF_FMASK = 1112072
 pkg syscall (openbsd-386), const RTM_VERSION = 5
 pkg syscall (openbsd-386), const SIOCBRDGDADDR = 2166909255
 pkg syscall (openbsd-386-cgo), const IPV6_RECVDSTPORT ideal-int
 pkg syscall (openbsd-386-cgo), const IP_DIVERTFL = 4130
 pkg syscall (openbsd-386-cgo), const IP_DIVERTFL ideal-int
+pkg syscall (openbsd-386-cgo), const MADV_DONTNEED = 4
+pkg syscall (openbsd-386-cgo), const MADV_DONTNEED ideal-int
+pkg syscall (openbsd-386-cgo), const MADV_FREE = 6
+pkg syscall (openbsd-386-cgo), const MADV_FREE ideal-int
+pkg syscall (openbsd-386-cgo), const MADV_NORMAL = 0
+pkg syscall (openbsd-386-cgo), const MADV_NORMAL ideal-int
+pkg syscall (openbsd-386-cgo), const MADV_RANDOM = 1
+pkg syscall (openbsd-386-cgo), const MADV_RANDOM ideal-int
+pkg syscall (openbsd-386-cgo), const MADV_SEQUENTIAL = 2
+pkg syscall (openbsd-386-cgo), const MADV_SEQUENTIAL ideal-int
+pkg syscall (openbsd-386-cgo), const MADV_SPACEAVAIL = 5
+pkg syscall (openbsd-386-cgo), const MADV_SPACEAVAIL ideal-int
+pkg syscall (openbsd-386-cgo), const MADV_WILLNEED = 3
+pkg syscall (openbsd-386-cgo), const MADV_WILLNEED ideal-int
+pkg syscall (openbsd-386-cgo), const MAP_ANON = 4096
+pkg syscall (openbsd-386-cgo), const MAP_ANON ideal-int
+pkg syscall (openbsd-386-cgo), const MAP_COPY = 4
+pkg syscall (openbsd-386-cgo), const MAP_COPY ideal-int
+pkg syscall (openbsd-386-cgo), const MAP_FILE = 0
+pkg syscall (openbsd-386-cgo), const MAP_FILE ideal-int
+pkg syscall (openbsd-386-cgo), const MAP_FIXED = 16
+pkg syscall (openbsd-386-cgo), const MAP_FIXED ideal-int
+pkg syscall (openbsd-386-cgo), const MAP_FLAGMASK = 8183
+pkg syscall (openbsd-386-cgo), const MAP_FLAGMASK ideal-int
+pkg syscall (openbsd-386-cgo), const MAP_HASSEMAPHORE = 512
+pkg syscall (openbsd-386-cgo), const MAP_HASSEMAPHORE ideal-int
+pkg syscall (openbsd-386-cgo), const MAP_INHERIT = 128
+pkg syscall (openbsd-386-cgo), const MAP_INHERIT ideal-int
+pkg syscall (openbsd-386-cgo), const MAP_INHERIT_COPY = 1
+pkg syscall (openbsd-386-cgo), const MAP_INHERIT_COPY ideal-int
+pkg syscall (openbsd-386-cgo), const MAP_INHERIT_DONATE_COPY = 3
+pkg syscall (openbsd-386-cgo), const MAP_INHERIT_DONATE_COPY ideal-int
+pkg syscall (openbsd-386-cgo), const MAP_INHERIT_NONE = 2
+pkg syscall (openbsd-386-cgo), const MAP_INHERIT_NONE ideal-int
+pkg syscall (openbsd-386-cgo), const MAP_INHERIT_SHARE = 0
+pkg syscall (openbsd-386-cgo), const MAP_INHERIT_SHARE ideal-int
+pkg syscall (openbsd-386-cgo), const MAP_NOEXTEND = 256
+pkg syscall (openbsd-386-cgo), const MAP_NOEXTEND ideal-int
+pkg syscall (openbsd-386-cgo), const MAP_NORESERVE = 64
+pkg syscall (openbsd-386-cgo), const MAP_NORESERVE ideal-int
+pkg syscall (openbsd-386-cgo), const MAP_PRIVATE = 2
+pkg syscall (openbsd-386-cgo), const MAP_PRIVATE ideal-int
+pkg syscall (openbsd-386-cgo), const MAP_RENAME = 32
+pkg syscall (openbsd-386-cgo), const MAP_RENAME ideal-int
+pkg syscall (openbsd-386-cgo), const MAP_SHARED = 1
+pkg syscall (openbsd-386-cgo), const MAP_SHARED ideal-int
+pkg syscall (openbsd-386-cgo), const MAP_TRYFIXED = 1024
+pkg syscall (openbsd-386-cgo), const MAP_TRYFIXED ideal-int
+pkg syscall (openbsd-386-cgo), const MCL_CURRENT = 1
+pkg syscall (openbsd-386-cgo), const MCL_CURRENT ideal-int
+pkg syscall (openbsd-386-cgo), const MCL_FUTURE = 2
+pkg syscall (openbsd-386-cgo), const MCL_FUTURE ideal-int
+pkg syscall (openbsd-386-cgo), const MS_ASYNC = 1
+pkg syscall (openbsd-386-cgo), const MS_ASYNC ideal-int
+pkg syscall (openbsd-386-cgo), const MS_INVALIDATE = 4
+pkg syscall (openbsd-386-cgo), const MS_INVALIDATE ideal-int
+pkg syscall (openbsd-386-cgo), const MS_SYNC = 2
+pkg syscall (openbsd-386-cgo), const MS_SYNC ideal-int
+pkg syscall (openbsd-386-cgo), const PROT_EXEC = 4
+pkg syscall (openbsd-386-cgo), const PROT_EXEC ideal-int
+pkg syscall (openbsd-386-cgo), const PROT_NONE = 0
+pkg syscall (openbsd-386-cgo), const PROT_NONE ideal-int
+pkg syscall (openbsd-386-cgo), const PROT_READ = 1
+pkg syscall (openbsd-386-cgo), const PROT_READ ideal-int
+pkg syscall (openbsd-386-cgo), const PROT_WRITE = 2
+pkg syscall (openbsd-386-cgo), const PROT_WRITE ideal-int
 pkg syscall (openbsd-386-cgo), const RTF_FMASK = 1112072
 pkg syscall (openbsd-386-cgo), const RTM_VERSION = 5
 pkg syscall (openbsd-386-cgo), const SIOCBRDGDADDR = 2166909255
 pkg syscall (openbsd-amd64), const IPV6_RECVDSTPORT ideal-int
 pkg syscall (openbsd-amd64), const IP_DIVERTFL = 4130
 pkg syscall (openbsd-amd64), const IP_DIVERTFL ideal-int
+pkg syscall (openbsd-amd64), const MADV_DONTNEED = 4
+pkg syscall (openbsd-amd64), const MADV_DONTNEED ideal-int
+pkg syscall (openbsd-amd64), const MADV_FREE = 6
+pkg syscall (openbsd-amd64), const MADV_FREE ideal-int
+pkg syscall (openbsd-amd64), const MADV_NORMAL = 0
+pkg syscall (openbsd-amd64), const MADV_NORMAL ideal-int
+pkg syscall (openbsd-amd64), const MADV_RANDOM = 1
+pkg syscall (openbsd-amd64), const MADV_RANDOM ideal-int
+pkg syscall (openbsd-amd64), const MADV_SEQUENTIAL = 2
+pkg syscall (openbsd-amd64), const MADV_SEQUENTIAL ideal-int
+pkg syscall (openbsd-amd64), const MADV_SPACEAVAIL = 5
+pkg syscall (openbsd-amd64), const MADV_SPACEAVAIL ideal-int
+pkg syscall (openbsd-amd64), const MADV_WILLNEED = 3
+pkg syscall (openbsd-amd64), const MADV_WILLNEED ideal-int
+pkg syscall (openbsd-amd64), const MAP_ANON = 4096
+pkg syscall (openbsd-amd64), const MAP_ANON ideal-int
+pkg syscall (openbsd-amd64), const MAP_COPY = 4
+pkg syscall (openbsd-amd64), const MAP_COPY ideal-int
+pkg syscall (openbsd-amd64), const MAP_FILE = 0
+pkg syscall (openbsd-amd64), const MAP_FILE ideal-int
+pkg syscall (openbsd-amd64), const MAP_FIXED = 16
+pkg syscall (openbsd-amd64), const MAP_FIXED ideal-int
+pkg syscall (openbsd-amd64), const MAP_FLAGMASK = 8183
+pkg syscall (openbsd-amd64), const MAP_FLAGMASK ideal-int
+pkg syscall (openbsd-amd64), const MAP_HASSEMAPHORE = 512
+pkg syscall (openbsd-amd64), const MAP_HASSEMAPHORE ideal-int
+pkg syscall (openbsd-amd64), const MAP_INHERIT = 128
+pkg syscall (openbsd-amd64), const MAP_INHERIT ideal-int
+pkg syscall (openbsd-amd64), const MAP_INHERIT_COPY = 1
+pkg syscall (openbsd-amd64), const MAP_INHERIT_COPY ideal-int
+pkg syscall (openbsd-amd64), const MAP_INHERIT_DONATE_COPY = 3
+pkg syscall (openbsd-amd64), const MAP_INHERIT_DONATE_COPY ideal-int
+pkg syscall (openbsd-amd64), const MAP_INHERIT_NONE = 2
+pkg syscall (openbsd-amd64), const MAP_INHERIT_NONE ideal-int
+pkg syscall (openbsd-amd64), const MAP_INHERIT_SHARE = 0
+pkg syscall (openbsd-amd64), const MAP_INHERIT_SHARE ideal-int
+pkg syscall (openbsd-amd64), const MAP_NOEXTEND = 256
+pkg syscall (openbsd-amd64), const MAP_NOEXTEND ideal-int
+pkg syscall (openbsd-amd64), const MAP_NORESERVE = 64
+pkg syscall (openbsd-amd64), const MAP_NORESERVE ideal-int
+pkg syscall (openbsd-amd64), const MAP_PRIVATE = 2
+pkg syscall (openbsd-amd64), const MAP_PRIVATE ideal-int
+pkg syscall (openbsd-amd64), const MAP_RENAME = 32
+pkg syscall (openbsd-amd64), const MAP_RENAME ideal-int
+pkg syscall (openbsd-amd64), const MAP_SHARED = 1
+pkg syscall (openbsd-amd64), const MAP_SHARED ideal-int
+pkg syscall (openbsd-amd64), const MAP_TRYFIXED = 1024
+pkg syscall (openbsd-amd64), const MAP_TRYFIXED ideal-int
+pkg syscall (openbsd-amd64), const MCL_CURRENT = 1
+pkg syscall (openbsd-amd64), const MCL_CURRENT ideal-int
+pkg syscall (openbsd-amd64), const MCL_FUTURE = 2
+pkg syscall (openbsd-amd64), const MCL_FUTURE ideal-int
+pkg syscall (openbsd-amd64), const MS_ASYNC = 1
+pkg syscall (openbsd-amd64), const MS_ASYNC ideal-int
+pkg syscall (openbsd-amd64), const MS_INVALIDATE = 4
+pkg syscall (openbsd-amd64), const MS_INVALIDATE ideal-int
+pkg syscall (openbsd-amd64), const MS_SYNC = 2
+pkg syscall (openbsd-amd64), const MS_SYNC ideal-int
+pkg syscall (openbsd-amd64), const PROT_EXEC = 4
+pkg syscall (openbsd-amd64), const PROT_EXEC ideal-int
+pkg syscall (openbsd-amd64), const PROT_NONE = 0
+pkg syscall (openbsd-amd64), const PROT_NONE ideal-int
+pkg syscall (openbsd-amd64), const PROT_READ = 1
+pkg syscall (openbsd-amd64), const PROT_READ ideal-int
+pkg syscall (openbsd-amd64), const PROT_WRITE = 2
+pkg syscall (openbsd-amd64), const PROT_WRITE ideal-int
 pkg syscall (openbsd-amd64), const RTF_FMASK = 1112072
 pkg syscall (openbsd-amd64), const RTM_VERSION = 5
 pkg syscall (openbsd-amd64), const SIOCBRDGDADDR = 2166909255
 pkg syscall (openbsd-amd64-cgo), const IPV6_RECVDSTPORT ideal-int
 pkg syscall (openbsd-amd64-cgo), const IP_DIVERTFL = 4130
 pkg syscall (openbsd-amd64-cgo), const IP_DIVERTFL ideal-int
+pkg syscall (openbsd-amd64-cgo), const MADV_DONTNEED = 4
+pkg syscall (openbsd-amd64-cgo), const MADV_DONTNEED ideal-int
+pkg syscall (openbsd-amd64-cgo), const MADV_FREE = 6
+pkg syscall (openbsd-amd64-cgo), const MADV_FREE ideal-int
+pkg syscall (openbsd-amd64-cgo), const MADV_NORMAL = 0
+pkg syscall (openbsd-amd64-cgo), const MADV_NORMAL ideal-int
+pkg syscall (openbsd-amd64-cgo), const MADV_RANDOM = 1
+pkg syscall (openbsd-amd64-cgo), const MADV_RANDOM ideal-int
+pkg syscall (openbsd-amd64-cgo), const MADV_SEQUENTIAL = 2
+pkg syscall (openbsd-amd64-cgo), const MADV_SEQUENTIAL ideal-int
+pkg syscall (openbsd-amd64-cgo), const MADV_SPACEAVAIL = 5
+pkg syscall (openbsd-amd64-cgo), const MADV_SPACEAVAIL ideal-int
+pkg syscall (openbsd-amd64-cgo), const MADV_WILLNEED = 3
+pkg syscall (openbsd-amd64-cgo), const MADV_WILLNEED ideal-int
+pkg syscall (openbsd-amd64-cgo), const MAP_ANON = 4096
+pkg syscall (openbsd-amd64-cgo), const MAP_ANON ideal-int
+pkg syscall (openbsd-amd64-cgo), const MAP_COPY = 4
+pkg syscall (openbsd-amd64-cgo), const MAP_COPY ideal-int
+pkg syscall (openbsd-amd64-cgo), const MAP_FILE = 0
+pkg syscall (openbsd-amd64-cgo), const MAP_FILE ideal-int
+pkg syscall (openbsd-amd64-cgo), const MAP_FIXED = 16
+pkg syscall (openbsd-amd64-cgo), const MAP_FIXED ideal-int
+pkg syscall (openbsd-amd64-cgo), const MAP_FLAGMASK = 8183
+pkg syscall (openbsd-amd64-cgo), const MAP_FLAGMASK ideal-int
+pkg syscall (openbsd-amd64-cgo), const MAP_HASSEMAPHORE = 512
+pkg syscall (openbsd-amd64-cgo), const MAP_HASSEMAPHORE ideal-int
+pkg syscall (openbsd-amd64-cgo), const MAP_INHERIT = 128
+pkg syscall (openbsd-amd64-cgo), const MAP_INHERIT ideal-int
+pkg syscall (openbsd-amd64-cgo), const MAP_INHERIT_COPY = 1
+pkg syscall (openbsd-amd64-cgo), const MAP_INHERIT_COPY ideal-int
+pkg syscall (openbsd-amd64-cgo), const MAP_INHERIT_DONATE_COPY = 3
+pkg syscall (openbsd-amd64-cgo), const MAP_INHERIT_DONATE_COPY ideal-int
+pkg syscall (openbsd-amd64-cgo), const MAP_INHERIT_NONE = 2
+pkg syscall (openbsd-amd64-cgo), const MAP_INHERIT_NONE ideal-int
+pkg syscall (openbsd-amd64-cgo), const MAP_INHERIT_SHARE = 0
+pkg syscall (openbsd-amd64-cgo), const MAP_INHERIT_SHARE ideal-int
+pkg syscall (openbsd-amd64-cgo), const MAP_NOEXTEND = 256
+pkg syscall (openbsd-amd64-cgo), const MAP_NOEXTEND ideal-int
+pkg syscall (openbsd-amd64-cgo), const MAP_NORESERVE = 64
+pkg syscall (openbsd-amd64-cgo), const MAP_NORESERVE ideal-int
+pkg syscall (openbsd-amd64-cgo), const MAP_PRIVATE = 2
+pkg syscall (openbsd-amd64-cgo), const MAP_PRIVATE ideal-int
+pkg syscall (openbsd-amd64-cgo), const MAP_RENAME = 32
+pkg syscall (openbsd-amd64-cgo), const MAP_RENAME ideal-int
+pkg syscall (openbsd-amd64-cgo), const MAP_SHARED = 1
+pkg syscall (openbsd-amd64-cgo), const MAP_SHARED ideal-int
+pkg syscall (openbsd-amd64-cgo), const MAP_TRYFIXED = 1024
+pkg syscall (openbsd-amd64-cgo), const MAP_TRYFIXED ideal-int
+pkg syscall (openbsd-amd64-cgo), const MCL_CURRENT = 1
+pkg syscall (openbsd-amd64-cgo), const MCL_CURRENT ideal-int
+pkg syscall (openbsd-amd64-cgo), const MCL_FUTURE = 2
+pkg syscall (openbsd-amd64-cgo), const MCL_FUTURE ideal-int
+pkg syscall (openbsd-amd64-cgo), const MS_ASYNC = 1
+pkg syscall (openbsd-amd64-cgo), const MS_ASYNC ideal-int
+pkg syscall (openbsd-amd64-cgo), const MS_INVALIDATE = 4
+pkg syscall (openbsd-amd64-cgo), const MS_INVALIDATE ideal-int
+pkg syscall (openbsd-amd64-cgo), const MS_SYNC = 2
+pkg syscall (openbsd-amd64-cgo), const MS_SYNC ideal-int
+pkg syscall (openbsd-amd64-cgo), const PROT_EXEC = 4
+pkg syscall (openbsd-amd64-cgo), const PROT_EXEC ideal-int
+pkg syscall (openbsd-amd64-cgo), const PROT_NONE = 0
+pkg syscall (openbsd-amd64-cgo), const PROT_NONE ideal-int
+pkg syscall (openbsd-amd64-cgo), const PROT_READ = 1
+pkg syscall (openbsd-amd64-cgo), const PROT_READ ideal-int
+pkg syscall (openbsd-amd64-cgo), const PROT_WRITE = 2
+pkg syscall (openbsd-amd64-cgo), const PROT_WRITE ideal-int
 pkg syscall (openbsd-amd64-cgo), const RTF_FMASK = 1112072
 pkg syscall (openbsd-amd64-cgo), const RTM_VERSION = 5
 pkg syscall (openbsd-amd64-cgo), const SIOCBRDGDADDR = 2166909255
 pkg syscall (openbsd-amd64-cgo), type Statfs_t struct, F_mntfromspec [90]int8
 pkg syscall (openbsd-amd64-cgo), type Statfs_t struct, Pad_cgo_1 [2]uint8
 pkg syscall (openbsd-amd64-cgo), type Timespec struct, Sec int64
+pkg syscall (windows-386), const ERROR_NETNAME_DELETED = 64
+pkg syscall (windows-386), const ERROR_NETNAME_DELETED Errno
+pkg syscall (windows-386), const IOC_VENDOR = 402653184
+pkg syscall (windows-386), const IOC_VENDOR ideal-int
+pkg syscall (windows-386), const SIO_KEEPALIVE_VALS = 2550136836
+pkg syscall (windows-386), const SIO_KEEPALIVE_VALS ideal-int
+pkg syscall (windows-386), const WSAECONNRESET = 10054
+pkg syscall (windows-386), const WSAECONNRESET Errno
+pkg syscall (windows-386), func NewCallbackCDecl(interface{}) uintptr
+pkg syscall (windows-386), type TCPKeepalive struct
+pkg syscall (windows-386), type TCPKeepalive struct, Interval uint32
+pkg syscall (windows-386), type TCPKeepalive struct, OnOff uint32
+pkg syscall (windows-386), type TCPKeepalive struct, Time uint32
+pkg syscall (windows-amd64), const ERROR_NETNAME_DELETED = 64
+pkg syscall (windows-amd64), const ERROR_NETNAME_DELETED Errno
+pkg syscall (windows-amd64), const IOC_VENDOR = 402653184
+pkg syscall (windows-amd64), const IOC_VENDOR ideal-int
+pkg syscall (windows-amd64), const SIO_KEEPALIVE_VALS = 2550136836
+pkg syscall (windows-amd64), const SIO_KEEPALIVE_VALS ideal-int
+pkg syscall (windows-amd64), const WSAECONNRESET = 10054
+pkg syscall (windows-amd64), const WSAECONNRESET Errno
+pkg syscall (windows-amd64), func NewCallbackCDecl(interface{}) uintptr
+pkg syscall (windows-amd64), type TCPKeepalive struct
+pkg syscall (windows-amd64), type TCPKeepalive struct, Interval uint32
+pkg syscall (windows-amd64), type TCPKeepalive struct, OnOff uint32
+pkg syscall (windows-amd64), type TCPKeepalive struct, Time uint32

File doc/go1.3.txt

+cmd/gofmt: remove -tabwidth and -tabs flags (CL 52170043)
 liblink: pull linker i/o into separate liblink C library (CL 35790044)
 misc/dist: renamed misc/makerelease (CL 39920043)
+runtime: output how long goroutines are blocked (CL 50420043)
 syscall: add NewCallbackCDecl to use for windows callbacks (CL 36180044)

File doc/go_spec.html

 <!--{
 	"Title": "The Go Programming Language Specification",
-	"Subtitle": "Version of Jan 2, 2014",
+	"Subtitle": "Version of Jan 14, 2014",
 	"Path": "/ref/spec"
 }-->
 
 If an explicit period (<code>.</code>) appears instead of a name, all the
 package's exported identifiers declared in that package's
 <a href="#Blocks">package block</a> will be declared in the importing source
-file's file block and can be accessed without a qualifier.
+file's file block and must be accessed without a qualifier.
 </p>
 
 <p>
 <code>package math</code>, which exports function <code>Sin</code>, and
 installed the compiled package in the file identified by
 <code>"lib/math"</code>.
-This table illustrates how <code>Sin</code> may be accessed in files
+This table illustrates how <code>Sin</code> is accessed in files
 that import the package after the
 various types of import declaration.
 </p>

File src/cmd/api/run.go

 	gopath := prepGoPath()
 
 	cmd := exec.Command("go", "install", "--tags=api_tool", "cmd/api")
-	cmd.Env = append([]string{"GOPATH=" + gopath}, filterOut(os.Environ(), "GOARCH")...)
+	cmd.Env = append(filterOut(os.Environ(), "GOARCH", "GOPATH"), "GOPATH="+gopath)
 	out, err := cmd.CombinedOutput()
 	if err != nil {
 		log.Fatalf("Error installing cmd/api: %v\n%s", err, out)

File src/cmd/dist/build.c

 
 	"cmd/addr2line",
 	"cmd/objdump",
-	"cmd/pack",
 	"cmd/prof",
 
 	"cmd/cc",  // must be before c
 	"cmd/gc",
 	"cmd/go",	
 	"cmd/objdump",
-	"cmd/pack",
 	"cmd/prof",
 	"lib9",
 	"libbio",

File src/cmd/gc/gen.c

 	n = nod(OXXX, N, N);
 	tempname(n, t);
 	n->sym->def->used = 1;
-	return n;
+	return n->orig;
 }

File src/cmd/gc/go.h

 EXTERN	int	flag_race;
 EXTERN	int	flag_largemodel;
 EXTERN	int	noescape;
+EXTERN	int	debuglive;
 EXTERN	Link*	ctxt;
 
 EXTERN	int	nointerface;

File src/cmd/gc/lex.c

 	flagstr("installsuffix", "pkg directory suffix", &flag_installsuffix);
 	flagcount("j", "debug runtime-initialized variables", &debug['j']);
 	flagcount("l", "disable inlining", &debug['l']);
+	flagcount("live", "debug liveness analysis", &debuglive);
 	flagcount("m", "print optimization decisions", &debug['m']);
 	flagstr("o", "obj: set output file", &outfile);
 	flagstr("p", "path: set expected package import path", &myimportpath);

File src/cmd/gc/plive.c

 }
 
 // Collects and returns and array of Node*s for functions arguments and local
-// variables.  TODO(cshapiro): only return pointer containing nodes if we are
-// not also generating a dead value map.
+// variables.
 static Array*
-getvariables(Node *fn)
+getvariables(Node *fn, int allvalues)
 {
 	Array *result;
 	NodeList *ll;
 	result = arraynew(0, sizeof(Node*));
 	for(ll = fn->dcl; ll != nil; ll = ll->next) {
 		if(ll->n->op == ONAME) {
-			switch(ll->n->class & ~PHEAP) {
+			switch(ll->n->class) {
 			case PAUTO:
 			case PPARAM:
 			case PPARAMOUT:
-				arrayadd(result, &ll->n);
+				if(haspointers(ll->n->type) || allvalues)
+					arrayadd(result, &ll->n);
+				break;
 			}
 		}
 	}
 			case PPARAMOUT:
 				pos = arrayindexof(vars, from->node);
 				if(pos == -1)
-					fatal("progeffects: variable %N is unknown", prog->from.node);
+					goto Next;
 				if(info.flags & (LeftRead | LeftAddr))
 					bvset(uevar, pos);
 				if(info.flags & LeftWrite)
 			}
 		}
 	}
+Next:
 	if(info.flags & (RightRead | RightWrite | RightAddr)) {
 		to = &prog->to;
 		if (to->node != nil && to->sym != nil && !isfunny(to->node)) {
 			case PPARAMOUT:
 				pos = arrayindexof(vars, to->node);
 				if(pos == -1)
-					fatal("progeffects: variable %N is unknown", to->node);
+					goto Next1;
 				if(info.flags & (RightRead | RightAddr))
 					bvset(uevar, pos);
 				if(info.flags & RightWrite)
 			}
 		}
 	}
+Next1:;
 }
 
 // Constructs a new liveness structure used to hold the global state of the
 livenessepilogue(Liveness *lv)
 {
 	BasicBlock *bb;
-	Bvec *livein;
-	Bvec *liveout;
-	Bvec *uevar;
-	Bvec *varkill;
-	Bvec *args;
-	Bvec *locals;
+	Bvec *livein, *liveout, *uevar, *varkill, *args, *locals;
 	Prog *p, *next;
-	int32 i;
-	int32 nvars;
-	int32 pos;
+	int32 i, j, nmsg, nvars, pos;
+	char **msg;
+	Fmt fmt;
 
 	nvars = arraylength(lv->vars);
 	livein = bvalloc(nvars);
 	liveout = bvalloc(nvars);
 	uevar = bvalloc(nvars);
 	varkill = bvalloc(nvars);
+	msg = nil;
+	nmsg = 0;
 
 	for(i = 0; i < arraylength(lv->cfg); i++) {
 		bb = *(BasicBlock**)arrayget(lv->cfg, i);
 				arrayadd(lv->deadvalues, &locals);
 			}
 		}
+		
+		if(debuglive) {
+			nmsg = arraylength(lv->livepointers);
+			msg = xmalloc(nmsg*sizeof msg[0]);
+			for(j=0; j<nmsg; j++)
+				msg[j] = nil;
+		}
 
 		// walk backward, emit pcdata and populate the maps
 		pos = arraylength(lv->livepointers) - 1;
 			}
 			if(issafepoint(p)) {
 				// Found an interesting instruction, record the
-				// corresponding liveness information.  Only
-				// CALL instructions need a PCDATA annotation.
+				// corresponding liveness information.  
+
+				if(debuglive) {
+					fmtstrinit(&fmt);
+					fmtprint(&fmt, "%L: live at ", p->lineno);
+					if(p->as == ACALL)
+						fmtprint(&fmt, "CALL %lS:", p->to.sym);
+					else
+						fmtprint(&fmt, "TEXT %lS:", p->from.sym);
+					for(j = 0; j < arraylength(lv->vars); j++)
+						if(bvget(liveout, j))
+							fmtprint(&fmt, " %N", *(Node**)arrayget(lv->vars, j));
+					fmtprint(&fmt, "\n");
+					msg[pos] = fmtstrflush(&fmt);
+				}
+
+				// Record live pointers.
+				args = *(Bvec**)arrayget(lv->argslivepointers, pos);
+				locals = *(Bvec**)arrayget(lv->livepointers, pos);
+				twobitlivepointermap(lv, liveout, lv->vars, args, locals);
+
+				// Record dead values.
+				if(lv->deadvalues != nil) {
+					args = *(Bvec**)arrayget(lv->argsdeadvalues, pos);
+					locals = *(Bvec**)arrayget(lv->deadvalues, pos);
+					twobitdeadvaluemap(lv, liveout, lv->vars, args, locals);
+				}
+
+				// Only CALL instructions need a PCDATA annotation.
 				// The TEXT instruction annotation is implicit.
 				if(p->as == ACALL) {
 					if(isdeferreturn(p)) {
 					}
 				}
 
-				// Record live pointers.
-				args = *(Bvec**)arrayget(lv->argslivepointers, pos);
-				locals = *(Bvec**)arrayget(lv->livepointers, pos);
-				twobitlivepointermap(lv, liveout, lv->vars, args, locals);
-
-				// Record dead values.
-				if(lv->deadvalues != nil) {
-					args = *(Bvec**)arrayget(lv->argsdeadvalues, pos);
-					locals = *(Bvec**)arrayget(lv->deadvalues, pos);
-					twobitdeadvaluemap(lv, liveout, lv->vars, args, locals);
-				}
-
 				pos--;
 			}
 		}
+		if(debuglive) {
+			for(j=0; j<nmsg; j++) 
+				if(msg[j] != nil)
+					print("%s", msg[j]);
+			free(msg);
+			msg = nil;
+			nmsg = 0;
+		}
 	}
 
 	free(livein);
 	// Construct the global liveness state.
 	cfg = newcfg(firstp);
 	if(0) printcfg(cfg);
-	vars = getvariables(fn);
+	vars = getvariables(fn, deadsym != nil);
 	lv = newliveness(fn, firstp, cfg, vars, deadsym != nil);
 
 	// Run the dataflow framework.

File src/cmd/gc/reflect.c

 	//    h *Hmap
 	//    buckets *Bucket
 	//    bptr *Bucket
-	//    other [5]uintptr
+	//    other [4]uintptr
 	// }
 	// must match ../../pkg/runtime/hashmap.c:hash_iter.
 	field[0] = typ(TFIELD);
 	field[6] = typ(TFIELD);
 	field[6]->type = typ(TARRAY);
 	field[6]->type->type = types[TUINTPTR];
-	field[6]->type->bound = 5;
-	field[6]->type->width = 5 * widthptr;
+	field[6]->type->bound = 4;
+	field[6]->type->width = 4 * widthptr;
 	field[6]->sym = mal(sizeof(Sym));
 	field[6]->sym->name = "other";
 	
 	}
 	field[6]->down = T;
 	off += field[6]->type->width;
-	if(off != 11 * widthptr)
-		yyerror("hash_iter size not correct %d %d", off, 11 * widthptr);
+	if(off != 10 * widthptr)
+		yyerror("hash_iter size not correct %d %d", off, 10 * widthptr);
 	t->hiter = i;
 	i->map = t;
 	return i;

File src/cmd/gc/sinit.c

 			else {
 				a = nod(OXXX, N, N);
 				*a = n1;
+				a->orig = a; // completely separate copy
 				if(!staticassign(a, e->expr, out))
 					*out = list(*out, nod(OAS, a, e->expr));
 			}

File src/cmd/gc/typecheck.c

 		checklvalue(n->left, "take the address of");
 		for(l=n->left; l->op == ODOT; l=l->left)
 			l->addrtaken = 1;
+		if(l->orig != l && l->op == ONAME)
+			fatal("found non-orig name node %N", l);
 		l->addrtaken = 1;
 		defaultlit(&n->left, T);
 		l = n->left;

File src/cmd/go/pkg.go

 	"cmd/fix":                              toTool,
 	"cmd/link":                             toTool,
 	"cmd/nm":                               toTool,
+	"cmd/pack":                             toTool,
 	"cmd/yacc":                             toTool,
 	"code.google.com/p/go.tools/cmd/cover": toTool,
 	"code.google.com/p/go.tools/cmd/godoc": toBin,

File src/cmd/gofmt/doc.go

 
 /*
 Gofmt formats Go programs.
+It uses tabs (width = 8) for indentation and blanks for alignment.
 
 Without an explicit path, it processes the standard input.  Given a file,
 it operates on that file; given a directory, it operates on all .go files in
 		If a file's formatting is different from gofmt's, overwrite it
 		with gofmt's version.
 
-Formatting control flags:
-	-comments=true
-		Print comments; if false, all comments are elided from the output.
-	-tabs=true
-		Indent with tabs; if false, spaces are used instead.
-	-tabwidth=8
-		Tab width in spaces.
+Debugging support:
+	-cpuprofile filename
+		Write cpu profile to the specified file.
 
 
 The rewrite rule specified with the -r flag must be a string of the form:

File src/cmd/gofmt/gofmt.go

 	doDiff      = flag.Bool("d", false, "display diffs instead of rewriting files")
 	allErrors   = flag.Bool("e", false, "report all errors (not just the first 10 on different lines)")
 
-	// layout control
-	comments  = flag.Bool("comments", true, "print comments")
-	tabWidth  = flag.Int("tabwidth", 8, "tab width")
-	tabIndent = flag.Bool("tabs", true, "indent with tabs")
-
 	// debugging
 	cpuprofile = flag.String("cpuprofile", "", "write cpu profile to this file")
 )
 
+const (
+	tabWidth    = 8
+	printerMode = printer.UseSpaces | printer.TabIndent
+)
+
 var (
-	fileSet     = token.NewFileSet() // per process FileSet
-	exitCode    = 0
-	rewrite     func(*ast.File) *ast.File
-	parserMode  parser.Mode
-	printerMode printer.Mode
+	fileSet    = token.NewFileSet() // per process FileSet
+	exitCode   = 0
+	rewrite    func(*ast.File) *ast.File
+	parserMode parser.Mode
 )
 
 func report(err error) {
 }
 
 func initParserMode() {
-	parserMode = parser.Mode(0)
-	if *comments {
-		parserMode |= parser.ParseComments
-	}
+	parserMode = parser.ParseComments
 	if *allErrors {
 		parserMode |= parser.AllErrors
 	}
 }
 
-func initPrinterMode() {
-	printerMode = printer.UseSpaces
-	if *tabIndent {
-		printerMode |= printer.TabIndent
-	}
-}
-
 func isGoFile(f os.FileInfo) bool {
 	// ignore non-Go files
 	name := f.Name()
 	}
 
 	var buf bytes.Buffer
-	err = (&printer.Config{Mode: printerMode, Tabwidth: *tabWidth}).Fprint(&buf, fileSet, file)
+	err = (&printer.Config{Mode: printerMode, Tabwidth: tabWidth}).Fprint(&buf, fileSet, file)
 	if err != nil {
 		return err
 	}
 func gofmtMain() {
 	flag.Usage = usage
 	flag.Parse()
-	if *tabWidth < 0 {
-		fmt.Fprintf(os.Stderr, "negative tabwidth %d\n", *tabWidth)
-		exitCode = 2
-		return
-	}
 
 	if *cpuprofile != "" {
 		f, err := os.Create(*cpuprofile)
 	}
 
 	initParserMode()
-	initPrinterMode()
 	initRewrite()
 
 	if flag.NArg() == 0 {

File src/cmd/gofmt/gofmt_test.go

 	}
 
 	initParserMode()
-	initPrinterMode()
 	initRewrite()
 
 	var buf bytes.Buffer

File src/cmd/gofmt/long_test.go

 	}
 	ast.SortImports(fset, f)
 	src.Reset()
-	return (&printer.Config{Mode: printerMode, Tabwidth: *tabWidth}).Fprint(src, fset, f)
+	return (&printer.Config{Mode: printerMode, Tabwidth: tabWidth}).Fprint(src, fset, f)
 }
 
 func testFile(t *testing.T, b1, b2 *bytes.Buffer, filename string) {

File src/cmd/ld/doc.go

 		Omit the symbol table and debug information.
 	-V
 		Print the linker version.
+	-w
+		Omit the DWARF symbol table.
 	-X symbol value
 		Set the value of an otherwise uninitialized string variable.
 		The symbol name should be of the form importpath.name,

File src/cmd/link/auto.go

+// Copyright 2014 The Go Authors.  All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Automatic symbol generation.
+
+// TODO(rsc): Handle go.typelink, go.track symbols.
+// TODO(rsc): Do not handle $f64. and $f32. symbols. Instead, generate those
+// from the compiler and assemblers as dupok data, and then remove autoData below.
+package main
+
+import (
+	"debug/goobj"
+	"strconv"
+	"strings"
+)
+
+// linkerDefined lists the symbols supplied by other parts of the linker
+// (runtime.go and layout.go).
+var linkerDefined = map[string]bool{
+	"bss":        true,
+	"data":       true,
+	"ebss":       true,
+	"edata":      true,
+	"efunctab":   true,
+	"end":        true,
+	"enoptrbss":  true,
+	"enoptrdata": true,
+	"erodata":    true,
+	"etext":      true,
+	"etypelink":  true,
+	"functab":    true,
+	"gcbss":      true,
+	"gcdata":     true,
+	"noptrbss":   true,
+	"noptrdata":  true,
+	"pclntab":    true,
+	"rodata":     true,
+	"text":       true,
+	"typelink":   true,
+}
+
+// isAuto reports whether sym is an automatically-generated data or constant symbol.
+func (p *Prog) isAuto(sym goobj.SymID) bool {
+	return strings.HasPrefix(sym.Name, "go.weak.") ||
+		strings.HasPrefix(sym.Name, "$f64.") ||
+		strings.HasPrefix(sym.Name, "$f32.") ||
+		linkerDefined[sym.Name]
+}
+
+// autoData defines the automatically generated data symbols needed by p.
+func (p *Prog) autoData() {
+	for sym := range p.Missing {
+		switch {
+		// Floating-point constants that need to be loaded from memory are
+		// written as $f64.{16 hex digits} or $f32.{8 hex digits}; the hex digits
+		// give the IEEE bit pattern of the constant. As far as the layout into
+		// memory is concerned, we interpret these as uint64 or uint32 constants.
+		case strings.HasPrefix(sym.Name, "$f64."), strings.HasPrefix(sym.Name, "$f32."):
+			size := 64
+			if sym.Name[2:4] == "32" {
+				size = 32
+			}
+			delete(p.Missing, sym)
+			fbits, err := strconv.ParseUint(sym.Name[len("$f64."):], 16, size)
+			if err != nil {
+				p.errorf("unexpected floating point symbol %s", sym)
+				continue
+			}
+			data := make([]byte, size/8)
+			if size == 64 {
+				p.byteorder.PutUint64(data, fbits)
+			} else {
+				p.byteorder.PutUint32(data, uint32(fbits))
+			}
+			p.addSym(&Sym{
+				Sym: &goobj.Sym{
+					SymID: sym,
+					Kind:  goobj.SRODATA,
+					Size:  size / 8,
+				},
+				Bytes: data,
+			})
+		}
+	}
+}
+
+// autoConst defines the automatically generated constant symbols needed by p.
+func (p *Prog) autoConst() {
+	for sym := range p.Missing {
+		switch {
+		case strings.HasPrefix(sym.Name, "go.weak."):
+			// weak symbol resolves to actual symbol if present, or else nil.
+			delete(p.Missing, sym)
+			targ := sym
+			targ.Name = sym.Name[len("go.weak."):]
+			var addr Addr
+			if s := p.Syms[targ]; s != nil {
+				addr = s.Addr
+			}
+			p.defineConst(sym.Name, addr)
+		}
+	}
+}
+
+// defineConst defines a new symbol with the given name and constant address.
+func (p *Prog) defineConst(name string, addr Addr) {
+	sym := goobj.SymID{Name: name}
+	p.addSym(&Sym{
+		Sym: &goobj.Sym{
+			SymID: sym,
+			Kind:  goobj.SCONST,
+		},
+		Package: nil,
+		Addr:    addr,
+	})
+}

File src/cmd/link/auto_test.go

+// Copyright 2014 The Go Authors.  All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Test for auto-generated symbols.
+
+// There is no test for $f64. and $f32. symbols, because those are
+// not possible to write in the assembler syntax. Instead of changing
+// the assembler to allow that, we plan to change the compilers
+// not to generate such symbols (plain dupok data is sufficient).
+
+package main
+
+import (
+	"bytes"
+	"debug/goobj"
+	"testing"
+)
+
+// Each test case is an object file, generated from a corresponding .s file.
+// The image of the autotab symbol should be a sequence of pairs of
+// identical 8-byte sequences.
+var autoTests = []string{
+	"testdata/autosection.6",
+	"testdata/autoweak.6",
+}
+
+func TestAuto(t *testing.T) {
+	for _, obj := range autoTests {
+		p := Prog{GOOS: "darwin", GOARCH: "amd64", StartSym: "start"}
+		p.omitRuntime = true
+		p.Error = func(s string) { t.Error(s) }
+		var buf bytes.Buffer
+		p.link(&buf, obj)
+		if p.NumError > 0 {
+			continue // already reported
+		}
+
+		const name = "autotab"
+		sym := p.Syms[goobj.SymID{Name: name}]
+		if sym == nil {
+			t.Errorf("%s is missing %s symbol", obj, name)
+			return
+		}
+		if sym.Size == 0 {
+			return
+		}
+
+		seg := sym.Section.Segment
+		off := sym.Addr - seg.VirtAddr
+		data := seg.Data[off : off+Addr(sym.Size)]
+		if len(data)%16 != 0 {
+			t.Errorf("%s: %s.Size = %d, want multiple of 16", obj, name, len(data))
+			return
+		}
+	Data:
+		for i := 0; i < len(data); i += 16 {
+			have := p.byteorder.Uint64(data[i : i+8])
+			want := p.byteorder.Uint64(data[i+8 : i+16])
+			if have != want {
+				// Look for relocation so we can explain what went wrong.
+				for _, r := range sym.Reloc {
+					if r.Offset == i {
+						t.Errorf("%s: %s+%#x: %s: have %#x want %#x", obj, name, i, r.Sym, have, want)
+						continue Data
+					}
+				}
+				t.Errorf("%s: %s+%#x: have %#x want %#x", obj, name, i, have, want)
+			}
+		}
+	}
+}

File src/cmd/link/dead.go

 
 package main
 
+import "debug/goobj"
+
 // dead removes unreachable code and data from the program.
+// It is basically a mark-sweep garbage collection: traverse all the
+// symbols reachable from the entry (startSymID) and then delete
+// the rest.
 func (p *Prog) dead() {
+	p.Dead = make(map[goobj.SymID]bool)
+	reachable := make(map[goobj.SymID]bool)
+	p.walkDead(p.startSym, reachable)
+
+	for sym := range p.Syms {
+		if !reachable[sym] {
+			delete(p.Syms, sym)
+			p.Dead[sym] = true
+		}
+	}
+
+	for sym := range p.Missing {
+		if !reachable[sym] {
+			delete(p.Missing, sym)
+			p.Dead[sym] = true
+		}
+	}
+
+	p.SymOrder = removeDead(p.SymOrder, reachable)
+
+	for _, pkg := range p.Packages {
+		pkg.Syms = removeDead(pkg.Syms, reachable)
+	}
 }
+
+// walkDead traverses the symbols reachable from sym, adding them to reachable.
+// The caller has verified that reachable[sym] = false.
+func (p *Prog) walkDead(sym goobj.SymID, reachable map[goobj.SymID]bool) {
+	reachable[sym] = true
+	s := p.Syms[sym]
+	if s == nil {
+		return
+	}
+	for i := range s.Reloc {
+		r := &s.Reloc[i]
+		if !reachable[r.Sym] {
+			p.walkDead(r.Sym, reachable)
+		}
+	}
+	if s.Func != nil {
+		for _, fdata := range s.Func.FuncData {
+			if fdata.Sym.Name != "" && !reachable[fdata.Sym] {
+				p.walkDead(fdata.Sym, reachable)
+			}
+		}
+	}
+}
+
+// removeDead removes unreachable (dead) symbols from syms,
+// returning a shortened slice using the same underlying array.
+func removeDead(syms []*Sym, reachable map[goobj.SymID]bool) []*Sym {
+	keep := syms[:0]
+	for _, sym := range syms {
+		if reachable[sym.SymID] {
+			keep = append(keep, sym)
+		}
+	}
+	return keep
+}

File src/cmd/link/dead_test.go

+// Copyright 2014 The Go Authors.  All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import (
+	"debug/goobj"
+	"reflect"
+	"strings"
+	"testing"
+)
+
+// Each test case is an object file, generated from a corresponding .s file.
+// The symbols in the object file with a dead_ prefix are the ones that
+// should be removed from the program.
+var deadTests = []string{
+	"testdata/dead.6",
+}
+
+func TestDead(t *testing.T) {
+	for _, obj := range deadTests {
+		p := Prog{GOOS: "darwin", GOARCH: "amd64", StartSym: "start"}
+		p.omitRuntime = true
+		p.Error = func(s string) { t.Error(s) }
+		p.init()
+		p.scan(obj)
+		if p.NumError > 0 {
+			continue // already reported
+		}
+		origSyms := copyMap(p.Syms)
+		origMissing := copyMap(p.Missing)
+		origSymOrder := copySlice(p.SymOrder)
+		origPkgSyms := copySlice(p.Packages["main"].Syms)
+		p.dead()
+		checkDeadMap(t, obj, "p.Syms", origSyms, p.Syms)
+		checkDeadMap(t, obj, "p.Missing", origMissing, p.Missing)
+		checkDeadSlice(t, obj, "p.SymOrder", origSymOrder, p.SymOrder)
+		checkDeadSlice(t, obj, `p.Packages["main"].Syms`, origPkgSyms, p.Packages["main"].Syms)
+	}
+}
+
+func copyMap(m interface{}) interface{} {
+	v := reflect.ValueOf(m)
+	out := reflect.MakeMap(v.Type())
+	for _, key := range v.MapKeys() {
+		out.SetMapIndex(key, v.MapIndex(key))
+	}
+	return out.Interface()
+}
+
+func checkDeadMap(t *testing.T, obj, name string, old, new interface{}) {
+	vold := reflect.ValueOf(old)
+	vnew := reflect.ValueOf(new)
+	for _, vid := range vold.MapKeys() {
+		id := vid.Interface().(goobj.SymID)
+		if strings.HasPrefix(id.Name, "dead_") {
+			if vnew.MapIndex(vid).IsValid() {
+				t.Errorf("%s: %s contains unnecessary symbol %s", obj, name, id)
+			}
+		} else {
+			if !vnew.MapIndex(vid).IsValid() {
+				t.Errorf("%s: %s is missing symbol %s", obj, name, id)
+			}
+		}
+	}
+	for _, vid := range vnew.MapKeys() {
+		id := vid.Interface().(goobj.SymID)
+		if !vold.MapIndex(vid).IsValid() {
+			t.Errorf("%s: %s contains unexpected symbol %s", obj, name, id)
+		}
+	}
+}
+
+func copySlice(x []*Sym) (out []*Sym) {
+	return append(out, x...)
+}
+
+func checkDeadSlice(t *testing.T, obj, name string, old, new []*Sym) {
+	for i, s := range old {
+		if strings.HasPrefix(s.Name, "dead_") {
+			continue
+		}
+		if len(new) == 0 {
+			t.Errorf("%s: %s is missing symbol %s\nhave%v\nwant%v", obj, name, s, new, old[i:])
+			return
+		}
+		if new[0].SymID != s.SymID {
+			t.Errorf("%s: %s is incorrect: have %s, want %s\nhave%v\nwant%v", obj, name, new[0].SymID, s.SymID, new, old[i:])
+			return
+		}
+		new = new[1:]
+	}
+	if len(new) > 0 {
+		t.Errorf("%s: %s has unexpected symbols: %v", new)
+	}
+}

File src/cmd/link/hex_test.go

+// Copyright 2014 The Go Authors.  All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import (
+	"encoding/hex"
+	"fmt"
+	"io/ioutil"
+	"regexp"
+	"strconv"
+	"strings"
+	"testing"
+)
+
+// mustParseHexdumpFile returns a block of data generated by
+// parsing the hex dump in the named file.
+// If the file cannot be read or does not contain a valid hex dump,
+// mustParseHexdumpFile calls t.Fatal.
+func mustParseHexdumpFile(t *testing.T, file string) []byte {
+	hex, err := ioutil.ReadFile(file)
+	if err != nil {
+		t.Fatal(err)
+	}
+	data, err := parseHexdump(string(hex))
+	if err != nil {
+		t.Fatal(err)
+	}
+	return data
+}
+
+// parseHexdump parses the hex dump in text, which should be the
+// output of "hexdump -C" or Plan 9's "xd -b",
+// and returns the original data used to produce the dump.
+// It is meant to enable storing golden binary files as text, so that
+// changes to the golden files can be seen during code reviews.
+func parseHexdump(text string) ([]byte, error) {
+	var out []byte
+	for _, line := range strings.Split(text, "\n") {
+		if i := strings.Index(line, "|"); i >= 0 { // remove text dump
+			line = line[:i]
+		}
+		f := strings.Fields(line)
+		if len(f) > 1+16 {
+			return nil, fmt.Errorf("parsing hex dump: too many fields on line %q", line)
+		}
+		if len(f) == 0 || len(f) == 1 && f[0] == "*" { // all zeros block omitted
+			continue
+		}
+		addr64, err := strconv.ParseUint(f[0], 16, 0)
+		if err != nil {
+			return nil, fmt.Errorf("parsing hex dump: invalid address %q", f[0])
+		}
+		addr := int(addr64)
+		if len(out) < addr {
+			out = append(out, make([]byte, addr-len(out))...)
+		}
+		for _, x := range f[1:] {
+			val, err := strconv.ParseUint(x, 16, 8)
+			if err != nil {
+				return nil, fmt.Errorf("parsing hexdump: invalid hex byte %q", x)
+			}
+			out = append(out, byte(val))
+		}
+	}
+	return out, nil
+}
+
+func hexdump(data []byte) string {
+	text := hex.Dump(data) + fmt.Sprintf("%08x\n", len(data))
+	text = regexp.MustCompile(`\n([0-9a-f]+(\s+00){16}.*\n)+`).ReplaceAllString(text, "\n*\n")
+	return text
+}

File src/cmd/link/layout.go

 // Entries with the same Segment name must be contiguous.
 var layout = []layoutSection{
 	{Segment: "text", Section: "text", Kind: goobj.STEXT},
+	{Segment: "rodata", Section: "rodata", Kind: goobj.SRODATA},
+	{Segment: "rodata", Section: "functab", Kind: goobj.SPCLNTAB},
+	{Segment: "rodata", Section: "typelink", Kind: goobj.STYPELINK},
+	{Segment: "data", Section: "noptrdata", Kind: goobj.SNOPTRDATA},
 	{Segment: "data", Section: "data", Kind: goobj.SDATA},
+	{Segment: "data", Section: "bss", Kind: goobj.SBSS},
+	{Segment: "data", Section: "noptrbss", Kind: goobj.SNOPTRBSS},
 
 	// Later:
 	//	{"rodata", "type", goobj.STYPE},
 	//	{"rodata", "string", goobj.SSTRING},
 	//	{"rodata", "gostring", goobj.SGOSTRING},
 	//	{"rodata", "gofunc", goobj.SGOFUNC},
-	//	{"rodata", "rodata", goobj.SRODATA},
-	//	{"rodata", "functab", goobj.SFUNCTAB},
-	//	{"rodata", "typelink", goobj.STYPELINK},
-	//	{"rodata", "symtab", goobj.SSYMTAB},
-	//	{"rodata", "pclntab", goobj.SPCLNTAB},
-	//	{"data", "noptrdata", goobj.SNOPTRDATA},
-	//	{"data", "bss", goobj.SBSS},
-	//	{"data", "noptrbss", goobj.SNOPTRBSS},
 }
 
 // layoutByKind maps from SymKind to an entry in layout.
 		}
 	}
 	layoutByKind = make([]*layoutSection, max)
-	for i, sect := range layout {
-		layoutByKind[sect.Kind] = &layout[i]
+	for i := range layout {
+		sect := &layout[i]
+		layoutByKind[sect.Kind] = sect
 		sect.Index = i
 	}
 }
 
 	// Assign symbols to sections using index, creating sections as needed.
 	// Could keep sections separated by type during input instead.
-	for _, sym := range p.Syms {
+	for _, sym := range p.SymOrder {
 		kind := sym.Kind
 		if kind < 0 || int(kind) >= len(layoutByKind) || layoutByKind[kind] == nil {
 			p.errorf("%s: unexpected symbol kind %v", sym.SymID, kind)
 			}
 			sections[lsect.Index] = sect
 		}
-		if sym.Data.Size > 0 {
+		if sym.Data.Size > 0 || len(sym.Bytes) > 0 {
 			sect.InFile = true
 		}
 		sym.Section = sect
 		if sect == nil {
 			continue
 		}
-		if seg == nil || seg.Name != layout[i].Segment {
+		segName := layout[i].Segment
+
+		// Special case: Mach-O does not support "rodata" segment,
+		// so store read-only data in text segment.
+		if p.GOOS == "darwin" && segName == "rodata" {
+			segName = "text"
+		}
+
+		if seg == nil || seg.Name != segName {
 			seg = &Segment{
-				Name: layout[i].Segment,
+				Name: segName,
 			}
 			p.Segments = append(p.Segments, seg)
 		}
 				seg.FileSize = addr - seg.VirtAddr
 			}
 		}
-		seg.VirtSize = addr
+		seg.VirtSize = addr - seg.VirtAddr
 	}
+
+	// Define symbols for section names.
+	var progEnd Addr
+	for i, sect := range sections {
+		name := layout[i].Section
+		var start, end Addr
+		if sect != nil {
+			start = sect.VirtAddr
+			end = sect.VirtAddr + sect.Size
+		}
+		p.defineConst(name, start)
+		p.defineConst("e"+name, end)
+		progEnd = end
+	}
+	p.defineConst("end", progEnd)
 }

File src/cmd/link/layout_test.go

+// Copyright 2014 The Go Authors.  All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import (
+	"bytes"
+	"strings"
+	"testing"
+)
+
+func TestLayout(t *testing.T) {
+	p := Prog{GOOS: "darwin", GOARCH: "amd64", StartSym: "text_start"}
+	p.omitRuntime = true
+	p.Error = func(s string) { t.Error(s) }
+	var buf bytes.Buffer
+	const obj = "testdata/layout.6"
+	p.link(&buf, obj)
+	if p.NumError > 0 {
+		return // already reported
+	}
+	if len(p.Dead) > 0 {
+		t.Errorf("%s: unexpected dead symbols %v", obj, p.Dead)
+		return
+	}
+
+	for _, sym := range p.SymOrder {
+		if p.isAuto(sym.SymID) {
+			continue
+		}
+		if sym.Section == nil {
+			t.Errorf("%s: symbol %s is missing section", obj, sym)
+			continue
+		}
+		i := strings.Index(sym.Name, "_")
+		if i < 0 {
+			t.Errorf("%s: unexpected symbol %s", obj, sym)
+			continue
+		}
+		if sym.Section.Name != sym.Name[:i] {
+			t.Errorf("%s: symbol %s in section %s, want %s", obj, sym, sym.Section.Name, sym.Name[:i])
+		}
+	}
+}

File src/cmd/link/load.go

 
 package main
 
-import (
-	"encoding/binary"
-	"os"
-)
+import "os"
 
 // load allocates segment images, populates them with data
 // read from package files, and applies relocations to the data.
 // loadPackage loads and relocates data for all the
 // symbols needed in the given package.
 func (p *Prog) loadPackage(pkg *Package) {
+	if pkg.File == "" {
+		// This "package" contains internally generated symbols only.
+		// All such symbols have a sym.Bytes field holding the actual data
+		// (if any), plus relocations.
+		for _, sym := range pkg.Syms {
+			if sym.Bytes == nil {
+				continue
+			}
+			seg := sym.Section.Segment
+			off := sym.Addr - seg.VirtAddr
+			data := seg.Data[off : off+Addr(sym.Size)]
+			copy(data, sym.Bytes)
+			p.relocateSym(sym, data)
+		}
+		return
+	}
+
+	// Package stored in file.
 	f, err := os.Open(pkg.File)
 	if err != nil {
 		p.errorf("%v", err)
 			continue
 		}
 		// TODO(rsc): If not using mmap, at least coalesce nearby reads.
+		if sym.Section == nil {
+			p.errorf("internal error: missing section for %s", sym.Name)
+		}
 		seg := sym.Section.Segment
 		off := sym.Addr - seg.VirtAddr
+		if off >= Addr(len(seg.Data)) || off+Addr(sym.Data.Size) > Addr(len(seg.Data)) {
+			p.errorf("internal error: allocated space for %s too small: %d bytes for %d+%d (%d)", sym, len(seg.Data), off, sym.Data.Size, sym.Size)
+		}
 		data := seg.Data[off : off+Addr(sym.Data.Size)]
 		_, err := f.ReadAt(data, sym.Data.Offset)
 		if err != nil {
 			p.errorf("%v: unknown relocation size %d", sym, r.Size)
 		case 4:
 			// TODO(rsc): Check for overflow?
-			// TODO(rsc): Handle big-endian systems.
-			binary.LittleEndian.PutUint32(frag, uint32(val))
+			p.byteorder.PutUint32(frag, uint32(val))
 		case 8:
-			binary.LittleEndian.PutUint64(frag, uint64(val))
+			p.byteorder.PutUint64(frag, uint64(val))
 		}
 	}
 }

File src/cmd/link/macho.go

 func (h *machoHeader) encode() []byte {
 	w := &machoWriter{p: h.p}
 	w.is64 = h.CPU&macho64Bit != 0
-	switch h.SubCPU {
-	default:
-		h.p.errorf("mach-o error: unknown CPU")
-	case machoSubCPU386:
-		w.order = binary.LittleEndian
-	}
+	w.order = w.p.byteorder
 
 	loadSize := 0
 	for _, seg := range h.Segments {

File src/cmd/link/macho_test.go

 		golden: true,
 		prog: &Prog{
 			GOARCH:       "amd64",
+			GOOS:         "darwin",
 			UnmappedSize: 0x1000,
 			Entry:        0x1000,
 			Segments: []*Segment{
 		golden: true,
 		prog: &Prog{
 			GOARCH:       "amd64",
+			GOOS:         "darwin",
 			UnmappedSize: 0x1000,
 			Entry:        0x1000,
 			Segments: []*Segment{
 		golden: true,
 		prog: &Prog{
 			GOARCH:       "amd64",
+			GOOS:         "darwin",
 			UnmappedSize: 0x1000,
 			Entry:        0x1000,
 			Segments: []*Segment{
 	for _, tt := range machoWriteTests {
 		name := tt.prog.GOARCH + "." + tt.name
 		prog := cloneProg(tt.prog)
+		prog.init()
 		var f machoFormat
 		vsize, fsize := f.headerSize(prog)
 		shiftProg(prog, vsize, fsize)

File src/cmd/link/prog.go

 
 import (
 	"debug/goobj"
+	"encoding/binary"
 	"fmt"
 	"go/build"
 	"io"
 	"os"
+	"runtime"
 )
 
 // A Prog holds state for constructing an executable (program) image.
 //
 type Prog struct {
 	// Context
-	GOOS      string // target operating system
-	GOARCH    string // target architecture
-	Format    string // desired file format ("elf", "macho", ...)
-	formatter formatter
-	Error     func(string) // called to report an error (if set)
-	NumError  int          // number of errors printed
+	GOOS     string       // target operating system
+	GOARCH   string       // target architecture
+	Format   string       // desired file format ("elf", "macho", ...)
+	Error    func(string) // called to report an error (if set)
+	NumError int          // number of errors printed
+	StartSym string
+
+	// Derived context
+	arch
+	formatter   formatter
+	startSym    goobj.SymID
+	pkgdir      string
+	omitRuntime bool // do not load runtime package
 
 	// Input
 	Packages   map[string]*Package  // loaded packages, by import path
 	Syms       map[goobj.SymID]*Sym // defined symbols, by symbol ID
-	Missing    map[goobj.SymID]bool // missing symbols, by symbol ID
+	Missing    map[goobj.SymID]bool // missing symbols
+	Dead       map[goobj.SymID]bool // symbols removed as dead
+	SymOrder   []*Sym               // order syms were scanned
 	MaxVersion int                  // max SymID.Version, for generating fresh symbol IDs
 
 	// Output
 	Segments     []*Segment // loaded memory segments
 }
 
-// startSymID is the symbol where program execution begins.
-var startSymID = goobj.SymID{Name: "_rt0_go"}
+// An arch describes architecture-dependent settings.
+type arch struct {
+	byteorder binary.ByteOrder
+	ptrsize   int
+}
 
 // A formatter takes care of the details of generating a particular
 // kind of executable file.
 	Package    *Package // package defining symbol
 	Section    *Section // section where symbol is placed in output program
 	Addr       Addr     // virtual address of symbol in output program
+	Bytes      []byte   // symbol data, for internally defined symbols
 }
 
 // A Segment is a loaded memory segment.
 	}
 	p.dead()
 	p.runtime()
+	p.autoData()
 	p.layout()
+	p.autoConst()
 	if p.NumError > 0 {
 		return
 	}
 			return
 		}
 	}
+	if p.StartSym == "" {
+		p.StartSym = fmt.Sprintf("_rt0_%s_%s", p.GOARCH, p.GOOS)
+	}
 
 	// Derive internal context.
 	p.formatter = formatters[p.Format]
 		p.errorf("unknown output file format %q", p.Format)
 		return
 	}
+	p.startSym = goobj.SymID{Name: p.StartSym}
+	arch, ok := arches[p.GOARCH]
+	if !ok {
+		p.errorf("unknown GOOS %q", p.GOOS)
+		return
+	}
+	p.arch = arch
+
+	p.pkgdir = fmt.Sprintf("%s/pkg/%s_%s", runtime.GOROOT(), p.GOOS, p.GOARCH)
 }
 
 // goosFormat records the default format for each known GOOS value.
 var formatters = map[string]formatter{
 	"darwin": machoFormat{},
 }
+
+var arches = map[string]arch{
+	"amd64": {
+		byteorder: binary.LittleEndian,
+		ptrsize:   8,
+	},
+}

File src/cmd/link/prog_test.go

 	return t
 }
 
+const saveMismatch = true
+
 // checkGolden checks that data matches the named file.
 // If not, it reports the error to the test.
 func checkGolden(t *testing.T, data []byte, name string) {
-	golden, err := ioutil.ReadFile(name)
-	if err != nil {
-		t.Errorf("%s: %v", name, err)
-		return
-	}
+	golden := mustParseHexdumpFile(t, name)
 	if !bytes.Equal(data, golden) {
+		if saveMismatch {
+			ioutil.WriteFile(name+".raw", data, 0666)
+			ioutil.WriteFile(name+".hex", []byte(hexdump(data)), 0666)
+		}
 		// TODO(rsc): A better diff would be nice, as needed.
 		i := 0
 		for i < len(data) && i < len(golden) && data[i] == golden[i] {

File src/cmd/link/scan.go

 import (
 	"debug/goobj"
 	"os"
+	"sort"
 	"strings"
 )
 
 func (p *Prog) scan(mainfile string) {
 	p.initScan()
 	p.scanFile("main", mainfile)
-	if len(p.Missing) != 0 {
-		// TODO(rsc): iterate in deterministic order
-		for sym := range p.Missing {
+	if len(p.Missing) > 0 && !p.omitRuntime {
+		p.scanImport("runtime")
+	}
+
+	var missing []string
+	for sym := range p.Missing {
+		if !p.isAuto(sym) {
+			missing = append(missing, sym.String())
+		}
+	}
+
+	if missing != nil {
+		sort.Strings(missing)
+		for _, sym := range missing {
 			p.errorf("undefined: %s", sym)
 		}
 	}
 	p.Packages = make(map[string]*Package)
 	p.Syms = make(map[goobj.SymID]*Sym)
 	p.Missing = make(map[goobj.SymID]bool)
-	p.Missing[startSymID] = true
+	p.Missing[p.startSym] = true
 }
 
 // scanFile reads file to learn about the package with the given import path.
 			if r.Sym.Version != 0 {
 				r.Sym.Version += p.MaxVersion
 			}
-			if p.Syms[r.Sym] != nil {
+			if p.Syms[r.Sym] == nil {
 				p.Missing[r.Sym] = true
 			}
 		}
+		if gs.Func != nil {
+			for i := range gs.Func.FuncData {
+				fdata := &gs.Func.FuncData[i]
+				if fdata.Sym.Name != "" {
+					if fdata.Sym.Version != 0 {
+						fdata.Sym.Version += p.MaxVersion
+					}
+					if p.Syms[fdata.Sym] == nil {
+						p.Missing[fdata.Sym] = true
+					}
+				}
+			}
+		}
 		if old := p.Syms[gs.SymID]; old != nil {
-			p.errorf("symbol %s defined in both %s and %s", old.Package.File, file)
-			continue
+			// Duplicate definition of symbol. Is it okay?
+			// TODO(rsc): Write test for this code.
+			switch {
+			// If both symbols are BSS (no data), take max of sizes
+			// but otherwise ignore second symbol.
+			case old.Data.Size == 0 && gs.Data.Size == 0:
+				if old.Size < gs.Size {
+					old.Size = gs.Size
+				}
+				continue
+
+			// If one is in BSS and one is not, use the one that is not.
+			case old.Data.Size > 0 && gs.Data.Size == 0:
+				continue
+			case gs.Data.Size > 0 && old.Data.Size == 0:
+				break // install gs as new symbol below
+
+			// If either is marked as DupOK, we can keep either one.
+			// Keep the one that we saw first.
+			case old.DupOK || gs.DupOK:
+				continue
+
+			// Otherwise, there's an actual conflict:
+			default:
+				p.errorf("symbol %s defined in both %s and %s %v %v", gs.SymID, old.Package.File, file, old.Data, gs.Data)
+				continue
+			}
 		}
 		s := &Sym{
 			Sym:     gs,
 			Package: pkg,
 		}
-		pkg.Syms = append(pkg.Syms, s)
-		p.Syms[gs.SymID] = s
+		p.addSym(s)
 		delete(p.Missing, gs.SymID)
+
+		if s.Data.Size > int64(s.Size) {
+			p.errorf("%s: initialized data larger than symbol (%d > %d)", s, s.Data.Size, s.Size)
+		}
 	}
 	p.MaxVersion += pkg.MaxVersion
 
 	}
 }
 
+func (p *Prog) addSym(s *Sym) {
+	pkg := s.Package
+	if pkg == nil {
+		pkg = p.Packages[""]
+		if pkg == nil {
+			pkg = &Package{}
+			p.Packages[""] = pkg
+		}
+		s.Package = pkg
+	}
+	pkg.Syms = append(pkg.Syms, s)
+	p.Syms[s.SymID] = s
+	p.SymOrder = append(p.SymOrder, s)
+}
+
 // scanImport finds the object file for the given import path and then scans it.
 func (p *Prog) scanImport(pkgpath string) {
 	if p.Packages[pkgpath] != nil {
 	}
 
 	// TODO(rsc): Implement correct search to find file.
-	p.scanFile(pkgpath, "/Users/rsc/rscgo/pkg/darwin_amd64/"+pkgpath+".a")
+	p.scanFile(pkgpath, p.pkgdir+"/"+pkgpath+".a")
 }

File src/cmd/link/testdata/autosection.6

Binary file added.

File src/cmd/link/testdata/autosection.s

+// Copyright 2014 The Go Authors.  All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Test of section-named symbols.
+
+#include "../../ld/textflag.h"
+
+TEXT start(SB),7,$0
+	MOVQ $autotab(SB),AX
+	MOVQ $autoptr(SB),AX
+	RET
+
+GLOBL zero(SB), $8
+
+GLOBL zeronoptr(SB), NOPTR, $16
+
+// text
+DATA autotab+0x00(SB)/8, $text(SB)
+DATA autotab+0x08(SB)/8, $start(SB)
+DATA autotab+0x10(SB)/8, $etext(SB)
+DATA autotab+0x18(SB)/8, $start+16(SB)
+
+// data
+DATA autotab+0x20(SB)/8, $data(SB)
+DATA autotab+0x28(SB)/8, $autotab(SB)
+DATA autotab+0x30(SB)/8, $edata(SB)
+DATA autotab+0x38(SB)/8, $nonzero+4(SB)
+
+// bss
+DATA autotab+0x40(SB)/8, $bss(SB)
+DATA autotab+0x48(SB)/8, $zero(SB)
+DATA autotab+0x50(SB)/8, $ebss(SB)
+DATA autotab+0x58(SB)/8, $zero+8(SB)
+
+// noptrdata
+DATA autotab+0x60(SB)/8, $noptrdata(SB)
+DATA autotab+0x68(SB)/8, $nonzeronoptr(SB)
+DATA autotab+0x70(SB)/8, $enoptrdata(SB)
+DATA autotab+0x78(SB)/8, $nonzeronoptr+8(SB)
+
+// noptrbss
+DATA autotab+0x80(SB)/8, $noptrbss(SB)
+DATA autotab+0x88(SB)/8, $zeronoptr(SB)
+DATA autotab+0x90(SB)/8, $enoptrbss(SB)
+DATA autotab+0x98(SB)/8, $zeronoptr+16(SB)
+
+// end
+DATA autotab+0xa0(SB)/8, $end(SB)
+DATA autotab+0xa8(SB)/8, $zeronoptr+16(SB)
+
+GLOBL autotab(SB), $0xb0
+
+DATA nonzero(SB)/4, $1
+GLOBL nonzero(SB), $4
+
+DATA nonzeronoptr(SB)/8, $2
+GLOBL nonzeronoptr(SB), NOPTR, $8