[Hexagon] Enable linux #defines

Enable standard linux defines when the triple is Linux and the
environment is musl.

Differential Revision: https://reviews.llvm.org/D76310
This commit is contained in:
Sid Manning 2020-03-17 13:41:35 -05:00
parent 0cc2d23751
commit 430c9a80c1
2 changed files with 15 additions and 0 deletions

View File

@ -117,6 +117,9 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
return new XCoreTargetInfo(Triple, Opts);
case llvm::Triple::hexagon:
if (os == llvm::Triple::Linux &&
Triple.getEnvironment() == llvm::Triple::Musl)
return new LinuxTargetInfo<HexagonTargetInfo>(Triple, Opts);
return new HexagonTargetInfo(Triple, Opts);
case llvm::Triple::lanai:

View File

@ -101,3 +101,15 @@
// RUN: -target-feature +hvxv67 -target-feature +hvx-length128b %s | FileCheck \
// RUN: %s -check-prefix CHECK-ELF
// CHECK-ELF: #define __ELF__ 1
// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-linux-musl \
// RUN: -target-cpu hexagonv67 -target-feature +hvxv67 \
// RUN: -target-feature +hvx-length128b %s | FileCheck \
// RUN: %s -check-prefix CHECK-LINUX
// CHECK-LINUX: #define __gnu_linux__ 1
// CHECK-LINUX: #define __linux 1
// CHECK-LINUX: #define __linux__ 1
// CHECK-LINUX: #define __unix 1
// CHECK-LINUX: #define __unix__ 1
// CHECK-LINUX: #define linux 1
// CHECK-LINUX: #define unix 1