mailgun / mailgun/godebug

Godebug issue with cgo `//export` marked go functions.

Open
#64 0 comments 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.