[PATCH] D98881: [RISCV] Fix mcount name
Nathan Chancellor via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 23 15:41:44 PDT 2021
nathanchance updated this revision to Diff 332811.
nathanchance retitled this revision from "[RISCV] Fix mcount name for Linux" to "[RISCV] Fix mcount name".
nathanchance edited the summary of this revision.
nathanchance added a comment.
Herald added subscribers: frasercrmck, apazos, jocewei, the_o, brucehoult, MartinMosbeck, edward-jones, zzheng, MaskRay, niosHD, sabuasal, johnrusso, rbar.
- Hoist MCountName assignment into RISCVTargetInfo
- Prevent MCountName from getting assigned in FreeBSD and OpenBSD targets
- Add more tests
I did not update Fuchsia or any other operating systems because it appears that the only supported configurations from GCC are -elf, -linux, -rtems, and -freebsd so I figured it was wise to only influence those. If anyone disagrees, let me know and I can update this.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D98881/new/
https://reviews.llvm.org/D98881
Files:
clang/lib/Basic/Targets/OSTargets.h
clang/lib/Basic/Targets/RISCV.h
clang/test/CodeGen/mcount.c
Index: clang/test/CodeGen/mcount.c
===================================================================
--- clang/test/CodeGen/mcount.c
+++ clang/test/CodeGen/mcount.c
@@ -12,6 +12,15 @@
// RUN: %clang_cc1 -pg -triple mipsel-unknown-gnu-linux -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
// RUN: %clang_cc1 -pg -triple mips64-unknown-gnu-linux -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
// RUN: %clang_cc1 -pg -triple mips64el-unknown-gnu-linux -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
+// RUN: %clang_cc1 -pg -triple riscv32 -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
+// RUN: %clang_cc1 -pg -triple riscv64 -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
+// RUN: %clang_cc1 -pg -triple riscv32-elf -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
+// RUN: %clang_cc1 -pg -triple riscv64-elf -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
+// RUN: %clang_cc1 -pg -triple riscv32-linux -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
+// RUN: %clang_cc1 -pg -triple riscv64-linux -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
+// RUN: %clang_cc1 -pg -triple riscv64-freebsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
+// RUN: %clang_cc1 -pg -triple riscv64-freebsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
+// RUN: %clang_cc1 -pg -triple riscv64-openbsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
// RUN: %clang_cc1 -pg -triple powerpc-netbsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
// RUN: %clang_cc1 -pg -triple powerpc64-netbsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
// RUN: %clang_cc1 -pg -triple powerpc64le-netbsd -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
Index: clang/lib/Basic/Targets/RISCV.h
===================================================================
--- clang/lib/Basic/Targets/RISCV.h
+++ clang/lib/Basic/Targets/RISCV.h
@@ -59,6 +59,7 @@
WCharType = SignedInt;
WIntType = UnsignedInt;
HasRISCVVTypes = true;
+ MCountName = "_mcount";
}
bool setCPU(const std::string &Name) override {
Index: clang/lib/Basic/Targets/OSTargets.h
===================================================================
--- clang/lib/Basic/Targets/OSTargets.h
+++ clang/lib/Basic/Targets/OSTargets.h
@@ -261,6 +261,9 @@
case llvm::Triple::arm:
this->MCountName = "__mcount";
break;
+ case llvm::Triple::riscv32:
+ case llvm::Triple::riscv64:
+ break;
}
}
};
@@ -491,6 +494,9 @@
case llvm::Triple::sparcv9:
this->MCountName = "_mcount";
break;
+ case llvm::Triple::riscv32:
+ case llvm::Triple::riscv64:
+ break;
}
}
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98881.332811.patch
Type: text/x-patch
Size: 3028 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210323/25b387f6/attachment-0001.bin>
More information about the cfe-commits
mailing list