Skip to content

Build-Linux#64

Open
jaykrell wants to merge 1 commit into
microsoft:mainfrom
jaykrell:linux
Open

Build-Linux#64
jaykrell wants to merge 1 commit into
microsoft:mainfrom
jaykrell:linux

Conversation

@jaykrell
Copy link
Copy Markdown
Member

@jaykrell jaykrell commented Apr 10, 2026

This PR adds support fo building with clangpdb on Linux.
It also adds gcc, but that is disabled due to an error.
The results might not yet boot, that is a secondary concern to be dealt with, later.
Also fixes gcc flags. Also aligns images in FV -- maybe wrong linker flags?

@jaykrell jaykrell force-pushed the linux branch 8 times, most recently from 90cc34b to d7509f9 Compare April 10, 2026 23:36
@jaykrell jaykrell marked this pull request as ready for review April 11, 2026 01:28
@jaykrell jaykrell force-pushed the linux branch 2 times, most recently from b8e006f to 9f60ecb Compare April 11, 2026 02:13
Copy link
Copy Markdown
Collaborator

@mebersol mebersol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Copilot] Linux build support is a welcome addition. A few items to address before merge:\n\n- Workflow: Outdated action version (checkout@v3 → v4), potentially wrong GCC prefix (underscores vs hyphens), heavy mono-complete dependency that may not be needed for CLANGPDB, and no pip/submodule caching.\n- DSC: ASLCC_FLAGS workaround is reasonable but fragile — should track as tech debt.\n- FDF: Align=Auto change is sound but differs from AARCH64's Align=4K approach — worth confirming the inconsistency is intentional.

Comment thread .github/workflows/Build-Linux.yml Outdated
Comment thread .github/workflows/Build-Linux.yml Outdated
Comment thread .github/workflows/Build-Linux.yml Outdated
Comment thread .github/workflows/Build-Linux.yml
Comment thread MsvmPkg/MsvmPkgAARCH64.dsc
Comment thread MsvmPkg/MsvmPkgX64.fdf Outdated
[Rule.Common.SEC]
FILE SEC = $(NAMED_GUID) {
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
PE32 PE32 Align=Auto $(INF_OUTPUT)/$(MODULE_NAME).efi
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Copilot] Changing from Align=32 to Align=Auto makes sense for cross-toolchain compatibility. Note that the AARCH64 FDF uses Align=4K for its SEC/PEI_CORE/PEIM rules rather than Align=Auto — is the difference intentional? Also, the DXE_DRIVER/DXE_RUNTIME_DRIVER/UEFI_APPLICATION rules in this file don't have explicit alignment — worth confirming they don't need the same treatment for Linux builds.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is all accidental and not full investigated, agreed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest Auto everywhere. I suggest it shouldn't even be an option.
Users should be expected to set FileAlign either to match SectionAlign for execute-in-place or simplicity, or small if they desire packing.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what Copilot suggested to Chris though. So this is Copilot reviewing itself and not agreeing with itself. I am just a human bystander.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not commit until this is looked at more. Sorry Chris.
Becauses, as Copilot points out, there's a gazillion of these. Why change only a few?
Let's look at the file alignments and placement in fv/fd before/after.
I mean, you know, anytime we produce PE directly with mslink or ldlink, we have two alignments to specify which should be plenty to make it correct. Gcc via ELF is another matter but not relevant here (for gcc we should give up on native gcc and instead use mingw-gcc, so much cleaner..even if we have to build it ourselves though I don't think we'll have to...)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively we can undo this part and commit. So it compiles and links but doesn't run. Meh.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it because align=auto is only being done for these modules which are execute in place (XIP)? I wonder if the alignment from codegen is different for these which is why we need align auto?

@jaykrell
Copy link
Copy Markdown
Member Author

The open question on the gcc stuff, is why is it working in closed source?
Different gcc/ld version?
I am slightly reluctant to fix it here, if it isn't broken there.
Unless we understand the difference. I agree that auto, 4k, an 64k, make a lot of sense.
Since this is only for gcc (right? I'll check) I suggest revert, and revisit "later".
If it is also for clang though, maybe take it and investigate "later"?

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.

4 participants