Skip to content

Prepare for the CMake plumbing to build the loader with MinGW#7

Closed
illwieckz wants to merge 45 commits into
illwieckz/mingw-1from
illwieckz/mingw
Closed

Prepare for the CMake plumbing to build the loader with MinGW#7
illwieckz wants to merge 45 commits into
illwieckz/mingw-1from
illwieckz/mingw

Conversation

@illwieckz

@illwieckz illwieckz commented Dec 10, 2025

Copy link
Copy Markdown
Member

slipher and others added 30 commits April 3, 2025 03:43
Only for amd64 host and target. nacl_helper_bootstrap also builds.

- Check in linux_syscall_support.h (like we did for Breakpad)
- Add a hacky symlink so we don't have to include the repository's
  parent directory or name it "native_client"
- Use LLVM from /usr/bin instead of Chromium toolchains
- Remove sysroot flags (depend on host system instead)
- Disable setup of NaCl-target toolchains in scons scripts
Disable GDB tests by default and when they are disabled don't try to
look for a 2nd NaCl toolchain just to grab its GDB.

GDB tests on Linux are broken for me anyway in upstream with the
incompatibly old curses lib dependency issue.
With some minor fixes, the build is able to run and produce an irt_core
binary when configured with the Saigo toolchain.
Added documentation how to do this to the README.

Still keeping the 'if nacltools' guards I added so that sel_ldr can be
built without acquiring any NaCl toolchains.
The only known working implementation is for i686 MSVC.

- amd64 MSVC was already disabled and marked at not working,
- there is no MinGW implementation in the code.
'pipes' module was removed from the standard library.
assertEquals and assertNotEquals were removed in Python 3.12.
Doesn't work on my Debian Trixie. Anyway I believe this seccomp BPF
thing is an experiment that was never really productionized.

After this everything passes for me with
./scons --mode=opt-host,nacl saigo=1 platform=x86-64 all_tests
Clearly the test shouldn't be disabled with Saigo for that condition.
But I couldn't find any problem with running the test for any PNaCl
configuration either (it always had a build id).
This fixes some test (if the repository dir is not named exactly
native_client).
Check in a copy of the 2013-vintage Googletest which is specified in the
DEPS file. Trying to use an external one would not work because an old
version that supports old C++ standards is needed. Hook it up to the
build system so that most tests work now.

Imported from gtest revision 2d3543f81d6d4583332f8b60768ade18e0f96220:
- LICENSE
- src/
- *.h files within include/
Like upstream, you must pass a breakpad_tools_dir argument for the tests
to run. Unlike upstream, the Breakpad #includes will be looked for also
in the tools dir, instead of the Chromium code depot.
For Linux toolchains (except x86-64 where I previously commented it
out), there were hard-coded sysroot flags referring to the paths of
Chromium's bundled dependencies. Get rid of this. On my machine the
cross toolchains work fine without it. But I added a
a 'sysroot' command line argument, so if anyone needs it they can
pass sysroot=... on the scons command line to configure a --sysroot flag.
This one only seems to be triggered when a test fails.
Use system qemu-armhf for the emulator for tests. The command here
basically matches what the run_under_qemu_arm script (which can be seen
at tools/trusted_cross_toolchains/qemu_tool_arm.sh) was doing.

Also change the emulator in run.py.
This fixes a NaCl syscall that only exists for a test. Fixes the
run_infoleak_test test target on ARM.
REGS_SAVER_FUNC is meant to work even if the stack pointer is
misaligned, but the multi-register PUSH instructions crash if the stack
is misaligned, as per the ARM documentation. I guess the old(?) bundled
QEMU used by upstream doesn't implement this faithfully. Fix it by using
a series of single-register pushes instead.

Fixes the run_register_set_test test target on ARM.
Use `volatile` as optimization barrier for the value of the pointer (NOT
for what's pointed at) like in Daemon's /injectFault segfault.

fixup: crashing
This test is using some custom macros instead of googletest and
ASSERT_EQ apparently double-evaluates the arguments if the assertion
fails.
slipher and others added 2 commits December 17, 2025 21:10
Use --orphan-handling=unwanted when linking nacl_helper_bootstrap which
makes the linker discard any sections not explicitly mentioned in the
linker script. This prevents the linker from producing a defective
binary with overlapping PT_LOAD headers when using GCC on certain
distros such as Ubuntu and Arch that have it configured to produce a
.note.gnu.property section
@illwieckz illwieckz changed the base branch from master to illwieckz/mingw-1 June 19, 2026 00:05
@illwieckz illwieckz added the enhancement New feature or request label Jun 20, 2026
@illwieckz illwieckz closed this Jun 21, 2026
@illwieckz illwieckz force-pushed the illwieckz/mingw-1 branch from e52b0bd to 9bf3b1f Compare June 21, 2026 23:48
@illwieckz illwieckz changed the title Make it possible to build the Windows executables with MinGW CMake plumbing to build the Windows executables with MinGW Jun 21, 2026
@illwieckz illwieckz changed the title CMake plumbing to build the Windows executables with MinGW CMake plumbing to build the loader with MinGW Jun 22, 2026
@illwieckz illwieckz changed the title CMake plumbing to build the loader with MinGW Prepare for the CMake plumbing to build the loader with MinGW Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants