Pelles C forum

Pelles C => Bug reports => Topic started by: akko on April 20, 2007, 09:39:00 PM

Title: POLINK bug?
Post by: akko 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?
Title: Re: POLINK bug?
Post by: Ehtyar 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.
Title: Re: POLINK bug?
Post by: severach on April 21, 2007, 03:48:10 AM
Search the Pelles board for that error code.
Title: Re: POLINK bug?
Post by: Ehtyar 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.
Title: Re: POLINK bug?
Post by: akko 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

Title: Re: POLINK bug?
Post by: Pelle 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...

Title: Re: POLINK bug?
Post by: TimoVJL 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.
Title: Re: POLINK bug?
Post by: Ehtyar 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.
Title: Re: POLINK bug?
Post by: Vortex 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
Title: Re: POLINK bug?
Post by: akko 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 !!
Title: Re: POLINK bug?
Post by: akko 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)').
Title: Re: POLINK bug?
Post by: severach 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 ? (http://wiki.codeblocks.org/index.php?title=FAQ#Q:_Microsoft_calls_MSVCRT.DLL_a_.22Known_DLL..22_How_do_I_know_if_I_can.2Fshould_use_it_.3F)
Title: Re: POLINK bug?
Post by: frankie 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.
Title: Re: POLINK bug?
Post by: akko 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.
Title: Re: POLINK bug?
Post by: akko 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).