This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: `$' in identifiers -vs- PPC Linux
- To: Geoff Keating <geoffk at cygnus dot com>
- Subject: Re: `$' in identifiers -vs- PPC Linux
- From: Franz Sirl <Franz dot Sirl-kernel at lauterbach dot com>
- Date: Thu, 31 Aug 2000 22:07:46 +0200
- Cc: tromey at cygnus dot com,gcc-bugs at gcc dot gnu dot org,gcc-patches at gcc dot gnu dot org
- References: <Tom Tromey's message of "30 Aug 2000 15:25:22 -0600"> <87u2c2tpa5.fsf@creche.cygnus.com> <5.0.0.13.2.20000831143109.01f33ec0@mail.lauterbach.com>
On Thu, 31 Aug 2000, Franz Sirl wrote:
> At 02:58 31.08.00, Geoff Keating wrote:
> >Tom Tromey <tromey@cygnus.com> writes:
> > > Alexandre> I'm bitten by this problem on AIX 4.1, when compiling
> > > Alexandre> libgcj. It would be nice if g++ could somehow mangle `$'
> > > Alexandre> so as to accept it in source-code (even if with
> > > Alexandre> -fdollars-in-identifiers) even if the assembler can't
> > > Alexandre> accept them directly.
> > >
> > > Yes. For instance it could mangle them the way that gcj already
> > > mangles non-ASCII characters that are valid in Java identifiers.
> >
> >It'd be good to move this code into the language-independent parts of
> >the compiler, because it'll be needed even for C mangling of \u escapes
> >in identifiers.
> >
> >I also have no objection to moving DOLLARS_IN_IDENTIFIERS into aix.h
> >if someone wants to generate a patch. The native assembler on all the
> >ppc sysv stuff is GNU as, which should be OK with $, and it's probably
> >better to be consistent between linuxes.
>
> I can do this patch later today, reminds me that I wanted to move some
> other macros to aix.h stiil.
OK, here is the patch. Bootstrap still running, but I expect no problems
since problems should already show up during compile :-).
This closes the "move colliding macros from rs6000.h to platform headers" for
me.
The remaining collisions
STRICT_ALIGNMENT
STACK_BOUNDARY
BIGGEST_ALIGNMENT
ASM_OUTPUT_INT
SIZE_TYPE
make no real sense to move into aix.h IMHO.
The patch also syncs the ASM_APP_* macros for Linux on PPC and fixes the
CONSTRUCTOR handling in rs6000.c. Geoff, related to the CONSTRUCTOR handling
I also want to revive execute/20000516-1.c from CVS, this test is meant to
pass and is _different_ from execute/20000722-1.c. The test verifies that
CONSTRUCTOR data is put into a writeable section. I didn't notice yet that
you did remove it, but the removal was wrong.
OK to commit?
BTW, it seems gcc/stmt.c is seriously corrupted in CVS, but I don't know cvs
well enough to tell if this can be fixed from remote.
Franz.
2000-08-31 Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
* rs6000/rs6000.h (NO_DOLLAR_IN_LABEL, DOLLARS_IN_IDENTIFIERS,
ENCODE_SECTION_INFO, ASM_OUTPUT_SPECIAL_POOL_ENTRY_P): Move from
here...
* rs6000/aix.h: ...to here.
* rs6000/linux.h (ASM_APP_ON, ASM_APP_OFF): Define to Linux-style.
* rs6000/rs6000.c (rs6000_select_section): Handle CONSTRUCTOR.
(rs6000_unique_section): Likewise.
Index: aix.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/rs6000/aix.h,v
retrieving revision 1.7
diff -u -p -r1.7 aix.h
--- aix.h 2000/08/22 19:27:31 1.7
+++ aix.h 2000/08/31 19:30:42
@@ -50,6 +50,17 @@ Boston, MA 02111-1307, USA. */
#define FASCIST_ASSEMBLER
+/* We define this to prevent the name mangler from putting dollar signs into
+ function names. */
+
+#define NO_DOLLAR_IN_LABEL
+
+/* We define this to 0 so that gcc will never accept a dollar sign in a
+ variable name. This is needed because the AIX assembler will not accept
+ dollar signs. */
+
+#define DOLLARS_IN_IDENTIFIERS 0
+
/* AIX does not have any init/fini or ctor/dtor sections, so create
static constructors and destructors as normal functions. */
/* #define ASM_OUTPUT_CONSTRUCTOR(file, name) */
@@ -227,6 +238,30 @@ toc_section () \
} \
}
+/* Return non-zero if this entry is to be written into the constant
+ pool in a special way. We do so if this is a SYMBOL_REF, LABEL_REF
+ or a CONST containing one of them. If -mfp-in-toc (the default),
+ we also do this for floating-point constants. We actually can only
+ do this if the FP formats of the target and host machines are the
+ same, but we can't check that since not every file that uses
+ GO_IF_LEGITIMATE_ADDRESS_P includes real.h. We also do this when
+ we can write the entry into the TOC and the entry is not larger
+ than a TOC entry. */
+
+#define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \
+ (TARGET_TOC \
+ && (GET_CODE (X) == SYMBOL_REF \
+ || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
+ && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
+ || GET_CODE (X) == LABEL_REF \
+ || (GET_CODE (X) == CONST_INT \
+ && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \
+ || (GET_CODE (X) == CONST_DOUBLE \
+ && (TARGET_POWERPC64 \
+ || TARGET_MINIMAL_TOC \
+ || (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
+ && ! TARGET_NO_FP_IN_TOC)))))
+
/* Select section for constant in constant pool.
On RS/6000, all constants are in the private read-only data area.
@@ -239,6 +274,17 @@ toc_section () \
else \
read_only_private_data_section (); \
}
+
+/* If we are referencing a function that is static or is known to be
+ in this file, make the SYMBOL_REF special. We can use this to indicate
+ that we can branch to this function without emitting a no-op after the
+ call. Do not set this flag if the function is weakly defined. */
+
+#define ENCODE_SECTION_INFO(DECL) \
+ if (TREE_CODE (DECL) == FUNCTION_DECL \
+ && (TREE_ASM_WRITTEN (DECL) || ! TREE_PUBLIC (DECL)) \
+ && ! DECL_WEAK (DECL)) \
+ SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1;
/* Indicate that jump tables go in the text section. */
Index: linux.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/rs6000/linux.h,v
retrieving revision 1.19
diff -u -p -r1.19 linux.h
--- linux.h 2000/04/14 23:16:25 1.19
+++ linux.h 2000/08/31 19:30:42
@@ -54,6 +54,14 @@ Boston, MA 02111-1307, USA. */
#undef TARGET_VERSION
#define TARGET_VERSION fprintf (stderr, " (PowerPC GNU/Linux)");
+/* Override rs6000.h definition. */
+#undef ASM_APP_ON
+#define ASM_APP_ON "#APP\n"
+
+/* Override rs6000.h definition. */
+#undef ASM_APP_OFF
+#define ASM_APP_OFF "#NO_APP\n"
+
#undef DEFAULT_VTABLE_THUNKS
#ifndef USE_GNULIBC_1
#define DEFAULT_VTABLE_THUNKS 1
Index: rs6000.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.146
diff -u -p -r1.146 rs6000.c
--- rs6000.c 2000/08/24 20:31:35 1.146
+++ rs6000.c 2000/08/31 19:30:50
@@ -7391,6 +7391,11 @@ rs6000_select_section (decl, reloc)
&& DECL_INITIAL (decl)
&& DECL_INITIAL (decl) != error_mark_node
&& TREE_CONSTANT (DECL_INITIAL (decl)));
+ else if (TREE_CODE (decl) == CONSTRUCTOR)
+ readonly = (! (flag_pic && reloc)
+ && TREE_READONLY (decl)
+ && ! TREE_SIDE_EFFECTS (decl)
+ && TREE_CONSTANT (decl));
else
readonly = 1;
if (needs_sdata && rs6000_sdata != SDATA_EABI)
@@ -7447,6 +7452,11 @@ rs6000_unique_section (decl, reloc)
&& DECL_INITIAL (decl)
&& DECL_INITIAL (decl) != error_mark_node
&& TREE_CONSTANT (DECL_INITIAL (decl)));
+ else if (TREE_CODE (decl) == CONSTRUCTOR)
+ readonly = (! (flag_pic && reloc)
+ && TREE_READONLY (decl)
+ && ! TREE_SIDE_EFFECTS (decl)
+ && TREE_CONSTANT (decl));
else
readonly = 1;
if (needs_sdata && rs6000_sdata != SDATA_EABI)
Index: rs6000.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/rs6000/rs6000.h,v
retrieving revision 1.90
diff -u -p -r1.90 rs6000.h
--- rs6000.h 2000/08/14 05:59:50 1.90
+++ rs6000.h 2000/08/31 19:30:55
@@ -2327,17 +2327,6 @@ extern int rs6000_trunc_used;
the end of the line. */
#define ASM_COMMENT_START " #"
-/* We define this to prevent the name mangler from putting dollar signs into
- function names. */
-
-#define NO_DOLLAR_IN_LABEL
-
-/* We define this to 0 so that gcc will never accept a dollar sign in a
- variable name. This is needed because the AIX assembler will not accept
- dollar signs. */
-
-#define DOLLARS_IN_IDENTIFIERS 0
-
/* Implicit library calls should use memcpy, not bcopy, etc. */
#define TARGET_MEM_FUNCTIONS
@@ -2348,43 +2337,8 @@ extern int rs6000_trunc_used;
#define EXCEPTION_SECTION data_section
-/* If we are referencing a function that is static or is known to be
- in this file, make the SYMBOL_REF special. We can use this to indicate
- that we can branch to this function without emitting a no-op after the
- call. Do not set this flag if the function is weakly defined. */
-
-#define ENCODE_SECTION_INFO(DECL) \
- if (TREE_CODE (DECL) == FUNCTION_DECL \
- && (TREE_ASM_WRITTEN (DECL) || ! TREE_PUBLIC (DECL)) \
- && ! DECL_WEAK (DECL)) \
- SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1;
-
/* Flag to say the TOC is initialized */
extern int toc_initialized;
-
-/* Return non-zero if this entry is to be written into the constant
- pool in a special way. We do so if this is a SYMBOL_REF, LABEL_REF
- or a CONST containing one of them. If -mfp-in-toc (the default),
- we also do this for floating-point constants. We actually can only
- do this if the FP formats of the target and host machines are the
- same, but we can't check that since not every file that uses
- GO_IF_LEGITIMATE_ADDRESS_P includes real.h. We also do this when
- we can write the entry into the TOC and the entry is not larger
- than a TOC entry. */
-
-#define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \
- (TARGET_TOC \
- && (GET_CODE (X) == SYMBOL_REF \
- || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
- && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
- || GET_CODE (X) == LABEL_REF \
- || (GET_CODE (X) == CONST_INT \
- && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \
- || (GET_CODE (X) == CONST_DOUBLE \
- && (TARGET_POWERPC64 \
- || TARGET_MINIMAL_TOC \
- || (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
- && ! TARGET_NO_FP_IN_TOC)))))
/* Macro to output a special constant pool entry. Go to WIN if we output
it. Otherwise, it is written the usual way.