Commit Graph

7 Commits

Author SHA1 Message Date
David Lamparter
08a73c422d lib/xref: work around GCC bug 41091
gcc fucks up global variables with section attributes when they're used
in templated C++ code.  The template instantiation "magic" kinda breaks
down (it's implemented through COMDAT in the linker, which clashes with
the section attribute.)

The workaround provides full runtime functionality, but the xref
extraction tool (xrelfo.py) won't work on C++ code compiled by GCC.

FWIW, clang gets this right.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-03 00:55:07 +01:00
David Lamparter
96a7061450 lib/xref: restore lost extern "C" beginning
The `}` is still there, but the `extern "C" {` got lost somewhere,
probably in a rebase...

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-03 00:54:59 +01:00
David Lamparter
01485adb9d lib/xref: add xrefs for install_element()
Combined with the DEFUN xrefs, this means we can extract the full CLI
tree from a binary file.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-01 17:28:11 +01:00
David Lamparter
feb06e7a93 lib/xref: add xrefs for DEFUNs
This allows grabbing a list of all DEFUNs and their help texts through
the xref extraction mechanics.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-01 17:28:11 +01:00
David Lamparter
131879fb92 lib/xref: add xrefs on zlog_* calls
This allows extracting a list of all log messages including their ECs
and autogenerated unique IDs for them.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-01 17:28:09 +01:00
David Lamparter
60a3efec24 lib/xref: use to transport thread_* file/line/func
Just a better way of doing what was previously the "debugargdef" macro.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-01 17:20:41 +01:00
David Lamparter
8e427c2938 lib: "xref" identifier infrastructure
This adds the machinery for cross reference points (hence "xref") for
things to be annotated with source code location or other metadata
and/or to be uniquely identified and found at runtime or by dissecting
executable files.

The extraction tool to walk down an ELF file is done and working but
needs some more cleanup and will be added in a separate commit.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-01 17:18:02 +01:00