summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2017-02-03 07:37:16 -0500
committermidipix <writeonce@midipix.org>2017-02-03 07:37:16 -0500
commit260511cf41481ecf20a73410b7e0d1ca5efcfa8a (patch)
tree597154a85587cfba647e3b5f89d3b1a0ac72efea
parentaf228071b80d528ff67b7fd8736573994f594f87 (diff)
downloadmdso-260511cf41481ecf20a73410b7e0d1ca5efcfa8a.tar.bz2
mdso-260511cf41481ecf20a73410b7e0d1ca5efcfa8a.tar.xz
mdso_generate_symentry(): prepend an underscore to the symbol name as needed.
-rw-r--r--src/logic/mdso_generate_symentry.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/logic/mdso_generate_symentry.c b/src/logic/mdso_generate_symentry.c
index 80c297e..31f2062 100644
--- a/src/logic/mdso_generate_symentry.c
+++ b/src/logic/mdso_generate_symentry.c
@@ -12,16 +12,12 @@
#include "mdso_errinfo_impl.h"
static const char * const asm_lines[] = {
- "\t.file \"__%s_sym_entry.s\"\n",
-
"\t.section " MDSO_STRS_SECTION ",\"r\"\n",
"\t.globl .__dsostr_%s\n",
"\t.balign 2\n\n",
".__dsostr_%s:\n",
"\t.ascii\t\"%s\\0\"\n\n"
-
"\t.section " MDSO_SYMS_SECTION ",\"r\"\n",
- "\t.globl __imp_%s\n",
0
};
@@ -33,23 +29,32 @@ int mdso_generate_symentry(
const char * const * line;
const char * alignstr;
const char * ptrsize;
+ const char * uscore;
+
+ if (fprintf(fout,"\t.file \"__%s_sym_entry.s\"\n",sym) < 0)
+ return MDSO_FILE_ERROR(dctx);
if (dctx->cctx->drvflags & MDSO_DRIVER_QUAD_PTR) {
alignstr = "\t.balign 16\n\n";
ptrsize = ".quad";
+ uscore = "";
} else {
alignstr = "\t.balign 8\n\n";
ptrsize = ".long";
+ uscore = "_";
}
for (line=asm_lines; *line; line++)
if ((fprintf(fout,*line,sym)) < 0)
return MDSO_FILE_ERROR(dctx);
+ if (fprintf(fout,"\t.globl __imp_%s%s\n",uscore,sym) < 0)
+ return MDSO_FILE_ERROR(dctx);
+
if ((fputs(alignstr,fout)) < 0)
return MDSO_FILE_ERROR(dctx);
- if ((fprintf(fout,"__imp_%s:\n",sym)) < 0)
+ if ((fprintf(fout,"__imp_%s%s:\n",uscore,sym)) < 0)
return MDSO_FILE_ERROR(dctx);
if ((fprintf(fout,"\t%s\t.__dsostr_%s\n",ptrsize,sym)) < 0)