Skip to content

Commit 3d7fd14

Browse files
committed
LdScript,C,C++: make ref tag entries for sections in __attribute__((section("SECTION"))) found in C/C++ code
input.c: extern void f0 (void) __attribute__ ((section ("sec"))); tags: sec input-1.c \ /^extern void f0 (void) __attribute__ ((section ("sec")));$/;" \ kind:inputSection line:1 language:LdScript \ roles:destination Signed-off-by: Masatake YAMATO <[email protected]>
1 parent ce196a6 commit 3d7fd14

File tree

20 files changed

+188
-24
lines changed

20 files changed

+188
-24
lines changed

Tmain/list-roles.d/stdout-expected.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ Julia n/module imported on loaded by "import"
7272
Julia n/module namespace on only some symbols in it are imported
7373
Julia n/module used on loaded by "using"
7474
Kconfig k/kconfig source on kconfig file loaded with source directive
75+
LdScript i/inputSection destination on specified as the destination of code and data
7576
LdScript i/inputSection discarded on discarded when linking
7677
LdScript i/inputSection mapped on mapped to output section
7778
LdScript s/symbol entrypoint on entry points
@@ -204,6 +205,7 @@ Julia n/module imported on loaded by "import"
204205
Julia n/module namespace on only some symbols in it are imported
205206
Julia n/module used on loaded by "using"
206207
Kconfig k/kconfig source on kconfig file loaded with source directive
208+
LdScript i/inputSection destination on specified as the destination of code and data
207209
LdScript i/inputSection discarded on discarded when linking
208210
LdScript i/inputSection mapped on mapped to output section
209211
LdScript s/symbol entrypoint on entry points
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
--sort=no
2+
--kinds-C=+p
3+
--param-CPreProcessor._expand=1
4+
--fields-C=+{section}{macrodef}
5+
--fields=+S
6+
--fields=+rl
7+
--extras=+r
8+
--languages=-LdScript
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
f input.c /^char f [] __attribute__((section("__ksymtab_strings"), used, aligned(1)));$/;" v language:C typeref:typename:char[] roles:def section:__ksymtab_strings
2+
a input.c /^struct duart a __attribute__ ((section ("DUART_A"))) = { 0 };$/;" v language:C typeref:struct:duart roles:def section:DUART_A
3+
b input.c /^struct duart b __attribute__ ((section ("DUART_B"))) = { 0 };$/;" v language:C typeref:struct:duart roles:def section:DUART_B
4+
stack input.c /^char stack[10000] __attribute__ ((section ("STACK"))) = { 0 };$/;" v language:C typeref:typename:char[10000] roles:def section:STACK
5+
init_data input.c /^int init_data __attribute__ ((section ("INITDATA")));$/;" v language:C typeref:typename:int roles:def section:INITDATA
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* Variables */
2+
char f [] __attribute__((section("__ksymtab_strings"), used, aligned(1)));
3+
4+
/* Taken form gcc's info document. */
5+
struct duart a __attribute__ ((section ("DUART_A"))) = { 0 };
6+
struct duart b __attribute__ ((section ("DUART_B"))) = { 0 };
7+
char stack[10000] __attribute__ ((section ("STACK"))) = { 0 };
8+
int init_data __attribute__ ((section ("INITDATA")));

Units/parser-cxx.r/attribute-sections.cpp.d/args.ctags

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
--param-CPreProcessor._expand=1
44
--fields-C=+{section}{macrodef}
55
--fields=+S
6-
--fields=+r
6+
--fields=+rl
77
--extras=+r
Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,37 @@
1-
f input.c /^char f [] __attribute__((section("__ksymtab_strings"), used, aligned(1)));$/;" v typeref:typename:char[] roles:def section:__ksymtab_strings
2-
a input.c /^struct duart a __attribute__ ((section ("DUART_A"))) = { 0 };$/;" v typeref:struct:duart roles:def section:DUART_A
3-
b input.c /^struct duart b __attribute__ ((section ("DUART_B"))) = { 0 };$/;" v typeref:struct:duart roles:def section:DUART_B
4-
stack input.c /^char stack[10000] __attribute__ ((section ("STACK"))) = { 0 };$/;" v typeref:typename:char[10000] roles:def section:STACK
5-
init_data input.c /^int init_data __attribute__ ((section ("INITDATA")));$/;" v typeref:typename:int roles:def section:INITDATA
6-
COMMAND_LINE_SIZE input-0.c /^#define COMMAND_LINE_SIZE /;" d file: roles:def macrodef:127
7-
__section input-0.c /^#define __section(section) __attribute__((__section_/;" d file: signature:(section) roles:def macrodef:__attribute__((__section__(section)))
8-
__initdata input-0.c /^#define __initdata /;" d file: roles:def macrodef:__section(".init.data")
9-
b0 input-0.c /^char __initdata b0[COMMAND_LINE_SIZE];$/;" v typeref:typename:char[127] roles:def section:.init.data
10-
b1 input-0.c /^char b1[COMMAND_LINE_SIZE] __initdata;$/;" v typeref:typename:char[127] roles:def section:.init.data
11-
f0 input-1.c /^extern void f0 (void) __attribute__ ((section ("bar0p")));$/;" p typeref:typename:void file: signature:(void) roles:def section:bar0p
12-
f0 input-1.c /^void f0 (void) __attribute__ ((section ("bar0")))$/;" f typeref:typename:void signature:(void) roles:def section:bar0
13-
f1 input-1.c /^extern void __attribute__ ((section ("bar1p"))) f1 (void);$/;" p typeref:typename:void file: signature:(void) roles:def section:bar1p
14-
f1 input-1.c /^void __attribute__ ((section ("bar1"))) f1 (void)$/;" f typeref:typename:void signature:(void) roles:def section:bar1
15-
f2 input-1.c /^extern __attribute__ ((section ("bar2p"))) void f2 (void);$/;" p typeref:typename:void file: signature:(void) roles:def section:bar2p
16-
f2 input-1.c /^__attribute__ ((section ("bar2"))) void f2 (void)$/;" f typeref:typename:void signature:(void) roles:def section:bar2
17-
f3 input-1.c /^__attribute__ ((section ("bar3p"))) extern void f3 (void);$/;" p typeref:typename:void file: signature:(void) roles:def section:bar3p
18-
f3 input-1.c /^__attribute__ ((section ("bar3"))) extern void f3 (void)$/;" f typeref:typename:void signature:(void) roles:def section:bar3
19-
f4 input-1.c /^__attribute__ ((section ("bar4p"))) static void f4 (void);$/;" p typeref:typename:void file: signature:(void) roles:def section:bar4p
20-
f4 input-1.c /^__attribute__ ((section ("bar4"))) static void f4 (void)$/;" f typeref:typename:void file: signature:(void) roles:def section:bar4
1+
__ksymtab_strings input.c /^char f [] __attribute__((section("__ksymtab_strings"), used, aligned(1)));$/;" i language:LdScript roles:destination
2+
f input.c /^char f [] __attribute__((section("__ksymtab_strings"), used, aligned(1)));$/;" v language:C typeref:typename:char[] roles:def section:__ksymtab_strings
3+
DUART_A input.c /^struct duart a __attribute__ ((section ("DUART_A"))) = { 0 };$/;" i language:LdScript roles:destination
4+
a input.c /^struct duart a __attribute__ ((section ("DUART_A"))) = { 0 };$/;" v language:C typeref:struct:duart roles:def section:DUART_A
5+
DUART_B input.c /^struct duart b __attribute__ ((section ("DUART_B"))) = { 0 };$/;" i language:LdScript roles:destination
6+
b input.c /^struct duart b __attribute__ ((section ("DUART_B"))) = { 0 };$/;" v language:C typeref:struct:duart roles:def section:DUART_B
7+
STACK input.c /^char stack[10000] __attribute__ ((section ("STACK"))) = { 0 };$/;" i language:LdScript roles:destination
8+
stack input.c /^char stack[10000] __attribute__ ((section ("STACK"))) = { 0 };$/;" v language:C typeref:typename:char[10000] roles:def section:STACK
9+
INITDATA input.c /^int init_data __attribute__ ((section ("INITDATA")));$/;" i language:LdScript roles:destination
10+
init_data input.c /^int init_data __attribute__ ((section ("INITDATA")));$/;" v language:C typeref:typename:int roles:def section:INITDATA
11+
COMMAND_LINE_SIZE input-0.c /^#define COMMAND_LINE_SIZE /;" d language:C file: roles:def macrodef:127
12+
__section input-0.c /^#define __section(section) __attribute__((__section_/;" d language:C file: signature:(section) roles:def macrodef:__attribute__((__section__(section)))
13+
__initdata input-0.c /^#define __initdata /;" d language:C file: roles:def macrodef:__section(".init.data")
14+
.init.data input-0.c /^char __initdata b0[COMMAND_LINE_SIZE];$/;" i language:LdScript roles:destination
15+
b0 input-0.c /^char __initdata b0[COMMAND_LINE_SIZE];$/;" v language:C typeref:typename:char[127] roles:def section:.init.data
16+
.init.data input-0.c /^char b1[COMMAND_LINE_SIZE] __initdata;$/;" i language:LdScript roles:destination
17+
b1 input-0.c /^char b1[COMMAND_LINE_SIZE] __initdata;$/;" v language:C typeref:typename:char[127] roles:def section:.init.data
18+
bar0p input-1.c /^extern void f0 (void) __attribute__ ((section ("bar0p")));$/;" i language:LdScript roles:destination
19+
f0 input-1.c /^extern void f0 (void) __attribute__ ((section ("bar0p")));$/;" p language:C typeref:typename:void file: signature:(void) roles:def section:bar0p
20+
bar0 input-1.c /^{$/;" i language:LdScript roles:destination
21+
f0 input-1.c /^void f0 (void) __attribute__ ((section ("bar0")))$/;" f language:C typeref:typename:void signature:(void) roles:def section:bar0
22+
bar1p input-1.c /^extern void __attribute__ ((section ("bar1p"))) f1 (void);$/;" i language:LdScript roles:destination
23+
f1 input-1.c /^extern void __attribute__ ((section ("bar1p"))) f1 (void);$/;" p language:C typeref:typename:void file: signature:(void) roles:def section:bar1p
24+
bar1 input-1.c /^{$/;" i language:LdScript roles:destination
25+
f1 input-1.c /^void __attribute__ ((section ("bar1"))) f1 (void)$/;" f language:C typeref:typename:void signature:(void) roles:def section:bar1
26+
bar2p input-1.c /^extern __attribute__ ((section ("bar2p"))) void f2 (void);$/;" i language:LdScript roles:destination
27+
f2 input-1.c /^extern __attribute__ ((section ("bar2p"))) void f2 (void);$/;" p language:C typeref:typename:void file: signature:(void) roles:def section:bar2p
28+
bar2 input-1.c /^{$/;" i language:LdScript roles:destination
29+
f2 input-1.c /^__attribute__ ((section ("bar2"))) void f2 (void)$/;" f language:C typeref:typename:void signature:(void) roles:def section:bar2
30+
bar3p input-1.c /^__attribute__ ((section ("bar3p"))) extern void f3 (void);$/;" i language:LdScript roles:destination
31+
f3 input-1.c /^__attribute__ ((section ("bar3p"))) extern void f3 (void);$/;" p language:C typeref:typename:void file: signature:(void) roles:def section:bar3p
32+
bar3 input-1.c /^{$/;" i language:LdScript roles:destination
33+
f3 input-1.c /^__attribute__ ((section ("bar3"))) extern void f3 (void)$/;" f language:C typeref:typename:void signature:(void) roles:def section:bar3
34+
bar4p input-1.c /^__attribute__ ((section ("bar4p"))) static void f4 (void);$/;" i language:LdScript roles:destination
35+
f4 input-1.c /^__attribute__ ((section ("bar4p"))) static void f4 (void);$/;" p language:C typeref:typename:void file: signature:(void) roles:def section:bar4p
36+
bar4 input-1.c /^{$/;" i language:LdScript roles:destination
37+
f4 input-1.c /^__attribute__ ((section ("bar4"))) static void f4 (void)$/;" f language:C typeref:typename:void file: signature:(void) roles:def section:bar4

docs/man-pages.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Man pages
3030
ctags-lang-javascript(7) <man/ctags-lang-javascript.7.rst>
3131
ctags-lang-julia(7) <man/ctags-lang-julia.7.rst>
3232
ctags-lang-kconfig(7) <man/ctags-lang-kconfig.7.rst>
33+
ctags-lang-ldscript(7) <man/ctags-lang-ldscript.7.rst>
3334
ctags-lang-markdown(7) <man/ctags-lang-markdown.7.rst>
3435
ctags-lang-python(7) <man/ctags-lang-python.7.rst>
3536
ctags-lang-r(7) <man/ctags-lang-r.7.rst>

docs/man/ctags-lang-c++.7.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ Change since "0.0"
3535
SEE ALSO
3636
--------
3737
:ref:`ctags(1) <ctags(1)>`,
38+
:ref:`ctags-lang-ldscript(7) <ctags-lang-ldscript(7)>`,
3839
`The new C/C++ parser <https://docs.ctags.io/en/latest/parser-cxx.html>`_ (https://docs.ctags.io/en/latest/parser-cxx.html)

docs/man/ctags-lang-c.7.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ Change since "0.0"
3535
SEE ALSO
3636
--------
3737
:ref:`ctags(1) <ctags(1)>`,
38+
:ref:`ctags-lang-ldscript(7) <ctags-lang-ldscript(7)>`,
3839
`The new C/C++ parser <https://docs.ctags.io/en/latest/parser-cxx.html>`_ (https://docs.ctags.io/en/latest/parser-cxx.html)

docs/man/ctags-lang-cuda.7.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ Change since "0.0"
3232
SEE ALSO
3333
--------
3434
:ref:`ctags(1) <ctags(1)>`,
35+
:ref:`ctags-lang-ldscript(7) <ctags-lang-ldscript(7)>`,
3536
`The new C/C++ parser <https://docs.ctags.io/en/latest/parser-cxx.html>`_ (https://docs.ctags.io/en/latest/parser-cxx.html)

0 commit comments

Comments
 (0)