'Unable to insert module in Ubuntu

I written simple hello world dynamic module for ubuntu, while inserting it I'm getting an error

insmod: ERROR: could not insert module pcd.ko: Invalid module format

when I check dmesg, I get this

module: x86/modules: Skipping invalid relocation target, existing value is nonzero for type 1, loc 00000000f1750993, val ffffffffc39162ea

I tried to check if version of kernel is same or not but they are same

xxxxxxx@xxxxxxx:~/workspace/ldd/custom_drivers/002pseudo_char_driver$ uname -r
5.13.0-35-generic
xxxxxx@xxxxxxxx:~/workspace/ldd/custom_drivers/002pseudo_char_driver$ modinfo pcd.ko
filename:       /home/xxxxxxx/workspace/ldd/custom_drivers/002pseudo_char_driver/pcd.ko
description:    A pseudo character driver
author:         xxxxxxx
license:        GPL
srcversion:     30261074162DBCAE996D8E0
depends:        
retpoline:      Y
name:           pcd
vermagic:       5.13.0-35-generic SMP mod_unload modversions 

so what is the problem and how to solve it?

this is Makefile I used

obj-m := pcd.o
ARCH=arm
CROSS_COMPILE=arm-linux-gnueabihf-
KERN_DIR=/home/xxxxxxx/workspace/ldd/source/linux_kernel4.19.94-ti-r42/
HOST_KERN_DIR = /lib/modules/$(shell uname -r)/build/

all:
        sudo make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KERN_DIR) M=$(shell pwd) modules
clean:
        sudo make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KERN_DIR) M=$(shell pwd) clean
help:
        sudo make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KERN_DIR) M=$(shell pwd) help
host:
        sudo make -C $(HOST_KERN_DIR) M=$(shell pwd) modules

to compile I entered

make host

result of uname -a

subhash@subhashHP:~/workspace/ldd/custom_drivers/002pseudo_char_driver$ uname -a
Linux subhashHP 5.13.0-35-generic #40~20.04.1-Ubuntu SMP Mon Mar 7 09:18:32 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source