https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63228
Bug ID: 63228 Summary: -m16 doesn't work if gcc is compiled for x32 Product: gcc Version: 4.9.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: mikulas at artax dot karlin.mff.cuni.cz Host: x86_64-linux-gnux32 Target: x86_64-linux-gnux32 Build: x86_64-linux-gnux32 When gcc is configured and compiled for x32 mode (x86_64-linux-gnux32 triplet), the flag -m16 doesn't work. The bug was reproduced on gcc-4.9.1-13 from Debian Ports x32 distribution (https://wiki.debian.org/X32Port) Attempting to compile or assemble anything with "gcc -m16 -march=i386" results in this error message: error: CPU you selected does not support x86-64 instruction set (this error causes linux kernel 3.16.2 compilation failure) If you remove "-march=i386", the file is compiled, but it can't be assembled, because gcc generates incorrect assembler as if it was x86_64 target. For example, compiling a file test.c containing "int bla(void) { return 3; }" with "gcc -c -m16 test.c", results in these error messages: /tmp/cc89iTZG.s: Assembler messages: /tmp/cc89iTZG.s:9: Error: bad register name `%rbp' /tmp/cc89iTZG.s:15: Error: bad register name `%rbp' When gcc is configured for x86_64 mode (x86_64-unknown-linux-gnu), -m16 works correctly.