[PATCH] D22666: Frontend: Fix mcount inlining bug

Honggyu Kim via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 12 03:06:34 PDT 2016


honggyu.kim added a comment.

In https://reviews.llvm.org/D22666#513465, @compnerd wrote:

> No, the inserted character is a literal SOH, not the string "\01".


I don't know why the string is passed in a different way but '\01' is shown in IR previously as below

  $ clang -target armv7-unknown-none-eabi -pg -meabi gnu -S -emit-llvm -o - test-mcount.c
    ...
  define i32 @f() #0 {
    call void @"\01__gnu_mcount_nc"() #1
    ret i32 0
  }
    ...

But it doesn't show '\01' in IR with this modifiction.

  $ clang -target armv7-unknown-none-eabi -pg -meabi gnu -S -emit-llvm -o - test-mcount.c
    ...
  attributes #0 = { nounwind "counting-function"="__gnu_mcount_nc" ... }
    ...

The expected result is as follows. '\01' is clearly shown in IR.

  $ clang -target armv7-unknown-none-eabi -pg -meabi gnu -S -emit-llvm -o - test-mcount.c
    ...
  attributes #0 = { nounwind "counting-function"="\01__gnu_mcount_nc" ... }
    ...

Since I couldn't find why string passing is handled in a different way with previous version, I just put double backslash in "\\01__gnu_mcount_nc" because it generates the expected IR output. I know that we should have clear reason for this.
Do you have any idea why this problem happens?


https://reviews.llvm.org/D22666





More information about the cfe-commits mailing list