* GCC jump tables
@ 2023-08-08 2:59 Andrey Grodzovsky
2023-08-08 14:54 ` Segher Boessenkool
0 siblings, 1 reply; 5+ messages in thread
From: Andrey Grodzovsky @ 2023-08-08 2:59 UTC (permalink / raw)
To: gcc-help
[-- Attachment #1: Type: text/plain, Size: 356 bytes --]
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 ?
Thanks,
Andrey
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 3886 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GCC jump tables
2023-08-08 2:59 GCC jump tables Andrey Grodzovsky
@ 2023-08-08 14:54 ` Segher Boessenkool
2023-08-08 15:14 ` [External] " Andrey Grodzovsky
0 siblings, 1 reply; 5+ messages in thread
From: Segher Boessenkool @ 2023-08-08 14:54 UTC (permalink / raw)
To: Andrey Grodzovsky; +Cc: gcc-help
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? Or, let's
take a step back first: what exactly do you call a "jump table" here?
Segher
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [External] Re: GCC jump tables
2023-08-08 14:54 ` Segher Boessenkool
@ 2023-08-08 15:14 ` Andrey Grodzovsky
2023-08-08 20:48 ` Segher Boessenkool
0 siblings, 1 reply; 5+ messages in thread
From: Andrey Grodzovsky @ 2023-08-08 15:14 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: gcc-help
[-- Attachment #1: Type: text/plain, Size: 1441 bytes --]
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 #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 3886 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [External] Re: GCC jump tables
2023-08-08 15:14 ` [External] " Andrey Grodzovsky
@ 2023-08-08 20:48 ` Segher Boessenkool
2023-08-09 16:13 ` [External] " Andrey Grodzovsky
0 siblings, 1 reply; 5+ messages in thread
From: Segher Boessenkool @ 2023-08-08 20:48 UTC (permalink / raw)
To: Andrey Grodzovsky; +Cc: gcc-help
On Tue, Aug 08, 2023 at 11:14:02AM -0400, Andrey Grodzovsky wrote:
> On 2023-08-08 10:54, Segher Boessenkool wrote:
> >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
This is stuff that the Linux kernel does. Manually. The compiler has
nothing to do with it.
Segher
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [External] Re: [External] Re: GCC jump tables
2023-08-08 20:48 ` Segher Boessenkool
@ 2023-08-09 16:13 ` Andrey Grodzovsky
0 siblings, 0 replies; 5+ messages in thread
From: Andrey Grodzovsky @ 2023-08-09 16:13 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: gcc-help
[-- Attachment #1: Type: text/plain, Size: 1848 bytes --]
On 2023-08-08 16:48, Segher Boessenkool wrote:
> On Tue, Aug 08, 2023 at 11:14:02AM -0400, Andrey Grodzovsky wrote:
>> On 2023-08-08 10:54, Segher Boessenkool wrote:
>>> 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://urldefense.proofpoint.com/v2/url?u=https-3A__elixir.bootlin.com_linux_v5.15_source_mm_gup.c-23L1964&d=DwIDAw&c=aC52l5ychvsxSLm72twIgEW2BEeqYPY0uTQnrVZ6RBM&r=MPhNfvPJjusxPWFiIwhytlSBR8Vj8O1RcqwrEfh5BQ7jv0n8sh4iBBnJso-aIHAA&m=-_eY5Xylio3iSKZ0qoybyl-kdPuN3EDl1o7eQhcMEzkzScMNML1FGQrPEelgvGhT&s=prTAoPR06auK9EH2ixHIy5SdiVRW5y3jXXsjhaFdKgs&e=
>>
>>> 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
> This is stuff that the Linux kernel does. Manually. The compiler has
> nothing to do with it.
Yep, already found the needed flag to #undef to disable jump tables
emission - https://elixir.bootlin.com/linux/v5.15/source/arch/Kconfig#L48
Andrey
>
>
> Segher
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 3886 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-08-09 16:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-08 2:59 GCC jump tables Andrey Grodzovsky
2023-08-08 14:54 ` Segher Boessenkool
2023-08-08 15:14 ` [External] " Andrey Grodzovsky
2023-08-08 20:48 ` Segher Boessenkool
2023-08-09 16:13 ` [External] " Andrey Grodzovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).