This is an archive of the discontinued LLVM Phabricator instance.

[llvm-mc] The object form of the GNU triple should be the same as the string form.
ClosedPublic

Authored by dsanders on Jun 15 2015, 10:57 AM.

Details

Summary

GetTarget() may modify TripleName without also updating TheTriple.
This can lead to situations where the MCObjectStreamer has a different triple
to the rest of LLVM.

This inconsistency caused sparc-little-endian.s to pass on Windows because most
of LLVM had sparcel-pc-win32 while MCObjectStreamer had "". I believe the same
kind of thing was also true of Darwin.

Diff Detail

Event Timeline

dsanders updated this revision to Diff 27691.Jun 15 2015, 10:57 AM
dsanders retitled this revision from to [llvm-mc] The object form of the GNU triple should be the same as the string form..
dsanders updated this object.
dsanders edited the test plan for this revision. (Show Details)
dsanders added subscribers: rafael, rengolin, Unknown Object (MLST).
rengolin accepted this revision.Jun 15 2015, 1:43 PM
rengolin added a reviewer: rengolin.

Ouch! This is a really bad design, thanks for the fix and the comment.

For the future, I believe we should either do the normalization in GetTarget and make sure no other function does, or don't change the triple at all in there. Hidden side effects of that magnitude are really horrible... :(

But not for this patch. LGTM. Thanks!

This revision is now accepted and ready to land.Jun 15 2015, 1:43 PM
dsanders closed this revision.Jun 16 2015, 3:01 AM