News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

fatal error #4010

Started by Robert, December 14, 2004, 02:56:00 AM

Previous topic - Next topic

Robert

Compiling BCX 5.05.131 and up with Pelle's C 2.90.1 generates

fatal error #4010: [asm] COFF section with more than 65535
relocations.

Any ideas why I am having this problem?

Robert Wishlaw

Pelle

There is a limitation in the COFF file format - used by OBJ files: a section (code, data, ...) may contain a maximum of 65535 relocations. This is because the field that holds the count is only 16 bits. Relocations are places where an address must be filled in, but the address is unknown by the compiler, so it's passed on to the linker - usually for external functions and variables (like C runtime functions).

The good news is that Microsoft invented a hack to get around this, and be able to use a 32 bit value for the relocation count. I will try to add this to the next version.

Pelle
/Pelle

Robert

Pelle:

Further to the above

pocc -W1 -Gd -Go -Ze -Zx -Tx86-coff bcx.c

produces the COFF error.

If -Ot -Os or -Ox are added to the command line the compilation will complete with no error.

Robert Wishlaw

Anonymous

Quote from: "Robert"Pelle:

Further to the above

pocc -W1 -Gd -Go -Ze -Zx -Tx86-coff bcx.c

produces the COFF error.

If -Ot -Os or -Ox are added to the command line the compilation will complete with no error.

Robert Wishlaw

This appears to be another optimization bug, things that behave differently depending on optimizations used...  Check the already running thread on the errors caused by exception handling with optimizations enabled for more detail.

I hate to say this 'cause I like PC just fine... but I'm beginning to think Pelle needs to rework the entire optimization strategy.

Pelle

Quote from: "Robert"
Further to the above

pocc -W1 -Gd -Go -Ze -Zx -Tx86-coff bcx.c

produces the COFF error.

If -Ot -Os or -Ox are added to the command line the compilation will complete with no error.
Hello Robert,

This seems reasonable. Turning on optimizations will, for example, turn on the intrinsic functions (especially -Ot, but also -Os). This could reduce the number of calls to runtime functions, and possibly reduce the number of relocations required, giving you a value below 65535 (below the current COFF limit).

The general fix right now is to split the (large) source file into multiple source files, and compile them separately - but I suspect this a lot of work for you.

I have now added support for more than 65535 relocations in an object file - this will be in the next release. A beta should be available fairly soon.

Pelle
/Pelle