On Sun, 2007-07-08 at 20:20 +0100, Pedro Alves wrote:
> Here goes the v2 of the seh giga macros.  Wear sunglasses.

Interesting stuff.

I've had little time to spend on this recently, but I've approached
things the other way. If I get far enough, then maybe both may meet.

I fiddled with gcc/config/arm/mingw32.h to put stuff around a function.
This is the difference obtained on a small example :

dannypc: {13} diff nullptr-before.s nullptr.s
12c12,18
<       .global main
---
>       .global main
>       @ ASM_DECLARE_FUNCTION_NAME a
>       .global _cegcc_main_data
> _cegcc_main_data:
>       .word 0 /* _cegcc_main_handler */
>       .word 0 /* _cegcc_main_size */
>       @ ASM_DECLARE_FUNCTION_NAME b
14a21
>       @ Yow prologue
39a47,49
>       @ ASM_DECLARE_FUNCTION_SIZE a
> _cegcc_main_end:
>       @ ASM_DECLARE_FUNCTION_SIZE b

Right now this is pretty useless, I'd need an interface to be able to
get to this from source. Working on that.

        Danny
-- 
Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info
/* Operating system specific defines to be used when targeting GCC for
   hosting on Windows CE, using GNU tools and the Windows32 API Library.
   Copyright (C) 2006
   Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING.  If not, write to
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.  */

#undef TARGET_VERSION
#define TARGET_VERSION fprintf (stderr, " (arm MinGW)"); 

#undef EXTRA_OS_CPP_BUILTINS
#define EXTRA_OS_CPP_BUILTINS()					\
  do								\
    {								\
      builtin_define ("__COREDLL__");				\
      builtin_define ("__MINGW32__");			   	\
      builtin_define ("__MINGW32CE__");			   	\
      builtin_define ("_WIN32");				\
      builtin_define_std ("WIN32");				\
      builtin_define_std ("WINNT");				\
    }								\
  while (0)

#undef CPP_SPEC
#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} \
%{!nostdinc: -idirafter ../include/w32api%s -idirafter ../../include/w32api%s }"

#undef LIB_SPEC
#define LIB_SPEC "%{pg:-lgmon} -lcoredll"

/* Include in the mingw32 libraries with libgcc */
#undef LINK_SPEC
#define LINK_SPEC "%{shared|mdll: --shared} \
  %{static:-Bstatic} %{!static:-Bdynamic} \
  %{shared|mdll: -e DllMainCRTStartup}"

/* Include in the mingw32 libraries with libgcc */
#undef LIBGCC_SPEC
#define LIBGCC_SPEC \
  "%{mthreads:-lmingwthrd} -lmingw32 -lgcc -lceoldname -lmingwex -lcoredll"

#undef STARTFILE_SPEC
#define STARTFILE_SPEC "%{shared|mdll:dllcrt3%O%s} \
  %{!shared:%{!mdll:crt3%O%s}} %{pg:gcrt3%O%s}"

/* Override startfile prefix defaults.  */
#ifndef STANDARD_STARTFILE_PREFIX_1
#define STANDARD_STARTFILE_PREFIX_1 "/mingw/lib/"
#endif
#ifndef STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_2 ""
#endif

/* Output STRING, a string representing a filename, to FILE.
   We canonicalize it to be in Unix format (backslashes are replaced
   forward slashes.  */
#undef OUTPUT_QUOTED_STRING
#define OUTPUT_QUOTED_STRING(FILE, STRING)               \
do {						         \
  char c;					         \
						         \
  putc ('\"', asm_file);			         \
						         \
  while ((c = *string++) != 0)			         \
    {						         \
      if (c == '\\')				         \
	c = '/';				         \
						         \
      if (ISPRINT (c))                                   \
        {                                                \
          if (c == '\"')			         \
	    putc ('\\', asm_file);		         \
          putc (c, asm_file);			         \
        }                                                \
      else                                               \
        fprintf (asm_file, "\\%03o", (unsigned char) c); \
    }						         \
						         \
  putc ('\"', asm_file);			         \
} while (0)

#if 0
/* We need a ARM specific header to function declarations.  */
/* Copied from config/arm/pe.h and then altered */
/* Write the extra assembler code needed to declare a function
   properly.  If we are generating SDB debugging information, this
   will happen automatically, so we only need to handle other cases.  */
#undef ASM_DECLARE_FUNCTION_NAME
#define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL)			\
  do									\
    {									\
	asm_fprintf (STREAM, "\t%@ ASM_DECLARE_FUNCTION_NAME a\n");	\
	asm_fprintf (STREAM, "\t.global _cegcc_%s_data\n", NAME);		\
	asm_fprintf (STREAM, "_cegcc_%s_data:\n", NAME);			\
	asm_fprintf (STREAM, "\t.word 0 /* _cegcc_%s_handler */\n", NAME);	\
	asm_fprintf (STREAM, "\t.word 0 /* _cegcc_%s_size */\n", NAME);	\
	asm_fprintf (STREAM, "\t%@ ASM_DECLARE_FUNCTION_NAME b\n");	\
    if (arm_pe_dllexport_name_p (NAME))				\
      arm_pe_record_exported_symbol (NAME, 0);			\
    if (write_symbols != SDB_DEBUG)					\
      arm_pe_declare_function_type (STREAM, NAME, TREE_PUBLIC (DECL));	\
    ARM_DECLARE_FUNCTION_NAME (STREAM, NAME, DECL);		\
    if (TARGET_THUMB)						\
      fprintf (STREAM, "\t.code 16\n");			\
    ASM_OUTPUT_LABEL (STREAM, NAME);					\
    }									\
    while (0)

/* We might need an ARM specific trailer for function declarations.  */
#undef  ASM_DECLARE_FUNCTION_SIZE
#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)			\
    {									\
	asm_fprintf (FILE, "\t%@ ASM_DECLARE_FUNCTION_SIZE a\n");	\
	asm_fprintf (FILE, "_cegcc_%s_end:\n", FNAME);	\
	asm_fprintf (FILE, "\t%@ ASM_DECLARE_FUNCTION_SIZE b\n");	\
    }
#endif
        .file   "nullptr.c"
        .def    __gccmain;      .scl    2;      .type   32;     .endef
        .section .rdata
        .align  0
.LC0:
        .ascii  "A\000l\000l\000 \000d\000o\000n\000e\000\000\000"
        .align  0
.LC1:
        .ascii  "m\000a\000i\000n\000\000\000"
        .text
        .align  0
        .global main
        @ ASM_DECLARE_FUNCTION_NAME a
        .global _cegcc_main_data
_cegcc_main_data:
        .word 0 /* _cegcc_main_handler */
        .word 0 /* _cegcc_main_size */
        @ ASM_DECLARE_FUNCTION_NAME b
        .def    main;   .scl    2;      .type   32;     .endef
main:
        @ Yow prologue
        @ args = 0, pretend = 0, frame = 12
        @ frame_needed = 1, uses_anonymous_args = 0
        mov     ip, sp
        stmfd   sp!, {fp, ip, lr, pc}
        sub     fp, ip, #4
        sub     sp, sp, #12
        bl      __gccmain
        mov     r3, #0
        str     r3, [fp, #-24]
        ldr     r3, [fp, #-24]
        ldr     r3, [r3, #0]
        add     r3, r3, #1
        str     r3, [fp, #-20]
        mov     r0, #0
        ldr     r1, .L3
        ldr     r2, .L3+4
        mov     r3, #0
        bl      MessageBoxW
        sub     sp, fp, #12
        ldmfd   sp, {fp, sp, pc}
.L4:
        .align  0
.L3:
        .word   .LC0
        .word   .LC1
        @ ASM_DECLARE_FUNCTION_SIZE a
_cegcc_main_end:
        @ ASM_DECLARE_FUNCTION_SIZE b
        .def    MessageBoxW;    .scl    2;      .type   32;     .endef

Attachment: signature.asc
Description: This is a digitally signed message part

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to