Blame src/logic/mdso_generate_symfn.c

6691d8
/****************************************************************/
6691d8
/*  mdso: midipix dso scavenger                                 */
3e816c
/*  Copyright (C) 2015--2016  Z. Gilboa                         */
6691d8
/*  Released under GPLv2 and GPLv3; see COPYING.MDSO.           */
6691d8
/****************************************************************/
6691d8
6691d8
#include <stdint.h>
6691d8
#include <stdio.h>
62fec7
6691d8
#include <mdso/mdso.h>
62fec7
#include "mdso_errinfo_impl.h"
6691d8
6691d8
static const char * const asm_lines[] = {
6691d8
	"\t.file     \"__%s_sym_fn.s\"\n",
6691d8
	"\t.section  .text\n",
6691d8
	"\t.globl    %s\n",
6691d8
	"\t.def      %s; .scl 2; .type 32; .endef\n\n",
6691d8
6691d8
	"%s:\n",
6691d8
	"\tjmp *__imp_%s\n\n",
6691d8
	0
6691d8
};
6691d8
62fec7
int mdso_generate_symfn(
62fec7
	const struct mdso_driver_ctx *	dctx,
62fec7
	const char *			sym,
62fec7
	FILE *				fout)
6691d8
{
6691d8
	const char * const * line;
6691d8
6691d8
	for (line=asm_lines; *line; line++)
6691d8
		if ((fprintf(fout,*line,sym)) < 0)
62fec7
			return MDSO_FILE_ERROR(dctx);
6691d8
6691d8
	return 0;
6691d8
}