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

Eli Friedman eli.friedman at gmail.com
Sun May 15 15:22:24 PDT 2011


On Sun, May 15, 2011 at 1:23 PM, Joerg Sonnenberger
<joerg at britannica.bec.de> wrote:
> On Tue, May 03, 2011 at 06:47:44PM +0200, Joerg Sonnenberger wrote:
>> The attached part distinguishes between the triple given by the user and
>> whatever is passed down to different parts of clang (cc1, clang-as).
>> It does the job, but this is going to duplicate a lot of code for other
>> platforms. The other issue of course is the XXX comment at the end about
>> toolchain caching. This would work at the moment, since the primary
>> triple is the same for all compilations inside clang, but would fail as
>> soon as a clang daemon was written.
>
> Any feedback on this?

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.

-Eli



More information about the cfe-dev mailing list