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

coff: Add initial Coff support #1

Merged
merged 1 commit into from
Sep 24, 2021
Merged

coff: Add initial Coff support #1

merged 1 commit into from
Sep 24, 2021

Conversation

Pombal
Copy link

@Pombal Pombal commented Sep 23, 2021

No description provided.

@Pombal Pombal force-pushed the main branch 2 times, most recently from 4068ce2 to e8a8ade Compare September 23, 2021 14:24
Copy link
Owner

@kubkon kubkon left a comment

Choose a reason for hiding this comment

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

Looks great, thanks @Pombal! Just one nit that I'd like you comment on before I merge it into master.

src/Coff.zig Outdated
const file = try options.emit.directory.createFile(options.emit.sub_path, .{
.truncate = true,
.read = true,
.mode = 0,
Copy link
Owner

Choose a reason for hiding this comment

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

I think this should include a check like in other backends when using zld to cross-link to a foreign platform from Linux say.

Suggested change
.mode = 0,
.mode = if (std.Target.current.os.tag == .windows) 0 else 0o777,

Copy link
Author

Choose a reason for hiding this comment

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

Sure, that's fixed now. I thought it would only be used on Windows platforms.

Copy link
Owner

Choose a reason for hiding this comment

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

So the idea is that in principle since zld is written in Zig, it can easily be cross-compiled for any platform which we should make use by giving the possibility to easily cross-link to any platform too. It will obviously be lacking in this department all of the automation tooling that goes with Zig proper, but this where once would use the zig ld abstraction embedded directly in Zig toolchain.

Copy link
Owner

Choose a reason for hiding this comment

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

Also, I'm not sure how this works with cross-linking to Windows from Linux while testing in Wine. Something I need to give a look but didn't yet. It might not be needed indeed, but for consistency I'd like for all linker backends to set the mode correctly :-)

@kubkon
Copy link
Owner

kubkon commented Sep 23, 2021

Also, do you mind changing the README to say that work on COFF is now officially in progress?

@Pombal
Copy link
Author

Pombal commented Sep 24, 2021

Also, do you mind changing the README to say that work on COFF is now officially in progress?

I would rather not do that until I'm more certain I have the bandwidth to work on this for an extended period of time. But I can make the change if you'd prefer it.

@kubkon
Copy link
Owner

kubkon commented Sep 24, 2021

Also, do you mind changing the README to say that work on COFF is now officially in progress?

I would rather not do that until I'm more certain I have the bandwidth to work on this for an extended period of time. But I can make the change if you'd prefer it.

I'm good with either TBH, and just so we're clear, there is absolutely no pressure!

@kubkon kubkon merged commit 5c608b7 into kubkon:main Sep 24, 2021
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