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

Move many settings from being per-Compilation to being per-Module #18160

Merged
merged 133 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
1a3e0d6
std.Uri: default some fields to null
andrewrk Nov 29, 2023
134e8cf
move is_libcpp_lib_name and is_libc_lib_name to std.Target
andrewrk Nov 29, 2023
c20ad51
introduce std.Build.Module and extract some logic into it
andrewrk Nov 29, 2023
579f572
zig build system: remove vcpkg integration
andrewrk Dec 1, 2023
142471f
zig build system: change target, compilation, and module APIs
andrewrk Dec 3, 2023
dd45095
spelling fixes
andrewrk Dec 3, 2023
ad38564
fix std lib tests
andrewrk Dec 3, 2023
0ee8fbb
build runner: print subtree of failed nodes context
andrewrk Dec 3, 2023
04480f7
fix linker test regressions
andrewrk Dec 3, 2023
3963be0
std.Build: handle ResolvedTarget in userInputOptionsFromArgs
andrewrk Dec 3, 2023
f10b526
fix windows-only test case not upgraded to new build API
andrewrk Dec 4, 2023
767eb5d
fix infinite loop in Run step
andrewrk Dec 4, 2023
67d48b9
std.Target: flatten
andrewrk Dec 4, 2023
3179f58
rename std.zig.CrossTarget to std.Target.Query
andrewrk Dec 4, 2023
dbdb875
std.Target: add DynamicLinker
andrewrk Dec 4, 2023
8c44954
std.Target.Query: remove deprecated API
andrewrk Dec 5, 2023
3e52302
std.Build: fix userInputOptionsFromArgs ResolvedTarget
andrewrk Dec 5, 2023
ce94c28
resinator: update std.Target.Query usage
andrewrk Dec 5, 2023
77420af
compiler: get the dynamic linker from the target
andrewrk Dec 5, 2023
8d5da55
std.Target.Query: fix regression with windows os version range
andrewrk Dec 5, 2023
f5613a0
update docgen for std Target.Query API breaks
andrewrk Dec 5, 2023
b92e30f
std.Build.ResolvedTarget: rename target field to result
andrewrk Dec 5, 2023
12de7e3
WIP: move many global settings to become per-Module
andrewrk Dec 10, 2023
2bef071
move a large chunk of linker logic away from "options"
andrewrk Dec 12, 2023
2be36c5
linker: update references to module
andrewrk Dec 12, 2023
6ec6c07
linker: update output_mode references
andrewrk Dec 12, 2023
b5e2af4
linker: update link_mode references
andrewrk Dec 12, 2023
98da660
linker: update options references of CsuObjects
andrewrk Dec 12, 2023
5a6a1f8
linker: update target references
andrewrk Dec 12, 2023
43720be
frontend: fix stack protector option logic
andrewrk Dec 12, 2023
9a48a5a
compiler: update references to single_threaded
andrewrk Dec 12, 2023
3b6cb25
update image_base references
andrewrk Dec 12, 2023
0789e91
linkers: update references to "options" field
andrewrk Dec 12, 2023
41a8f5a
remove parent_compilation_link_libc
andrewrk Dec 13, 2023
f5ddef1
update references to module (to be renamed to zcu)
andrewrk Dec 13, 2023
1642c00
update libunwind references to bin_file.options
andrewrk Dec 13, 2023
bc4d2b6
compiler: update references to target
andrewrk Dec 13, 2023
b162c3c
update bin_file.options references in Module (Zcu)
andrewrk Dec 13, 2023
33cdf33
compiler: update many references to bin_file.options
andrewrk Dec 14, 2023
769dea6
Compilation: redo whole vs incremental logic in create and update
andrewrk Dec 14, 2023
f54471b
compiler: miscellaneous branch progress
andrewrk Dec 14, 2023
c49957d
fix a round of compile errors caused by this branch
andrewrk Dec 15, 2023
6b44bdd
linker: remove bad NvPtx flushModule implementation
andrewrk Dec 15, 2023
7e7d5dc
musl: update references to bin_file.options
andrewrk Dec 15, 2023
2596f5d
update bin_file.options references in Sema
andrewrk Dec 15, 2023
a1236b3
libcxx: update to new Compilation API
andrewrk Dec 15, 2023
ea0ba4f
tsan: update to new Compilation API
andrewrk Dec 15, 2023
92b54e5
glibc: update to new Compilation API
andrewrk Dec 15, 2023
b54ad93
update codegen.llvm references to bin_file.options
andrewrk Dec 16, 2023
638db68
move dll_export_fns and rdynamic to Compilation.Config
andrewrk Dec 16, 2023
48d5861
fix more compilation errors introduced by this branch
andrewrk Dec 16, 2023
4629708
linker: fix some allocator references
andrewrk Dec 16, 2023
2047a6b
fix remaining compile errors except one
andrewrk Dec 16, 2023
b6dd5ad
MachO: rip out the caching mechanism
andrewrk Dec 16, 2023
9715936
Compilation: oops! used comp before init
andrewrk Dec 16, 2023
d71e627
std.fs.Dir.atomicFile: provide an option for make path
andrewrk Dec 16, 2023
0be97b5
fix population of builtin.zig not making the parent dir
andrewrk Dec 16, 2023
e3409c0
Elf: fix createEmpty not creating the file
andrewrk Dec 16, 2023
b1fc3fe
Elf: fix invalid free of path field
andrewrk Dec 16, 2023
57afdfc
compilation: fix build artifact communication from sub-compilation
andrewrk Dec 16, 2023
f256431
fix compilation errors when enabling llvm
andrewrk Dec 16, 2023
9b98d33
Compilation: don't store arena until it's done being used
andrewrk Dec 16, 2023
2d2a188
linker: rename intermediary_basname to zcu_object_sub_path
andrewrk Dec 16, 2023
a3ff4d9
fix entry symbol name on mips
andrewrk Dec 18, 2023
38f2172
fix memory leak in addModuleTableToCacheHash
andrewrk Dec 18, 2023
90cc408
fix --show-builtin when no positional argument is provided
andrewrk Dec 18, 2023
fe87bae
frontend: fix handling of special builtin module
andrewrk Dec 19, 2023
4b667e7
fix compilations without zig compilation units
andrewrk Dec 19, 2023
ca77c3b
std.Build.Step.Compile: restore previous step name
andrewrk Dec 19, 2023
db2ca2c
CLI: mark any_dyn_libs=true when encountering a shared object
andrewrk Dec 19, 2023
8944dea
CLI: fix regressed logic for any_dyn_libs
andrewrk Dec 19, 2023
529d01c
resolve error tracing logic at module creation time
andrewrk Dec 19, 2023
76c4781
std.Build.Step.Options: update unit test to new API
andrewrk Dec 19, 2023
fad3583
CLI: better error messages for bad args
andrewrk Dec 19, 2023
056f04c
CLI: rename clang_argv to cc_argv
andrewrk Dec 19, 2023
3b36c4d
zig build: pass resolved_target to Module.create
andrewrk Dec 19, 2023
3262e9c
zig build: fix logic for extracting executable file from Compilation
andrewrk Dec 19, 2023
e12e296
CLI: fix not respecting module remappings
andrewrk Dec 24, 2023
9141e1a
CLI: fix logic for sending output file path
andrewrk Dec 25, 2023
24eec48
CLI: update main usage text
andrewrk Dec 25, 2023
8cf2cfc
update bootstrap scripts to new zig CLI
andrewrk Dec 25, 2023
41ab64c
Compilation.Config.resolve: explicit error set
andrewrk Dec 25, 2023
edccd68
Package.Module: fix typo in default red-zone setting
andrewrk Dec 25, 2023
4d28db7
Zcu: mark outdated decl handling as unreachable from only_c builds
andrewrk Dec 25, 2023
981166e
link.Elf: truncate=true in createEmpty
andrewrk Dec 25, 2023
1edcea9
link.Wasm: fix relationship between createEmpty/open
andrewrk Dec 25, 2023
44e2dbe
fix logic for default entry point
andrewrk Dec 25, 2023
4f8a44c
compiler: fix UAF when writing builtin.zig
andrewrk Dec 25, 2023
98dd4f7
frontend: skip astgen for builtin.zig
andrewrk Dec 25, 2023
944b0ef
link.File.Coff: fix relationship between createEmpty/open
andrewrk Dec 25, 2023
b36659c
fix MachO linking
andrewrk Dec 25, 2023
4c07d41
CLI: fix logic for zig test error message
andrewrk Dec 25, 2023
b8a8fb9
link.File.Elf: bump 32-bit image_base default to 64K
andrewrk Dec 27, 2023
951c5b3
frontend: fix "any" default resolution ambiguity
andrewrk Dec 27, 2023
6beae6c
frontend: avoid spurious error when no zcu
andrewrk Dec 27, 2023
c9fe436
frontend: remove deprecated field from Compilation
andrewrk Dec 27, 2023
57562c8
compiler: push entry symbol name resolution into the linker
andrewrk Dec 27, 2023
524dc75
Compilation: several branch regression fixes
andrewrk Dec 27, 2023
1ef4df9
std.Build.Step.Compile: support modules with different args
andrewrk Dec 24, 2023
5e2035d
update zig1.wasm
andrewrk Dec 25, 2023
190f603
zig build: reintroduce --prominent-compile-errors
andrewrk Dec 27, 2023
beed47e
std.Build: add error_tracing field to addExecutable and friends
andrewrk Dec 27, 2023
c8c32a0
update stack trace tests to account for new defaults
andrewrk Dec 27, 2023
435b74a
move force_undefined_symbols into Compilation
andrewrk Dec 27, 2023
372b407
move eh_frame_hdr from link.File to Compilation
andrewrk Dec 27, 2023
5b05e99
Compilation: consolidate module hashing code
andrewrk Dec 27, 2023
7f13754
Compilation: fix whole mode cache hash
andrewrk Dec 27, 2023
4c3342e
glibc: fix crash from not setting owner module
andrewrk Dec 27, 2023
476484f
Compilation: inline the flush function
andrewrk Dec 27, 2023
791e83c
frontend: make dll_export_fns=false on non-windows
andrewrk Dec 27, 2023
6509c49
move misc_errors from linker to Compilation
andrewrk Dec 27, 2023
8babc14
std.Build.Module: default CSourceFile flags to empty list
andrewrk Dec 28, 2023
027e7c1
test.link.glibc_compat: fix invalid build system API usage
andrewrk Dec 28, 2023
e47141a
frontend: fix incorrect WebAssembly hasDebugInfo=false
andrewrk Dec 28, 2023
3a0b76b
link.File.Wasm: remove dead condition
andrewrk Dec 28, 2023
659e043
Compilation: don't add importlib jobs when outputting C code
andrewrk Dec 28, 2023
92cc2f4
CLI: fix compilation on Windows
andrewrk Dec 28, 2023
b867491
restore -fno-emit-bin -femit-llvm-ir functionality
andrewrk Dec 28, 2023
8fa4496
std.Build.Step.Compile: fix search prefix lowering
andrewrk Dec 29, 2023
196ddf0
frontend: fix populateTestFunctions accessing the wrong module
andrewrk Dec 29, 2023
751ff04
fix stack_iterator test build script
andrewrk Dec 29, 2023
668c0cd
compiler: Compilation.Config: trivial refactor
andrewrk Dec 29, 2023
96b4eea
std: disable failing test on macos
andrewrk Dec 29, 2023
c2cc1b3
frontend: add logging to help troubleshoot builtin.zig write failures
andrewrk Dec 29, 2023
e22102d
Compilation: make create() take an arena allocator
andrewrk Dec 29, 2023
a89d687
Compilation: fix cache hash of incremental builds
andrewrk Dec 29, 2023
6b27096
frontend: ignore AccessDenied when writing builtin.zig
andrewrk Dec 29, 2023
7fb9f58
Compilation: rename before flush during whole cache mode
andrewrk Jan 1, 2024
7cec11a
CI: update windows scripts to new CLI module syntax
andrewrk Jan 1, 2024
eae6d45
CLI: introduce global -I args for C include paths
andrewrk Jan 2, 2024
d5c1e7f
link: accept the update arena in flush
andrewrk Jan 2, 2024
2b63ba3
add standalone test for depending on the main module
andrewrk Jan 2, 2024
c546ddb
disable standalone coff_dwarf test on aarch64-windows
andrewrk Jan 2, 2024
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
77 changes: 43 additions & 34 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -480,22 +480,23 @@ set(ZIG_STAGE2_SOURCES
"${CMAKE_SOURCE_DIR}/lib/compiler_rt/unordtf2.zig"
"${CMAKE_SOURCE_DIR}/lib/std/start.zig"
"${CMAKE_SOURCE_DIR}/lib/std/std.zig"
"${CMAKE_SOURCE_DIR}/lib/std/target.zig"
"${CMAKE_SOURCE_DIR}/lib/std/target/aarch64.zig"
"${CMAKE_SOURCE_DIR}/lib/std/target/amdgpu.zig"
"${CMAKE_SOURCE_DIR}/lib/std/target/arm.zig"
"${CMAKE_SOURCE_DIR}/lib/std/target/avr.zig"
"${CMAKE_SOURCE_DIR}/lib/std/target/bpf.zig"
"${CMAKE_SOURCE_DIR}/lib/std/target/hexagon.zig"
"${CMAKE_SOURCE_DIR}/lib/std/target/mips.zig"
"${CMAKE_SOURCE_DIR}/lib/std/target/msp430.zig"
"${CMAKE_SOURCE_DIR}/lib/std/target/nvptx.zig"
"${CMAKE_SOURCE_DIR}/lib/std/target/powerpc.zig"
"${CMAKE_SOURCE_DIR}/lib/std/target/riscv.zig"
"${CMAKE_SOURCE_DIR}/lib/std/target/sparc.zig"
"${CMAKE_SOURCE_DIR}/lib/std/target/s390x.zig"
"${CMAKE_SOURCE_DIR}/lib/std/target/wasm.zig"
"${CMAKE_SOURCE_DIR}/lib/std/target/x86.zig"
"${CMAKE_SOURCE_DIR}/lib/std/Target.zig"
"${CMAKE_SOURCE_DIR}/lib/std/Target/Query.zig"
"${CMAKE_SOURCE_DIR}/lib/std/Target/aarch64.zig"
"${CMAKE_SOURCE_DIR}/lib/std/Target/amdgpu.zig"
"${CMAKE_SOURCE_DIR}/lib/std/Target/arm.zig"
"${CMAKE_SOURCE_DIR}/lib/std/Target/avr.zig"
"${CMAKE_SOURCE_DIR}/lib/std/Target/bpf.zig"
"${CMAKE_SOURCE_DIR}/lib/std/Target/hexagon.zig"
"${CMAKE_SOURCE_DIR}/lib/std/Target/mips.zig"
"${CMAKE_SOURCE_DIR}/lib/std/Target/msp430.zig"
"${CMAKE_SOURCE_DIR}/lib/std/Target/nvptx.zig"
"${CMAKE_SOURCE_DIR}/lib/std/Target/powerpc.zig"
"${CMAKE_SOURCE_DIR}/lib/std/Target/riscv.zig"
"${CMAKE_SOURCE_DIR}/lib/std/Target/sparc.zig"
"${CMAKE_SOURCE_DIR}/lib/std/Target/s390x.zig"
"${CMAKE_SOURCE_DIR}/lib/std/Target/wasm.zig"
"${CMAKE_SOURCE_DIR}/lib/std/Target/x86.zig"
"${CMAKE_SOURCE_DIR}/lib/std/Thread.zig"
"${CMAKE_SOURCE_DIR}/lib/std/Thread/Futex.zig"
"${CMAKE_SOURCE_DIR}/lib/std/Thread/Mutex.zig"
Expand All @@ -508,20 +509,19 @@ set(ZIG_STAGE2_SOURCES
"${CMAKE_SOURCE_DIR}/lib/std/zig.zig"
"${CMAKE_SOURCE_DIR}/lib/std/zig/Ast.zig"
"${CMAKE_SOURCE_DIR}/lib/std/zig/AstRlAnnotate.zig"
"${CMAKE_SOURCE_DIR}/lib/std/zig/CrossTarget.zig"
"${CMAKE_SOURCE_DIR}/lib/std/zig/c_builtins.zig"
"${CMAKE_SOURCE_DIR}/lib/std/zig/Parse.zig"
"${CMAKE_SOURCE_DIR}/lib/std/zig/render.zig"
"${CMAKE_SOURCE_DIR}/lib/std/zig/Server.zig"
"${CMAKE_SOURCE_DIR}/lib/std/zig/string_literal.zig"
"${CMAKE_SOURCE_DIR}/lib/std/zig/system.zig"
"${CMAKE_SOURCE_DIR}/lib/std/zig/system/NativePaths.zig"
"${CMAKE_SOURCE_DIR}/lib/std/zig/system/NativeTargetInfo.zig"
"${CMAKE_SOURCE_DIR}/lib/std/zig/system/x86.zig"
"${CMAKE_SOURCE_DIR}/lib/std/zig/tokenizer.zig"
"${CMAKE_SOURCE_DIR}/src/Air.zig"
"${CMAKE_SOURCE_DIR}/src/AstGen.zig"
"${CMAKE_SOURCE_DIR}/src/Compilation.zig"
"${CMAKE_SOURCE_DIR}/src/Compilation/Config.zig"
"${CMAKE_SOURCE_DIR}/src/Liveness.zig"
"${CMAKE_SOURCE_DIR}/src/Module.zig"
"${CMAKE_SOURCE_DIR}/src/Package.zig"
Expand Down Expand Up @@ -810,18 +810,26 @@ endif()

set(BUILD_ZIG2_ARGS
"${CMAKE_SOURCE_DIR}/lib"
build-exe src/main.zig -ofmt=c -lc
-OReleaseSmall
--name zig2 -femit-bin="${ZIG2_C_SOURCE}"
--mod "build_options::${ZIG_CONFIG_ZIG_OUT}"
--mod "aro_options::src/stubs/aro_options.zig"
--mod "Builtins/Builtin.def::src/stubs/aro_builtins.zig"
--mod "Attribute/names.def::src/stubs/aro_names.zig"
--mod "Diagnostics/messages.def::src/stubs/aro_messages.zig"
--mod "aro_backend:build_options=aro_options:deps/aro/backend.zig"
--mod "aro:Builtins/Builtin.def,Attribute/names.def,Diagnostics/messages.def,build_options=aro_options,backend=aro_backend:deps/aro/aro.zig"
--deps build_options,aro
build-exe -ofmt=c -lc -OReleaseSmall
--name zig2
-femit-bin="${ZIG2_C_SOURCE}"
-target "${ZIG_HOST_TARGET_TRIPLE}"
--dep "build_options"
--dep "aro"
--mod "root" "src/main.zig"
--mod "build_options" "${ZIG_CONFIG_ZIG_OUT}"
--mod "aro_options" "src/stubs/aro_options.zig"
--mod "Builtins/Builtin.def" "src/stubs/aro_builtins.zig"
--mod "Attribute/names.def" "src/stubs/aro_names.zig"
--mod "Diagnostics/messages.def" "src/stubs/aro_messages.zig"
--dep "build_options=aro_options"
--mod "aro_backend" "deps/aro/backend.zig"
--dep "Builtins/Builtin.def"
--dep "Attribute/names.def"
--dep "Diagnostics/messages.def"
--dep "build_options=aro_options"
--dep "backend=aro_backend"
--mod "aro" "deps/aro/aro.zig"
)

add_custom_command(
Expand All @@ -834,12 +842,13 @@ add_custom_command(

set(BUILD_COMPILER_RT_ARGS
"${CMAKE_SOURCE_DIR}/lib"
build-obj lib/compiler_rt.zig -ofmt=c
-OReleaseSmall
--name compiler_rt -femit-bin="${ZIG_COMPILER_RT_C_SOURCE}"
--mod "build_options::${ZIG_CONFIG_ZIG_OUT}"
--deps build_options
build-obj -ofmt=c -OReleaseSmall
--name compiler_rt
-femit-bin="${ZIG_COMPILER_RT_C_SOURCE}"
-target "${ZIG_HOST_TARGET_TRIPLE}"
--dep "build_options"
--mod "root" "lib/compiler_rt.zig"
--mod "build_options" "${ZIG_CONFIG_ZIG_OUT}"
)

add_custom_command(
Expand Down
36 changes: 24 additions & 12 deletions bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,31 +138,43 @@ int main(int argc, char **argv) {

{
const char *child_argv[] = {
"./zig1", "lib", "build-exe", "src/main.zig",
"./zig1", "lib", "build-exe",
"-ofmt=c", "-lc", "-OReleaseSmall",
"--name", "zig2", "-femit-bin=zig2.c",
"--mod", "build_options::config.zig",
"--mod", "aro_options::src/stubs/aro_options.zig",
"--mod", "Builtins/Builtin.def::src/stubs/aro_builtins.zig",
"--mod", "Attribute/names.def::src/stubs/aro_names.zig",
"--mod", "Diagnostics/messages.def::src/stubs/aro_messages.zig",
"--mod", "aro_backend:build_options=aro_options:deps/aro/backend.zig",
"--mod", "aro:Builtins/Builtin.def,Attribute/names.def,Diagnostics/messages.def,build_options=aro_options,backend=aro_backend:deps/aro/aro.zig",
"--deps", "build_options,aro",
"-target", host_triple,
"--dep", "build_options",
"--dep", "aro",
"--mod", "root", "src/main.zig",

"--mod", "build_options", "config.zig",
"--mod", "aro_options", "src/stubs/aro_options.zig",
"--mod", "Builtins/Builtin.def", "src/stubs/aro_builtins.zig",
"--mod", "Attribute/names.def", "src/stubs/aro_names.zig",
"--mod", "Diagnostics/messages.def", "src/stubs/aro_messages.zig",

"--dep", "build_options=aro_options",
"--mod", "aro_backend", "deps/aro/backend.zig",

"--dep", "Builtins/Builtin.def",
"--dep", "Attribute/names.def",
"--dep", "Diagnostics/messages.def",
"--dep", "build_options=aro_options",
"--dep", "backend=aro_backend",
"--mod", "aro", "deps/aro/aro.zig",
NULL,
};
print_and_run(child_argv);
}

{
const char *child_argv[] = {
"./zig1", "lib", "build-obj", "lib/compiler_rt.zig",
"./zig1", "lib", "build-obj",
"-ofmt=c", "-OReleaseSmall",
"--name", "compiler_rt", "-femit-bin=compiler_rt.c",
"--mod", "build_options::config.zig",
"--deps", "build_options",
"-target", host_triple,
"--dep", "build_options",
"--mod", "root", "lib/compiler_rt.zig",
"--mod", "build_options", "config.zig",
NULL,
};
print_and_run(child_argv);
Expand Down
Loading