Commit graph

14 commits

Author SHA1 Message Date
Andrew Kelley
17d40ecb49 stage2: building libunwind.a
and put glibc shared objects on the elf linker line
2020-09-16 17:18:13 -07:00
Andrew Kelley
17f094ec5b stage2: build glibc shared objects using assembly files
closes #6358
2020-09-16 14:33:13 -07:00
Andrew Kelley
3256b3c485 stage2: glibc shared objects use ok file to detect cache hits 2020-09-16 13:41:53 -07:00
Andrew Kelley
95941c4e70 stage2: building glibc shared objects
* caching system: use 16 bytes siphash final(), there was a bug in the
   std lib that wasn't catching undefined values for 18 bytes. fixed in
   master branch.
 * fix caching system unit test logic to not cause error.TextBusy on windows
 * port the logic from stage1 for building glibc shared objects
 * add is_native_os to the base cache hash
 * fix incorrectly freeing crt_files key (which is always a reference to
   global static constant data)
 * fix 2 use-after-free in loading glibc metadata
 * fix memory leak in buildCRTFile (errdefer instead of defer on arena)
2020-09-16 03:02:46 -07:00
Andrew Kelley
1da9e0fcaf stage2: building glibc libc_nonshared.a CRT file 2020-09-15 00:41:02 -07:00
Andrew Kelley
dffdb2844e track all TODO comments in BRANCH_TODO file
Before merging, do this for every item in the file:
 * solve the issue, or
 * convert the task to a github issue and update the comment
   to link to the issue (and remove "TODO" text from the comment).
Then delete the file.

Related: #363
2020-09-14 18:06:19 -07:00
Andrew Kelley
f2e380380e stage2: building glibc Scrt1.o 2020-09-14 00:24:03 -07:00
Andrew Kelley
e5aef96293 stage2: CRT files retain locks on the build artifacts 2020-09-13 22:54:16 -07:00
Andrew Kelley
97ea5da18d stage2: fix bad include path for glibc abi-note.S 2020-09-13 22:38:50 -07:00
Andrew Kelley
046dce9cef stage2: fix not creating cache o dir before writing to it
also remove non-working debug CLI options
2020-09-13 21:13:24 -07:00
Andrew Kelley
4d59f77528 stage2: rename Module to Compilation 2020-09-13 19:49:52 -07:00
Andrew Kelley
2a8fc1a18e stage2: caching system integration & Module/Compilation splitting
* update to the new cache hash API
 * std.Target defaultVersionRange moves to std.Target.Os.Tag
 * std.Target.Os gains getVersionRange which returns a tagged union
 * start the process of splitting Module into Compilation and "zig
   module".
   - The parts of Module having to do with only compiling zig code are
     extracted into ZigModule.zig.
   - Next step is to rename Module to Compilation.
   - After that rename ZigModule back to Module.
 * implement proper cache hash usage when compiling C objects, and
   properly manage the file lock of the build artifacts.
 * make versions optional to match recent changes to master branch.
 * proper cache hash integration for compiling zig code
 * proper cache hash integration for linking even when not compiling zig
   code.
 * ELF LLD linking integrates with the caching system. A comment from
   the source code:

   Here we want to determine whether we can save time by not invoking LLD when the
   output is unchanged. None of the linker options or the object files that are being
   linked are in the hash that namespaces the directory we are outputting to. Therefore,
   we must hash those now, and the resulting digest will form the "id" of the linking
   job we are about to perform.
   After a successful link, we store the id in the metadata of a symlink named "id.txt" in
   the artifact directory. So, now, we check if this symlink exists, and if it matches
   our digest. If so, we can skip linking. Otherwise, we proceed with invoking LLD.

 * implement disable_c_depfile option
 * add tracy to a few more functions
2020-09-13 19:29:07 -07:00
Andrew Kelley
03a23418ff stage2: linking with LLD and building glibc static CRT files
* implement --debug-cc and --debug-link
 * implement C source files having extra flags
   - TODO a way to pass them on the CLI
 * introduce the Directory abstraction which contains both an open file
   descriptor and a file path name. The former is preferred but the
   latter is needed when communicating paths over a command line (e.g.
   to Clang or LLD).
 * use the cache hash to choose an artifact directory
   - TODO: use separate cache hash instances for the zig module and
     each C object
 * Module: introduce the crt_files table for keeping track of built libc
   artifacts for linking.
 * Add the ability to build 4/6 of the glibc static CRT lib files.
 * The zig-cache directory is now passed as a parameter to Module.
 * Implement the CLI logic of -femit-bin and -femit-h
   - TODO: respect -fno-emit-bin
   - TODO: the emit .h feature
 * Add the -fvalgrind, -fstack-check, and --single-threaded CLI options.
 * Implement the logic for auto detecting whether to enable PIC,
   sanitize-C, stack-check, valgrind, and single-threaded.
 * Properly add PIC args (or not) to clang argv.
 * Implement renaming clang-compiled object files into their proper
   place within the cache artifact directory.
   - TODO: std lib needs a proper higher level abstraction for
     std.os.renameat.
 * Package is cleaned up to use the "Unmanaged" StringHashMap and use the
   new Directory abstraction.
 * Clean up zig lib directory detection to make proper use of directory
   handles.
 * Linker code invokes LLD.
   - TODO properly deal with the stdout and stderr that we get from it
     and expose diagnostics from the Module API that match the expected
     error message format.
 * Delete the bitrotted LLVM C ABI bindings. We'll resurrect just the
   functions we need as we introduce dependencies on them. So far it
   only has ZigLLDLink in it.
 * Remove dead timer code.
 * `zig env` now prints the path to the zig executable as well.
2020-09-12 00:51:06 -07:00
Andrew Kelley
8cf40f3445 stage2: loading glibc metadata 2020-09-10 22:24:27 -07:00