[PATCH] D22666: Frontend: Fix mcount inlining bug
Honggyu Kim via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 4 23:03:06 PDT 2016
honggyu.kim added a comment.
Hi Renato and Saleem,
I found one more testcase that has to be changed. It's in `llvm/tools/clang/test/Frontend/gnu-mcount.c`.
But strangely, some cases provide mcount name with prefix '\01' such as below:
class ARMTargetInfo : public TargetInfo {
...
public:
ARMTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts,
bool IsBigEndian)
: TargetInfo(Triple), FPMath(FP_Default), IsAAPCS(true), LDREX(0),
HW_FP(0) {
...
if (Triple.getOS() == llvm::Triple::Linux ||
Triple.getOS() == llvm::Triple::UnknownOS)
this->MCountName =
Opts.EABIVersion == "gnu" ? "\01__gnu_mcount_nc" : "\01mcount";
...
}
...
};
class AArch64TargetInfo : public TargetInfo {
...
AArch64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
: TargetInfo(Triple), ABI("aapcs") {
...
if (Triple.getOS() == llvm::Triple::Linux ||
Triple.getOS() == llvm::Triple::UnknownOS)
this->MCountName = Opts.EABIVersion == "gnu" ? "\01_mcount" : "mcount";
...
}
...
};
The modified testcase does not pass because of '\01' prefix. The following example is reduced version of the testcase.
$ cat test-mcount.c
// RUN: %clang -target armv7-unknown-none-eabi -pg -meabi gnu -S -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK -check-prefix CHECK-ARM-EABI-MEABI-GNU
int f() {
return 0;
}
// CHECK-LABEL: f
// CHECK-ARM-EABI-MEABI-GNU: attributes #{{[0-9]+}} = { {{.*}}"counting-function"="\01__gnu_mcount_nc"{{.*}} }
This is not passed only because of '\01' prefix. It seems that '\01' prefix is analyzed in a strange way when string match is performed by `llvm-lit`.
If I remove \01 prefix in MCountName in `llvm/tools/clang/test/Frontend/gnu-mcount.c` file and recompile it, then test it again, the testcase passes.
Can you please check why '\01' prefix is needed?
Related links:
https://llvm.org/bugs/show_bug.cgi?id=23969
https://llvm.org/bugs/show_bug.cgi?id=27311
https://reviews.llvm.org/D22666
More information about the cfe-commits
mailing list