[RFH] About dlltool --output-exp --add-indirect.
Tue Oct 31 11:46:00 GMT 2006
I am looking at fixing the underscore usage in dlltool for arm-wince-pe,
but I see something I don't understand:
What is the --add-indirect option used for? I see that it puts the
_imp_<symbol> on the export table,
but what is it that used for?
Here is a snippet of the dlltool.c:gen_exp_file, where --add-indirect is
/* Add to the output file a way of getting to the exported names
without using the import library. */
fprintf (f, "\t.section\t.rdata\n");
for (i = 0, exp = d_exports; exp; i++, exp = exp->next)
if (!exp->noname || show_allnames)
/* We use a single underscore for MS compatibility, and a
double underscore for backward compatibility with old
cygwin releases. */
fprintf (f, "\t%s\t__imp_%s\n", ASM_GLOBAL, exp->name);
fprintf (f, "\t%s\t_imp__%s\n", ASM_GLOBAL, exp->name);
fprintf (f, "__imp_%s:\n", exp->name);
fprintf (f, "_imp__%s:\n", exp->name);
fprintf (f, "\t%s\t%s\n", ASM_LONG, exp->name);
How can this be right? Since we are outputting assembly, isn't there an
underscore missing in the left of all those _imp_ ?
In ld/pe-dll.c, if the target is underscored (cygwin/mingw), we use
__imp_ by default, and add an ___imp_ alias
if compatibility with older cygwin releases is requested. From what I
see with MSVC, __imp_ is indeed the correct
From what I can find on the web, an exp file is a normal coff
object/bfd with the only the .edata section of the image.
Anyone has an idea how to generate the equivalent of --add-indirect with
Also, does anyone use this option nowadays?
Oh, and --add-indirect docs on dlltool's manual has the funniest comment
I could find on binutils.
Specifies that when dlltool is creating the exports file it
should add a section which allows the exported functions
to be referenced without using the import library. Whatever
the hell that means!
More information about the Binutils