This is an archive of the discontinued LLVM Phabricator instance.

[Hexagon][test] Fix tests on Linux/musl
AcceptedPublic

Authored by awilfox on May 30 2022, 1:42 AM.

Details

Reviewers
kparzysz
MaskRay
Summary

When running on a host system using musl, the target triple is defined
as hexagon-unknown-linux-musl by default. The Linux ABI differs from
the non-Linux one with varargs, so this causes the tests to fail.

Closes BZ49592, PR48936.

Diff Detail

Event Timeline

awilfox created this revision.May 30 2022, 1:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 30 2022, 1:42 AM
awilfox requested review of this revision.May 30 2022, 1:42 AM
MaskRay accepted this revision.EditedMay 31 2022, 7:50 PM

The Linux ABI differs from the non-Linux one with varargs, so this causes the tests to fail.

I think this is incorrect. This is due to difference between linux-gnu and linux-musl.

-march=hexagon uses the default target triple (which typically has linux-gnu on a linux-gnu system) and changes the arch part of hexagon.
This is subtly different from -mtriple=... which sets all components of a target triple.

Somehow linux-gnu and generic ELF have the same behavior, which linux-musl has a different behavior.

I think the better fix is to replace -march= with -mtriple=hexagon, instead of keeping both.

This revision is now accepted and ready to land.May 31 2022, 7:50 PM
MaskRay retitled this revision from [Hexagon][Tests] Fix tests on Linux/musl to [Hexagon][test] Fix tests on Linux/musl.May 31 2022, 7:50 PM

I'm happy to refactor to remove the -march; I was just following the rest of the tests in the Hexagon directory that all have this pattern of -march followed by -mtriple (see the original musl tests added in D72701, and also the OpenBSD test in D126265). Should we remove the -march from the other tests as well?

As for "Linux ABI" vs "musl ABI", D72701 and its resultant commit specify:

Checking OS was too vague and could result in this ABI being unexpectedly enabled if the triple was not set and the host tools were built for Linux. Musl is the only C-library currently used by Hexagon Linux so that is the check I'm using to enable the ABI.

I think the original developers were under the impression that musl wasn't used for development / workstation OS, so they felt this was safe. Since we at Adélie Linux hadn't been updating our LLVM packaging, we didn't run into this issue until now.

I'm happy to refactor to remove the -march; I was just following the rest of the tests in the Hexagon directory that all have this pattern of -march followed by -mtriple (see the original musl tests added in D72701, and also the OpenBSD test in D126265). Should we remove the -march from the other tests as well?

Yes. Generally -march should be avoided for llc.

As for "Linux ABI" vs "musl ABI", D72701 and its resultant commit specify:

Thx.

Checking OS was too vague and could result in this ABI being unexpectedly enabled if the triple was not set and the host tools were built for Linux. Musl is the only C-library currently used by Hexagon Linux so that is the check I'm using to enable the ABI.

I think the original developers were under the impression that musl wasn't used for development / workstation OS, so they felt this was safe. Since we at Adélie Linux hadn't been updating our LLVM packaging, we didn't run into this issue until now.