On 2023-08-08 10:54, Segher Boessenkool wrote:
Hi! On Mon, Aug 07, 2023 at 10:59:51PM -0400, Andrey Grodzovsky via Gcc-help wrote:Hello, question regarding jump tables - is there a way to totally disable their generation in C code ? I know -fno-jump-tables but it's only effective for switch cases, but still after compiling my code with this flag i see a jump table being generated due to some function call. Is there any way to totally prevent their creation ?For what other source code do you see jump tables generated?
It's calling any of the get_user_pages_remote, get_user_pages, put_page, mmap_read_lock, mmap_read_unlock function calls, I am calling them from within kernel module, they reside in the monolitic vmlinux kernel binary and are exported outside for kernel modules use. e.g. Definition of get_user_pages is here https://elixir.bootlin.com/linux/v5.15/source/mm/gup.c#L1964
Or, let's take a step back first: what exactly do you call a "jump table" here?
For me it would be anything that ends up creating a jump table entry in the ELF header or the resulting object file so this when
i run readelf -S on the .o file [20] __jump_table PROGBITS 0000000000000000 00001d00 [21] .rela__jump_table RELA 0000000000000000 0002aaf0 If i comment out those calls then the entries above disappear. Thanks, Andrey
Segher
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature