RE: gcc question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Florian,

Yes, understood the point. I would have to "not using -fPIC" if I could not found any way out. 
Anyway if I willing to change the asm function to change the constraint to something different from "i" (immediate), I wonder if the question is still proper.

Regards,
Hon 

 0:static __always_inline bool arch_static_branch(struct static_key *key, bool branch) {
 1:	asm_volatile_goto("1:"
 2:		".byte " __stringify(STATIC_KEY_INIT_NOP) "\n\t"
 3:		".pushsection __jump_table,  \"aw\" \n\t"
 4:		_ASM_ALIGN "\n\t"
 5:		_ASM_PTR "1b, %l[l_yes], %c0 + %c1 \n\t"
 6:		".popsection \n\t"
 7:		: :  "i" (key),  "i" (branch) : : l_yes);
 8:
 9:	return false;
10:l_yes:
11:	return true;
}

-----Original Message-----
From: Florian Weimer <fweimer@xxxxxxxxxx> 
Sent: Monday, September 13, 2021 12:23 PM
To: HON LUU <hon@xxxxxxxxxxxxxxxx>
Cc: Segher Boessenkool <segher@xxxxxxxxxxxxxxxxxxx>; gcc-help@xxxxxxxxxxx
Subject: Re: gcc question

* HON LUU:

> + Another interesting note is:
>     + if I remove -fPIC from user space gcc command, then the code compile successfully. However -fPIC is the must for my project.

arch_static_branch is useable in the kernel (or kernel modules), but the kernel cannot be compiled with -fPIC.  So you have to stop using one thing or the other.

This isn't really a GCC question, is more about the kernel build system.

Thanks,
Florian





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux