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

Failure to analyze when the symbol table is disabled on darwin/arm64/go 1.22/cgo #52

Open
nikpivkin opened this issue May 21, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@nikpivkin
Copy link

nikpivkin commented May 21, 2024

Hi, thanks for this tool!

Steps to reproduce:

level=INFO msg="Parsing binary..."
level=INFO msg="Parsing binary done"
level=INFO msg="Finding build info..."
level=INFO msg="Build info found"
level=INFO msg="Loading sections..."
level=INFO msg="Loading sections done"
level=INFO msg="Loading packages..."
level=ERROR msg="Fatal error: failed to find runtime.text symbol: moduledata structure not found"

But if I add an environment variable CGO_ENABLED=0 to disable cgo, the analysis runs successfully.

OS: macos m1
Go: 1.22

@Zxilly
Copy link
Owner

Zxilly commented May 21, 2024

Do you compile with the target darwin-arm64? If so this is an known issue.
https://github.com/Zxilly/go-size-analyzer/blob/master/scripts/skip.txt

@Zxilly Zxilly added the bug Something isn't working label May 21, 2024
@Zxilly
Copy link
Owner

Zxilly commented May 21, 2024

A temporary workaround is to keep the symbol table, and the dwarf can be removed as it didn't be used right now.

@nikpivkin
Copy link
Author

Yes, the target is darwin-arm64. Why does this work with CGO_ENABLED=0?

@Zxilly
Copy link
Owner

Zxilly commented May 21, 2024

CGO implicitly enables external links, where links are no longer executed by go, but by the linker provided by the operating system. This will change some of the assumptions of go itself.
Currently this problem only occurs with darwin-arm64 on go 1.22, and I don't use Apple's M-series chips, so it's hard for me to find out exactly what's wrong.

@nikpivkin
Copy link
Author

I got it, thanks.

@nikpivkin
Copy link
Author

@Zxilly I can provide dumps if it can help. I've been trying to research this, but I haven't gotten too far.

@Zxilly
Copy link
Owner

Zxilly commented May 29, 2024

It's an error triggered by an upstream library, and I'm sure it's fixable. And I already have some samples I can use to reproduce the error.
But I'm busy lately. Maybe I'll have time to look at this in a few months.
You can follow https://github.com/goretk/gore for progress.

@Zxilly Zxilly changed the title Failure to analyze when the symbol table is disabled Failure to analyze when the symbol table is disabled on darwin/arm64/go 1.22/cgo Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants