Files
scc/libs/format/include/scf_impl.h
zzy 3aaf3a3991 feat: add SCF format library and rename components to SCC prefix
- Introduce new SCF (SCC Format) library with header, implementation, and test files
- SCF is a minimal executable/linkable format focused on internal linking with external symbol import/export abstraction
- Rename lexer and lex_parser packages from 'smcc_' to 'scc_' prefix for consistency
- Update hashmap implementation to use 'scc_' prefix for types and structures
- Add build configuration for new format library with dependencies on libcore and libutils
2025-12-11 17:29:12 +08:00

43 lines
1.1 KiB
C

#ifndef __SCC_FORMAT_IMPL_H__
#define __SCC_FORMAT_IMPL_H__
#include <libcore.h>
#include <libutils.h>
#include <scf.h>
typedef SCC_VEC(u8) scf_sect_data_t;
typedef SCC_VEC(scf_sym_t) scf_sym_vec_t;
typedef SCC_VEC(scf_reloc_t) scf_reloc_vec_t;
typedef struct {
scf_header_t header;
scf_sect_data_t text;
scf_sect_data_t data;
scf_sect_data_t symtab;
scf_sect_data_t reloc;
scf_sect_data_t strtab;
scc_strpool_t strpool;
scc_hashtable_t str2idx;
scf_sym_vec_t syms;
scf_reloc_vec_t relocs;
} scf_t;
void scf_init(scf_t *scf);
cbool scf_parse(scf_t *scf, const char *buffer, usize size);
cbool scf_write(scf_t *scf, char *buffer, usize size);
cbool scf_exchange_section(scf_t *scf, scf_sect_type_t type,
scf_sect_data_t **section);
cbool scf_add_sym(scf_t *scf, scf_sym_t *sym);
cbool scf_add_reloc(scf_t *scf, scf_reloc_t *reloc);
cbool scf_apply_relocations(scf_t *scf);
cbool scf_write_done(scf_t *scf); // 在写入前进行内部整理
cbool scf_check_valid(scf_t *scf);
typedef SCC_VEC(scf_t) scf_vec_t;
cbool scf_link_all(scf_vec_t scfs, scf_t *outscf);
#endif /* __SCC_FORMAT_IMPL_H__ */