Date: Wed, 20 Aug 1997 09:31:46 +1100 From: Bill Currie Subject: Re: Function Sizes In-reply-to: To: Eli Zaretskii , DJGPP , chirayu AT radiolink DOT net Message-id: <199708192136.JAA12610@teleng1.tait.co.nz gatekeeper.tait.co.nz> Organization: Tait Electronics Limited MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT References: <1 DOT 5 DOT 4 DOT 16 DOT 19970819170452 DOT 3547702e AT giasbga DOT vsnl DOT net DOT in> Comments: Authenticated sender is Precedence: bulk On 19 Aug 97 at 16:17, Eli Zaretskii wrote: > > On Tue, 19 Aug 1997, Chirayu Krishnappa wrote: > > > >aware that you cannot be always sure that it will work. Subtle > > >changes in compiler optimizations in some future release could > > >rearrange functions and break this trick altogether. > > > > But then we need some way to lock functions in a compatible (with future > > compiler versions) manner. This seems to be the only method. > > The only reliable way is to write the function in assembly. Not quite, you can also use the __attribute__((section)) method (gnu only of course) to put all code to be locked into a special section, use a special linker script to handle the new section correctly, and lock the whole section at once. The only problems are: gcc for djgpp isn't configured to allow section attributes. I have the patch for this, and gcc-2.8 should be configured correctly (I've sent the patch to the maintainers). Also gas-2.8.1 (and below) has a bug that causes problems with relocations for `call' instructions (I have the patch and 2.8.2 will have the fix). Bill -- Leave others their otherness.