[lkml]   [2021]   [Feb]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject答复: [PATCH] recordmcount: use w8 to read re lp->r info in arm64 is fake mcount

There is no problem when I use aarch64_be(gcc v10.2). Because gcc v10.2 use __patchable_function_entries
instead of __mcount. I am not sure when the change happened.

Chen Jun

发件人: Chen Jun []
发送时间: 2021年2月22日 21:59
抄送:;;; Xiangrui (Euler) <>
主题: [PATCH] recordmcount: use w8 to read relp->r_info in arm64_is_fake_mcount

On little endian system, Use aarch64_be(gcc v7.3) downloaded from to build image with CONFIG_CPU_BIG_ENDIAN = y, CONFIG_FTRACE = y, CONFIG_DYNAMIC_FTRACE = y.

gcc will create symbols of _mcount but recordmcount can not create mcount_loc for *.o.
aarch64_be-linux-gnu-objdump -r fs/namei.o | grep mcount
00000000000000d0 R_AARCH64_CALL26 _mcount ...
0000000000007190 R_AARCH64_CALL26 _mcount

The reason is than funciton arm64_is_fake_mcount can not work correctly.
A symbol of _mcount in *.o compiled with big endian compiler likes:
00 00 00 2d 00 00 01 1b
w(rp->r_info) will return 0x2d instead of 0x011b. Because w() takes uint32_t as parameter, which truncates rp->r_info.

Use w8() instead w() to read relp->r_info

Fixes: ea0eada45632 ("recordmcount: only record relocation of type R_AARCH64_CALL26 on arm64.")
Signed-off-by: Chen Jun <>
scripts/recordmcount.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c index b9c2ee7ab43f..cce12e1971d8 100644
--- a/scripts/recordmcount.c
+++ b/scripts/recordmcount.c
@@ -438,7 +438,7 @@ static int arm_is_fake_mcount(Elf32_Rel const *rp)

static int arm64_is_fake_mcount(Elf64_Rel const *rp) {
- return ELF64_R_TYPE(w(rp->r_info)) != R_AARCH64_CALL26;
+ return ELF64_R_TYPE(w8(rp->r_info)) != R_AARCH64_CALL26;

/* 64-bit EM_MIPS has weird ELF64_Rela.r_info.
 \ /
  Last update: 2021-02-22 16:52    [W:0.054 / U:1.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site