summaryrefslogtreecommitdiff
path: root/lang/gcc/patches/patch-al
blob: 1685b7fbac4082ce456490a652ad9578a11ebd4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
$NetBSD: patch-al,v 1.3 2001/03/01 00:30:34 jlam Exp $

--- ../gcc-2.95.2/gcc/config/netbsd.h.orig	Wed Dec 16 15:59:58 1998
+++ ../gcc-2.95.2/gcc/config/netbsd.h	Wed Feb 28 18:41:35 2001
@@ -48,17 +48,37 @@
 #define ASM_SPEC " %| %{fpic:-k} %{fPIC:-k -K}"
 
 /* Provide a LIB_SPEC appropriate for NetBSD.  Just select the appropriate
-   libc, depending on whether we're doing profiling.  */
+   libc, depending on whether we're doing profiling; if `-posix' is specified,
+   link against the appropriate libposix first.  */
 
 #undef LIB_SPEC
-#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
+#define LIB_SPEC							\
+  "%{posix:%{!p:%{!pg:-lposix}}%{p:-lposix_p}%{pg:-lposix_p}}		\
+   %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
+
+/* Provide a LIBGCC_SPEC appropriate for NetBSD.  We also want to exclude
+   libgcc when -symbolic.  */
+
+#undef LIBGCC_SPEC
+#define LIBGCC_SPEC "%{!shared:%{!symbolic:-lgcc}}"
+
+/* #ifdef NETBSD_AOUT */
+
+/* Provide a STARTFILE_SPEC appropriate for NetBSD a.out.  Here we
+   provide support for the special GCC option -static.  */
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC \
+  "%{!shared:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:%{!static:crt0%O%s}%{static:scrt0%O%s}}}} %{shared:c++rt0%O%s}"
 
 /* Provide a LINK_SPEC appropriate for NetBSD.  Here we provide support
    for the special GCC options -static, -assert, and -nostdlib.  */
 
 #undef LINK_SPEC
 #define LINK_SPEC \
-  "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{R*} %{static:-Bstatic} %{assert*}"
+  "%{nostdlib:-nostdlib} %{!shared:%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{static:-Bstatic}} %{shared:-Bshareable} %{R*} %{assert*}"
+
+/* #endif NETBSD_AOUT */
 
 /* This defines which switch letters take arguments. */
 #undef SWITCH_TAKES_ARG
@@ -127,6 +147,9 @@
    entries in an ELF object file under SVR4.  These macros also output
    the starting labels for the relevant functions/objects.  */
 
+/* XXX.  This is WRONG for alpha.  Needs to be verified on other ELF ports. */
+#ifndef NETBSD_ELF
+
 /* Write the extra assembler code needed to declare a function properly.
    Some svr4 assemblers need to also have something extra said about the
    function's return value.  We allow for that here.  */
@@ -207,3 +230,56 @@
 	putc ('\n', FILE);						\
       }									\
   } while (0)
+
+#endif /* ! NETBSD_ELF */
+
+/* NetBSD ELF support begins here. */
+
+#ifdef NETBSD_ELF
+
+/* Start with generic ELF definitions. */
+#if !defined(__sparc__)
+#include "elfos.h"
+
+#undef DWARF_DEBUGGING_INFO	/* XXX */
+#undef DWARF2_DEBUGGING_INFO	/* XXX */
+#endif
+
+/* Provide a STARTFILE_SPEC appropriate for NetBSD ELF targets.  Here we
+   provide support for the special GCC option -static.  On ELF targets,
+   we also add the crtbegin.o file which provides part of the support
+   for getting C++ file-scope static objects constructed before entering
+   `main'. */
+
+#undef STARTFILE_SPEC
+#define	STARTFILE_SPEC \
+ "%{!shared: \
+     %{pg:gcrt0%O%s} \
+     %{!pg: \
+        %{p:gcrt0%O%s} \
+        %{!p:crt0%O%s}}} \
+   %{!shared:crtbegin%O%s} %{shared:crtbeginS%O%s}"
+
+/* Provide an ENDFILE_SPEC appropriate for NetBSD ELF targets.  Here we
+   add crtend.o, which provides part of the support for getting C++
+   file-scope static objects deconstructed after exiting `main'. */
+
+#undef ENDFILE_SPEC
+#define	ENDFILE_SPEC \
+ "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
+
+/* Provide a LINK_SPEC appropriate for a NetBSD ELF target.  */
+
+#undef LINK_SPEC
+#define	LINK_SPEC \
+ "%{assert*} \
+  %{shared:-shared} \
+  %{!shared: \
+    -dc -dp \
+    %{!nostdlib:%{!r*:%{!e*:-e __start}}} \
+    %{!static: \
+      %{rdynamic:-export-dynamic} \
+      %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \
+    %{static:-static}}"
+
+#endif /* NETBSD_ELF */