Skip to content

UEFI Target groundwork: runtime: extract Windows PE globals scan helper - #5361

Merged
deadprogram merged 4 commits into
tinygo-org:devfrom
sparques:pr/runtime-windows-pe-helper
Jun 7, 2026
Merged

UEFI Target groundwork: runtime: extract Windows PE globals scan helper#5361
deadprogram merged 4 commits into
tinygo-org:devfrom
sparques:pr/runtime-windows-pe-helper

Conversation

@sparques

@sparques sparques commented May 1, 2026

Copy link
Copy Markdown
Contributor

I am back with another attempt trying to get UEFI as a target.

Summary

This PR extracts the PE/COFF globals-scanning logic from src/runtime/os_windows.go into a separate helper file, src/runtime/os_windows_pe.go.

The extracted code includes:

  • PE header structs
  • section header structs
  • module handle storage
  • the helper that scans writable PE sections for GC roots

Why

The Windows runtime currently embeds PE parsing details directly inside findGlobals. Pulling that logic into a dedicated helper makes the runtime code easier to follow and isolates the PE-specific implementation detail in one place. For supporting UEFI, the PE stuff is needed isolated from the rest of os_windows.go.

Behavior

This is intended to be a mechanical refactor only. There should be no functional change to Windows behavior.

Comment thread src/runtime/os_windows_pe.go
Comment thread src/runtime/os_windows_pe.go
@deadprogram

Copy link
Copy Markdown
Member

Thanks for working on this @sparques I made one minor comment.

Can you please rebase against the latest dev branch so the tests can run.

@deadprogram

Copy link
Copy Markdown
Member

@sparques looks like you need to run go fmt

make: *** [GNUmakefile:213: fmt-check] Error 1
Unformatted:
  src/runtime/os_windows_pe.go

@sparques

sparques commented Jun 6, 2026

Copy link
Copy Markdown
Contributor Author

@deadprogram Okay, I think it's good now.

@deadprogram

Copy link
Copy Markdown
Member

Thanks for working on this @sparques now squash/merging.

@deadprogram
deadprogram merged commit e6e7250 into tinygo-org:dev Jun 7, 2026
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants