Skip to content

Commit

Permalink
cmd/link: specify correct size for dynamic symbols in 386 elf output
Browse files Browse the repository at this point in the history
Currently 386 ELF binaries are generated with dynamic symbols that have
a size of zero bytes, even though the symbol in the symbol table has
the correct size. Fix this by specifying the correct size when creating
dynamic symbols.

Issue found on OpenBSD -current, where ld.so is now producing link
warnings due to mismatched symbol sizes.

Fixes #15593.

Change-Id: Ib1a12b23ff9159c61ac980bf48a983b86f3df256
Reviewed-on: https://go-review.googlesource.com/22912
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
  • Loading branch information
4a6f656c authored and minux committed May 8, 2016
1 parent 394ac81 commit 0b6e5e3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cmd/link/internal/ld/elf.go
Original file line number Diff line number Diff line change
Expand Up @@ -2665,8 +2665,8 @@ func Elfadddynsym(ctxt *Link, s *LSym) {
Addaddr(ctxt, d, s)
}

/* size */
Adduint32(ctxt, d, 0)
/* size of object */
Adduint32(ctxt, d, uint32(s.Size))

/* type */
t := STB_GLOBAL << 4
Expand Down

0 comments on commit 0b6e5e3

Please sign in to comment.