Building a custom kernel module fails with the error: modpost: "__show_free_areas".

Solution Verified - Updated -

Issue

  • Building a custom kernel module with the compilation flag EXTRA_CFLAGS += -O0 in the Makefile or by running the command make EXTRA_CFLAGS="-O0" fails with the following error message.
ERROR: modpost: "__show_free_areas" [/location/cbproxy.ko] undefined!
make[2]: *** [scripts/Makefile.modpost:128: /location/src/Module.symvers] Error 1

Environment

  • Red Hat Enterprise Linux 9.5
  • Third party module: cbproxy

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content