1 /* Id: ccconfig.h,v 1.28 2014/12/24 08:43:28 plunky Exp */ 2 /* $NetBSD: ccconfig.h,v 1.1.1.6 2016/02/09 20:29:20 plunky Exp $ */ 3 4 /* 5 * Copyright (c) 2004 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 33 /* common cpp predefines */ 34 #define CPPADD { "-D__linux__", "-D__ELF__", NULL, } 35 36 #define CRT0 "crt1.o" 37 #define GCRT0 "gcrt1.o" 38 39 #define STARTLABEL "_start" 40 41 #if defined(mach_i386) 42 #define CPPMDADD { "-D__i386__", NULL, } 43 #define DYNLINKLIB "/lib/ld-linux.so.2" 44 #define MUSL_DYLIB "/lib/ld-musl-i386.so.1" 45 #elif defined(mach_powerpc) 46 #define CPPMDADD { "-D__ppc__", NULL, } 47 #define DYNLINKLIB "/lib/ld-linux.so.2" 48 #define MUSL_DYLIB "/lib/ld-musl-powerpc.so.1" 49 #elif defined(mach_amd64) 50 #include "../inc/amd64.h" 51 #define DYNLINKLIB "/lib64/ld-linux-x86-64.so.2" 52 #define MUSL_DYLIB "/lib/ld-musl-x86_64.so.1" 53 #ifndef MULTIARCH_PATH 54 #define DEFLIBDIRS { "/usr/lib64/", 0 } 55 #else 56 #define DEFLIBDIRS { "/usr/lib64/", "/usr/lib/" MULTIARCH_PATH "/", 0 } 57 #endif 58 #elif defined(mach_mips) 59 #define CPPMDADD { "-D__mips__", NULL, } 60 #define DYNLINKLIB "/lib/ld.so.1" 61 #define MUSL_ROOT "/lib/ld-musl-mips" 62 #define MUSL_EL "el" 63 #define MUSL_SF "-sf" 64 #else 65 #error defines for arch missing 66 #endif 67 68 /* 69 * When USE_MUSL is defined, we either provide MUSL_DYLIB, or 70 * code to construct the dynamic linker name at runtime 71 */ 72 #ifdef USE_MUSL 73 #ifdef MUSL_DYLIB 74 #define DYNLINKLIB MUSL_DYLIB 75 #else 76 #ifndef MUSL_EB 77 #define MUSL_EB NULL 78 #endif 79 #ifndef MUSL_EL 80 #define MUSL_EL NULL 81 #endif 82 #ifndef MUSL_SF 83 #define MUSL_SF NULL 84 #endif 85 #ifndef MUSL_HF 86 #define MUSL_HF NULL 87 #endif 88 #ifndef MUSL_EXT 89 #define MUSL_EXT ".so.1" 90 #endif 91 92 #define PCC_SETUP_LD_ARGS { \ 93 char *t = MUSL_ROOT; \ 94 t = cat(t, bigendian ? MUSL_EB : MUSL_EL); \ 95 t = cat(t, softfloat ? MUSL_SF : MUSL_HF); \ 96 dynlinklib = cat(t, MUSL_EXT); \ 97 } 98 #endif 99 #endif 100