archive_engine.h (1022B)
1 #ifndef KIT_DRIVER_ARCHIVE_ENGINE_H 2 #define KIT_DRIVER_ARCHIVE_ENGINE_H 3 4 #include <kit/core.h> 5 #include <kit/object.h> 6 7 #include "driver.h" 8 9 /* Serialize each in-memory object builder to bytes and write them as the 10 * members of a POSIX `ar` archive (with a symbol index, the form a linker 11 * expects from a static library). objs[i] is emitted under member name 12 * names[i] (e.g. "a.o"); `epoch` seeds reproducible member timestamps. 13 * 14 * The builders are emitted, not freed — the caller keeps ownership. `out` is 15 * neither opened nor closed here. Returns 0 on success, 1 on failure (an error 16 * has already been reported via driver_errf with `tool`). 17 * 18 * Reused by `build-lib` (static archives) and available for a future `ar` 19 * pipeline that archives freshly compiled objects. */ 20 int driver_archive_emit(DriverEnv* env, const KitContext* ctx, const char* tool, 21 KitObjBuilder* const* objs, const KitSlice* names, 22 uint32_t n, uint64_t epoch, KitWriter* out); 23 24 #endif