Subject: Re: Shared library support for ARM ELF
To: Todd Vierling <firstname.lastname@example.org>
From: Ben Harris <email@example.com>
Date: 07/20/2001 17:35:15
On Fri, 20 Jul 2001, Todd Vierling wrote:
> On Fri, 20 Jul 2001, Ben Harris wrote:
> : > What else is required?
> : MASK_RETURN_ADDR needs to be changed to generate code to check what mode
> : the CPU is in at run-time and pick the correct mask appropriately.
> : sys/arch/arm/include/profile.h demonstrates how to do this, but it needs
> : to be converted to a form GCC can understand.
> The mask is needed when gcc is *compiling* code, so how would this be done
> at run-time? (Generation of code that does it on every return insn? Eek,
> that sounds like a significant overhead added to function calls....)
MASK_RETURN_ADDR is _not_ used for normal function return. The CPU is
quite capable of getting this right. If it weren't, I wouldn't be able to
run APCS-32 code on arm26 at all. Remember, we're already in the
situation where code compiled with -mapcs32 is good enough to go
multi-user on an arm26 system (which is no worse than -mapcs-26).
MASK_RETURN_ADDR is used in eh_outer_context(), which is called from
expand_builtin_extract_return_addr(), which is called from
expand_builtin() when compiling a call to __builtin_extract_return_addr(),
which in turn is called by get_return_addr() in libgcc, which is called by
throw_helper(), which is called by __throw() and __rethrow(), which
presumably do what they say.
So the extra three instructions are required once per stack frame when an
exception is thrown, and are part of libgcc, so the size of normal
compiled code won't change at all.
> Note I'm reading from your definition of "run-time" here that you are
> implying a program's run-time, not gcc's.
Indeed I am, since GCC MASK_RETURN_ADDR is already dependent on the target
Ben Harris <firstname.lastname@example.org>
Portmaster, NetBSD/arm26 <URL:http://www.netbsd.org/Ports/arm26/>