This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
INT_ASM_OP oddity
- To: gcc-patches at gcc dot gnu dot org
- Subject: INT_ASM_OP oddity
- From: Alexandre Oliva <aoliva at redhat dot com>
- Date: 02 Feb 2001 04:38:50 -0200
- Organization: GCC Team, Red Hat
I was surprised to find out that INT_ASM_OP is never used for
integers, only for pointers. So I thought I'd document this in at
least one place, and make it easier for non-32-bit targets to override
it. I thought about replacing all occurrences of INT_ASM_OP with
REF_ASM_OP or PTR_ASM_OP, but I found that to be too much of a hassle,
and there was a minor risk of breaking something. So I just made it
easier for targets to override INT_ASM_OP. It can now be done before
svr4.h is included.
While I was at it, I noticed the SH COFF configuration headers used a
different yet functionally equivalent implementation of
ASM_OUTPUT_CONSTRUCTOR/DESTRUCTOR macros, compared with those in
elfos.h. So I thought I'd copy the definition from elfos.h, just to
reduce the variation.
Ok to install?
Index: gcc/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* config/elfos.h (INT_ASM_OP): Don't define it if it's already
defined.
* config/sh/sh.h (INT_ASM_OP, ASM_OUTPUT_CONSTRUCTOR,
ASM_OUTPUT_DESTRUCTOR): Copy definitions from config/elfos.h.
Index: gcc/config/elfos.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/elfos.h,v
retrieving revision 1.24
diff -u -p -r1.24 elfos.h
--- gcc/config/elfos.h 2001/01/15 23:43:10 1.24
+++ gcc/config/elfos.h 2001/02/02 06:25:28
@@ -1,6 +1,7 @@
/* elfos.h -- operating system specific defines to be used when
targeting GCC for some generic ELF system
- Copyright (C) 1991, 1994, 1995, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1991, 1994, 1995, 1999, 2000, 2001
+ Free Software Foundation, Inc.
Based on svr4.h contributed by Ron Guilmette (rfg@netcom.com).
This file is part of GNU CC.
@@ -232,11 +233,17 @@ Boston, MA 02111-1307, USA. */
} \
while (0)
-/* This is the pseudo-op used to generate a 32-bit word of data with a
- specific value in some section. This is the same for all known svr4
- assemblers. */
+/* This is the pseudo-op used to generate a reference to a specific
+ symbol in some section. It is only used in machine-specific
+ configuration files, typically only in ASM_OUTPUT_CONSTRUCTOR and
+ ASM_OUTPUT_DESTRUCTOR. This is the same for all known svr4
+ assemblers, except those in targets that don't use 32-bit pointers.
+ Those should override INT_ASM_OP. Yes, the name of the macro is
+ misleading. */
+#ifndef INT_ASM_OP
#define INT_ASM_OP "\t.long\t"
+#endif
/* This is the pseudo-op used to generate a contiguous sequence of byte
values from a double-quoted string WITHOUT HAVING A TERMINATING NUL
Index: gcc/config/sh/sh.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/sh/sh.h,v
retrieving revision 1.95
diff -u -p -r1.95 sh.h
--- gcc/config/sh/sh.h 2001/01/11 17:15:13 1.95
+++ gcc/config/sh/sh.h 2001/02/02 06:25:29
@@ -1931,11 +1931,34 @@ dtors_section() \
#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
do { fprintf (FILE, ".section\t%s\n", NAME); } while (0)
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { ctors_section(); asm_fprintf((FILE),"\t.long\t%U%s\n", (NAME)); } while (0)
+/* This is the pseudo-op used to generate a reference to a specific
+ symbol in some section. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { dtors_section(); asm_fprintf((FILE),"\t.long\t%U%s\n", (NAME)); } while (0)
+#define INT_ASM_OP "\t.long\t"
+
+/* A C statement (sans semicolon) to output an
+ element in the table of global constructors. */
+#define ASM_OUTPUT_CONSTRUCTOR(FILE, NAME) \
+ do \
+ { \
+ ctors_section (); \
+ fprintf (FILE, "%s", INT_ASM_OP); \
+ assemble_name (FILE, NAME); \
+ fprintf (FILE, "\n"); \
+ } \
+ while (0)
+
+/* A C statement (sans semicolon) to output an
+ element in the table of global destructors. */
+#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
+ do \
+ { \
+ dtors_section (); \
+ fprintf (FILE, "%s", INT_ASM_OP); \
+ assemble_name (FILE, NAME); \
+ fprintf (FILE, "\n"); \
+ } \
+ while (0)
#undef DO_GLOBAL_CTORS_BODY
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me