NO

Author Topic: Compatibility of compiler and linker switches...  (Read 4400 times)

Anonymous

  • Guest
Compatibility of compiler and linker switches...
« on: July 28, 2005, 07:01:24 PM »
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....

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Compatibility of compiler and linker switches...
« Reply #1 on: July 30, 2005, 10:05:17 PM »
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

  • Guest
Compatibility of compiler and linker switches...
« Reply #2 on: July 30, 2005, 10:17:03 PM »
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?

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Compatibility of compiler and linker switches...
« Reply #3 on: July 30, 2005, 10:58:54 PM »
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

  • Guest
Compatibility of compiler and linker switches...
« Reply #4 on: July 30, 2005, 11:08:06 PM »
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!

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Compatibility of compiler and linker switches...
« Reply #5 on: July 30, 2005, 11:49:34 PM »
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