Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
b2763b0
cmake: add MinGW CMake toolchains for cross-compilation
illwieckz Apr 7, 2025
12a6d62
cmake: add CMake scripts to build sel_ldr and nacl_helper_bootstrap
illwieckz Apr 7, 2025
0bed0cf
win32: include stdint for INT64_MAX
illwieckz Apr 8, 2025
b8b40a3
win32: use lowercase header file name
illwieckz Apr 8, 2025
b9cec2e
win32: use __inline__ instead of __forceinline__ on MinGW
illwieckz Apr 8, 2025
e0c198a
win32: do not use non-standard i64 integer suffix on MinGW
illwieckz Apr 8, 2025
c602d47
win32: do not declare PosixSignals enum on MinGW
illwieckz Apr 8, 2025
a7dc021
win32: use GCC noinline on MinGW
illwieckz Apr 8, 2025
97e64f5
win32: use asm intrinsics alternative to __halt() on MinGW
illwieckz Apr 8, 2025
224f152
win32: use posix intrinsics instead of MSVC asm code on i686 MinGW
illwieckz Apr 8, 2025
8dbb29a
win32: skip some CPU detection on Windows with MinGW like 64-bit MSVC
illwieckz Apr 8, 2025
7a07926
win32: do not use MSVC fast asm in port_win.c on i686 MinGW
illwieckz Apr 8, 2025
1204c38
scons: build arm sel_ldr and nacl_helper_bootstrap with 64K page size
illwieckz Apr 10, 2025
882d4e4
cmake: build arm sel_ldr and nacl_helper_bootstrap with 64K page size
illwieckz Apr 10, 2025
f3d4d4a
cmake: fix building nacl_helper_bootstrap with zero-based 64-bit sand…
illwieckz Oct 13, 2025
92805b2
cmake: use size optimization for nacl_helper_bootstrap, with toplevel…
illwieckz Oct 13, 2025
58cd85c
win32: silence some MSVC pragma and redefinitions on MinGW
illwieckz Dec 9, 2025
401ee9e
win32: silence warnings about undefined NACL_USE_TLS and NACL_USE_TSD
illwieckz Dec 9, 2025
2cd0a47
win32: add and use a simplistic macamd64.inc
illwieckz Apr 8, 2025
0223f8b
win32: implement CPU detection for MinGW
illwieckz Dec 10, 2025
02ac525
cmake: add the Yokai CMake framework
illwieckz Apr 7, 2025
64f68e4
cmake: discard extra sections linking nacl_helper_bootstrap
illwieckz Dec 18, 2025
2b20148
cleanup: remove BUILD.gn support
illwieckz Jun 25, 2026
08189c9
tools: move files from build/ to tools/build/
illwieckz Jun 25, 2026
f588867
cleanup: remove DEPS files
illwieckz Jun 25, 2026
8115460
gitignore: ignore toolchain/ symbolic link
illwieckz Jun 25, 2026
8ab33e7
gitignore: ignore the build/ directory
illwieckz Jun 25, 2026
6b0137a
win32: do not redefine mode_t with conflicting type on MinGW
illwieckz Apr 8, 2025
965f9a2
cmake: add install target
illwieckz Jun 25, 2026
10c0aae
cmake: use path sanitization
illwieckz Jun 26, 2026
3085d99
bootstrap: force alignement to make possible to build nacl_helper_boo…
illwieckz Apr 10, 2025
beca906
win32: disable DEP qualifications outside of MSVC
illwieckz Jul 7, 2026
6db3cdb
posix: g_prereserved_sandbox_size only exists on Linux, not on macOS
illwieckz Jul 7, 2026
dc56f6e
cmake: standardize found executable path variable name
illwieckz Jul 7, 2026
8a85cf5
cmake: configure jwasm anytime on mingw, even if explicitly provided
illwieckz Jul 7, 2026
d949bc3
WIP: CI
illwieckz Jul 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions .azure-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Documentation: https://wiki.unvanquished.net/wiki/Continuous_integration

trigger:
branches:
include:
- master

pr:
branches:
include:
- '*'
paths:
include:
- .azure-pipelines.yml
- src/
- include-hax/
- cmake/
- CMakeLists.txt

strategy:
matrix:
Linux amd64 GCC:
VM_IMAGE: 'ubuntu-22.04'
APT_PACKAGES: ninja-build g++-10
C_COMPILER: gcc-10
CXX_COMPILER: g++-10
Linux i686 GCC:
VM_IMAGE: 'ubuntu-22.04'
APT_PACKAGES: ninja-build g++-i686-linux-gnu
C_COMPILER: i686-linux-gnu-gcc
CXX_COMPILER: i686-linux-gnu-g++
COMPILER_FLAGS: -mfpmath=sse -msse
Linux armhf GCC:
# There is an IO bug in qemu-arm from ubuntu-22.04.
VM_IMAGE: 'ubuntu-24.04'
APT_PACKAGES: ninja-build g++-arm-linux-gnueabihf qemu-user
C_COMPILER: arm-linux-gnueabihf-gcc
CXX_COMPILER: arm-linux-gnueabihf-g++
EXE_RUNNER: qemu-arm -L /usr/arm-linux-gnueabihf
Linux amd64 Clang:
VM_IMAGE: 'ubuntu-22.04'
APT_PACKAGES: ninja-build
C_COMPILER: clang
CXX_COMPILER: clang++
Windows amd64 MinGW:
VM_IMAGE: 'ubuntu-22.04'
APT_PACKAGES: ninja-build g++-mingw-w64-x86-64 mingw-w64-x86-64-dev gcc-mingw-w64-x86-64-posix-runtime wine
SETUP_COMMANDS: sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
TOOLCHAIN_FILE: cmake/cross-toolchain-mingw64.cmake
EXE_RUNNER: wine
EXE_EXT: .exe
WITH_JWASM: true
Windows i686 MinGW:
VM_IMAGE: 'ubuntu-22.04'
APT_ARCHITECTURE: i386
APT_PACKAGES: ninja-build g++-mingw-w64-i686 mingw-w64-i686-dev gcc-mingw-w64-i686-posix-runtime wine wine32
SETUP_COMMANDS: sudo update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix
TOOLCHAIN_FILE: cmake/cross-toolchain-mingw32.cmake
COMPILER_FLAGS: -mfpmath=sse -msse
EXE_RUNNER: wine
EXE_EXT: .exe
WITH_JWASM: true
macOS amd64 AppleClang:
VM_IMAGE: 'macOS-14'
CMAKE_GENERATOR: Unix Makefiles
NPROC_COMMAND: sysctl -n hw.logicalcpu

pool:
vmImage: $(VM_IMAGE)

steps:
- bash: |
set -xue
if [ -n "${APT_ARCHITECTURE:-}" ]; then
sudo dpkg --add-architecture "${APT_ARCHITECTURE}"
fi
if [ -n "${APT_PACKAGES:-}" ]; then
sudo apt-get update && sudo apt-get -y -q --no-install-recommends install ${APT_PACKAGES}
fi
if [ -n "${SETUP_COMMANDS:-}" ]; then
$(SETUP_COMMANDS)
fi
displayName: 'Setup'
- bash: |
set -xue
export CMAKE_BUILD_PARALLEL_LEVEL="$(${NPROC_COMMAND:-nproc})"
echo "${CMAKE_BUILD_PARALLEL_LEVEL}"
cmake_args=(-G"${CMAKE_GENERATOR:-Ninja}")
if "${WITH_JWASM:-false}"; then
git clone https://github.com/JWasm/JWasm.git build/jwasm
cmake -Sbuild/jwasm -Bbuild/jwasm/build
cmake --build build/jwasm/build --config Release
# No EXE_EXT, this is a native tool.
cmake_args+=(-DCMAKE_ASM_MASM_COMPILER="$(realpath build/jwasm/build/jwasm)")
fi
if [ -n "${TOOLCHAIN_FILE:-}" ]; then
cmake_args+=(-DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_FILE}")
fi
if [ -n "${C_COMPILER:-}" ]; then
cmake_args+=(-DCMAKE_C_COMPILER="${C_COMPILER}")
fi
if [ -n "${CXX_COMPILER:-}" ]; then
cmake_args+=(-DCMAKE_CXX_COMPILER="${CXX_COMPILER}")
fi
if [ -n "${COMPILER_FLAGS:-}" ]; then
cmake_args+=(-DCMAKE_C_FLAGS="${COMPILER_FLAGS}" -DCMAKE_CXX_FLAGS="${COMPILER_FLAGS}")
fi
cmake -S. -Bbuild "${cmake_args[@]}"
cmake --build build --config Release
displayName: 'Build'
- bash: |
set -xue
# TODO
true
displayName: 'Test'
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ testserver.log
/toolchain_build/src/

# Ignore these absolute directories (relative to native_client directory)
/build/Debug/
/build/Release/
/tools/build/Debug/
/tools/build/Release/
/chromebinaries/
/scons-out/
/toolchain/
/toolchain
/tools/BUILD/
/tools/out/
/tools/perf_expectations/
Expand All @@ -51,3 +52,6 @@ testserver.log

# Ignore the hermetic cygwin used on windows toolchain builds.
/cygwin/

# It is common practice with CMake to build in build/
/build/
25 changes: 0 additions & 25 deletions .gn

This file was deleted.

33 changes: 0 additions & 33 deletions BUILD.gn

This file was deleted.

118 changes: 118 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
cmake_minimum_required(VERSION 3.12)

if (COMPILER_TARGET)
set(CMAKE_C_COMPILER_TARGET "${COMPILER_TARGET}")
set(CMAKE_CXX_COMPILER_TARGET "${COMPILER_TARGET}")
set(CMAKE_ASM_COMPILER_TARGET "${COMPILER_TARGET}")
endif()

project(native_client C CXX ASM)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

include(Yokai/Detection)
include(NaClFlags)

if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo)
endif()

option(BUILD_NACL_LOADER "Build the sel_ldr program." ON)

if (YOKAI_TARGET_SYSTEM_LINUX_COMPATIBILITY)
option(BUILD_NACL_HELPER_BOOTSTRAP "Build the nacl_helper_bootstrap program on platforms requiring it." ON)
endif()

# TODO(arbenson): remove this once binutils bug is fixed (see
# src/trusted/service_runtime/arch/x86_64/sel_addrspace_posix_x86_64.c)
if (BUILD_NACL_LOADER AND YOKAI_TARGET_ARCH_AMD64 AND NOT YOKAI_TARGET_SYSTEM_WINDOWS)
option(USE_AMD64_ZERO_BASED_SANDBOX "Allow the zero-based sandbox model to run insecurely." OFF)
endif()

if (BUILD_NACL_LOADER AND YOKAI_TARGET_SYSTEM_WINDOWS)
option(FORCE_NO_TRUSTED_BUILD "Prevent use of trusted toolchain." OFF)
endif()

if (BUILD_NACL_LOADER AND YOKAI_TARGET_SYSTEM_WINDOWS)
set(REQUIRE_MASM ON)
endif()

if (BUILD_NACL_LOADER AND YOKAI_TARGET_SYSTEM_MACOS)
set(REQUIRE_PYTHON ON)
endif()

if (BUILD_NACL_HELPER_BOOTSTRAP)
set(REQUIRE_PYTHON ON)
endif()

if (REQUIRE_PYTHON)
if (NOT PYTHON)
find_program(PATH_PYTHON NAMES "python3" DOC "Path to the python3 executable." REQUIRED)
endif()
endif()

if (REQUIRE_MASM)
if (YOKAI_CXX_COMPILER_MINGW)
if (NOT CMAKE_ASM_MASM_COMPILER)
find_program(PATH_JWASM NAMES "jwasm" DOC "Path to the JWasm executable." REQUIRED)

set(CMAKE_ASM_MASM_COMPILER "${PATH_JWASM}")
endif()

include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include-hax/fake_masm")

if (YOKAI_TARGET_ARCH_I686)
list(APPEND CMAKE_ASM_MASM_FLAGS "-coff")
elseif(YOKAI_TARGET_ARCH_AMD64)
list(APPEND CMAKE_ASM_MASM_FLAGS "-win64")
endif()
endif()

enable_language(ASM_MASM)
endif()

include_directories("include-hax")

if (YOKAI_TARGET_ARCH_I686)
set(VALIDATOR_ARCH_SUFFIX "_x86_32")
elseif (YOKAI_TARGET_ARCH_AMD64)
set(VALIDATOR_ARCH_SUFFIX "_x86_64")
elseif (YOKAI_TARGET_ARCH_ARMHF OR YOKAI_TARGET_ARCH_ARMEL)
set(VALIDATOR_ARCH_SUFFIX "_arm")
elseif (YOKAI_TARGET_ARCH_MIPSEL)
set(VALIDATOR_ARCH_SUFFIX "_mips32")
endif()

if (BUILD_NACL_LOADER)
add_subdirectory(src/shared/gio)
add_subdirectory(src/shared/imc)
add_subdirectory(src/shared/platform)
add_subdirectory(src/trusted/cpu_features)
add_subdirectory(src/trusted/debug_stub)
add_subdirectory(src/trusted/desc)
add_subdirectory(src/trusted/fault_injection)
add_subdirectory(src/trusted/interval_multiset)
add_subdirectory(src/trusted/nacl_base)
add_subdirectory(src/trusted/perf_counter)
add_subdirectory(src/trusted/platform_qualify)
add_subdirectory(src/trusted/validator)

if (YOKAI_TARGET_ARCH_I686 OR YOKAI_TARGET_ARCH_AMD64)
add_subdirectory(src/trusted/validator_x86)
add_subdirectory(src/trusted/validator_ragel)
elseif (YOKAI_TARGET_ARCH_ARMHF OR YOKAI_TARGET_ARCH_ARMEL)
add_subdirectory(src/trusted/validator_arm)
elseif (YOKAI_TARGET_ARCH_MIPSEL)
add_subdirectory(src/trusted/validator_mips)
endif()
endif()

if (BUILD_NACL_LOADER)
add_subdirectory(src/trusted/service_runtime)
endif()

if (BUILD_NACL_HELPER_BOOTSTRAP)
add_subdirectory(src/trusted/service_runtime/linux)
endif()
Loading