2

It is needed to gather the necessary information about the translation unit using the plugin for GCC and to modify AST on its base. I've already understood how to gather information. But I haven't understand yet how to modify AST before it's passed into CRT. Very little information is available on this subject. Tell me plese what should I read on this subject? Share thoughts, links.

Thank's.

P.S. I've already read everything on these links:

http://en.wikibooks.org/wiki/GNU_C_Compiler_Internals/Print_version http://developer.apple.com/library/mac/#documentation/DeveloperTools/gcc-4.2.1/gccint/index.html#Top

artless noise
  • 21,212
  • 6
  • 68
  • 105
niXman
  • 1,698
  • 3
  • 16
  • 40
  • Please, can an exact example of what do you want to modify. – osgx Aug 05 '11 at 21:42
  • On the base if the gathered information I need to create the rtti_extended table in the .data section of an executable file and integrate it with my code. – niXman Aug 06 '11 at 08:43

2 Answers2

1

The GCC test suite contains a basic examples of such modifications. See http://gcc.gnu.org/viewcvs/gcc/trunk/gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c and start_unit_plugin.c shows how to create a var. Unfortunately for more serious modifications the GCC source code are probably your best bet.

Holger Just
  • 52,918
  • 14
  • 115
  • 123
g_u_e_s_t
  • 11
  • 1
0

Are you tied to GCC for this endeavor? The ROSE compiler is built specifically for performing source-level modification, then handing the resulting code off to a backend compiler.

Phil Miller
  • 36,389
  • 13
  • 67
  • 90