PATCH: PR target/59672: Add -m16 support for x86

H.J. Lu
Wed Jan 29 16:39:00 GMT 2014

On Wed, Jan 29, 2014 at 6:41 AM, Alexander Monakov <> wrote:
> On Wed, 29 Jan 2014, H.J. Lu wrote:
>> Since the .code16gcc directive was added to binutils back in 1999,
>> it is older than the minimum binutils required for x86 GCC.  There
>> is no need to specify a separate minimum binutils for it.
> It's not clear to me why the compiler should be involved in providing this
> functionality.  Can the assembler simply support '-mcode16gcc' command-line
> flag, which would have the effect of enabling .code16gcc for the whole
> translation unit?  That way, you could simply add -Wa,-mcode16gcc to the GCC
> command line and avoid the need to patch the compiler.  Am I missing
> something?

-m16 is used by Linux kernel, which checks if the compiler supports -m16
and uses it if it does. Adding gas --code16gcc check is an additional change
in Linux kernel.  Clang already supports -m16, which generates objects
directly.  Adding gas --code16gcc check doesn't help clang.  Add -m16
to gcc makes gcc and clang consistent to Linux kernel build.


More information about the Gcc-patches mailing list