Compatibility of compiler and linker switches...

Started by Anonymous, July 28, 2005, 07:01:24 PM

Previous topic - Next topic

Anonymous

Hi Pelle,
I'm not sure if I've asked you this before, so bear with me if I have (this time I'll print it out...)

Are there command line switches for the compiler and the linker that are incompatible with one another -- either self negating or likely to cause errors in output?

A list of the ones we can't use together would be very helpful....

Pelle

There are few incompatibilities, as far as I know. You can't mix machines (compiler option /Tx86-coff with linker option /machine:arm, but this should be pretty obvious).

Compiler options /Gm and /Gn will change the "decoration" of public symbols, so they might cause problems if linking with the wrong library.

Linker options like /align:#, /driver, /entry, /fixed, /force:multiple, /merge, /noentry, /version, /osversion are best left alone - unless you are very sure what you are doing...

This is all I can think of right now...

Pelle
/Pelle

Anonymous

Quote from: "Pelle"There are few incompatibilities, as far as I know. You can't mix machines (compiler option /Tx86-coff with linker option /machine:arm, but this should be pretty obvious).

Compiler options /Gm and /Gn will change the "decoration" of public symbols, so they might cause problems if linking with the wrong library.

Linker options like /align:#, /driver, /entry, /fixed, /force:multiple, /merge, /noentry, /version, /osversion are best left alone - unless you are very sure what you are doing...

This is all I can think of right now...

Pelle

Thanks Pelle... that's a help.

How about the Os and Ot switches?  Can they be used together?

Pelle

You can specify both without complains from the complier - but the last one will "win" (you either optimize for speed or size - not both).

You can use #pragma optimize() if you want different strategies for different functions inside a source file...

Pelle
/Pelle

Anonymous

Quote from: "Pelle"You can specify both without complains from the complier - but the last one will "win" (you either optimize for speed or size - not both).

You can use #pragma optimize() if you want different strategies for different functions inside a source file...

Pelle

Thanks, Pelle... I wasn't clear on what would happen.  Is the "last wins" rule generally true for opposing switches?  

I do use the pragmas as overrides for the defaults in a project... its a very nice feature!

Pelle

Quote from: "ldblake"Is the "last wins" rule generally true for opposing switches?
Normally, yes. The tools should complain when they absolutely have to, but not otherwise...

Pelle
/Pelle