]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libgo/Makefile.am
Fix boostrap failure in tree-ssa-loop-ch.cc
[thirdparty/gcc.git] / libgo / Makefile.am
index 373dd0cf73cff1b959ef75af694bd21d8f74954c..207d5a9812768095ee7e3cd1c4ad982a343f6858 100644 (file)
@@ -13,6 +13,12 @@ if LIBGO_IS_RTEMS
 subdirs = testsuite
 endif
 
+if LIBGO_IS_DARWIN
+GO_EXPORT_SECTION_NAME = __GNU_GO.__go_export
+else
+GO_EXPORT_SECTION_NAME = .go_export
+endif
+
 SUBDIRS = ${subdirs}
 
 gcc_version := $(shell $(GOC) -dumpversion)
@@ -124,6 +130,7 @@ toolexeclibgo_DATA = \
        bytes.gox \
        context.gox \
        crypto.gox \
+       embed.gox \
        encoding.gox \
        errors.gox \
        expvar.gox \
@@ -181,6 +188,7 @@ toolexeclibgocrypto_DATA = \
        crypto/des.gox \
        crypto/dsa.gox \
        crypto/ecdsa.gox \
+       crypto/ed25519.gox \
        crypto/elliptic.gox \
        crypto/hmac.gox \
        crypto/md5.gox \
@@ -212,13 +220,13 @@ toolexeclibgodatabasesql_DATA = \
 toolexeclibgodebugdir = $(toolexeclibgodir)/debug
 
 toolexeclibgodebug_DATA = \
+       debug/buildinfo.gox \
        debug/dwarf.gox \
        debug/elf.gox \
        debug/gosym.gox \
        debug/macho.gox \
        debug/pe.gox \
-       debug/plan9obj.gox \
-       debug/xcoff.gox
+       debug/plan9obj.gox
 
 toolexeclibgoencodingdir = $(toolexeclibgodir)/encoding
 
@@ -250,13 +258,19 @@ toolexeclibgogo_DATA = \
        go/token.gox \
        go/types.gox
 
+toolexeclibgogobuilddir = $(toolexeclibgogodir)/build
+
+toolexeclibgogobuild_DATA = \
+       go/build/constraint.gox
+
 toolexeclibgohashdir = $(toolexeclibgodir)/hash
 
 toolexeclibgohash_DATA = \
        hash/adler32.gox \
        hash/crc32.gox \
        hash/crc64.gox \
-       hash/fnv.gox
+       hash/fnv.gox \
+       hash/maphash.gox
 
 toolexeclibgohtmldir = $(toolexeclibgodir)/html
 
@@ -285,6 +299,7 @@ toolexeclibgoindex_DATA = \
 toolexeclibgoiodir = $(toolexeclibgodir)/io
 
 toolexeclibgoio_DATA = \
+       io/fs.gox \
        io/ioutil.gox
 
 toolexeclibgologdir = $(toolexeclibgodir)/log
@@ -311,6 +326,7 @@ toolexeclibgonetdir = $(toolexeclibgodir)/net
 toolexeclibgonet_DATA = \
        net/http.gox \
        net/mail.gox \
+       net/netip.gox \
        net/rpc.gox \
        net/smtp.gox \
        net/textproto.gox \
@@ -352,7 +368,9 @@ toolexeclibgoregexp_DATA = \
 toolexeclibgoruntimedir = $(toolexeclibgodir)/runtime
 
 toolexeclibgoruntime_DATA = \
+       runtime/cgo.gox \
        runtime/debug.gox \
+       runtime/metrics.gox \
        runtime/pprof.gox \
        runtime/trace.gox
 
@@ -364,6 +382,7 @@ toolexeclibgosync_DATA = \
 toolexeclibgotestingdir = $(toolexeclibgodir)/testing
 
 toolexeclibgotesting_DATA = \
+       testing/fstest.gox \
        testing/iotest.gox \
        testing/quick.gox
 
@@ -384,23 +403,38 @@ toolexeclibgotexttemplatedir = $(toolexeclibgotextdir)/template
 toolexeclibgotexttemplate_DATA = \
        text/template/parse.gox
 
+toolexeclibgotimedir = $(toolexeclibgodir)/time
+
+toolexeclibgotime_DATA = \
+       time/tzdata.gox
+
 toolexeclibgounicodedir = $(toolexeclibgodir)/unicode
 
 toolexeclibgounicode_DATA = \
        unicode/utf16.gox \
        unicode/utf8.gox
 
+# Some internal packages are needed to bootstrap the gc toolchain.
+toolexeclibgointernaldir = $(toolexeclibgodir)/internal
+toolexeclibgointernal_DATA = \
+       internal/reflectlite.gox \
+       internal/unsafeheader.gox
+
 # Some packages are only needed for tests, so unlike the other
 # internal packages nothing will explicitly depend on them.
 # Force them to be built.
 noinst_DATA = \
-       golang_org/x/net/internal/nettest.gox \
-       golang_org/x/net/nettest.gox \
+       golang.org/x/net/nettest.gox \
+       internal/cfg.gox \
+       internal/obscuretestdata.gox \
+       internal/profile.gox \
        internal/testenv.gox \
        internal/trace.gox \
        net/internal/socktest.gox \
+       os/exec/internal/fdtest.gox \
        os/signal/internal/pty.gox \
-       runtime/pprof/internal/profile.gox
+       reflect/internal/example1.gox \
+       reflect/internal/example2.gox
 
 if LIBGO_IS_RTEMS
 rtems_task_variable_add_file = runtime/rtems-task-variable-add.c
@@ -408,33 +442,10 @@ else
 rtems_task_variable_add_file =
 endif
 
+runtime_context_asm_file =
+if LIBGO_IS_X86
 if LIBGO_IS_LINUX
-runtime_getncpu_file = runtime/getncpu-linux.c
-else
-if LIBGO_IS_DARWIN
-runtime_getncpu_file = runtime/getncpu-bsd.c
-else
-if LIBGO_IS_IRIX
-runtime_getncpu_file = runtime/getncpu-irix.c
-else
-if LIBGO_IS_SOLARIS
-runtime_getncpu_file = runtime/getncpu-solaris.c
-else
-if LIBGO_IS_FREEBSD
-runtime_getncpu_file = runtime/getncpu-bsd.c
-else
-if LIBGO_IS_NETBSD
-runtime_getncpu_file = runtime/getncpu-bsd.c
-else
-if LIBGO_IS_AIX
-runtime_getncpu_file = runtime/getncpu-aix.c
-else
-runtime_getncpu_file = runtime/getncpu-none.c
-endif
-endif
-endif
-endif
-endif
+runtime_context_asm_file += runtime/go-context.S
 endif
 endif
 
@@ -443,25 +454,21 @@ runtime_files = \
        runtime/go-assert.c \
        runtime/go-caller.c \
        runtime/go-callers.c \
-       runtime/go-cdiv.c \
        runtime/go-cgo.c \
        runtime/go-construct-map.c \
        runtime/go-ffi.c \
        runtime/go-fieldtrack.c \
        runtime/go-matherr.c \
        runtime/go-memclr.c \
-       runtime/go-memcmp.c \
-       runtime/go-memequal.c \
        runtime/go-memmove.c \
+       runtime/go-memequal.c \
        runtime/go-nanotime.c \
        runtime/go-now.c \
        runtime/go-nosys.c \
+       runtime/go-strerror.c \
        runtime/go-reflect-call.c \
-       runtime/go-runtime-error.c \
        runtime/go-setenv.c \
        runtime/go-signal.c \
-       runtime/go-strslice.c \
-       runtime/go-typedesc-equal.c \
        runtime/go-unsafe-pointer.c \
        runtime/go-unsetenv.c \
        runtime/go-unwind.c \
@@ -472,82 +479,126 @@ runtime_files = \
        runtime/proc.c \
        runtime/runtime_c.c \
        runtime/stack.c \
-       runtime/thread.c \
        runtime/yield.c \
-       $(rtems_task_variable_add_file) \
-       $(runtime_getncpu_file)
+       $(runtime_context_asm_file) \
+       $(rtems_task_variable_add_file)
 
 version.go: s-version; @true
 s-version: Makefile
        rm -f version.go.tmp
        echo "package sys" > version.go.tmp
-       echo 'func init() { DefaultGoroot = "$(prefix)" }' >> version.go.tmp
-       echo 'const TheVersion = "'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'"' >> version.go.tmp
-       echo 'const Goexperiment = ``' >> version.go.tmp
-       echo 'const GOARCH = "'$(GOARCH)'"' >> version.go.tmp
-       echo 'const GOOS = "'$(GOOS)'"' >> version.go.tmp
        echo 'const GccgoToolDir = "$(libexecsubdir)"' >> version.go.tmp
-       echo >> version.go.tmp
-       echo "type ArchFamilyType int" >> version.go.tmp
-       echo >> version.go.tmp
-       echo "const (" >> version.go.tmp
-       echo "  UNKNOWN ArchFamilyType = iota" >> version.go.tmp
+       echo 'const StackGuardMultiplierDefault = 1' >> version.go.tmp
+       $(SHELL) $(srcdir)/mvifdiff.sh version.go.tmp version.go
+       $(STAMP) $@
+
+zgoarch.go: s-zgoarch; @true
+s-zgoarch: Makefile goarch.sh
+       rm -f zgoarch.go.tmp
+       echo "package goarch" > zgoarch.go.tmp
+       echo >> zgoarch.go.tmp
+       echo 'const GOARCH = "'$(GOARCH)'"' >> zgoarch.go.tmp
+       echo >> zgoarch.go.tmp
+       echo 'const (' >> zgoarch.go.tmp
+       echo "  _ArchFamily = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) family`" >> zgoarch.go.tmp
+       echo "  _BigEndian = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) bigendian`" >> zgoarch.go.tmp
+       echo "  _DefaultPhysPageSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) defaultphyspagesize`" >> zgoarch.go.tmp
+       echo "  _Int64Align = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) int64align`" >> zgoarch.go.tmp
+       echo "  _MinFrameSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) minframesize`" >> zgoarch.go.tmp
+       echo "  _PCQuantum = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) pcquantum`" >> zgoarch.go.tmp
+       echo "  _StackAlign = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) stackalign`" >> zgoarch.go.tmp
+       echo ")" >> zgoarch.go.tmp
+       echo >> zgoarch.go.tmp
+       echo "const (" >> zgoarch.go.tmp
+       echo "  UNKNOWN ArchFamilyType = iota" >> zgoarch.go.tmp
        for a in $(ALLGOARCHFAMILY); do \
-         echo "        $${a}" >> version.go.tmp; \
+         echo "        $${a}" >> zgoarch.go.tmp; \
        done
-       echo ")" >> version.go.tmp
-       echo >> version.go.tmp
+       echo ")" >> zgoarch.go.tmp
+       echo >> zgoarch.go.tmp
        for a in $(ALLGOARCH); do \
          f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
          n="$${f}`echo $${a} | sed -e 's/.//'`"; \
          if test "$${a}" = "$(GOARCH)"; then \
-           echo "const Goarch$${n} = 1" >> version.go.tmp; \
+           echo "const Is$${n} = 1" >> zgoarch.go.tmp; \
          else \
-           echo "const Goarch$${n} = 0" >> version.go.tmp; \
+           echo "const Is$${n} = 0" >> zgoarch.go.tmp; \
          fi; \
        done
-       echo >> version.go.tmp
-       echo "const (" >> version.go.tmp
-       echo "  ArchFamily = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) family`" >> version.go.tmp
-       echo "  BigEndian = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) bigendian`" >> version.go.tmp
-       echo "  CacheLineSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) cachelinesize`" >> version.go.tmp
-       echo "  DefaultPhysPageSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) defaultphyspagesize`" >> version.go.tmp
-       echo "  HugePageSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) hugepagesize`" >> version.go.tmp
-       echo "  Int64Align = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) int64align`" >> version.go.tmp
-       echo "  MinFrameSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) minframesize`" >> version.go.tmp
-       echo "  PCQuantum = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) pcquantum`" >> version.go.tmp
-       echo ")" >> version.go.tmp
-       echo >> version.go.tmp
+       $(SHELL) $(srcdir)/mvifdiff.sh zgoarch.go.tmp zgoarch.go
+       $(STAMP) $@
+
+zgoos.go: s-zgoos; @true
+s-zgoos: Makefile
+       rm -f zgoos.go.tmp
+       echo "package goos" > zgoos.go.tmp
+       echo >> zgoos.go.tmp
+       echo 'const GOOS = "'$(GOOS)'"' >> zgoos.go.tmp
+       echo >> zgoos.go.tmp
        for a in $(ALLGOOS); do \
          f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
          n="$${f}`echo $${a} | sed -e 's/.//'`"; \
          if test "$${a}" = "$(GOOS)"; then \
-           echo "const Goos$${n} = 1" >> version.go.tmp; \
+           echo "const Is$${n} = 1" >> zgoos.go.tmp; \
          else \
-           echo "const Goos$${n} = 0" >> version.go.tmp; \
+           echo "const Is$${n} = 0" >> zgoos.go.tmp; \
          fi; \
        done
-       echo >> version.go.tmp
-       echo "type Uintreg uintptr" >> version.go.tmp
-       $(SHELL) $(srcdir)/mvifdiff.sh version.go.tmp version.go
+       $(SHELL) $(srcdir)/mvifdiff.sh zgoos.go.tmp zgoos.go
+       $(STAMP) $@
+
+cpugen.go: s-cpu; @true
+s-cpu: Makefile goarch.sh
+       rm -f cpugen.go.tmp
+       echo "package cpu" > cpugen.go.tmp
+       echo "const CacheLinePadSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) cachelinesize`" >> cpugen.go.tmp
+       echo "const FunctionDescriptors = $(FUNCTION_DESCRIPTORS)" >> cpugen.go.tmp
+       $(SHELL) $(srcdir)/mvifdiff.sh cpugen.go.tmp cpugen.go
+       $(STAMP) $@
+
+gcpugen.go: s-gcpu; @true
+s-gcpu: Makefile goarch.sh
+       rm -f gcpugen.go.tmp
+       echo "package cpu" > gcpugen.go.tmp
+       echo "const cacheLineSize = `$(SHELL) $(srcdir)/goarch.sh $(GOARCH) cachelinesize`" >> gcpugen.go.tmp
+       $(SHELL) $(srcdir)/mvifdiff.sh gcpugen.go.tmp gcpugen.go
+       $(STAMP) $@
+
+goroot.go: s-goroot; @true
+s-goroot: Makefile
+       rm -f goroot.go.tmp
+       echo "package runtime" > goroot.go.tmp
+       echo 'var defaultGOROOT = `$(prefix)`' >> goroot.go.tmp
+       echo 'var buildVersion = `'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'`' >> goroot.go.tmp
+       $(SHELL) $(srcdir)/mvifdiff.sh goroot.go.tmp goroot.go
+       $(STAMP) $@
+
+buildcfg.go: s-buildcfg; @true
+s-buildcfg: Makefile
+       rm -f buildcfg.go.tmp
+       echo "package buildcfg" > buildcfg.go.tmp
+       echo "import \"runtime\"" >> buildcfg.go.tmp
+       echo 'func defaultGOROOTValue() string { return `$(prefix)` }' >> buildcfg.go.tmp
+       echo 'const defaultGO386 = `sse2`' >> buildcfg.go.tmp
+       echo 'const defaultGOAMD64 = `v1`' >> buildcfg.go.tmp
+       echo 'const defaultGOARM = `5`' >> buildcfg.go.tmp
+       echo 'const defaultGOMIPS = `hardfloat`' >> buildcfg.go.tmp
+       echo 'const defaultGOMIPS64 = `hardfloat`' >> buildcfg.go.tmp
+       echo 'const defaultGOPPC64 = `power8`' >> buildcfg.go.tmp
+       echo 'const defaultGOEXPERIMENT = `fieldtrack`' >> buildcfg.go.tmp
+       echo 'const defaultGO_EXTLINK_ENABLED = ``' >> buildcfg.go.tmp
+       echo 'const defaultGO_LDSO = ``' >> buildcfg.go.tmp
+       echo 'const version = `'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'`' >> buildcfg.go.tmp
+       echo 'const defaultGOOS = runtime.GOOS' >> buildcfg.go.tmp
+       echo 'const defaultGOARCH = runtime.GOARCH' >> buildcfg.go.tmp
+       $(SHELL) $(srcdir)/mvifdiff.sh buildcfg.go.tmp buildcfg.go
        $(STAMP) $@
 
 objabi.go: s-objabi; @true
 s-objabi: Makefile
        rm -f objabi.go.tmp
        echo "package objabi" > objabi.go.tmp
-       echo "import \"runtime\"" >> objabi.go.tmp
-       echo 'func init() { defaultGOROOT = `$(prefix)` }' >> objabi.go.tmp
-       echo 'const defaultGO386 = `sse2`' >> objabi.go.tmp
-       echo 'const defaultGOARM = `5`' >> objabi.go.tmp
-       echo 'const defaultGOMIPS = `hardfloat`' >> objabi.go.tmp
-       echo 'const defaultGOMIPS64 = `hardfloat`' >> objabi.go.tmp
-       echo 'const defaultGOOS = runtime.GOOS' >> objabi.go.tmp
-       echo 'const defaultGOARCH = runtime.GOARCH' >> objabi.go.tmp
-       echo 'const defaultGO_EXTLINK_ENABLED = ``' >> objabi.go.tmp
-       echo 'const version = `'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'`' >> objabi.go.tmp
-       echo 'const stackGuardMultiplier = 1' >> objabi.go.tmp
-       echo 'const goexperiment = ``' >> objabi.go.tmp
+       echo 'const stackGuardMultiplierDefault = 1' >> objabi.go.tmp
        $(SHELL) $(srcdir)/mvifdiff.sh objabi.go.tmp objabi.go
        $(STAMP) $@
 
@@ -566,6 +617,48 @@ s-gccgosizes: Makefile goarch.sh
        $(SHELL) $(srcdir)/mvifdiff.sh gccgosizes.go.tmp gccgosizes.go
        $(STAMP) $@
 
+os_linknames.go: s-os_linknames; @true
+s-os_linknames: os-list gen-sysinfo.go $(srcdir)/mklinknames.awk $(srcdir)/go/os/*.go
+       rm -f os_linknames.go.tmp
+       $(AWK) -f $(srcdir)/mklinknames.awk -v package=os `cat os-list` > os_linknames.go.tmp
+       $(SHELL) $(srcdir)/mvifdiff.sh os_linknames.go.tmp os_linknames.go
+       $(STAMP) $@
+
+os-list: s-os-list; @true
+s-os-list: Makefile $(srcdir)/go/os/*.go
+       rm -f os-list.tmp
+       $(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/os > os-list.tmp
+       $(SHELL) $(srcdir)/mvifdiff.sh os-list.tmp os-list
+       $(STAMP) $@
+
+os_user_linknames.go: s-os_user_linknames; @true
+s-os_user_linknames: os-user-list gen-sysinfo.go $(srcdir)/mklinknames.awk $(srcdir)/go/os/user/*.go
+       rm -f os_user_linknames.go.tmp
+       $(AWK) -f $(srcdir)/mklinknames.awk -v package=user `cat os-user-list` > os_user_linknames.go.tmp
+       $(SHELL) $(srcdir)/mvifdiff.sh os_user_linknames.go.tmp os_user_linknames.go
+       $(STAMP) $@
+
+os-user-list: s-os-user-list; @true
+s-os-user-list: Makefile $(srcdir)/go/os/user/*.go
+       rm -f os-user-list.tmp
+       $(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/os/user > os-user-list.tmp
+       $(SHELL) $(srcdir)/mvifdiff.sh os-user-list.tmp os-user-list
+       $(STAMP) $@
+
+runtime_linknames.go: s-runtime_linknames; @true
+s-runtime_linknames: runtime-list gen-sysinfo.go $(srcdir)/mklinknames.awk $(srcdir)/go/runtime/*.go
+       rm -f runtime_linknames.go.tmp
+       $(AWK) -f $(srcdir)/mklinknames.awk -v package=runtime `cat runtime-list` > runtime_linknames.go.tmp
+       $(SHELL) $(srcdir)/mvifdiff.sh runtime_linknames.go.tmp runtime_linknames.go
+       $(STAMP) $@
+
+runtime-list: s-runtime-list; @true
+s-runtime-list: Makefile $(srcdir)/go/runtime/*.go
+       rm -f runtime-list.tmp
+       $(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/runtime > runtime-list.tmp
+       $(SHELL) $(srcdir)/mvifdiff.sh runtime-list.tmp runtime-list
+       $(STAMP) $@
+
 runtime_sysinfo.go: s-runtime_sysinfo; @true
 s-runtime_sysinfo: $(srcdir)/mkrsysinfo.sh gen-sysinfo.go
        GOARCH=$(GOARCH) GOOS=$(GOOS) $(SHELL) $(srcdir)/mkrsysinfo.sh
@@ -598,7 +691,7 @@ s-zdefaultcc: Makefile
 # compiling runtime) to prune out certain types that should not be
 # exported back to C. See comments in mkruntimeinc.sh for more details.
 runtime.inc: s-runtime-inc; @true
-s-runtime-inc: runtime.lo Makefile
+s-runtime-inc: runtime.lo mkruntimeinc.sh Makefile
        $(SHELL) $(srcdir)/mkruntimeinc.sh
        $(SHELL) $(srcdir)/mvifdiff.sh tmp-runtime.inc runtime.inc
        $(STAMP) $@
@@ -607,12 +700,12 @@ noinst_DATA += zdefaultcc.go
 
 # Generate the list of go std packages that were included in libgo
 zstdpkglist.go: s-zstdpkglist; @true
-s-zstdpkglist: Makefile
+s-zstdpkglist: Makefile libgo-packages.txt
        rm -f zstdpkglist.go.tmp
        echo 'package goroot' > zstdpkglist.go.tmp
        echo "" >> zstdpkglist.go.tmp
        echo 'var stdpkg = map[string]bool{' >> zstdpkglist.go.tmp
-       echo $(libgo_go_objs) 'unsafe.lo' 'runtime/cgo.lo' | sed 's|[a-z0-9_/]*_c\.lo||g' | sed 's|\([a-z0-9_/]*\)\.lo|"\1": true,|g' >> zstdpkglist.go.tmp
+       echo $(libgo_go_objs) 'unsafe.lo' | sed 's|[a-z0-9_./]*_c\.lo||g' | sed 's|golang\.org/[a-z0-9_./]*\.lo||g' | sed 's|\([a-z0-9_./]*\)\.lo|"\1": true,|g' >> zstdpkglist.go.tmp
        echo '}' >> zstdpkglist.go.tmp
        $(SHELL) $(srcdir)/mvifdiff.sh zstdpkglist.go.tmp zstdpkglist.go
        $(STAMP) $@
@@ -646,6 +739,13 @@ s-syscall_arch: Makefile
        $(SHELL) $(srcdir)/mvifdiff.sh syscall_arch.go.tmp syscall_arch.go
        $(STAMP) $@
 
+syscall_linknames.go: s-syscall_linknames; @true
+s-syscall_linknames: libcalls.go gen-sysinfo.go $(srcdir)/mklinknames.awk
+       rm -f syscall_linknames.go.tmp
+       $(AWK) -v package=syscall -f $(srcdir)/mklinknames.awk libcalls.go > syscall_linknames.go.tmp
+       $(SHELL) $(srcdir)/mvifdiff.sh syscall_linknames.go.tmp syscall_linknames.go
+       $(STAMP) $@
+
 SYSINFO_FLAGS = \
        $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
        $(CPPFLAGS) $(OSCFLAGS) -O
@@ -703,25 +803,32 @@ else
 syscall_lib_clone_lo =
 endif
 
+if LIBGO_IS_X86
+golangorg_x_sys_cpu_gccgo_x86_lo = golang.org/x/sys/cpu_gccgo_x86.lo
+else
+golangorg_x_sys_cpu_gccgo_x86_lo =
+endif
+
 PACKAGES = $(shell cat $(srcdir)/libgo-packages.txt)
 
 libgo_go_objs = \
        $(addsuffix .lo,$(PACKAGES)) \
-       bytes/index.lo \
        internal/bytealg/bytealg.lo \
        reflect/makefunc_ffi_c.lo \
-       strings/index.lo \
        $(syscall_lib_clone_lo) \
        syscall/errno.lo \
        syscall/signame.lo \
        syscall/wait.lo \
-       $(golang_org_x_net_lif_lo) \
-       $(golang_org_x_net_route_lo) \
+       runtime/internal/syscall/errno.lo \
+       os/dir_gccgo_c.lo \
+       $(golangorg_x_net_lif_lo) \
+       $(golangorg_x_net_route_lo) \
        log/syslog/syslog_c.lo \
        $(os_lib_inotify_lo) \
        runtime/internal/atomic_c.lo \
        sync/atomic_c.lo \
-       internal/cpu/cpu_gccgo.lo
+       internal/cpu/cpu_gccgo.lo \
+       $(golangorg_x_sys_cpu_gccgo_x86_lo)
 
 libgo_ldflags = \
        -version-info $(libtool_VERSION) $(PTHREAD_CFLAGS) $(AM_LDFLAGS)
@@ -788,7 +895,7 @@ GOLINK = $(LIBTOOL) --tag GO --mode-link $(GOC) \
 BUILDDEPS = \
        $(MKDIR_P) $(@D); \
        dir=`echo $@ | sed -e 's/.lo.dep$$//'`; \
-       files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$$dir --extrafiles="$(extra_go_files_$(subst /,_,$(subst .lo.dep,,$@)))" $(matchargs_$(subst /,_,$(subst .lo.dep,,$@)))`; \
+       files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$$dir --extrafiles="$(extra_go_files_$(subst .,_,$(subst /,_,$(subst .lo.dep,,$@))))" $(matchargs_$(subst /,_,$(subst .lo.dep,,$@)))`; \
        $(SHELL) $(srcdir)/godeps.sh `echo $@ | sed -e 's/.dep$$//'` $$files > $@.tmp; \
        if ! cmp $@.tmp $@ >/dev/null 2>/dev/null; then \
          rm -f `echo $@ | sed -e 's/\.dep$$//'`; \
@@ -799,7 +906,7 @@ BUILDDEPS = \
 BUILDPACKAGE = \
        $(MKDIR_P) $(@D); \
        files=`echo $^ | sed -e 's/[^ ]*\.gox//g' -e 's/[^ ]*\.dep//'`; \
-       $(LTGOCOMPILE) -I . -c -fgo-pkgpath=`echo $@ | sed -e 's/.lo$$//' -e 's|golang_org|vendor/golang_org|'` $($(subst -,_,$(subst .,_,$(subst /,_,$@)))_GOCFLAGS) -o $@ $$files
+       $(LTGOCOMPILE) -I . -c -fgo-pkgpath=`echo $@ | sed -e 's/.lo$$//'` $($(subst -,_,$(subst .,_,$(subst /,_,$@)))_GOCFLAGS) -o $@ $$files
 
 # How to build a .gox file from a .lo file.
 # Matching .o file can either be in the same directory as the .lo (non-PIC
@@ -809,7 +916,7 @@ BUILDGOX = \
        if test ! -f $$f; then \
          f="$(basename $(<D)/.libs/$(<F)).o"; \
        fi; \
-       $(OBJCOPY) -j .go_export $$f $@.tmp; \
+       $(OBJCOPY) -j $(GO_EXPORT_SECTION_NAME) $$f $@.tmp; \
        $(SHELL) $(srcdir)/mvifdiff.sh $@.tmp `echo $@ | sed -e 's/s-gox/gox/'`
 
 GOTESTFLAGS =
@@ -819,7 +926,7 @@ GOBENCH =
 CHECK = \
        GC="$(GOC) $(GOCFLAGS) $($(subst /,_,$@)_GOCFLAGS) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \
        export GC; \
-       GOLIBS="$(extra_check_libs_$(subst /,_,$(@D))) $(MATH_LIBS) $(NET_LIBS) $(LIBS)"; \
+       GOLIBS="$(extra_check_libs_$(subst .,_,$(subst /,_,$(@D)))) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS) $(LIBS)"; \
        export GOLIBS; \
        RUNTESTFLAGS="$(RUNTESTFLAGS)"; \
        export RUNTESTFLAGS; \
@@ -833,7 +940,7 @@ CHECK = \
        export LD_LIBRARY_PATH; \
        $(MKDIR_P) $(@D); \
        rm -f $@-testsum $@-testlog; \
-       files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$(@D) --extrafiles="$(extra_go_files_$(subst /,_,$(@D)))" $(matchargs_$(subst /,_,$(@D)))`; \
+       files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$(@D) --extrafiles="$(extra_go_files_$(subst .,_,$(subst /,_,$(@D))))" $(matchargs_$(subst /,_,$(@D)))`; \
        if test "$(USE_DEJAGNU)" = "yes"; then \
          $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --dejagnu=yes --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --testname="$(@D)" $(GOTESTFLAGS); \
        elif test "$(GOBENCH)" != ""; then \
@@ -927,8 +1034,9 @@ $(foreach package,$(GOTOOL_PACKAGES),$(eval $(call PACKAGE_template,$(package)))
 math_lo_GOCFLAGS = $(MATH_FLAG)
 math_check_GOCFLAGS = $(MATH_FLAG)
 
-# Add the generated file runtime_sysinfo.go to the runtime package.
-extra_go_files_runtime = runtime_sysinfo.go sigtab.go
+# Add generated files to the runtime package.
+extra_go_files_runtime = \
+       runtime_linknames.go runtime_sysinfo.go sigtab.go goroot.go
 runtime.lo.dep: $(extra_go_files_runtime)
 
 # Add generated files to the syscall package.
@@ -936,6 +1044,7 @@ extra_go_files_syscall = \
        libcalls.go \
        sysinfo.go \
        syscall_arch.go \
+       syscall_linknames.go \
        $(syscall_epoll_file)
 syscall.lo.dep: $(extra_go_files_syscall)
 
@@ -960,9 +1069,36 @@ endif
 # Also use -fno-inline to get better results from the memory profiler.
 runtime_pprof_check_GOCFLAGS = -static-libgo -fno-inline
 
+if LIBGO_IS_AIX
+# reflect tests must be done with -static-libgo. Otherwize,
+# there will be a duplication of the canonicalization map.
+reflect_check_GOCFLAGS = -static-libgo -Wl,-bbigtoc
+endif
+
+if HAVE_STATIC_LINK
+# Use -static for the syscall tests if possible, because otherwise when
+# running as root the re-execs ignore LD_LIBRARY_PATH.
+syscall_check_GOCFLAGS = -static
+endif
+
 extra_go_files_runtime_internal_sys = version.go
 runtime/internal/sys.lo.dep: $(extra_go_files_runtime_internal_sys)
 
+extra_go_files_internal_cpu = cpugen.go
+internal/cpu.lo.dep: $(extra_go_files_internal_cpu)
+
+extra_go_files_internal_goarch = zgoarch.go
+internal/goarch.lo.dep: $(extra_go_files_internal_goarch)
+
+extra_go_files_internal_goos = zgoos.go
+internal/goos.lo.dep: $(extra_go_files_internal_goos)
+
+extra_go_files_golang_org_x_sys_cpu = gcpugen.go
+golang.org/x/sys/cpu.lo.dep: $(extra_go_files_golang_org_x_sys_cpu)
+
+extra_go_files_internal_buildcfg = buildcfg.go
+cmd/internal/buildcfg.lo.dep: $(extra_go_files_internal_buildcfg)
+
 extra_go_files_internal_goroot = zstdpkglist.go
 internal/goroot.lo.dep: $(extra_go_files_internal_goroot)
 
@@ -975,10 +1111,18 @@ cmd/internal/objabi.lo.dep: $(extra_go_files_cmd_internal_objabi)
 extra_go_files_cmd_go_internal_cfg = zdefaultcc.go
 cmd/go/internal/cfg.lo.dep: $(extra_go_files_cmd_go_internal_cfg)
 
+extra_go_files_os = os_linknames.go
+os.lo.dep: $(extra_go_files_os)
+
+extra_go_files_os_user = os_user_linknames.go
+os/user.lo.dep: $(extra_go_files_os_user)
+
 extra_check_libs_cmd_go_internal_cache = $(abs_builddir)/libgotool.a
+extra_check_libs_cmd_go_internal_fsys = $(abs_builddir)/libgotool.a
 extra_check_libs_cmd_go_internal_generate = $(abs_builddir)/libgotool.a
 extra_check_libs_cmd_go_internal_get = $(abs_builddir)/libgotool.a
 extra_check_libs_cmd_go_internal_load = $(abs_builddir)/libgotool.a
+extra_check_libs_cmd_go_internal_lockedfile = $(abs_builddir)/libgotool.a
 extra_check_libs_cmd_go_internal_imports = $(abs_builddir)/libgotool.a
 extra_check_libs_cmd_go_internal_modconv = $(abs_builddir)/libgotool.a
 extra_check_libs_cmd_go_internal_modfetch = $(abs_builddir)/libgotool.a
@@ -988,21 +1132,20 @@ extra_check_libs_cmd_go_internal_modload = $(abs_builddir)/libgotool.a
 extra_check_libs_cmd_go_internal_module = $(abs_builddir)/libgotool.a
 extra_check_libs_cmd_go_internal_mvs = $(abs_builddir)/libgotool.a
 extra_check_libs_cmd_go_internal_search = $(abs_builddir)/libgotool.a
+extra_check_libs_cmd_go_internal_str = $(abs_builddir)/libgotool.a
+extra_check_libs_cmd_go_internal_test = $(abs_builddir)/libgotool.a
+extra_check_libs_cmd_go_internal_vcs = $(abs_builddir)/libgotool.a
 extra_check_libs_cmd_go_internal_web2 = $(abs_builddir)/libgotool.a
 extra_check_libs_cmd_go_internal_work = $(abs_builddir)/libgotool.a
 
+extra_check_libs_cmd_internal_buildid = $(abs_builddir)/libgotool.a
+
 extra_check_libs_cmd_vet_internal_cfg = $(abs_builddir)/libgotool.a
 
 # FIXME: The following C files may as well move to the runtime
 # directory and be treated like other C files.
 
-# Use C code to speed up {bytes,strings}.IndexByte and friends.
-bytes/index.lo: go/bytes/indexbyte.c runtime.inc
-       @$(MKDIR_P) bytes
-       $(LTCOMPILE) -c -o $@ $(srcdir)/go/bytes/indexbyte.c
-strings/index.lo: go/strings/indexbyte.c runtime.inc
-       @$(MKDIR_P) strings
-       $(LTCOMPILE) -c -o $@ $(srcdir)/go/strings/indexbyte.c
+# Use C code to speed up internal/bytealg.IndexByte and friends.
 internal/bytealg/bytealg.lo: go/internal/bytealg/bytealg.c runtime.inc
        @$(MKDIR_P) internal/bytealg
        $(LTCOMPILE) -c -o $@ $(srcdir)/go/internal/bytealg/bytealg.c
@@ -1040,11 +1183,26 @@ syscall/wait.lo: go/syscall/wait.c runtime.inc
        @$(MKDIR_P) syscall
        $(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/wait.c
 
+# Some runtime/internal/syscall functions are written in C.
+runtime/internal/syscall/errno.lo: go/runtime/internal/syscall/errno.c runtime.inc
+       @$(MKDIR_P) runtime/internal/syscall
+       $(LTCOMPILE) -c -o $@ $(srcdir)/go/runtime/internal/syscall/errno.c
+
+# An os function is written in C.
+os/dir_gccgo_c.lo: go/os/dir_gccgo_c.c runtime.inc
+       @$(MKDIR_P) os
+       $(LTCOMPILE) -c -o $@ $(srcdir)/go/os/dir_gccgo_c.c
+
 # internal/cpu needs some C code.
 internal/cpu/cpu_gccgo.lo: go/internal/cpu/cpu_gccgo.c runtime.inc
        @$(MKDIR_P) internal/cpu
        $(LTCOMPILE) -c -o $@ $(srcdir)/go/internal/cpu/cpu_gccgo.c
 
+# Similarly, golang.org/x/sys/cpu needs some C code.
+golang.org/x/sys/cpu_gccgo_x86.lo: go/golang.org/x/sys/cpu/cpu_gccgo_x86.c runtime.inc
+       @$(MKDIR_P) golang.org/x/sys
+       $(LTCOMPILE) -c -o $@ $(srcdir)/go/golang.org/x/sys/cpu/cpu_gccgo_x86.c
+
 # Solaris 11.4 changed the type of fields in struct stat.
 # Use a build tag, based on a configure check, to cope.
 if LIBGO_IS_SOLARIS
@@ -1059,34 +1217,27 @@ endif
 
 if LIBGO_IS_BSD
 
-# Build golang_org/x/net/route only on BSD systems.
+# Build golang.org/x/net/route only on BSD systems.
 
-$(eval $(call PACKAGE_template,golang_org/x/net/route))
+$(eval $(call PACKAGE_template,golang.org/x/net/route))
 
-golang_org_x_net_route_lo = \
-       golang_org/x/net/route.lo
-golang_org_x_net_route_check = \
-       golang_org/x/net/route/check
+golangorg_x_net_route_lo = \
+       golang.org/x/net/route.lo
 
 endif
 
 if LIBGO_IS_SOLARIS
 
-# Build golang_org/x/net/lif only on Solaris systems.
+# Build golang.org/x/net/lif only on Solaris systems.
 
-$(eval $(call PACKAGE_template,golang_org/x/net/lif))
+$(eval $(call PACKAGE_template,golang.org/x/net/lif))
 
-golang_org_x_net_lif_lo = \
-       golang_org/x/net/lif.lo
-golang_org_x_net_lif_check = \
-       golang_org/x/net/lif/check
+golangorg_x_net_lif_lo = \
+       golang.org/x/net/lif.lo
 
 endif
 
-TPACKAGES = $(shell cat $(srcdir)/check-packages.txt)
-TEST_PACKAGES = $(addsuffix /check,$(TPACKAGES)) \
-       $(golang_org_x_net_lif_check) \
-       $(golang_org_x_net_route_check)
+TEST_PACKAGES = $(addsuffix /check,$(shell cat $(srcdir)/check-packages.txt))
 
 check: check-tail
 check-recursive: check-head
@@ -1156,7 +1307,7 @@ check-tail: check-recursive check-multi
        if test "$$untested" -ne "0"; then \
          echo "# of untested testcases         $$untested" >> libgo.sum; \
        fi; \
-       echo `echo $(GOC) | sed -e 's/ .*//'`  `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \
+       echo `echo $(GOC) | sed -e 's/ .*//'`  `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*\)$$/\1/p'` >> libgo.sum; \
        echo >> libgo.log; \
        echo "runtest completed at `date`" >> libgo.log; \
        if test "$$fail" -ne "0"; then \
@@ -1195,7 +1346,8 @@ MOSTLYCLEANFILES = \
        s-libcalls s-libcalls-list s-syscall_arch s-gen-sysinfo s-sysinfo \
        s-errno s-epoll \
        libgo.head libgo.sum.sep libgo.log.sep libgo.var \
-       libcalls-list runtime.inc runtime.inc.tmp2 runtime.inc.tmp3
+       libcalls-list \
+       runtime.inc runtime.inc.tmp2 runtime.inc.tmp3 runtime.inc.raw
 
 mostlyclean-local:
        find . -name '*.lo' -print | xargs $(LIBTOOL) --mode=clean rm -f
@@ -1213,3 +1365,30 @@ clean-local:
 
 distclean-local:
        find . -name '*.lo.dep' -print | xargs rm -f
+
+include $(top_srcdir)/../multilib.am
+
+if LIBGO_IS_AIX
+ALL_LOCAL_DEPS = add-aix-fat-library
+else
+ALL_LOCAL_DEPS =
+endif
+all-local: $(ALL_LOCAL_DEPS)
+
+MAJOR=$(firstword $(subst :, ,$(libtool_VERSION)))
+
+# If we want to use "AR -r" when creating AIX FAT archives,
+# AR must be stripped of all its -X flags.
+# Otherwize, if AR was defined with -X32_64, the replace option would
+# erase the default .so when adding the extra one. There is no
+# order priority within -X flags.
+add-aix-fat-library: all-multi
+       @if test "$(MULTIBUILDTOP)" = ""; then \
+         arx=`echo $(AR) | sed -e 's/-X[^ ]*//g'`; \
+         $${arx} -X$(AIX_EXTRA_ARCH) rc .libs/$(PACKAGE).a ../ppc$(AIX_EXTRA_ARCH)/$(PACKAGE)/.libs/$(PACKAGE).so.$(MAJOR); \
+         $${arx} -X$(AIX_EXTRA_ARCH) rc ../pthread/$(PACKAGE)/.libs/$(PACKAGE).a ../pthread/ppc$(AIX_EXTRA_ARCH)/$(PACKAGE)/.libs/$(PACKAGE).so.$(MAJOR); \
+         $${arx} -X$(AIX_EXTRA_ARCH) rc libgobegin.a ../ppc$(AIX_EXTRA_ARCH)/$(PACKAGE)/$(libgobegin_a_OBJECTS); \
+         $${arx} -X$(AIX_EXTRA_ARCH) rc ../pthread/$(PACKAGE)/libgobegin.a ../pthread/ppc$(AIX_EXTRA_ARCH)/$(PACKAGE)/$(libgobegin_a_OBJECTS); \
+         $${arx} -X$(AIX_EXTRA_ARCH) rc libgolibbegin.a ../ppc$(AIX_EXTRA_ARCH)/$(PACKAGE)/$(libgolibbegin_a_OBJECTS); \
+         $${arx} -X$(AIX_EXTRA_ARCH) rc ../pthread/$(PACKAGE)/libgolibbegin.a ../pthread/ppc$(AIX_EXTRA_ARCH)/$(PACKAGE)/$(libgolibbegin_a_OBJECTS); \
+       fi