Patchwork [PCH] Do not write/read asm_out_file

login
register
mail settings
Submitter Steven Bosscher
Date June 7, 2012, 5:58 p.m.
Message ID <CABu31nPAxbhe=F9OvCoszOEtBTsC0Vd6YmCUpn=0N+pV83fvgQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/163655/
State New
Headers show

Comments

Steven Bosscher - June 7, 2012, 5:58 p.m.
On Thu, Jun 7, 2012 at 7:52 PM, Richard Sandiford
<rdsandiford@googlemail.com> wrote:
> Steven Bosscher <stevenb.gcc@gmail.com> writes:
>> On Wed, Jun 6, 2012 at 7:15 PM, Paolo Bonzini <bonzini@gnu.org> wrote:
>>> Il 06/06/2012 09:15, Steven Bosscher ha scritto:
>>>> +    add_asm_printf ("%s\n\t.ascii \"%s\"\n",
>>>> +                 READONLY_DATA_SECTION_ASM_OP, string);
>>>> +  else
>>>
>>> Need to escape the string as in mips_output_ascii, of course. :(
>>
>> Well, I suppose so...
>> But I was wondering why mips writes out ident strings as ascii in the
>> first place.
>>
>> The GCC version string is output as .ident with "normal" quoting, but
>> a user #ident is printed out as a .ascii. It has been like that since
>> the initial revision (r297, more than 20 years ago). See example at
>> the bottom of this mail (some test case in the test suite, but I don't
>> remember which one).
>>
>> Shouldn't we just print out .ident for #ident? That would make things
>> a lot easier for me, at least :-)
>> Richard S.?
>
> Yeah, I think both the ASM_OUTPUT_ASCII and ASM_OUTPUT_IDENT definitions
> can go.  We only support GAS and ELF these days, and all MIPS configs
> need to include elfos.h.  Will be a few days before I have chance to
> test though.

Would it be OK for you if I change the MIPS specific parts of
http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00416.html to be as
follows:

 #ifndef MIPS_DEFAULT_GVALUE


I would test this with a mips-elf cross compiler on mips-sim.

Ciao!
Steven
Richard Sandiford - June 7, 2012, 6:02 p.m.
Steven Bosscher <stevenb.gcc@gmail.com> writes:
> On Thu, Jun 7, 2012 at 7:52 PM, Richard Sandiford
> <rdsandiford@googlemail.com> wrote:
>> Steven Bosscher <stevenb.gcc@gmail.com> writes:
>>> On Wed, Jun 6, 2012 at 7:15 PM, Paolo Bonzini <bonzini@gnu.org> wrote:
>>>> Il 06/06/2012 09:15, Steven Bosscher ha scritto:
>>>>> +    add_asm_printf ("%s\n\t.ascii \"%s\"\n",
>>>>> +                 READONLY_DATA_SECTION_ASM_OP, string);
>>>>> +  else
>>>>
>>>> Need to escape the string as in mips_output_ascii, of course. :(
>>>
>>> Well, I suppose so...
>>> But I was wondering why mips writes out ident strings as ascii in the
>>> first place.
>>>
>>> The GCC version string is output as .ident with "normal" quoting, but
>>> a user #ident is printed out as a .ascii. It has been like that since
>>> the initial revision (r297, more than 20 years ago). See example at
>>> the bottom of this mail (some test case in the test suite, but I don't
>>> remember which one).
>>>
>>> Shouldn't we just print out .ident for #ident? That would make things
>>> a lot easier for me, at least :-)
>>> Richard S.?
>>
>> Yeah, I think both the ASM_OUTPUT_ASCII and ASM_OUTPUT_IDENT definitions
>> can go.  We only support GAS and ELF these days, and all MIPS configs
>> need to include elfos.h.  Will be a few days before I have chance to
>> test though.
>
> Would it be OK for you if I change the MIPS specific parts of
> http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00416.html to be as
> follows:
>
> Index: config/mips/sde.h
> ===================================================================
> --- config/mips/sde.h   (revision 188182)
> +++ config/mips/sde.h   (working copy)
> @@ -97,17 +97,6 @@ along with GCC; see the file COPYING3.  If not see
>  /* Use periods rather than dollar signs in special g++ assembler names.  */
>  #define NO_DOLLAR_IN_LABEL
>
> -/* Attach a special .ident directive to the end of the file to identify
> -   the version of GCC which compiled this code.  */
> -#undef IDENT_ASM_OP
> -#define IDENT_ASM_OP "\t.ident\t"
> -
> -/* Output #ident string into the ELF .comment section, so it doesn't
> -   form part of the load image, and so that it can be stripped.  */
> -#undef ASM_OUTPUT_IDENT
> -#define ASM_OUTPUT_IDENT(STREAM, STRING) \
> -  fprintf (STREAM, "%s\"%s\"\n", IDENT_ASM_OP, STRING);
> -
>  /* Currently we don't support 128bit long doubles, so for now we force
>     n32 to be 64bit.  */
>  #undef LONG_DOUBLE_TYPE_SIZE
> Index: config/mips/mips.c
> ===================================================================
> --- config/mips/mips.c  (revision 188182)
> +++ config/mips/mips.c  (working copy)
> @@ -58,6 +58,7 @@ along with GCC; see the file COPYING3.  If not see
>  #include "diagnostic.h"
>  #include "target-globals.h"
>  #include "opts.h"
> +#include "cgraph.h"
>
>  /* True if X is an UNSPEC wrapper around a SYMBOL_REF or LABEL_REF.  */
>  #define UNSPEC_ADDRESS_P(X)                                    \
> @@ -3097,6 +3098,7 @@ mips_legitimize_move (enum machine_mode mode, rtx
>      }
>    return false;
>  }
> +
>  ^L
>  /* Return true if value X in context CONTEXT is a small-data address
>     that can be rewritten as a LO_SUM.  */
> Index: config/mips/mips.h
> ===================================================================
> --- config/mips/mips.h  (revision 188182)
> +++ config/mips/mips.h  (working copy)
> @@ -2674,15 +2674,6 @@ do {
>                          \
>  #undef ASM_OUTPUT_ASCII
>  #define ASM_OUTPUT_ASCII mips_output_ascii
>
> -/* Output #ident as a in the read-only data section.  */
> -#undef  ASM_OUTPUT_IDENT
> -#define ASM_OUTPUT_IDENT(FILE, STRING)                                 \
> -{                                                                      \
> -  const char *p = STRING;                                              \
> -  int size = strlen (p) + 1;                                           \
> -  switch_to_section (readonly_data_section);                           \
> -  assemble_string (p, size);                                           \
> -}
>  ^L
>  /* Default to -G 8 */
>  #ifndef MIPS_DEFAULT_GVALUE
>
>
> I would test this with a mips-elf cross compiler on mips-sim.

Not sure I understand the mips.c bit, but everything else looks good,
thanks.

Richard

Patch

Index: config/mips/sde.h
===================================================================
--- config/mips/sde.h   (revision 188182)
+++ config/mips/sde.h   (working copy)
@@ -97,17 +97,6 @@  along with GCC; see the file COPYING3.  If not see
 /* Use periods rather than dollar signs in special g++ assembler names.  */
 #define NO_DOLLAR_IN_LABEL

-/* Attach a special .ident directive to the end of the file to identify
-   the version of GCC which compiled this code.  */
-#undef IDENT_ASM_OP
-#define IDENT_ASM_OP "\t.ident\t"
-
-/* Output #ident string into the ELF .comment section, so it doesn't
-   form part of the load image, and so that it can be stripped.  */
-#undef ASM_OUTPUT_IDENT
-#define ASM_OUTPUT_IDENT(STREAM, STRING) \
-  fprintf (STREAM, "%s\"%s\"\n", IDENT_ASM_OP, STRING);
-
 /* Currently we don't support 128bit long doubles, so for now we force
    n32 to be 64bit.  */
 #undef LONG_DOUBLE_TYPE_SIZE
Index: config/mips/mips.c
===================================================================
--- config/mips/mips.c  (revision 188182)
+++ config/mips/mips.c  (working copy)
@@ -58,6 +58,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "diagnostic.h"
 #include "target-globals.h"
 #include "opts.h"
+#include "cgraph.h"

 /* True if X is an UNSPEC wrapper around a SYMBOL_REF or LABEL_REF.  */
 #define UNSPEC_ADDRESS_P(X)                                    \
@@ -3097,6 +3098,7 @@  mips_legitimize_move (enum machine_mode mode, rtx
     }
   return false;
 }
+
 ^L
 /* Return true if value X in context CONTEXT is a small-data address
    that can be rewritten as a LO_SUM.  */
Index: config/mips/mips.h
===================================================================
--- config/mips/mips.h  (revision 188182)
+++ config/mips/mips.h  (working copy)
@@ -2674,15 +2674,6 @@  do {
                         \
 #undef ASM_OUTPUT_ASCII
 #define ASM_OUTPUT_ASCII mips_output_ascii

-/* Output #ident as a in the read-only data section.  */
-#undef  ASM_OUTPUT_IDENT
-#define ASM_OUTPUT_IDENT(FILE, STRING)                                 \
-{                                                                      \
-  const char *p = STRING;                                              \
-  int size = strlen (p) + 1;                                           \
-  switch_to_section (readonly_data_section);                           \
-  assemble_string (p, size);                                           \
-}
 ^L
 /* Default to -G 8 */