[cfe-dev] GNU-style target triple and -m32 modifier

Joerg Sonnenberger joerg at britannica.bec.de
Mon May 16 00:23:42 PDT 2011


On Sun, May 15, 2011 at 03:22:24PM -0700, Eli Friedman wrote:
> If I'm understanding correctly, passing -m32 to clang targeting
> x86_64--netbsd is supposed to make executables targeting
> i486--netbsdelf, but is incorrectly trying to use tools for
> i486--netbsd.  You're trying to fix this by keeping around the
> original target triple, and pretending that a i486--netbsd triple is
> actually i486--netbsdelf if the original triple is x86_64--netbsd.  It
> seems like it would be much more straightforward to just fix the
> triple-handling code so that passing in -m32 figures out the correct
> triple.

Not exactly. Passing -m32 should have two results: *compile* for the
equivalent of i386--netbsdelf and call as/ld with the correct 32bit
flags. My problem here is that the original triple is "lost", so it
tries to call the wrong cross-compile as/ld and uses the wrong arguments
for those. E.g. correct behavior is to either call a x86_64 as with --32
or a i386 as without, but currently neither happens.

The patch contains this in the NetBSD specific targets, but I believe
that the problem of distinguishing -m32 from "native" 32bit compilation
might be a bit more popular to duplicate all the code.

Joerg



More information about the cfe-dev mailing list