xref: /freebsd/usr.sbin/kldxref/fileformat (revision 05248206f720394d95c2a7475429311df670a2e9)
19c6f9240SPeter Wemm
216c6e097SLuigi Rizzolinker.hints file consists from the one or more records,
316c6e097SLuigi Rizzoand is processed by sys/kern/kern_linker.c::linker_hints_lookup()
416c6e097SLuigi Rizzo
516c6e097SLuigi RizzoFirst record of file is special and determines its version:
69c6f9240SPeter Wemm
79c6f9240SPeter Wemmint	version;
89c6f9240SPeter Wemm
99c6f9240SPeter Wemm    All subsequent records have following format:
109c6f9240SPeter Wemm
119c6f9240SPeter Wemmstruct record {
129c6f9240SPeter Wemm	int	length;		/* length of following data */
139c6f9240SPeter Wemm	char	data[length];
149c6f9240SPeter Wemm};
159c6f9240SPeter Wemm
169c6f9240SPeter Wemm    Each record is aligned on sizeof(int) boundary. First integer of the field
179c6f9240SPeter Wemm'data' determines its type:
189c6f9240SPeter Wemm
199c6f9240SPeter Wemmstruct data {
2016c6e097SLuigi Rizzo	int	type;		/* type of data. currently MDT_* values */
219c6f9240SPeter Wemm};
229c6f9240SPeter Wemm
239c6f9240SPeter Wemm    The rest of record depends on the type.
249c6f9240SPeter Wemm
259c6f9240SPeter Wemmstruct string {
2616c6e097SLuigi Rizzo	uint8_t	length;		/* length of string */
279c6f9240SPeter Wemm	char	val[];		/* string itself (no terminating zero) */
289c6f9240SPeter Wemm};
299c6f9240SPeter Wemm
309c6f9240SPeter Wemmstruct data_mdt_version {
319c6f9240SPeter Wemm	int	type = MDT_VERSION;
329c6f9240SPeter Wemm	struct string	modname;
3316c6e097SLuigi Rizzo	/* padding */
349c6f9240SPeter Wemm	int	version;
359c6f9240SPeter Wemm	struct string	kldname;
3616c6e097SLuigi Rizzo	/* padding */
379c6f9240SPeter Wemm};
389c6f9240SPeter Wemm
399c6f9240SPeter Wemmstruct data_mdt_module {
4016c6e097SLuigi Rizzo	int	type = MDT_MODULE;
419c6f9240SPeter Wemm	struct string	modname;
429c6f9240SPeter Wemm	struct string	kldname;
4316c6e097SLuigi Rizzo	/* padding */
449c6f9240SPeter Wemm};
45