diff options
| author | Alex Bradbury <asb@lowrisc.org> | 2018-02-03 11:56:11 +0000 |
|---|---|---|
| committer | Alex Bradbury <asb@lowrisc.org> | 2018-02-03 11:56:11 +0000 |
| commit | 3e1478f866e66d74e7314635aa49448e023b8d27 (patch) | |
| tree | 07faf5002723c5c6325f7585badad487bc355c95 /clang/lib/Basic | |
| parent | a43ba2d84f23e95b28fe22daafe7c056a20f8ba2 (diff) | |
| download | bcm5719-llvm-3e1478f866e66d74e7314635aa49448e023b8d27.tar.gz bcm5719-llvm-3e1478f866e66d74e7314635aa49448e023b8d27.zip | |
[RISCV] Create a LinuxTargetInfo when targeting Linux
Previously, RISCV32TargetInfo or RISCV64TargetInfo were created
unconditionally. Use LinuxTargetInfo<RISCV??TargetInfo> to ensure that the
proper OS-specific defines are present.
This patch only adds logic to instantiate LinuxTargetInfo and leaves a TODO,
as I'm reluctant to add logic for other targets (e.g. FreeBSD, RTEMS) until
I've produced and tested at least one binary for that OS+target combo.
Thanks to @mgrang to reporting the issue.
llvm-svn: 324170
Diffstat (limited to 'clang/lib/Basic')
| -rw-r--r-- | clang/lib/Basic/Targets.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 931b8afb69a..a845a4c3fbe 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -372,8 +372,14 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple, return new AMDGPUTargetInfo(Triple, Opts); case llvm::Triple::riscv32: + // TODO: add cases for FreeBSD, NetBSD, RTEMS once tested. + if (os == llvm::Triple::Linux) + return new LinuxTargetInfo<RISCV32TargetInfo>(Triple, Opts); return new RISCV32TargetInfo(Triple, Opts); case llvm::Triple::riscv64: + // TODO: add cases for FreeBSD, NetBSD, RTEMS once tested. + if (os == llvm::Triple::Linux) + return new LinuxTargetInfo<RISCV64TargetInfo>(Triple, Opts); return new RISCV64TargetInfo(Triple, Opts); case llvm::Triple::sparc: |

