Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / lang / gcc / patches / patch-af
blob6ce7fa9feb7750a600bbb2bda2673dc1fefce1b6
1 $NetBSD$
3 --- ../gcc-2.95.3/gcc/config/netbsd.h
4 +++ ../gcc-2.95.3/gcc/config/netbsd.h.orig
5 @@ -36,10 +36,13 @@
6  
7  
8  /* Provide a CPP_SPEC appropriate for NetBSD.  Current we just deal with
9 -   the GCC option `-posix'.  */
10 +   the GCC option `-posix'.  We also deal with -pthread, which is required
11 +   for the 2.95.3 STL to work.  */
13  #undef CPP_SPEC
14 -#define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE}"
15 +#define CPP_SPEC \
16 +  "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} \
17 +   %{pthread:-D_REENTRANT -D_PTHREADS}"
19  /* Provide an ASM_SPEC appropriate for NetBSD.  Currently we only deal
20     with the options for generating PIC code.  */
21 @@ -54,7 +57,8 @@
23  #undef LIB_SPEC
24  #define LIB_SPEC                                                       \
25 -  "%{posix:%{!p:%{!pg:-lposix}}%{p:-lposix_p}%{pg:-lposix_p}}          \
26 +  "%{pthread:%{!p:%{!pg:-lpthread}}%{p:-lpthread_p}%{pg:-lpthread_p}}  \
27 +   %{posix:%{!p:%{!pg:-lposix}}%{p:-lposix_p}%{pg:-lposix_p}}          \
28     %{!shared:%{!symbolic:%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}}"
30  /* Provide a LIBGCC_SPEC appropriate for NetBSD.  We also want to exclude
31 @@ -64,7 +68,7 @@
32  #ifdef  NETBSD_NATIVE
33  #define LIBGCC_SPEC "%{!symbolic:%{!shared:%{!p:%{!pg:-lgcc}}}%{shared:-lgcc_pic}%{p:-lgcc_p}%{pg:-lgcc_p}}"
34  #else
35 -#define LIBGCC_SPEC "%{!shared:%{!symbolic:-lgcc}}"
36 +#define LIBGCC_SPEC "%{!symbolic:%{!shared:-lgcc}%{shared:-lgcc_pic}}"
37  #endif
39  /* #ifdef NETBSD_AOUT */
40 @@ -147,6 +151,96 @@
41  #define ASM_DECLARE_RESULT(FILE, RESULT)
42  #endif
44 +/* NetBSD a.out support begins here. */
46 +#ifndef NETBSD_ELF
48 +#undef DWARF_DEBUGGING_INFO    /* XXX */
49 +#undef DWARF2_DEBUGGING_INFO   /* XXX */
51 +/* Write the extra assembler code needed to declare a function properly.
52 +   Some svr4 assemblers need to also have something extra said about the
53 +   function's return value.  We allow for that here.  */
55 +#undef ASM_DECLARE_FUNCTION_NAME
56 +#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)                    \
57 +  do {                                                                 \
58 +    fprintf (FILE, "\t%s\t ", TYPE_ASM_OP);                            \
59 +    assemble_name (FILE, NAME);                                                \
60 +    putc (',', FILE);                                                  \
61 +    fprintf (FILE, TYPE_OPERAND_FMT, "function");                      \
62 +    putc ('\n', FILE);                                                 \
63 +    ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));                     \
64 +    ASM_OUTPUT_LABEL(FILE, NAME);                                      \
65 +  } while (0)
67 +/* Write the extra assembler code needed to declare an object properly.  */
69 +#undef ASM_DECLARE_OBJECT_NAME
70 +#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)                      \
71 +  do {                                                                 \
72 +    fprintf (FILE, "\t%s\t ", TYPE_ASM_OP);                            \
73 +    assemble_name (FILE, NAME);                                                \
74 +    putc (',', FILE);                                                  \
75 +    fprintf (FILE, TYPE_OPERAND_FMT, "object");                                \
76 +    putc ('\n', FILE);                                                 \
77 +    size_directive_output = 0;                                         \
78 +    if (!flag_inhibit_size_directive && DECL_SIZE (DECL))              \
79 +      {                                                                        \
80 +       size_directive_output = 1;                                      \
81 +       fprintf (FILE, "\t%s\t ", SIZE_ASM_OP);                         \
82 +       assemble_name (FILE, NAME);                                     \
83 +       fprintf (FILE, ",%d\n",  int_size_in_bytes (TREE_TYPE (DECL))); \
84 +      }                                                                        \
85 +    ASM_OUTPUT_LABEL(FILE, NAME);                                      \
86 +  } while (0)
88 +/* Output the size directive for a decl in rest_of_decl_compilation
89 +   in the case where we did not do so before the initializer.
90 +   Once we find the error_mark_node, we know that the value of
91 +   size_directive_output was set
92 +   by ASM_DECLARE_OBJECT_NAME when it was run for the same decl.  */
94 +#undef ASM_FINISH_DECLARE_OBJECT
95 +#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)        \
96 +do {                                                                    \
97 +     char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0);                  \
98 +     if (!flag_inhibit_size_directive && DECL_SIZE (DECL)               \
99 +         && ! AT_END && TOP_LEVEL                                       \
100 +        && DECL_INITIAL (DECL) == error_mark_node                       \
101 +        && !size_directive_output)                                      \
102 +       {                                                                \
103 +        size_directive_output = 1;                                      \
104 +        fprintf (FILE, "\t%s\t ", SIZE_ASM_OP);                         \
105 +        assemble_name (FILE, name);                                     \
106 +        fprintf (FILE, ",%d\n",  int_size_in_bytes (TREE_TYPE (DECL))); \
107 +       }                                                                \
108 +   } while (0)
110 +/* This is how to declare the size of a function.  */
112 +#undef ASM_DECLARE_FUNCTION_SIZE
113 +#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)                   \
114 +  do {                                                                 \
115 +    if (!flag_inhibit_size_directive)                                  \
116 +      {                                                                        \
117 +        char label[256];                                               \
118 +       static int labelno;                                             \
119 +       labelno++;                                                      \
120 +       ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno);            \
121 +       ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno);               \
122 +       fprintf (FILE, "\t%s\t ", SIZE_ASM_OP);                         \
123 +       assemble_name (FILE, (FNAME));                                  \
124 +        fprintf (FILE, ",");                                           \
125 +       assemble_name (FILE, label);                                    \
126 +        fprintf (FILE, "-");                                           \
127 +       assemble_name (FILE, (FNAME));                                  \
128 +       putc ('\n', FILE);                                              \
129 +      }                                                                        \
130 +  } while (0)
132 +#endif
134  /* NetBSD ELF support begins here. */
136  #ifdef NETBSD_ELF
137 @@ -167,6 +261,7 @@
138       %{!pg: \
139          %{p:gcrt0%O%s} \
140          %{!p:crt0%O%s}}} \
141 +   %:if-exists(crti%O%s) \
142     %{!shared:crtbegin%O%s} %{shared:crtbeginS%O%s}"
144  /* Provide an ENDFILE_SPEC appropriate for NetBSD ELF targets.  Here we
145 @@ -175,13 +270,14 @@
147  #undef ENDFILE_SPEC
148  #define        ENDFILE_SPEC \
149 - "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
150 + "%{!shared:crtend%O%s} %{shared:crtendS%O%s} \
151 +  %:if-exists(crtn%O%s)"
153  /* Provide a LINK_SPEC appropriate for a NetBSD ELF target.  */
155  #undef LINK_SPEC
156  #define        LINK_SPEC \
157 - "%{assert*} \
158 + "%{assert*} %{R*} \
159    %{shared:-shared} \
160    %{!shared: \
161      -dc -dp \