Kernel module cross-compile: unrecognized command-line option ‘-mrecord-mcount’

Bug #2043384 reported by Michał Fita
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcc-12-cross (Ubuntu)
New
Undecided
Unassigned

Bug Description

I'm trying to build the external kernel module via cross-compilation for ARM64 on Ubuntu 23.04 and I'm getting following output w/error:

make -C /lib/modules/6.2.0-36-generic/build M=/home/user/Projekty/Opteran/platform_v4l2_driver modules
make[1]: Wejście do katalogu '/usr/src/linux-headers-6.2.0-36-generic'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1ubuntu1~23.04) 12.3.0
  You are using: aarch64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1ubuntu1~23.04) 12.3.0
  CC [M] /home/user/Projekty/Opteran/platform_v4l2_driver/ova-one.o
aarch64-linux-gnu-gcc-12: error: unrecognized command-line option ‘-mrecord-mcount’
make[2]: *** [scripts/Makefile.build:260: /home/user/Projekty/Opteran/platform_v4l2_driver/ova-one.o] Błąd 1
make[1]: *** [Makefile:2026: /home/user/Projekty/Opteran/platform_v4l2_driver] Błąd 2
make[1]: Opuszczenie katalogu '/usr/src/linux-headers-6.2.0-36-generic'
make: *** [Makefile:9: modules] Błąd 2

The key one being `unrecognized command-line option ‘-mrecord-mcount’`, what - according to Google - was a problem with some old <5 gcc. Why am I facing this today?

My invocation for the build process:

ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make

The `Makefile` I'm using:

obj-m := my-module.o

KERNELDIR ?= /lib/modules/$(shell uname -r)/build

all default: modules
install: modules_install

modules modules_install help clean:
 $(MAKE) -C $(KERNELDIR) M=$(shell pwd) $@

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.