🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #51527

(none)

#51527
From: Elliot Stewart
Date: Mon, 17 May 1993 13:02
47 lines
2271 bytes
The following is the environment that I am using:
1)Sun SPARCstation ELC
2)Sun OS v4.1.3
3)GCC v1.42

I am trying to create my own library for GCC that will insert a procedure call
with no arguments at the begining of main().  The name of the procedure
call being inserted is "_prolog".  The following is the code I am using to
generate the procedure call:

/* code begin */        
void catch_prolog()
{  rtx first, pattern;

   for(first = get_insns(); (first != NULL) && (GET_CODE(first) == NOTE);
       first = NEXT_INSN(first));

   if(first == NULL)
      pfatal_with_name("Error -- empty function");
   else
   {  pattern = gen_rtx(CALL, VOIDmode,
                        gen_rtx(MEM, FUNCTION_MODE,
                                gen_rtx(SYMBOL_REF, SImode, "_prolog")),
                        const0_rtx);
      emit_call_insn_before(pattern, first);
   }
}
/* code end */

When I make GCC, my added library is accepted(no errors).  But when I try 
using GCC on a program, my inserted procedure call is not recognized.  Here
is a copy of the error I get when trying to compile a program called test1.c:

test1.c:11: The following insn was not recognizable:
(call_insn 51 4 40 (call (mem:SI (symbol_ref:SI ("_prolog")))
       (const_int 0)) -1 (nil)
   (nil))
gcc: Program cc1 got fatal signal 6.

           
How do I fix my inserted instruction so that it is recognizable?  Any help
would be greatly appreciated.  If more information is needed in order to 
clarify what I am doing, just ask.

Elliot Stewart
Center for Reliable and High Performance Computing
University of Illinois at Urbana-Champaign
Technical Details
Message-ID: <199305171252.AA09703@gershwin.crhc.uiuc.edu>
Path: arc1-ca.pugleaf.net!gmd.de!Germany.EU.net!mcsun!uunet!zaphod.mps.ohio-state.edu!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!crhc.uiuc.edu!stewart

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,4d77a915525af4bd,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-05-17 06:05:03 PST
Path: arc1-ca.pugleaf.net!gmd.de!Germany.EU.net!mcsun!uunet!zaphod.mps.ohio-state.edu!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!crhc.uiuc.edu!stewart
From: stewart@crhc.uiuc.edu (Elliot Stewart)
Newsgroups: gnu.gcc.help
Subject: (none)
Date: 17 May 1993 09:02:04 -0400
Organization: GNUs Not Usenet
Lines: 47
Sender: daemon@cis.ohio-state.edu
Distribution: gnu
Message-ID: <199305171252.AA09703@gershwin.crhc.uiuc.edu>