Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/link: ELF linker generates incorrect local dynamic symbol count #33358

Open
shachaf opened this issue Jul 30, 2019 · 3 comments

Comments

@shachaf
Copy link

commented Jul 30, 2019

When generating a dynamically-linked ELF file, the ".dynsym" section's info field specifies the number of local symbols. It currently seems to generate 0, but symbol 0 is reserved and always local, so the value should be at least 1. readelf (from GNU binutils 2.30) reports this warning.

What version of Go are you using (go version)?

$ go version
go version go1.10.4 linux/amd64

Does this issue reproduce with the latest release?

It is present in master at the time of writing.

See https://github.com/golang/go/blob/master/src/cmd/link/internal/ld/elf.go#L1934

What operating system and processor architecture are you using (go env)?

linux_amd64

What did you do?

Build a program that uses dynamic linking. E.g.

package main

import "net"

func main() {
	net.Dial("", "")
}

And look at the .dynsym info field.

What did you expect to see?

.dynsym info field >= 1.

What did you see instead?

.dynsym info field 0, and no warnings from readelf.

  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [11] .dynsym           DYNSYM           000000000052c1e0  0012c1e0
       0000000000000390  0000000000000018   A      10     0     8
readelf: Warning: local symbol 0 found at index >= .dynsym's sh_info value of 0
@agnivade

This comment has been minimized.

Copy link
Member

commented Jul 30, 2019

@agnivade agnivade changed the title ELF linker generates incorrect local dynamic symbol count cmd/link: ELF linker generates incorrect local dynamic symbol count Jul 30, 2019

@ianlancetaylor ianlancetaylor added this to the Go1.14 milestone Jul 30, 2019

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Jul 30, 2019

Thanks. I agree that this should be fixed.

@gopherbot

This comment has been minimized.

Copy link

commented Jul 31, 2019

Change https://golang.org/cl/187979 mentions this issue: cmd/link: set .dynsym info field

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.