1 /*         Id: ccconfig.h,v 1.6 2014/12/24 08:43:28 plunky Exp  */
2 /*         $NetBSD: ccconfig.h,v 1.1.1.2 2016/02/09 20:29:21 plunky Exp $ */
3 /*
4  * Escrit per Antoine Leca pel projecte PCC, 2011-03.
5  * Copyright (C) 2011 Anders Magnusson (ragge@ludd.luth.se).
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 /*
30  * Various settings that controls how the C compiler works.
31  *
32  * MINIX (http://www.minix3.org), both Classic a.out=PC/IX and ELF
33  */
34 
35 #ifdef ELFABI
36 /* MINIX versions 3.2 (2011) and up, using NetBSD userland. */
37 
38 /* common cpp predefines */
39 #define CPPADD      { "-D__minix", "-D__ELF__", NULL }
40 
41 #define   DYNLINKLIB          "/libexec/ld.elf_so"
42 
43 #define CRTEND_T    "crtend.o"
44 
45 #define DEFLIBS               { "-lc", NULL }
46 #define DEFPROFLIBS { "-lc_p", NULL }
47 #define DEFCXXLIBS  { "-lp++", "-lc", NULL }
48 
49 #if defined(mach_amd64)
50 #include "../inc/amd64.h"
51 #define   PCC_SIZE_TYPE                 "unsigned long"
52 #define   PCC_PTRDIFF_TYPE    "long"
53 #elif defined(mach_arm)
54 #define   CPPMDADD  { "-D__arm__", NULL, }
55 #elif defined(mach_i386)
56 #define   CPPMDADD  { "-D__i386", "-D__i386__", NULL, }
57 #else
58 #error defines for arch missing
59 #endif
60 
61 #ifndef   PCC_WINT_TYPE
62 #define   PCC_WINT_TYPE                 "int"
63 #endif
64 #ifndef   PCC_SIZE_TYPE
65 #define   PCC_SIZE_TYPE                 "unsigned int"
66 #endif
67 #ifndef   PCC_PTRDIFF_TYPE
68 #define   PCC_PTRDIFF_TYPE    "int"
69 #endif
70 
71 #elif defined(AOUTABI)
72 /* MINIX 2 or 3.1.x, a.out-like format derived from PC/IX. */
73 
74 /* common cpp predefines */
75 #define CPPADD      { "-D__minix", NULL }
76 
77 /* linker stuff */
78 #define STARTLABEL  "crtso"
79 #define CRT0                  "crtso.o"
80 #ifdef notyet
81 #define GCRT0       "/usr/lib/pcc/gcrtso.o"
82 #endif
83 
84 #define CRTBEGIN    0
85 #define CRTEND                0
86 #define CRTBEGIN_S  0
87 #define CRTEND_S    0
88 #define CRTBEGIN_T  0
89 #define CRTEND_T    0
90 
91 #define CRTI                  0
92 #define CRTN                  "-lend"
93 
94 #if defined(mach_i386)
95 #define CPPMDADD { "-D__i386", "-D__i386__", \
96           "-D_EM_WSIZE=4", "-D_EM_PSIZE=4", "-D_EM_LSIZE=4", \
97           "-D_EM_SSIZE=2", "-D_EM_FSIZE=4", "-D_EM_DSIZE=8", \
98           NULL, }
99 #else
100 #define CPPMDADD { "-D__i86", \
101           "-D_EM_WSIZE=2", "-D_EM_PSIZE=2", "-D_EM_LSIZE=4", \
102           "-D_EM_SSIZE=2", "-D_EM_FSIZE=4", "-D_EM_DSIZE=8", \
103           NULL, }
104 #endif
105 
106 #else
107 #error defines for ABI missing
108 #endif
109