ESSTRA Core intervenes in compilation and embeds information about all source and header files involved in compilation as metadata in the resulting binary file.
ESSTRA Core is being developed on Ubuntu 22.04 with GCC 11.4.0 installed on a x86_64 PC.
This version of ESSTRA Core has a feature to embed a list of the absolute paths of all source and header files involved in compilation into a binary file as metadata.
Note that the data formats and content of the metadata, as well as the input/output specifications of each tool, are tentative and may change in the future.
Before you build the GCC plugin, you have to install a package on your system. For Debian/Ubuntu, check the version of GCC first:
$ gcc --version
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
...
In this case, the major version is 11, so install the package named
gcc-11-plugin-dev
:
$ sudo apt install gcc-11-plugin-dev
After that, run make
in the top directory:
$ make
If no errors, a file named esstracore.so
is generated.
This is the GCC plugin "ESSTRA Core."
To install ESSTRA Core on your system, run the following command:
$ sudo make install
Then esstracore.so
is installed in /usr/local/share/esstra/
.
To use ESSTRA Core, specify the path of esstracore.so
using the option
-fplugin=
of gcc
or g++
.
For example, if you compile a source file helloworld.c
with gcc
and
generates a binary file helloworld
, type:
$ gcc -fplugin=/usr/local/share/esstra/esstracore.so helloworld.c -o helloworld
For a C++ source file helloworld.cpp
, type:
$ g++ -fplugin=/usr/local/share/esstra/esstracore.so helloworld.cpp -o helloworld
The generated binary file helloworld
has metadata embedded by ESSTRA Core.
Use ESSTRA Utility a to access metadata embedded in binary files.
Note that this does not affect the behavior of the binary file itself.
It might be annoying to specify the option -fplugin=
for every gcc
or
g++
.
In such case, you can take advantage of GCC's
Spec Files mechanism
which allows you to implicitly specify the default options of the compiler.
See the linked article for more information.
See the LICENSE file.