Skip to content

Conversation

JagoGyselinck
Copy link
Contributor

Hello!

Thank you for maintaining this tool. We've been using it at Guardsquare for a while and have recently identified a use-case where we would also need to run it on Windows hosts.

This could be achieved by switching the compiler to MinGW-w64. However, when opening the ELF file for reading/writing the code currently does not pass the O_BINARY flag. If the flag is not passed on Windows, the file is opened in text mode and reading/writing may prematurely end due to misinterpretation of file contents.

This pull request resolves this issue by:

  • Defining O_BINARY as 0 if it isn't defined, so that it has no effect on systems that do not have the O_BINARY flag.
  • Passing O_BINARY when opening the ELF file for reading/writing.

Thank you for taking the time to look at this.

Best Regards,
Jago

@Mic92 Mic92 merged commit 31d052c into NixOS:master Apr 7, 2022
@Mic92
Copy link
Member

Mic92 commented Apr 7, 2022

Thanks. It might make sense to add mingw as a target to the CI to avoid future breakage in future.

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