|
|
c6570d |
/****************************************************************/
|
|
|
c6570d |
/* mdso: midipix dso scavenger */
|
|
|
473806 |
/* Copyright (C) 2015--2024 SysDeer Technologies, LLC */
|
|
|
c6570d |
/* Released under GPLv2 and GPLv3; see COPYING.MDSO. */
|
|
|
c6570d |
/****************************************************************/
|
|
|
c6570d |
|
|
|
c6570d |
#include <stdint.h>
|
|
|
c6570d |
#include <stdlib.h>
|
|
|
c6570d |
#include <stdio.h>
|
|
|
c6570d |
#include <string.h>
|
|
|
c6570d |
#include <errno.h>
|
|
|
c6570d |
#include <inttypes.h>
|
|
|
c6570d |
|
|
|
c6570d |
#include <mdso/mdso.h>
|
|
|
c6570d |
#include <mdso/mdso_output.h>
|
|
|
c6570d |
#include "mdso_driver_impl.h"
|
|
|
c6570d |
#include "mdso_dprintf_impl.h"
|
|
|
c6570d |
#include "mdso_errinfo_impl.h"
|
|
|
c6570d |
|
|
|
c6570d |
static int pretty_expsym_crc32(
|
|
|
c6570d |
int fdout,
|
|
|
c6570d |
const char * name)
|
|
|
c6570d |
{
|
|
|
c6570d |
return mdso_dprintf(
|
|
|
c6570d |
fdout,"%" PRIx32 " %s\n",
|
|
|
c6570d |
mdso_crc32_mbstr((const unsigned char *)name,0),
|
|
|
c6570d |
name);
|
|
|
c6570d |
}
|
|
|
c6570d |
|
|
|
c6570d |
static int pretty_expsym_crc64(
|
|
|
c6570d |
int fdout,
|
|
|
c6570d |
const char * name)
|
|
|
c6570d |
{
|
|
|
c6570d |
return mdso_dprintf(
|
|
|
c6570d |
fdout,"%" PRIx64 " %s\n",
|
|
|
c6570d |
mdso_crc64_mbstr((const unsigned char *)name,0),
|
|
|
c6570d |
name);
|
|
|
c6570d |
}
|
|
|
c6570d |
|
|
|
c6570d |
int mdso_output_expsyms_crc32(
|
|
|
c6570d |
const struct mdso_driver_ctx * dctx,
|
|
|
c6570d |
const struct mdso_unit_ctx * uctx)
|
|
|
c6570d |
{
|
|
|
c6570d |
int fdout;
|
|
|
c6570d |
const char * const * sym;
|
|
|
c6570d |
|
|
|
c6570d |
fdout = mdso_driver_fdout(dctx);
|
|
|
c6570d |
|
|
|
c6570d |
if (!uctx->syms[0])
|
|
|
c6570d |
return 0;
|
|
|
c6570d |
|
|
|
c6570d |
for (sym=uctx->syms; *sym; sym++)
|
|
|
c6570d |
if ((pretty_expsym_crc32(fdout,*sym)) < 0)
|
|
|
c6570d |
return MDSO_SYSTEM_ERROR(dctx);
|
|
|
c6570d |
|
|
|
c6570d |
return 0;
|
|
|
c6570d |
}
|
|
|
c6570d |
|
|
|
c6570d |
int mdso_output_expsyms_crc64(
|
|
|
c6570d |
const struct mdso_driver_ctx * dctx,
|
|
|
c6570d |
const struct mdso_unit_ctx * uctx)
|
|
|
c6570d |
{
|
|
|
c6570d |
int fdout;
|
|
|
c6570d |
const char * const * sym;
|
|
|
c6570d |
|
|
|
c6570d |
fdout = mdso_driver_fdout(dctx);
|
|
|
c6570d |
|
|
|
c6570d |
if (!uctx->syms[0])
|
|
|
c6570d |
return 0;
|
|
|
c6570d |
|
|
|
c6570d |
for (sym=uctx->syms; *sym; sym++)
|
|
|
c6570d |
if ((pretty_expsym_crc64(fdout,*sym)) < 0)
|
|
|
c6570d |
return MDSO_SYSTEM_ERROR(dctx);
|
|
|
c6570d |
|
|
|
c6570d |
return 0;
|
|
|
c6570d |
}
|