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

gollvm: syscall.DT_UNKNOWN is no defined, during the build process, for rkt #41404

Closed
advancedwebdeveloper opened this issue Sep 15, 2020 · 4 comments
Labels
Milestone

Comments

@advancedwebdeveloper
Copy link

@advancedwebdeveloper advancedwebdeveloper commented Sep 15, 2020

Hello again.
I was trying to build an archived project, rkt - so I expected to use stable source code base, for testing purposes.

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

$ go version

go version go1.15rc2 gollvm LLVM 12.0.0git linux/amd64

Does this issue reproduce with the latest release?

Probably.

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

go env $ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/home/oceanfish81/.cache/go-build" GOENV="/home/oceanfish81/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/home/oceanfish81/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/oceanfish81/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/tools" GCCGO="/usr/local/bin/llvm-goc" AR="ar" CC="/usr/bin/clang" CXX="/usr/bin/clang++" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build520867872=/tmp/go-build -gno-record-gcc-switches -funwind-tables"
$ go env

What did you do?

I was searching for Go files - and tried to build inside a sub-folder:

~/rkt/common$ go build

_/home/oceanfish81/rkt/common

./common.go:480:29: error: reference to undefined identifier 'syscall.DT_UNKNOWN'

@thanm , that's not the only constant for auto-generation (as for today).

./common.go:530:3: error: goarm is not a function; '//go:linkname' is only supported for functions

@cherrymui , are you familiar with the cause of this bug?

Ivan

@advancedwebdeveloper
Copy link
Author

@advancedwebdeveloper advancedwebdeveloper commented Sep 15, 2020

https://github.com/golang/sys/blob/master/unix/zerrors_linux.go#L490 - DT_UNKNOWN is expected to have 0x0 value

Ivan

@gopherbot
Copy link

@gopherbot gopherbot commented Sep 15, 2020

Change https://golang.org/cl/254941 mentions this issue: libgo: additional type/const references in sysinfo.c

@thanm
Copy link
Member

@thanm thanm commented Sep 15, 2020

I'll update my patch in 254941 for DT_UNKNOWN.

Regarding go:linkname only supported for functions -- this is a known issue, see #30771 for example. The rkt code in question (reaching into the runtime to grab references to unexported variables) is not something that we want to encourage-- a package like this can potentially break on any new Go release as runtime internals change.

@toothrot toothrot changed the title [gollvm] syscall.DT_UNKNOWN is no defined, during the build process, for rkt gollvm: syscall.DT_UNKNOWN is no defined, during the build process, for rkt Sep 15, 2020
@toothrot toothrot added this to the Backlog milestone Sep 15, 2020
gopherbot pushed a commit to golang/gofrontend that referenced this issue Sep 16, 2020
Add a few more explicit references to enumeration constants
(RUSAGE_SELF, DT_UNKNOWN) in sysinfo.c to insure that their hosting enums
are emitted into DWARF, when using a clang host compiler during
the gollvm build.

Updates golang/go#41382.
Updates golang/go#41404.

Change-Id: Id0ed7a82ae5dc98ccffa5269a7147e0171c9b0ea
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/254941
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Than McIntosh <thanm@google.com>
kraj pushed a commit to kraj/gcc that referenced this issue Sep 16, 2020
Add a few more explicit references to enumeration constants
(RUSAGE_SELF, DT_UNKNOWN) in sysinfo.c to insure that their hosting enums
are emitted into DWARF, when using a clang host compiler during
the gollvm build.

Updates golang/go#41382.
Updates golang/go#41404.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/254941
@thanm
Copy link
Member

@thanm thanm commented Sep 16, 2020

./common.go:480:29: error: reference to undefined identifier 'syscall.DT_UNKNOWN'

This problem should now be fixed at head. The issue with go:linkname being applied to an unexported variable in the runtime package is still open, however, that will require a more general solution outside of gollvm in particular. Closing this bug, please reopen if need be.

@thanm thanm closed this Sep 16, 2020
rodgert added a commit to rodgert/gcc that referenced this issue Oct 16, 2020
Add a few more explicit references to enumeration constants
(RUSAGE_SELF, DT_UNKNOWN) in sysinfo.c to insure that their hosting enums
are emitted into DWARF, when using a clang host compiler during
the gollvm build.

Updates golang/go#41382.
Updates golang/go#41404.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/254941
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.