Skip to contentSkip to conversation

Setting the section for a function with SmPL

Cocci SF Markus Elfring 2 participants 4 messages Nov 2, 2017 – Nov 6, 2017

lore
Share & tools
lore
#0 lore raw

Hello,

Implementations of various functions will be changed on demand. It can happen then that you would like to know if the applied changes will result also in differences for the generated code.

Development tools like ?size? can display some information for such a comparison. The total size display might be occasionally not so useful. I imagine that it can help to split a default section configuration into smaller parts.
https://gcc.gnu.org/onlinedocs/gcc-7.2.0/gcc/Common-Function-Attributes.html#index-section-function-attribute

I would like to append a corresponding attribute to a function signature by the means of the semantic patch language.

@section_specification@
type T;
@@
T rcar_pcie_enable_msi(...)
+ __attribute__((section ("my_update")))
{
...
}

Unfortunately, the software ?Coccinelle 1.0.6-00345-g2ca0befa? does not like such an approach so far.

elfring at Sonne:~/Projekte/Linux/next-patched> spatch ~/Projekte/Coccinelle/janitor/set_section1.cocci drivers/pci/host/pcie-rcar.c ?
plus: parse error:
File "/home/elfring/Projekte/Coccinelle/janitor/set_section1.cocci", line 6, column 1, charpos = 105
around = '{',
whole content = {

Can the software situation be improved anyhow for this use case?

Regards,
Markus

#1 lore raw
Quoted 11 lines · SF Markus Elfring

Hello,

Implementations of various functions will be changed on demand. It can happen then that you would like to know if the applied changes will result also in differences for the generated code.

Development tools like ?size? can display some information for such a comparison. The total size display might be occasionally not so useful. I imagine that it can help to split a default section configuration into smaller parts.
https://gcc.gnu.org/onlinedocs/gcc-7.2.0/gcc/Common-Function-Attributes.html#index-section-function-attribute

Quoted 8 lines

I would like to append a corresponding attribute to a function signature by the means of the semantic patch language.

@section_specification@
type T;
@@
T rcar_pcie_enable_msi(...)
+ __attribute__((section ("my_update")))

I don't see any evidence that kernel developers would welcome this change in this form. If you have evidence to the contrary, then I will look into it when time permits.

julia

Quoted 25 lines

{
...
}

Unfortunately, the software ?Coccinelle 1.0.6-00345-g2ca0befa? does not like such an approach so far.

elfring at Sonne:~/Projekte/Linux/next-patched> spatch ~/Projekte/Coccinelle/janitor/set_section1.cocci drivers/pci/host/pcie-rcar.c ?
plus: parse error:
File "/home/elfring/Projekte/Coccinelle/janitor/set_section1.cocci", line 6, column 1, charpos = 105
around = '{',
whole content = {

Can the software situation be improved anyhow for this use case?

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci at systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

#2 lore raw
Quoted 8 lines
Quoted 5 lines

@section_specification@
type T;
@@
T rcar_pcie_enable_msi(...)
+ __attribute__((section ("my_update")))

I don't see any evidence that kernel developers would welcome this change in this form.

There is no welcome needed by them because the shown addition would be nice for testing purposes.

I tried out if section specifications can be also supported by the semantic patch language.
Does such functionality fit into the Coccinelle software?

Regards,
Markus

#3 lore raw
Quoted 5 lines · SF Markus Elfring
Quoted 5 lines
Quoted 5 lines

@section_specification@
type T;
@@
T rcar_pcie_enable_msi(...)
+ __attribute__((section ("my_update")))

This works now. It should have worked before, but the change was done incompletely.

julia