Questions tagged [gcc-plugins]

For Q/A relating to the GCC (Gnu compiler collection) plugins. This API allows you access to internals of the compiler to perform analysis and code modifications via modules loaded at runtime. Question on general use of the plugins are fine, such as how to pass arguments. The tag is NOT for creating other application plugins which are compiling with gcc.

For Q/A relating to the GCC (Gnu compiler collection) plugins. This API allows you access to internals of the compiler to perform analysis and code modifications via modules loaded at runtime. Question on general use of the plugins are fine, such as how to pass arguments. The tag is NOT for creating other application plugins which are compiling with gcc.

Selected online resources

50 questions
1
vote
1 answer

GCC pass registration - opt_pass undefined symbol

I'm trying to register a pass in my gcc plugin code. To do so, I first declare the my_first_pass class which derives from gimple_opt_pass and, in turn, this class derives from opt_pass and so on... class my_first_pass : public gimple_opt_pass { …
JonAlmos
  • 31
  • 5
1
vote
1 answer

gcc plugins with arm64 cross compiler : cannot open shared object file

I am trying to compute the sizes of each struct at compile time using a gcc plugin. Searching, I came across this article. I tried it out on a test program below with my native x64 gcc compiler and got the following results. #include…
user277465
1
vote
1 answer

How to save a tree in gcc intermediate representation? Is it possible?

I want to save a tree (specifically the type of a tree) in a file in binary form, and I need to load this tree in other compilation unit. For example: I have a main.c with 2 function: myTypeStruct getWhatever(){ myTypeStruct my; ...…
Jordy Baylac
  • 510
  • 6
  • 18
1
vote
1 answer

Building GCC plugins on Mac OS X 10.9.4

I am trying to re-build a simple GCC plugin (which builds fine on GNU Linux). I am intending to compile the plugin using GNU GCC v4.6.3 which I have already installed under Mac OS X. The Makefile contents are given…
Shahzad
  • 1,999
  • 6
  • 35
  • 44
1
vote
2 answers

Are there any mingw-w64 builds that supports GCC plugins?

I've been using builds from mingw-builds on windows for a long time, but I'd like to experiment with GCC plugins, which is not supported by mingw-builds project. So I tried searching for some other builds that support it, but couldn't find any. Is…
user2102508
  • 1,009
  • 11
  • 23
1
vote
1 answer

Gcc: adding automatic debug information during compilation

I was asked to implement a kind of gcc plug-in. Basically what I have to do is to add some debugging code in order to add debugging information to the written code. Let's use an example in order to explain what I need. Suppose we have the following…
pafede2
  • 1,626
  • 4
  • 23
  • 40
1
vote
2 answers

Problems with building the gcc plugin

I am trying to build the simple gcc plugin. I am a newbie, but I want to implement more complicated plugins in the future. I read a lot of manuals, and it seems that I did everything right, but something is wrong. I can't build it. Every time I try…
Lucky Man
  • 1,488
  • 3
  • 19
  • 41
1
vote
1 answer

gcc plugin c c++ find global nonstatic variables

i've been playing around with the gcc 4.6 plugin api. For convenience i use a python wrapper/plugin for the api. My goal ist to find the declarations of all variables with: global scope and not const and not static (means exported or visible) in…
1
vote
1 answer

GCC plugin: 'internal compiler error' in passes.c

I have been writing a GCC inter procedural plugin where I have to insert GIMPLE statements at certain points in the program. After this I perform a data flow analysis on the complete program. When I am done with my analysis I am removing those newly…
vinme
  • 11
  • 1
0
votes
1 answer

GCC plugin with method was declared inside class

I am developing an GCC plugin to process AST in SSA form. I create a callback run everytime after SSA form of function was compiled. Here is my code char* get_name_node(tree node) { // return string represent node name } void…
kiennt
  • 1,514
  • 2
  • 14
  • 13
0
votes
1 answer

How to compile gcc-plugin to generate shared object file?

I have installed gcc-plugin in my Ubuntu 16.10-32 bit and the installation have been done correctly: >$ gcc -print-file-name=plugin /usr/lib/gcc/i686-linux-gnu/6/plugin However, when I try to compile the plugin, I get a huge amount of errors,…
0
votes
1 answer

GCC plugins API : Gimple pass

I've been looking into online resources on writing GCC plugins. I'm currently using GCC version 7.3.0. I attempted writing a simple plugin that contained a callback which would be called upon PLUGIN_FINISH_TYPE. It worked fine. Next, I'm trying to…
learnlearnlearn
  • 946
  • 1
  • 8
  • 16
0
votes
1 answer

GCC Compiler, Plugins and structures

I have scenario like this: int open_ext2 () {} int close_ext2 () {} int read_ext2 () {} int write_ext2 () {} const struct fs_callbacks FS = { open_file: open_ext2, close_file: close_ext2, read_bytes: read_ext2, write_bytes:…
Markus
  • 21
  • 1
  • 4
0
votes
0 answers

Adding a gcc plugin to a cmake project

I want to add a gcc plugin to my cmake project. The solution should satisfy the following: The gcc plugin should be pulled from a git repository (I can use external project for this) Everything that is not the gcc plugin should automatically…
tohava
  • 5,344
  • 1
  • 25
  • 47
0
votes
1 answer

Get class annotation using gcc plugins

I am creating a gcc plugin that analyse a C++ file after parsing it. The plugin walks through the classes and generate some information about them. The plug-in is working, this is how I walk through classes. cp_binding_level*…
Othman Benchekroun
  • 1,998
  • 2
  • 17
  • 36