Godebug issue with cgo `//export` marked go functions.
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 2.5k
- Forks
- 102
- PR merge metrics
- No merged PRs in 30d
Description
It appears that godebug causes some issues with Go functions that are marked //export for use with native code via cgo.
E.g. running godebug to instrument a package that uses cgo to define a vsl_dispatch_catcher native function that in turn invokes a go function vsl_noise_handler that is marked //export vsl_noise_handler in the source produces:
$ godebug run -instrument=github.com/fastly/fst-noise/vsl noise/noise.go
# github.com/fastly/fst-noise/vsl
/tmp/go-build703672289/github.com/fastly/fst-noise/vsl/_obj/log.cgo2.o: In function `vsl_dispatch_catcher':
/tmp/godebug453289544/src/github.com/fastly/fst-noise/vsl/log.go:36: undefined reference to `vsl_noise_handler'
collect2: error: ld returned 1 exit status
Is there a workaround known?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with godebug run -instrument=github.com/fastly/fst-noise/vsl noise/noise.go, using the cgo example in log.go around line 36 and the //export vsl_noise_handler declaration. Trace how instrumentation affects that exported function and native callback; done means the instrumented package links without the undefined-reference error and the callback remains usable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, go
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100