aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link
diff options
context:
space:
mode:
authorByoungchan Lee <daniel.l@hpcnt.com>2021-11-25 20:40:21 +0900
committerThan McIntosh <thanm@google.com>2022-03-22 10:00:16 +0000
commita8f019e956db40e9846e635a622489e356cb3c63 (patch)
tree7a97b82d4d4697fa98445530001542e59d4cda0a /src/cmd/link
parent86c8075675ed74c1f404894242c26b99800f1639 (diff)
downloadgo-a8f019e956db40e9846e635a622489e356cb3c63.tar.xz
cmd/link: add DT_NEEDED for all 64-bit ELF dynimplib
Also change the relevant test to be tested on the linux-arm64 platform as well. Fixes #49789 Change-Id: Id2eac7a45279f037957442862f8ed63838b8e929 Reviewed-on: https://go-review.googlesource.com/c/go/+/366855 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Trust: Than McIntosh <thanm@google.com> Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/cmd/link')
-rw-r--r--src/cmd/link/internal/ld/elf.go2
-rw-r--r--src/cmd/link/internal/ld/elf_test.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/link/internal/ld/elf.go b/src/cmd/link/internal/ld/elf.go
index 7f45a8fce5..cb094a373a 100644
--- a/src/cmd/link/internal/ld/elf.go
+++ b/src/cmd/link/internal/ld/elf.go
@@ -2258,7 +2258,7 @@ func elfadddynsym(ldr *loader.Loader, target *Target, syms *ArchSyms, s loader.S
dil := ldr.SymDynimplib(s)
- if target.Arch.Family == sys.AMD64 && !cgoeDynamic && dil != "" && !seenlib[dil] {
+ if !cgoeDynamic && dil != "" && !seenlib[dil] {
du := ldr.MakeSymbolUpdater(syms.Dynamic)
Elfwritedynent(target.Arch, du, elf.DT_NEEDED, uint64(dstru.Addstring(dil)))
seenlib[dil] = true
diff --git a/src/cmd/link/internal/ld/elf_test.go b/src/cmd/link/internal/ld/elf_test.go
index d86ebb89e0..15eaa1388b 100644
--- a/src/cmd/link/internal/ld/elf_test.go
+++ b/src/cmd/link/internal/ld/elf_test.go
@@ -86,7 +86,7 @@ func TestNoDuplicateNeededEntries(t *testing.T) {
// across the board given the nature of the test).
pair := runtime.GOOS + "-" + runtime.GOARCH
switch pair {
- case "linux-amd64", "freebsd-amd64", "openbsd-amd64":
+ case "linux-amd64", "linux-arm64", "freebsd-amd64", "openbsd-amd64":
default:
t.Skip("no need for test on " + pair)
}