# stage2: prepare for building freestanding libc · gitcafe/zig

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

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

Visibility: public

Requested revision: 418105589a2723ca372596e5893e0e1e030efe87

Requested commit: 418105589a2723ca372596e5893e0e1e030efe87

Commit: 418105589a2723ca372596e5893e0e1e030efe87

Tree: ab6195e8b58bf58442a8d855d23accfca417b141

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
stage2: prepare for building freestanding libc

Extracts lib/std/special/c_stage1.zig from lib/std/special/c.zig.

When the self-hosted compiler is further along, all the logic from c_stage1.zig will
be migrated back c.zig and then c_stage1.zig will be deleted. Until then we have a
simpler implementation of c.zig that only uses features already implemented in self-hosted.

So far it only contains memcpy and memset, with slightly different
(arguably more correct!) implementations that are compatible with
self-hosted.

Additionally, this commit improves the LLVM backend:
 * use the more efficient and convenient fnInfo() when lowering function
   type info.
 * fix incremental compilation not deleting all basic blocks of a
   function.
 * hook up calling conventions
 * hook up the following function attributes:
   - noredzone, nounwind, uwtable, minsize, optsize, sanitize_thread

```

## Parents

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

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