Commit 697f4183 authored by Clément Chigot's avatar Clément Chigot Committed by Ian Lance Taylor

cmd/link: allow buildmode c-archive for aix/ppc64

Change-Id: Ia268b0d64dc89866aa09bfffcaa109741088a904
Reviewed-on: https://go-review.googlesource.com/c/go/+/169119
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent f7f4eef3
......@@ -51,7 +51,7 @@ func (mode *BuildMode) Set(s string) error {
*mode = BuildModePIE
case "c-archive":
switch objabi.GOOS {
case "darwin", "linux":
case "aix", "darwin", "linux":
case "freebsd":
switch objabi.GOARCH {
case "amd64":
......
......@@ -1000,7 +1000,7 @@ func dosymtype(ctxt *Link) {
for _, s := range ctxt.Syms.Allsym {
// Create a new entry in the .init_array section that points to the
// library initializer function.
if s.Name == *flagEntrySymbol {
if s.Name == *flagEntrySymbol && ctxt.HeadType != objabi.Haix {
addinitarrdata(ctxt, s)
}
}
......@@ -1380,6 +1380,13 @@ func (ctxt *Link) dodata() {
case BuildModeCArchive, BuildModeCShared, BuildModeShared, BuildModePlugin:
hasinitarr = true
}
if ctxt.HeadType == objabi.Haix {
if len(data[sym.SINITARR]) > 0 {
Errorf(nil, "XCOFF format doesn't allow .init_array section")
}
}
if hasinitarr && len(data[sym.SINITARR]) > 0 {
sect := addsection(ctxt.Arch, &Segdata, ".init_array", 06)
sect.Align = dataMaxAlign[sym.SINITARR]
......
......@@ -1102,7 +1102,11 @@ func (ctxt *Link) archive() {
}
ctxt.Out.f = nil
argv := []string{*flagExtar, "-q", "-c", "-s", *flagOutfile}
argv := []string{*flagExtar, "-q", "-c", "-s"}
if ctxt.HeadType == objabi.Haix {
argv = append(argv, "-X64")
}
argv = append(argv, *flagOutfile)
argv = append(argv, filepath.Join(*flagTmpdir, "go.o"))
argv = append(argv, hostobjCopy()...)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment