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: Target hook for ASM_FILE_END


Richard Sandiford <rsandifo@redhat.com> writes:

>
> Minor niggle, but how about guarding iris6_file_end with TARGET_IRIX6,
> just like the definition is?  Seems more self-documenting than an
> ATTRIBUTE_UNUSED directive.
>
> Also, something like:
>
>     #undef TARGET_ASM_FILE_END
>     #ifdef TARGET_IRIX6
>     static void iris6_file_end PARAMS ((void));
>     #define TARGET_ASM_FILE_END iris6_file_end
>     #else
>     #define TARGET_ASM_FILE_END mips_file_end
>     #endif
>
> (or whatever) would keep everything inside mips.c rather than
> polluting the header files with the names of static functions.
>
> Not really sure if that's better, just thought I'd ask.

Good idea, both - I'll incorporate them into the next revision.

> I think this counts as a bug fix ;).  Shouldn't the old code have
> been passing asm_out_file rather than "stream" to mips_asm_file_end()?
> "Stream" is the temporary file, and is closed by copy_file_data.

That's what I thought, but I couldn't prove it to myself.  I think
there's still a problem, though.

> Running:
>
>     $ cat foo.c
>     extern int x;
>     int f () { return x; }
>     $ gcc foo.c -O2 -mno-abicalls -G8 -S
>
> on irix before your patch, I get:
>
>     foo.c:3: fatal error: can't write to output file: Bad file number
>     compilation terminated.

Aha, that's how you do it.  I can confirm that that same test doesn't
cause a fatal error with my patch; however, the .s file looks wrong to
me.  Note where .LFE3 and the .end f line appear.

        #.file  1 "test.c"
        .set    nobopt
        .section .text,0x1,0x6,4,8
        .data
.LFE3:
        .end    f

        .extern x, 4

        .text
        .text
        .align  2
        .align  3
        .globl  f
        .ent    f
f:
.LFB3:
        .frame  $sp,0,$31               # vars= 0, regs= 0/0, args= 0, extra= 0
        .mask   0x00000000,0
        .fmask  0x00000000,0
        .set    noreorder
        .set    nomacro
        j       $31
        lw      $2,x
        .set    macro
        .set    reorder

I am looking into this.

zw


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