NO

Author Topic: POLINK bug?  (Read 10148 times)

akko

  • Guest
POLINK bug?
« on: April 20, 2007, 09:39:00 pm »
Sorry, my code is too long to show here (a console application).
Also I don't know if it is a bug. However .rdata smells of assembler although I use pure C code.

POLINK: warning: Multiple '.rdata' sections found with different flags (0x40000040 and 0xc0000040).

So my question: Can it be a bug or does the message indicate something else?

Ehtyar

  • Guest
Re: POLINK bug?
« Reply #1 on: April 20, 2007, 11:39:42 pm »
Also I don't know if it is a bug. However .rdata smells of assembler although I use pure C code.
This is because you do not have direct access to the sections using C (except from some linker switches) though they still exist in any PE, no matter what language you use.
POLINK: warning: Multiple '.rdata' sections found with different flags (0x40000040 and 0xc0000040).

So my question: Can it be a bug or does the message indicate something else?
The warning is generated because you have two sections with identical names and different attributes, it should not be a problem. If you really want to get rid of the error, you can try adding #pragma comment(linker,"/IGNORE:4078") to your source, or adding /IGNORE:4078 directly to the linker command line, though i am unsure if this will work with pelles.

Hope this helps, Ehtyar.

severach

  • Guest
Re: POLINK bug?
« Reply #2 on: April 21, 2007, 03:48:10 am »
Search the Pelles board for that error code.

Ehtyar

  • Guest
Re: POLINK bug?
« Reply #3 on: April 21, 2007, 04:48:49 am »
Search the Pelles board for that error code.
I believe he means "error message", which returns a few pages, none that present a solution.  It would also seem that polink does not accept the msvc /IGNORE switch, so there is no way to prevent the warning from displaying, sorry.

Ehtyar.

akko

  • Guest
Re: POLINK bug?
« Reply #4 on: April 21, 2007, 10:44:14 am »
Thanks to all.
It seems I got rid of the "bug"??

I had imported msvcrt.lib as linker option. But msvcrt seems to be already there by default and something ran into a conflict.

BTW ignoring or disabling the warning does not help. The exe was generated but did not run.

Andreas


Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2181
    • http://www.smorgasbordet.com
Re: POLINK bug?
« Reply #5 on: April 21, 2007, 04:40:01 pm »
This is a known issue if you link with (the old, and not really supported) msvcrt.lib. It was include a long time ago, as a service to some users. It will not be included in the future. The '.rdata' section is by agreement used for read-only data, and the 'flags' descibe it as such. For some reason, one '.rdata' section in msvcrt.lib is flagged as read-write - hence the warning. So it looks like a bug, but it's not mine. Microsoft may have fixed this in the 2005 version, but I havn't checked. The default is to use Pelles C runtime library (crt.lib, crtmt.lib, or pocrt.lib - depending on settings).

I have not added a system to the linker to disable certain warnings, since this is probably the only one that might need it. It seems like overkill to add it for a single warning...

/Pelle

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1981
Re: POLINK bug?
« Reply #6 on: April 21, 2007, 05:42:05 pm »
Visual C++ 2005 msvcrt.lib use msvcr80.dll
WinXP msvcrt.dll is version 7.0

BTW:
.rdata is 'Read-only initialized data' in Microsoft PE format documentation.
So that "bug" is in msvcrt.lib/.dll.
May the source be with you

Ehtyar

  • Guest
Re: POLINK bug?
« Reply #7 on: April 22, 2007, 01:22:59 am »
I am one of many programmers who prefer to link with the old msvcrt.lib as firstly it does not require manifest changes, and secondly it does not require you to redistribute a dll with your application (most of my apps consist of a standalone executable). The only reason M$ ever got away with the new msvcr**.dll was because anyone using msvc 03 or 05 had no choice in the matter. I am, of course, not complaining at all here, just explaining why many of us prefer the old msvcrt.lib (or even no msvcrt.lib at all).

Ehtyar.

Offline Vortex

  • Member
  • *
  • Posts: 565
    • http://www.vortex.masmcode.com
Re: POLINK bug?
« Reply #8 on: April 22, 2007, 11:02:50 am »
akko,

Could you try to rebuild msvcrt.lib to eliminate the .rdata section?

Code: [Select]
polib /MAKEDEF:msvcrt.def C:\pellesc\lib\win\msvcrt.lib
polib /OUT:msvcrt.lib /DEF:msvcrt.def /MACHINE:IX86
Code it... That's all...

akko

  • Guest
Re: POLINK bug?
« Reply #9 on: April 23, 2007, 08:41:30 pm »
Wow, works like a charm (hoping it didn't break something else: the original msvcrt.lib had 230k, the new on shrank to 127k)

Thanks, Vortex !!

akko

  • Guest
Re: POLINK bug?
« Reply #10 on: April 23, 2007, 10:57:40 pm »
WOWed too early  ???
When used in the full program I get:

POLINK: error: Symbol '_clock' is multiply defined ('msvcrt.lib(MSVCRT.dll)' and 'crt.lib(clock.obj)').

severach

  • Guest
Re: POLINK bug?
« Reply #11 on: April 24, 2007, 03:40:20 am »
I thought it was clear from the previous postings that the warning is to be ignored.

The file is a lot smaller because it lost some Microsoft only settings, lost some code that shouldn't be in an import library, and may be stored more compactly.

You can edit the .def file before making a new import library and remove the clock symbol. There are probably some other symbols in there you'll want to remove.

I like MSVCRT because it allows me to make tiny programs without using a hacked and cut down runtime library.

MSVCRT is not only well supported, it is the correct library for certain purposes. You can get the real MSVCRT import library from any Resource Kit. The main advantage of using MSVCR is that the Microsoft C++ system is completely supported by it and not MSVCRT. That isn't an issue in Pelles-C.

Microsoft calls MSVCRT.DLL a "Known DLL." How do I know if I can/should use it ?

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 1923
Re: POLINK bug?
« Reply #12 on: April 24, 2007, 12:06:38 pm »
WOWed too early  ???
When used in the full program I get:

POLINK: error: Symbol '_clock' is multiply defined ('msvcrt.lib(MSVCRT.dll)' and 'crt.lib(clock.obj)').
Continue to WOW  ;)
Simply use the /Zl switch to avoid emission of standard library names.
Your get the problem because the linker includes both runtime libraries M$VCRT and the PellesC crt.lib.

P.S. Please when you are not sure if what you got is a bug or not try to ask in the general section before to post here.
« Last Edit: April 24, 2007, 12:08:38 pm by frankie »

akko

  • Guest
Re: POLINK bug?
« Reply #13 on: April 24, 2007, 06:37:13 pm »
Thanks to everybody!

Frankie: Sorry, I didn't want to spam this section which is only for REAL bugs ;-)
I don't mind if you move the thread elsewhere.

akko

  • Guest
Re: POLINK bug?
« Reply #14 on: April 24, 2007, 07:31:24 pm »
Simply use the /Zl switch to avoid emission of standard library names.
Your get the problem because the linker includes both runtime libraries M$VCRT and the PellesC crt.lib.

PS. The /Zl switch does not work. I get a looong error list of
POLINK: error: Unresolved external symbol '<a_bunch_of_functions>'
POLINK: fatal error: 63 unresolved external(s).