home *** CD-ROM | disk | FTP | other *** search
/ Programming Win32 Under the API / ProgrammingWin32UnderTheApiPatVillani.iso / patches / gcc-2_95_2-x86-win32-patches.zi / gcc-2.95.2-patches / broken-down / gcc-2.95.2-win32-drectve.diff < prev    next >
Encoding:
Text File  |  1999-11-08  |  5.0 KB  |  145 lines

  1. Sat Aug 28 17:16:08 1999  Mumit Khan  <khan@xraylith.wisc.edu>
  2.  
  3.     * i386/winnt.c (export_list): New type.
  4.     (exports_head): Rename to
  5.     (export_head):  this.
  6.     (i386_pe_record_exported_symbol): Add is_data flag.
  7.     (i386_pe_asm_file_end): Emit directive for exported variables.
  8.     * i386/cygwin.h (i386_pe_record_exported_symbol): Update
  9.     prototype.
  10.     * i386/cygwin.h (ASM_OUTPUT_COMMON): Specify symbol type.
  11.     (ASM_DECLARE_OBJECT_NAME): Likewise.
  12.     (ASM_DECLARE_FUNCTION_NAME): Likewise.
  13.     * i386/uwin.h (ASM_DECLARE_FUNCTION_NAME): Likewise.
  14.  
  15. Index: gcc-2.95.2/gcc/config/i386/cygwin.h
  16. ===================================================================
  17. RCS file: /homes/khan/src/CVSROOT/gcc-2.95.2/gcc/config/i386/cygwin.h,v
  18. retrieving revision 1.4
  19. diff -u -3 -p -r1.4 cygwin.h
  20. --- gcc-2.95.2/gcc/config/i386/cygwin.h    1999/11/05 08:13:18    1.4
  21. +++ gcc-2.95.2/gcc/config/i386/cygwin.h    1999/11/05 08:20:18
  22. @@ -326,7 +326,7 @@ do {                                    \
  23.  #define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED)    \
  24.  do {                            \
  25.    if (i386_pe_dllexport_name_p (NAME))            \
  26. -    i386_pe_record_exported_symbol (NAME);        \
  27. +    i386_pe_record_exported_symbol (NAME, 1);        \
  28.    if (! i386_pe_dllimport_name_p (NAME))        \
  29.      {                            \
  30.        fprintf ((STREAM), "\t.comm\t");             \
  31. @@ -341,7 +341,7 @@ do {                            \
  32.  #define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL)     \
  33.  do {                            \
  34.    if (i386_pe_dllexport_name_p (NAME))            \
  35. -    i386_pe_record_exported_symbol (NAME);        \
  36. +    i386_pe_record_exported_symbol (NAME, 1);        \
  37.    ASM_OUTPUT_LABEL ((STREAM), (NAME));            \
  38.  } while (0)
  39.  
  40. @@ -444,7 +444,7 @@ do {                                    \
  41.    do                                    \
  42.      {                                    \
  43.        if (i386_pe_dllexport_name_p (NAME))                \
  44. -    i386_pe_record_exported_symbol (NAME);                \
  45. +    i386_pe_record_exported_symbol (NAME, 0);            \
  46.        if (write_symbols != SDB_DEBUG)                    \
  47.      i386_pe_declare_function_type (FILE, NAME, TREE_PUBLIC (DECL));    \
  48.        ASM_OUTPUT_LABEL (FILE, NAME);                    \
  49. @@ -515,7 +515,7 @@ do {                                    \
  50.  
  51.  extern void i386_pe_record_external_function PROTO((char *));
  52.  extern void i386_pe_declare_function_type STDIO_PROTO((FILE *, char *, int));
  53. -extern void i386_pe_record_exported_symbol PROTO((char *));
  54. +extern void i386_pe_record_exported_symbol PROTO((char *, int));
  55.  extern void i386_pe_asm_file_end STDIO_PROTO((FILE *));
  56.  
  57.  /* For Win32 ABI compatibility */
  58. Index: gcc-2.95.2/gcc/config/i386/uwin.h
  59. ===================================================================
  60. RCS file: /homes/khan/src/CVSROOT/gcc-2.95.2/gcc/config/i386/uwin.h,v
  61. retrieving revision 1.3
  62. diff -u -3 -p -r1.3 uwin.h
  63. --- gcc-2.95.2/gcc/config/i386/uwin.h    1999/11/05 08:19:24    1.3
  64. +++ gcc-2.95.2/gcc/config/i386/uwin.h    1999/11/05 08:20:18
  65. @@ -79,7 +79,7 @@ Boston, MA 02111-1307, USA. */
  66.    do                                    \
  67.      {                                    \
  68.        if (i386_pe_dllexport_name_p (NAME))                \
  69. -    i386_pe_record_exported_symbol (NAME);                \
  70. +    i386_pe_record_exported_symbol (NAME, 0);            \
  71.        /* UWIN binutils bug workaround. */                \
  72.        if (0 && write_symbols != SDB_DEBUG)                \
  73.      i386_pe_declare_function_type (FILE, NAME, TREE_PUBLIC (DECL));    \
  74. Index: gcc-2.95.2/gcc/config/i386/winnt.c
  75. ===================================================================
  76. RCS file: /homes/khan/src/CVSROOT/gcc-2.95.2/gcc/config/i386/winnt.c,v
  77. retrieving revision 1.3
  78. diff -u -3 -p -r1.3 winnt.c
  79. --- gcc-2.95.2/gcc/config/i386/winnt.c    1999/11/05 08:13:18    1.3
  80. +++ gcc-2.95.2/gcc/config/i386/winnt.c    1999/11/05 08:20:18
  81. @@ -561,8 +561,17 @@ i386_pe_record_external_function (name)
  82.    extern_head = p;
  83.  }
  84.  
  85. -static struct extern_list *exports_head;
  86. +/* Keep a list of exported symbols.  */
  87.  
  88. +struct export_list
  89. +{
  90. +  struct export_list *next;
  91. +  char *name;
  92. +  int is_data;        /* used to type tag exported symbols. */
  93. +};
  94. +
  95. +static struct export_list *export_head;
  96. +
  97.  /* Assemble an export symbol entry.  We need to keep a list of
  98.     these, so that we can output the export list at the end of the
  99.     assembly.  We used to output these export symbols in each function,
  100. @@ -570,15 +579,17 @@ static struct extern_list *exports_head;
  101.     linkonce.  */
  102.  
  103.  void
  104. -i386_pe_record_exported_symbol (name)
  105. +i386_pe_record_exported_symbol (name, is_data)
  106.       char *name;
  107. +     int is_data;
  108.  {
  109. -  struct extern_list *p;
  110. +  struct export_list *p;
  111.  
  112. -  p = (struct extern_list *) permalloc (sizeof *p);
  113. -  p->next = exports_head;
  114. +  p = (struct export_list *) permalloc (sizeof *p);
  115. +  p->next = export_head;
  116.    p->name = name;
  117. -  exports_head = p;
  118. +  p->is_data = is_data;
  119. +  export_head = p;
  120.  }
  121.  
  122.  /* This is called at the end of assembly.  For each external function
  123. @@ -605,12 +616,16 @@ i386_pe_asm_file_end (file)
  124.      }
  125.      }
  126.  
  127. -  if (exports_head)
  128. -    drectve_section ();
  129. -  for (p = exports_head; p != NULL; p = p->next)
  130. +  if (export_head)
  131.      {
  132. -      fprintf (file, "\t.ascii \" -export:%s\"\n",
  133. -               I386_PE_STRIP_ENCODING (p->name));
  134. +      struct export_list *q;
  135. +      drectve_section ();
  136. +      for (q = export_head; q != NULL; q = q->next)
  137. +    {
  138. +      fprintf (file, "\t.ascii \" -export:%s%s\"\n",
  139. +           I386_PE_STRIP_ENCODING (q->name),
  140. +           (q->is_data) ? ",data" : "");
  141. +    }
  142.      }
  143.  }
  144.  
  145.