# stage2: compiling C objects with clang · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/193ad413f03322b047bbfe17c4b2b368ba6bc097)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 193ad413f03322b047bbfe17c4b2b368ba6bc097

Requested commit: 193ad413f03322b047bbfe17c4b2b368ba6bc097

Commit: 193ad413f03322b047bbfe17c4b2b368ba6bc097

Tree: 5be27a318191ad64cb96e6702e55326f4255f182

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
stage2: compiling C objects with clang

 * add target_util.zig which has ported code from src/target.cpp
 * Module gains an arena that owns memory used during initialization
   that has the same lifetime as the Module. Useful for constructing
   file paths and lists of strings that have mixed lifetimes.
   - The Module memory itself is allocated in this arena. init/deinit
     are modified to be create/destroy.
   - root_name moves to the arena and no longer needs manual free
 * implement the ability to invoke `zig clang` as a subprocess
   - there are lots of TODOs that should be solved before merging
 * Module now requires a Random object and zig_lib_dir
 * Module now requires a path to its own executable or any zig
   executable that can do `zig clang`.
 * Wire up more CLI options.
 * Module creates "zig-cache" directory and "tmp" and "o" subdirectories
   ("h" is created by the cache_hash)
 * stubbed out some of the things linker code needs to do with TODO
   prints
 * delete dead code for computing compiler id. the previous commit
   eliminated the need for it.
 * add `zig translate-c` CLI option but it's not fully hooked up yet.
   It should be possible for this to be fully wired up before merging
   this branch.
 * `zig targets` now uses canonical data for available_libcs

```

## Parents

- [c99e34a00e1e839effbc8b257a400eb3b643fa12](https://git.cafe/gitcafe/zig/commit/c99e34a00e1e839effbc8b257a400eb3b643fa12?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/193ad413f03322b047bbfe17c4b2b368ba6bc097?format=markdown)
