Menu

#88 [x86-64] impossible to link in any VC-compiled static libs

closed-fixed
None
5
2010-05-12
2009-03-16
No

It's impossible to link in any VC-compiled static libs
because GCC prepends an underscore to symbol names,
while VC does not.
Symbols in VC-compiled .lib files are UNdecorated on x86-64 !

I'm don't understand much in this stuff, but maybe
an equivalent of -fno-leading-underscore should
be the default on x86_64-pc-mingw targets ?

Discussion

  • Kai Tietz

    Kai Tietz - 2009-03-16

    Right,

    this is one of the last major issue (beside the __chkstk issue), which prevents compatibility with VS libraries. Clear there are ways to make them compatible (you can rename symbols via objcopy), but they are pretty uncomfortable.
    The other way to solve this, is using -fno-leading-underscore to build crt and dependent libraries, and modify the .def file based library generation without the -k flag.
    But while 4.5 I want to adjust complete toolchain to not producing those underscores. Any help on this is very welcome.

    Cheers,
    Kai

     
  • Kai Tietz

    Kai Tietz - 2009-03-16
    • status: open --> open-later
     
  • Alexey Pushkin

    Alexey Pushkin - 2009-03-16

    Well, 4.5 might be a long time from now ...
    as I said I don't know the internals of this stuff ...
    as a mingw user I think -fno-leading-underscore
    could be a reasonable intermediate solution ...
    I don't know if there are negative side effects though ...

     
  • Kai Tietz

    Kai Tietz - 2009-03-16

    Well -fno-leading-underscore could be a work-a-round for this. The major issue is, that our crt assumes at the moment, that there are underscores, so we have to add a macro on build to indicate that we want to build without (for 64-bits). For 32-bit there have to be prefix underscores.
    I'll add today some helper macros for this to _mingw.h (__MINGW_USE_PREFIX_UNDERSCORE and __MINGW_IMP_SYMBOL(name) ). By this macros we can port our stuff to support both cases.

    Cheers,
    Kai

     
  • Kai Tietz

    Kai Tietz - 2009-03-16

    I added to our svn some helper macros for this. __MINGW_IMP_SYMBOL and __MINGW_USE_UNDERSCORE_PREFIX). Now the complete header-set has to be cleanup to use __MINGW_IMP_SYMBOL instead of the hard-coded names _imp__<symbol>.

     
  • Kai Tietz

    Kai Tietz - 2009-03-29
    • status: open-later --> open-accepted
     
  • Kai Tietz

    Kai Tietz - 2009-03-29

    By revision 700 our crt is prepared to make the underscore change in binutils/gcc.

    Cheers,
    Kai

     
  • Kai Tietz

    Kai Tietz - 2010-04-27
    • status: open-accepted --> pending-fixed
     
  • Kai Tietz

    Kai Tietz - 2010-04-27

    This bug is fixed for gcc 4.6 and binutils head version. Default is changed to vendor specific cdecl symbol decoration without underscore.

    Regards,
    Kai

     
  • NightStrike

    NightStrike - 2010-04-30
    • assigned_to: nobody --> ktietz70
    • priority: 9 --> 5
     
  • SourceForge Robot

    • status: pending-fixed --> closed-fixed
     
  • SourceForge Robot

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     

Log in to post a comment.