Page http://gcc.gnu.org/readings.html links to "GNU C Compiler Internals
(Wikibook)" http://en.wikibooks.org/wiki/GNU_C_Compiler_Internals , which in
turn links to: "GNU C Compiler Internals/GEM Framework 4 1"
http://en.wikibooks.org/wiki/GNU_C_Compiler_Internals/GEM_Framework_4_1 .

On that page, it says (in part) this:

GEM framework is designed to facilitate development of compiler extensions.

GEM defines a number of hooks throughout GCC's source code. It is implemented
as a patch to GCC. With GEM, a compiler extension is developed as a stand-alone
program. It is compiled into a dynamically-linked module which is specified as
the command line argument when GCC is invoked. GCC loads the module and calls
its initialization function. The module then registers its hooks that are
call-back functions in GCC.

In addition to the compiler hooks, GEM provides macros and functions that
simplify extension development. The current version of GEM defines a set of
hooks in the preprocessor, the AST, and the assembly code generation components
of GCC. 

The wiki links to http://www.ecsl.cs.sunysb.edu/gem/ which provides
http://www.ecsl.cs.sunysb.edu/gem/gem-1.7.tar.gz - the subject of this patch
enhancement.

Using GEM and DIRA you can protect your code against attacks (and presumably
any other crashes) similar to SSP or Mudflaps. GEM with DIRA claims to only
slow down the code it is used on some 20-50% (better than most other methods).

What is really great is that it can: "First, the memory state of the program is
restored to a pre-attack state. Second, a proper restart point is chosen and
the control is transferred to that point."

This allows your program to rollback and restart.

Imagine you are using an editor and saving your work. A fatal error occurs and
crashes the program poping up an (otherwise) annoying little window. Now after
you dismiss the message your program will simply continue. TRUE, if you do
_exactly_ the same thing again you might well expect the same result. 

What if you copied the text to the clipboard and pasted it into another editor,
then saved it - that is not the same as you did before, thus the result should
be different (IE: you can save your text, exit the program and re-install a
prior version if you wish).

Programs (and programmers) that went the extra mile (instead of simply adding a
compiler switch to the build) could write two subroutines (or different
methods) and when the crash occurred you could rollback and the program could
try the alternate routine for you.

No more ICE errors (in _end_ products, we still want bug-reports for GCC so we
can improve it :) ), the optimizers can backtrack to where the were last
successful and continue on a different path.

---

Currently GEM only supports GCC 3.4.1 and 4.1.0 so I made some patches for:

GCC 4.1.1 release revision 114100

GCC 4.2.1 Mon May 21 14:05:54 UTC 2007 (revision 124902)

GCC 4.3.0 Tue May 22 09:28:18 UTC 2007 (revision 124940)

I propose it would be a great idea to incorporate GEM into GCC. GEM alone does
not cause a significant speed penalty on GCC. (The DIRA loadable module can
make code run 20-50% slower _if_ it is loaded).

I am posting a note to [EMAIL PROTECTED] and enclosing the patches here:


-- 
           Summary: Patch: Add GCC Extension Modules (GEM) to 4.1.1 4.2.1
                    4.3.0
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rob1weld at aol dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32051

Reply via email to