HomePhabricator

[RISCV] Fix mcount name

Authored by nathanchance on Mar 23 2021, 3:16 PM.

Description

[RISCV] Fix mcount name

GCC's name for this symbol is _mcount, which the Linux kernel expects in
a few different place:

$ echo 'int main(void) { return 0; }' | riscv32-linux-gcc -c -pg -o tmp.o -x c -

$ llvm-objdump -dr tmp.o | grep mcount
                        0000000c:  R_RISCV_CALL _mcount

$ echo 'int main(void) { return 0; }' | riscv64-linux-gcc -c -pg -o tmp.o -x c -

$ llvm-objdump -dr tmp.o | grep mcount
                000000000000000c:  R_RISCV_CALL _mcount

$ echo 'int main(void) { return 0; }' | clang -c -pg -o tmp.o --target=riscv32-linux-gnu -x c -

$ llvm-objdump -dr tmp.o | grep mcount
                        0000000a:  R_RISCV_CALL_PLT     mcount

$ echo 'int main(void) { return 0; }' | clang -c -pg -o tmp.o --target=riscv64-linux-gnu -x c -

$ llvm-objdump -dr tmp.o | grep mcount
                000000000000000a:  R_RISCV_CALL_PLT     mcount

Set MCountName to "_mcount" in RISCVTargetInfo then prevent it from
getting overridden in certain OSTargetInfo constructors.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D98881

Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Details

Committed
nathanchanceMar 24 2021, 6:11 PM
Reviewer
MaskRay
Differential Revision
D98881: [RISCV] Fix mcount name
Parents
rGdd388ba3e0b0: [llvm-cov] Check path emptyness in path-equivalence after removing dots.
Branches
Unknown
Tags
Unknown