gcc question
HON LUU
hon@dreambigsemi.com
Mon Sep 13 19:40:53 GMT 2021
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@redhat.com>
Sent: Monday, September 13, 2021 12:23 PM
To: HON LUU <hon@dreambigsemi.com>
Cc: Segher Boessenkool <segher@kernel.crashing.org>; gcc-help@gcc.gnu.org
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
More information about the Gcc-help
mailing list