[LLVMdev] [DragonEgg] Strange call to @"\01__isoc99_fscanf"

Dmitry Mikushin dmitry at kernelgen.org
Tue Dec 25 14:03:27 PST 2012


Hi Anton!

Thanks for the hint! You're right: it is "callq    __isoc99_fscanf" in .s
file. My mistake is that I'm taking a function name directly from CallInst
and trying to dlsym it from the running executable. Now I'm using
mangler.getNameWithPrefix method to get the actual name, and it works.

Best regards,
- D.

2012/12/25 Anton Korobeynikov <anton at korobeynikov.info>

> > While testing a File I/O sample program, I've encountered a link failure
> due
> > to missing implementation of "\01__isoc99_fscanf" function. I think this
> > function should be named "__isoc99_fscanf" instead. Please see the
> program
> > code and LLVM IR generated by DragonEgg and clang below. It shows that
> clang
> > generates "__isoc99_fscanf", while DragonEgg gives "\01__isoc99_fscanf".
> We
> > generally use DragonEgg as our compiler frontend, so it is more
> important.
> > What could be the reason of "\01" issue?
> \01 is the magic prefix from asm("") thing in C sources. Basically
> this is the instruction to mangler not to change the name in any way,
> so, it should be emitted to assembler / binary code as
> "__isoc99_fscanf".
>
> How does .s / .o look like?
>
> --
> With best regards, Anton Korobeynikov
> Faculty of Mathematics and Mechanics, Saint Petersburg State University
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121225/076970ab/attachment.html>


More information about the llvm-dev mailing list