This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: Fix builtins/string-asm[12].c failures for __USER_LABEL_PREFIX__ != "" (Was: static-after-extern tests vs. mips explicit relocs)


Richard Henderson wrote:
> 
> On Wed, May 14, 2003 at 08:44:58PM +0100, Joern Rennecke wrote:
> > gcc:
> >       * c-decl.c (finish_decl): When setting the DECL_ASSEMBLER_NAME
> >       of a function using ASMSPEC, prepend a star.
> 
> I suspect we need a similar change somewhere in the C++ front end.

The C++ front end does not implement changing the assembler name in
re-declarations.
cp/decl.c:cp_finish_decl calls cp/decl.c:make_rtl_for_nonlocal_decl.
cp/decl.c:make_rtl_for_nonlocal_decl gives variables the raw asmspec
(i.e. they are missing the star to protect them from munging by
 assemble_name), then it calls toplev.c:rest_of_decl_compilation or
varasm.c:make_decl_rtl; toplev.c:rest_of_decl_compilation calls
varasm.c:make_decl_rtl, which in turn interprets an already set
DECL_RTL as indication that we are processing a redeclaration, and will
then ignore asmspec.
For functions and other non-variable declarations,
cp/decl.c:make_rtl_for_nonlocal_decl calls rest_of_decl_compilation,
so that varasm.c:make_decl_rtl will use the asmspec if this is the
first definition, but not if it is a redefinition.

AFAICS there is no code involved that would handle changing the
DECL_RTL of builtin functions.

So the first question is, is GNU C++ / Fortran etc supposed to change the
asm name of builtin functions when you change the asm name of their common
name?  I.e. the C / OBJC frontend changes the asm name of __builtin_memcpy,
which is also used for block moves, if you change the asm name for memcpy.
Should other front ends do the same?  If so, we shoud probably put that
handling of builtins into common code.
Also, should we change varasm.c:make_decl_rtl to use the asmspec even if
there is a pre-existing DECL_RTL, if the asmspec will change the name?
If we do that and also put handling for changing of the DECL_RTL of builtin
functions therem we can just call it from c-decl.c:make_decl_rtl to handle
the asmspec.
Otherwise, we'll be able to and have to decide on and code the handling
of this extension in every frontend on a case-by-case basis.

-- 
--------------------------
SuperH (UK) Ltd.
2410 Aztec West / Almondsbury / BRISTOL / BS32 4QX
T:+44 1454 465658


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]