summaryrefslogtreecommitdiffhomepage
path: root/src/logic
diff options
context:
space:
mode:
Diffstat (limited to 'src/logic')
-rw-r--r--src/logic/mdso_create_implib_sources.c85
-rw-r--r--src/logic/mdso_map_input.c62
2 files changed, 0 insertions, 147 deletions
diff --git a/src/logic/mdso_create_implib_sources.c b/src/logic/mdso_create_implib_sources.c
deleted file mode 100644
index 1031920..0000000
--- a/src/logic/mdso_create_implib_sources.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************/
-/* mdso: midipix dso scavenger */
-/* Copyright (C) 2015--2017 Z. Gilboa */
-/* Released under GPLv2 and GPLv3; see COPYING.MDSO. */
-/****************************************************************/
-
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <mdso/mdso.h>
-#include "mdso_errinfo_impl.h"
-
-static void mdso_init_asmname(char * buf, const char * fmt, const char * str)
-{
- char hexstr[24];
- long long unsigned int crc64;
-
- if (strlen(str) + strlen(fmt) > (PATH_MAX - 1)) {
- crc64 = mdso_crc64_mbstr((const unsigned char *)str,0);
- sprintf(hexstr,"%llx",crc64);
- sprintf(buf,fmt,hexstr);
- } else
- sprintf(buf,fmt,str);
-}
-
-mdso_api int mdso_create_implib_sources(const struct mdso_driver_ctx * dctx)
-{
- struct mdso_unit_ctx * uctx;
- const char ** unit;
- FILE * fout;
- char asmname[PATH_MAX];
- const char * const * sym;
- int ret;
-
- mdso_init_asmname(asmname,".dsometa_%s.s",dctx->cctx->libname);
-
- if (!(fout = mdso_create_asm_source(dctx,asmname)))
- return MDSO_NESTED_ERROR(dctx);
-
- ret = mdso_asmgen_dsometa(dctx,fout);
-
- if (fout != stdout)
- fclose(fout);
-
- if (ret < 0)
- return MDSO_NESTED_ERROR(dctx);
-
- for (unit=dctx->units; *unit; unit++) {
- if (mdso_get_unit_ctx(dctx,*unit,&uctx))
- return MDSO_NESTED_ERROR(dctx);
-
- for (sym=uctx->syms; *sym; sym++) {
- mdso_init_asmname(asmname,".%s_symentry.s",*sym);
-
- if (!(fout = mdso_create_asm_source(dctx,asmname)))
- return MDSO_NESTED_ERROR(dctx);
-
- ret = mdso_asmgen_symentry(dctx,*sym,fout);
-
- if (fout != stdout)
- fclose(fout);
-
- if (ret < 0)
- return MDSO_NESTED_ERROR(dctx);
-
- mdso_init_asmname(asmname,".%s_symfn.s",*sym);
-
- if (!(fout = mdso_create_asm_source(dctx,asmname)))
- return MDSO_NESTED_ERROR(dctx);
-
- ret = mdso_asmgen_symfn(dctx,*sym,fout);
-
- if (fout != stdout)
- fclose(fout);
-
- if (ret < 0)
- return MDSO_NESTED_ERROR(dctx);
- }
-
- mdso_free_unit_ctx(uctx);
- }
-
- return 0;
-}
diff --git a/src/logic/mdso_map_input.c b/src/logic/mdso_map_input.c
deleted file mode 100644
index 77401f3..0000000
--- a/src/logic/mdso_map_input.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************/
-/* mdso: midipix dso scavenger */
-/* Copyright (C) 2015--2017 Z. Gilboa */
-/* Released under GPLv2 and GPLv3; see COPYING.MDSO. */
-/****************************************************************/
-
-#include <stdint.h>
-#include <stdbool.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <mdso/mdso.h>
-#include "mdso_errinfo_impl.h"
-
-int mdso_map_input(
- const struct mdso_driver_ctx * dctx,
- int fd,
- const char * path,
- int prot,
- struct mdso_input * map)
-{
- struct stat st;
- bool fnew;
- int ret;
-
- if ((fnew = (fd < 0)))
- fd = open(path,O_RDONLY | O_CLOEXEC);
-
- if (fd < 0)
- return MDSO_SYSTEM_ERROR(dctx);
-
- if ((ret = fstat(fd,&st) < 0) && fnew)
- close(fd);
-
- else if ((st.st_size == 0) && fnew)
- close(fd);
-
- if (ret < 0)
- return MDSO_SYSTEM_ERROR(dctx);
-
- else if (st.st_size == 0)
- return MDSO_CUSTOM_ERROR(
- dctx,MDSO_ERR_SOURCE_SIZE_ZERO);
-
- map->size = st.st_size;
- map->addr = mmap(0,map->size,prot,MAP_PRIVATE,fd,0);
-
- if (fnew)
- close(fd);
-
- return (map->addr == MAP_FAILED)
- ? MDSO_SYSTEM_ERROR(dctx)
- : 0;
-}
-
-int mdso_unmap_input(struct mdso_input * map)
-{
- return munmap(map->addr,map->size);
-}