binutils Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gas

Fix gas .incbin test case for Windows/MSYS2

Adjusts gas assembler test case for .incbin directive to work on Windows.

The gas assembler’s test case for the .incbin directive has been updated to pass on Windows and MSYS2 environments. Previously, the test failed due to differences in how fopen() handles directories in read-only mode and the use of a non-existent /etc/ path. The test now uses ./tmpdir/ and a more flexible error message regular expression.

In Details

The gas/testsuite/gas/all/pr27381.s test case, which verifies the .incbin directive's error handling when given a directory, has been modified. On POSIX systems, fopen() on a directory returns a valid handle, while on Windows, it returns NULL. This commit adjusts the expected error message in pr27381.err to accommodate Windows behavior and replaces the non-existent /etc/ path with ./tmpdir/ to ensure cross-platform test compatibility.

For Context
.incbin
An assembler directive that instructs the assembler to read raw binary data from a file and include it in the current section of the object file.
gas
The GNU Assembler, part of the GNU Binutils package, which translates assembly language code into machine code.
MSYS2
A software distribution and building platform for Windows, providing a Bash shell and Unix-like tools.
fopen()
A C standard library function that opens a file and associates it with a stream, returning a file pointer.
regular expression
A sequence of characters that defines a search pattern, used here to match varying error messages.
Filed Under: gastestsuitewindowscross-platform