summaryrefslogtreecommitdiffhomepage
path: root/src/helper
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2017-02-08 00:41:56 -0500
committermidipix <writeonce@midipix.org>2017-02-08 01:19:08 -0500
commit3e55ee4c865e68c28daf9fe0a90346fa5c3446f2 (patch)
tree0f9a805b6497bb828dc7da4fb5ef27a6a0ef862e /src/helper
parentc12a925ddba06fc1d11298fc26c10f2d5ffb91db (diff)
downloadmdso-3e55ee4c865e68c28daf9fe0a90346fa5c3446f2.tar.bz2
mdso-3e55ee4c865e68c28daf9fe0a90346fa5c3446f2.tar.xz
driver: utility api: added mdso_create_implib_objects().
Diffstat (limited to 'src/helper')
-rw-r--r--src/helper/mdso_create_asm_source.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/src/helper/mdso_create_asm_source.c b/src/helper/mdso_create_asm_source.c
index 85aaaba..b152697 100644
--- a/src/helper/mdso_create_asm_source.c
+++ b/src/helper/mdso_create_asm_source.c
@@ -15,22 +15,19 @@
#include "mdso_driver_impl.h"
#include "mdso_errinfo_impl.h"
-FILE * mdso_create_asm_source(
+static FILE * mdso_create_output(
const struct mdso_driver_ctx * dctx,
- const char * asmname)
+ const char * name)
{
struct mdso_driver_ctx_impl * ictx;
uintptr_t addr;
int fdout;
FILE * fout;
- if (!dctx->cctx->dstdir)
- return stdout;
-
addr = (uintptr_t)dctx - offsetof(struct mdso_driver_ctx_impl,ctx);
ictx = (struct mdso_driver_ctx_impl *)addr;
- if ((fdout = openat(ictx->fddst,asmname,
+ if ((fdout = openat(ictx->fddst,name,
O_CREAT|O_TRUNC|O_WRONLY|O_NOCTTY|O_NOFOLLOW,
S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) < 0) {
MDSO_SYSTEM_ERROR(dctx);
@@ -45,3 +42,25 @@ FILE * mdso_create_asm_source(
return fout;
}
+
+FILE * mdso_create_asm_source(
+ const struct mdso_driver_ctx * dctx,
+ const char * asmname)
+{
+ if (!dctx->cctx->dstdir)
+ return stdout;
+
+ return mdso_create_output(dctx,asmname);
+}
+
+FILE * mdso_create_object(
+ const struct mdso_driver_ctx * dctx,
+ const char * objname)
+{
+ if (!dctx->cctx->dstdir) {
+ MDSO_CUSTOM_ERROR(dctx,MDSO_ERR_INVALID_DSTDIR);
+ return 0;
+ }
+
+ return mdso_create_output(dctx,objname);
+}