arch/arm64/kernel/entry-ftrace.S:238: undefined reference to `ftrace_graph_caller'
From: kbuild test robot
Date: Fri Dec 06 2019 - 02:09:41 EST
Hi Torsten,
FYI, the error/warning still remains.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b0d4beaa5a4b7d31070c41c2e50740304a3f1138
commit: 3b23e4991fb66f6d152f9055ede271a726ef9f21 arm64: implement ftrace with regs
date: 4 weeks ago
config: arm64-randconfig-a001-20191205 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 7.5.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 3b23e4991fb66f6d152f9055ede271a726ef9f21
# save the attached .config to linux build tree
GCC_VERSION=7.5.0 make.cross ARCH=arm64
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>
All errors (new ones prefixed by >>):
arch/arm64/kernel/entry-ftrace.o: In function `skip_ftrace_call':
>> arch/arm64/kernel/entry-ftrace.S:238: undefined reference to `ftrace_graph_caller'
arch/arm64/kernel/entry-ftrace.S:238:(.text+0x3c): relocation truncated to fit: R_AARCH64_CONDBR19 against undefined symbol `ftrace_graph_caller'
arch/arm64/kernel/entry-ftrace.S:243: undefined reference to `ftrace_graph_caller'
arch/arm64/kernel/entry-ftrace.S:243:(.text+0x54): relocation truncated to fit: R_AARCH64_CONDBR19 against undefined symbol `ftrace_graph_caller'
vim +238 arch/arm64/kernel/entry-ftrace.S
3b23e4991fb66f Torsten Duwe 2019-02-08 140
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 141 /*
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 142 * Gcc with -pg will put the following code in the beginning of each function:
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 143 * mov x0, x30
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 144 * bl _mcount
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 145 * [function's body ...]
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 146 * "bl _mcount" may be replaced to "bl ftrace_caller" or NOP if dynamic
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 147 * ftrace is enabled.
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 148 *
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 149 * Please note that x0 as an argument will not be used here because we can
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 150 * get lr(x30) of instrumented function at any time by winding up call stack
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 151 * as long as the kernel is compiled without -fomit-frame-pointer.
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 152 * (or CONFIG_FRAME_POINTER, this is forced on arm64)
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 153 *
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 154 * stack layout after mcount_enter in _mcount():
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 155 *
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 156 * current sp/fp => 0:+-----+
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 157 * in _mcount() | x29 | -> instrumented function's fp
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 158 * +-----+
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 159 * | x30 | -> _mcount()'s lr (= instrumented function's pc)
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 160 * old sp => +16:+-----+
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 161 * when instrumented | |
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 162 * function calls | ... |
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 163 * _mcount() | |
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 164 * | |
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 165 * instrumented => +xx:+-----+
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 166 * function's fp | x29 | -> parent's fp
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 167 * +-----+
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 168 * | x30 | -> instrumented function's lr (= parent's pc)
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 169 * +-----+
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 170 * | ... |
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 171 */
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 172
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 173 .macro mcount_enter
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 174 stp x29, x30, [sp, #-16]!
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 175 mov x29, sp
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 176 .endm
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 177
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 178 .macro mcount_exit
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 179 ldp x29, x30, [sp], #16
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 180 ret
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 181 .endm
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 182
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 183 .macro mcount_adjust_addr rd, rn
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 184 sub \rd, \rn, #AARCH64_INSN_SIZE
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 185 .endm
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 186
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 187 /* for instrumented function's parent */
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 188 .macro mcount_get_parent_fp reg
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 189 ldr \reg, [x29]
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 190 ldr \reg, [\reg]
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 191 .endm
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 192
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 193 /* for instrumented function */
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 194 .macro mcount_get_pc0 reg
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 195 mcount_adjust_addr \reg, x30
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 196 .endm
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 197
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 198 .macro mcount_get_pc reg
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 199 ldr \reg, [x29, #8]
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 200 mcount_adjust_addr \reg, \reg
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 201 .endm
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 202
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 203 .macro mcount_get_lr reg
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 204 ldr \reg, [x29]
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 205 ldr \reg, [\reg, #8]
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 206 .endm
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 207
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 208 .macro mcount_get_lr_addr reg
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 209 ldr \reg, [x29]
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 210 add \reg, \reg, #8
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 211 .endm
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 212
bd7d38dbdf356e AKASHI Takahiro 2014-04-30 213 #ifndef CONFIG_DYNAMIC_FTRACE
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 214 /*
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 215 * void _mcount(unsigned long return_address)
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 216 * @return_address: return address to instrumented function
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 217 *
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 218 * This function makes calls, if enabled, to:
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 219 * - tracer function to probe instrumented function's entry,
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 220 * - ftrace_graph_caller to set up an exit hook
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 221 */
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 222 ENTRY(_mcount)
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 223 mcount_enter
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 224
829d2bd1339220 Mark Rutland 2017-01-17 225 ldr_l x2, ftrace_trace_function
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 226 adr x0, ftrace_stub
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 227 cmp x0, x2 // if (ftrace_trace_function
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 228 b.eq skip_ftrace_call // != ftrace_stub) {
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 229
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 230 mcount_get_pc x0 // function's pc
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 231 mcount_get_lr x1 // function's lr (= parent's pc)
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 232 blr x2 // (*ftrace_trace_function)(pc, lr);
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 233
d125bffcefb290 Julien Thierry 2017-11-03 234 skip_ftrace_call: // }
d125bffcefb290 Julien Thierry 2017-11-03 235 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
829d2bd1339220 Mark Rutland 2017-01-17 236 ldr_l x2, ftrace_graph_return
f1ba46ee787d0a Ard Biesheuvel 2014-11-07 237 cmp x0, x2 // if ((ftrace_graph_return
f1ba46ee787d0a Ard Biesheuvel 2014-11-07 @238 b.ne ftrace_graph_caller // != ftrace_stub)
f1ba46ee787d0a Ard Biesheuvel 2014-11-07 239
829d2bd1339220 Mark Rutland 2017-01-17 240 ldr_l x2, ftrace_graph_entry // || (ftrace_graph_entry
829d2bd1339220 Mark Rutland 2017-01-17 241 adr_l x0, ftrace_graph_entry_stub // != ftrace_graph_entry_stub))
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 242 cmp x0, x2
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 243 b.ne ftrace_graph_caller // ftrace_graph_caller();
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 244 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
d125bffcefb290 Julien Thierry 2017-11-03 245 mcount_exit
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 246 ENDPROC(_mcount)
dbd3196299fe58 Mark Rutland 2018-12-07 247 EXPORT_SYMBOL(_mcount)
dbd3196299fe58 Mark Rutland 2018-12-07 248 NOKPROBE(_mcount)
819e50e25d0ce8 AKASHI Takahiro 2014-04-30 249
:::::: The code at line 238 was first introduced by commit
:::::: f1ba46ee787d0a880f884f401031315b0a777f25 arm64: ftrace: eliminate literal pool entries
:::::: TO: Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx>
:::::: CC: Will Deacon <will.deacon@xxxxxxx>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx Intel Corporation
Attachment:
.config.gz
Description: application/gzip