Friday September 03, 2004
AMD64 - compilation flag differences from cc to gcc
Well I've been asked more than once for this, so I decided that a publicly accessible version would help people.
| Purpose | sun cc | gnu cc |
|---|---|---|
| Compile in 64bit mode | -xarch=<sparcv9|amd64> (-xarch=generic64 soon) | -m64 (gcc really wins here!) |
| Compile a kernel module | -D_KERNEL | -D_KERNEL -mcmodel=kernel |
| Multi-Threaded | -D_REENTRANT (stop using -mt in S10) | -D_REENTRANT |
| Optimization | -xO<0-5> | -O<0-5> |
| Warnings | -v | -W or -Wall (mini lint) |
| Warnings are errors | -errwarn=%all | -Werror |
| Build a shared object (.so) | -G | -shared |
| Accept C++ style comments | -xCC | None (does it automatically) |
| Position independent code | -K PIC (32bit addresses - longer sparc instructions) -K pic (not 32bit addresses) | -fpic |