This is an archive of the discontinued LLVM Phabricator instance.

ADT: handle special case of ARM environment for SuSE
ClosedPublic

Authored by compnerd on Apr 24 2017, 5:37 PM.

Details

Reviewers
ismail
Summary

SuSE treats "gnueabi" as "gnueabihf" so make sure that we normalise the environment.

Diff Detail

Repository
rL LLVM

Event Timeline

compnerd created this revision.Apr 24 2017, 5:37 PM
ismail requested changes to this revision.Apr 25 2017, 12:58 AM

This looks good but please fix the typo in comments: SuSE -> SUSE
Also please use the correct triple: armv7hl-suse-linux-gnueabi (at least in the second test I think.)

Also the vendor test in TripleTest.cpp should be updated.

This revision now requires changes to proceed.Apr 25 2017, 12:58 AM

This could have side-effects, too, especially when going through textual IR, no?

Yes, the idea is that the textual IR uses the correct triple, unless it is overidden at the command line.

Yes, the idea is that the textual IR uses the correct triple, unless it is overidden at the command line.

Why not just handle this in clang?

@majnemer thats the idea :-). Passing either triple to clang would give the right behaviour (clang will normalize the triple before passing it to cc1).

Yes, the idea is that the textual IR uses the correct triple, unless it is overidden at the command line.

Why not just handle this in clang?

IIRC, the problem here is of consistency.

The Triple usage throughout LLVM is broken wrt float ABI, but "hf" at the end of the environment "makes it work". The reason being that "gnueabihf" is the mostly tested environment, so it converged to work by accident.

The target that clang passes to LLVM is, therefore, also broken. Making Clang change from "eabi" to "eabihf" would "work", in the sense that in some cases, the correct float ABI would be selected. But it would also serialise the *wrong* triple in IR.

Again, that solution has "converged" to work, because the IR triple doesn't have to make sense (for example "thumbv7a"), so it's possible that, for all intended purposes, just changing the environment in the clang driver should be enough.

If it wasn't for the fact, of course, that we already do that with Arch/CPU names, sometimes getting it terrible wrong, and most times "fixing" it with by "accidental convergence".

I'm not against continuing this pattern, as I certainly don't have time (and health) to try and fix the clang driver for the Nth time, but I just want to make clear to all parties involved that none of that is a "solution". :)

The real solution would be to continue Daniel's Triple refactoring [1] until all fields are uniquely represented on both Clang and LLVM.

</rant>

[1] Some references:

Can we go ahead with this?

@majnemer thats the idea - passing either triple to clang would give the right behaviour (clang will normalize the triple before passing it to cc1).
@ismail Im waiting on you to accept the change

@ismail Im waiting on you to accept the change

I requested two changes, does that makes sense?

@ismail the current version of the patch should have those requested changes :-).

ismail accepted this revision.Jun 2 2017, 2:13 AM

Thank you!

This revision is now accepted and ready to land.Jun 2 2017, 2:13 AM
compnerd closed this revision.Jun 3 2017, 3:31 PM

SVN r304670