Communication problems when adding an S file to the Linux kernel

After answering the previous question: Adding a .S file to linux kernel code I was able to add a .S file to Linux kernel files. However, my .S file contains several sections that replace functions written in C. I commented on these functions and declared the replacement functions as global, but when I try to bind the kernel (using make), I get the following error:

arch/x86/kernel/vmlinux.lds:XXX: non constant or forward reference address expression for section .YYY

The original functions that I replaced were declared using: __attribute__ ((unused, __section__("YYY"))) notrace

Asm sections are declared using:

.text
.globl YYY

I also tried adding:

.type YYY,@function

I might have missed an ad somewhere, but I'm not sure where to look.

Any ideas?

+3
source share
2

YYY, .text,

.text

.section YYY,"ax"
+2

:

.text
.globl YYY

, "", "YYY" . .type , "YYY" - . , : , "YYY" , . , .section (.text - .section, "" ).

+1

Source: https://habr.com/ru/post/1777084/


All Articles