diff options
| author | Cherry Zhang <cherryyz@google.com> | 2020-04-24 12:13:11 -0400 |
|---|---|---|
| committer | Cherry Zhang <cherryyz@google.com> | 2020-04-24 16:58:37 +0000 |
| commit | f2d8da1a353b493548e211b06fdf47bd998ad4b6 (patch) | |
| tree | b707f002054aa52151a5bf1ea61f5576a1138754 /src | |
| parent | f790533d9ffd6d50c8efccf8f8edac0ef76b3da4 (diff) | |
| download | go-f2d8da1a353b493548e211b06fdf47bd998ad4b6.tar.xz | |
[dev.link] cmd/link: set HeadType early
So we can use it to set per-OS flags.
Also set flagnewDoData after archinit, where IsELF is set.
This should correct the logic of setting flagnewDoData.
Change-Id: I18c7252f141aa35119005c252becc9d7cb74f2f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/229867
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmd/link/internal/ld/main.go | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/cmd/link/internal/ld/main.go b/src/cmd/link/internal/ld/main.go index 8b6b9b84a6..d8b4c8a94d 100644 --- a/src/cmd/link/internal/ld/main.go +++ b/src/cmd/link/internal/ld/main.go @@ -155,13 +155,8 @@ func Main(arch *sys.Arch, theArch Arch) { usage() } } - - if *flagnewDoData { - // New dodata() is currently only implemented for selected targets. - if !(ctxt.IsElf() && - (ctxt.IsAMD64() || ctxt.Is386())) { - *flagnewDoData = false - } + if ctxt.HeadType == objabi.Hunknown { + ctxt.HeadType.Set(objabi.GOOS) } checkStrictDups = *FlagStrictDups @@ -199,16 +194,19 @@ func Main(arch *sys.Arch, theArch Arch) { bench.Start("libinit") libinit(ctxt) // creates outfile - - if ctxt.HeadType == objabi.Hunknown { - ctxt.HeadType.Set(objabi.GOOS) - } - bench.Start("computeTLSOffset") ctxt.computeTLSOffset() bench.Start("Archinit") thearch.Archinit(ctxt) + if *flagnewDoData { + // New dodata() is currently only implemented for selected targets. + if !(ctxt.IsElf() && + (ctxt.IsAMD64() || ctxt.Is386())) { + *flagnewDoData = false + } + } + if ctxt.linkShared && !ctxt.IsELF { Exitf("-linkshared can only be used on elf systems") } |
