1 /**************************************************************************** 2 * * 3 * GNAT COMPILER COMPONENTS * 4 * * 5 * L I N K * 6 * * 7 * C Implementation File * 8 * * 9 * Copyright (C) 1992-2019, Free Software Foundation, Inc. * 10 * * 11 * GNAT is free software; you can redistribute it and/or modify it under * 12 * terms of the GNU General Public License as published by the Free Soft- * 13 * ware Foundation; either version 3, or (at your option) any later ver- * 14 * sion. GNAT is distributed in the hope that it will be useful, but WITH- * 15 * OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 * or FITNESS FOR A PARTICULAR PURPOSE. * 17 * * 18 * As a special exception under Section 7 of GPL version 3, you are granted * 19 * additional permissions described in the GCC Runtime Library Exception, * 20 * version 3.1, as published by the Free Software Foundation. * 21 * * 22 * You should have received a copy of the GNU General Public License and * 23 * a copy of the GCC Runtime Library Exception along with this program; * 24 * see the files COPYING3 and COPYING.RUNTIME respectively. If not, see * 25 * <http://www.gnu.org/licenses/>. * 26 * * 27 * GNAT was originally developed by the GNAT team at New York University. * 28 * Extensive contributions were provided by Ada Core Technologies Inc. * 29 * * 30 ****************************************************************************/ 31 32 /* This file contains host-specific parameters describing the behavior of the 33 linker. It is used by gnatlink as well as all tools that use Mlib. */ 34 35 #ifdef __cplusplus 36 extern "C" { 37 #endif 38 39 #ifdef IN_GCC 40 #include "auto-host.h" 41 #endif 42 43 #include <string.h> 44 45 /* objlist_file_supported is set to 1 when the system linker allows */ 46 /* response file, that is a file that contains the list of object files. */ 47 /* This is useful on systems where the command line length is limited, */ 48 /* meaning that putting all the object files on the command line can */ 49 /* result in an unacceptable limit on the number of files. */ 50 51 /* object_file_option denotes the system dependent linker option which */ 52 /* allows object file names to be placed in a file and then passed to */ 53 /* the linker. object_file_option must be set if objlist_file_supported */ 54 /* is set to 1. */ 55 56 /* link_max is a conservative system specific threshold (in bytes) of the */ 57 /* argument length passed to the linker which will trigger a file being */ 58 /* used instead of the command line directly. If the argument length is */ 59 /* greater than this threshold, then an objlist_file will be generated */ 60 /* and object_file_option and objlist_file_supported must be set. If */ 61 /* objlist_file_supported is set to 0 (unsupported), then link_max is */ 62 /* set to 2**31-1 so that the limit will never be exceeded. */ 63 64 /* run_path_option is the system dependent linker option which specifies */ 65 /* the run time path to use when loading dynamic libraries. This should */ 66 /* be set to the null string if the system does not support dynamic */ 67 /* loading of libraries. */ 68 69 /* shared_libgnat_default gives the system dependent link method that */ 70 /* be used by default for linking libgnat (shared or static) */ 71 72 /* shared_libgcc_default gives the system dependent link method that */ 73 /* be used by default for linking libgcc (shared or static) */ 74 75 /* separate_run_path_options is set to 1 when separate "rpath" arguments */ 76 /* must be passed to the linker for each directory in the rpath. */ 77 78 /* default_libgcc_subdir is the subdirectory name (from the installation */ 79 /* root) where we may find a shared libgcc to use by default. */ 80 81 #define SHARED 'H' 82 #define STATIC 'T' 83 84 #if defined (__WIN32) 85 const char *__gnat_object_file_option = "-Wl,@"; 86 const char *__gnat_run_path_option = ""; 87 int __gnat_link_max = 30000; 88 unsigned char __gnat_objlist_file_supported = 1; 89 char __gnat_shared_libgnat_default = STATIC; 90 char __gnat_shared_libgcc_default = STATIC; 91 const char *__gnat_object_library_extension = ".a"; 92 unsigned char __gnat_separate_run_path_options = 0; 93 const char *__gnat_default_libgcc_subdir = "lib"; 94 95 #elif defined (__hpux__) 96 const char *__gnat_object_file_option = "-Wl,-c,"; 97 const char *__gnat_run_path_option = "-Wl,+b,"; 98 int __gnat_link_max = 5000; 99 unsigned char __gnat_objlist_file_supported = 1; 100 char __gnat_shared_libgnat_default = STATIC; 101 char __gnat_shared_libgcc_default = STATIC; 102 const char *__gnat_object_library_extension = ".a"; 103 unsigned char __gnat_separate_run_path_options = 0; 104 const char *__gnat_default_libgcc_subdir = "lib"; 105 106 #elif defined (__FreeBSD__) || defined (__DragonFly__) \ 107 || defined (__NetBSD__) || defined (__OpenBSD__) \ 108 || defined (__QNX__) 109 const char *__gnat_object_file_option = "-Wl,@"; 110 const char *__gnat_run_path_option = "-Wl,-rpath,"; 111 char __gnat_shared_libgnat_default = STATIC; 112 char __gnat_shared_libgcc_default = STATIC; 113 int __gnat_link_max = 8192; 114 unsigned char __gnat_objlist_file_supported = 1; 115 const char *__gnat_object_library_extension = ".a"; 116 unsigned char __gnat_separate_run_path_options = 0; 117 const char *__gnat_default_libgcc_subdir = "lib"; 118 119 #elif defined (__APPLE__) 120 const char *__gnat_object_file_option = "-Wl,-filelist,"; 121 const char *__gnat_run_path_option = "-Wl,-rpath,"; 122 char __gnat_shared_libgnat_default = STATIC; 123 char __gnat_shared_libgcc_default = SHARED; 124 int __gnat_link_max = 262144; 125 unsigned char __gnat_objlist_file_supported = 1; 126 const char *__gnat_object_library_extension = ".a"; 127 unsigned char __gnat_separate_run_path_options = 1; 128 const char *__gnat_default_libgcc_subdir = "lib"; 129 130 #elif defined (__linux__) || defined (__GLIBC__) 131 const char *__gnat_object_file_option = "-Wl,@"; 132 const char *__gnat_run_path_option = "-Wl,-rpath,"; 133 char __gnat_shared_libgnat_default = STATIC; 134 char __gnat_shared_libgcc_default = STATIC; 135 int __gnat_link_max = 8192; 136 unsigned char __gnat_objlist_file_supported = 1; 137 const char *__gnat_object_library_extension = ".a"; 138 unsigned char __gnat_separate_run_path_options = 0; 139 #if defined (__x86_64) 140 # if defined (__LP64__) 141 const char *__gnat_default_libgcc_subdir = "lib64"; 142 # else 143 const char *__gnat_default_libgcc_subdir = "libx32"; 144 # endif 145 #else 146 const char *__gnat_default_libgcc_subdir = "lib"; 147 #endif 148 149 #elif defined (_AIX) 150 /* On AIX, even when with GNU ld we use native linker switches. This is 151 particularly important for '-f' as it should be interpreted by collect2. */ 152 153 const char *__gnat_object_file_option = "-Wl,-f,"; 154 const char *__gnat_run_path_option = ""; 155 char __gnat_shared_libgnat_default = STATIC; 156 char __gnat_shared_libgcc_default = STATIC; 157 int __gnat_link_max = 15000; 158 unsigned char __gnat_objlist_file_supported = 1; 159 const char *__gnat_object_library_extension = ".a"; 160 unsigned char __gnat_separate_run_path_options = 0; 161 const char *__gnat_default_libgcc_subdir = "lib"; 162 163 #elif (HAVE_GNU_LD) 164 /* These are the settings for all systems that use gnu ld. GNU style response 165 file is supported, the shared library default is STATIC. */ 166 167 const char *__gnat_object_file_option = "-Wl,@"; 168 const char *__gnat_run_path_option = ""; 169 char __gnat_shared_libgnat_default = STATIC; 170 char __gnat_shared_libgcc_default = STATIC; 171 int __gnat_link_max = 8192; 172 unsigned char __gnat_objlist_file_supported = 1; 173 const char *__gnat_object_library_extension = ".a"; 174 unsigned char __gnat_separate_run_path_options = 0; 175 const char *__gnat_default_libgcc_subdir = "lib"; 176 177 #elif defined (VMS) 178 const char *__gnat_object_file_option = ""; 179 const char *__gnat_run_path_option = ""; 180 char __gnat_shared_libgnat_default = STATIC; 181 char __gnat_shared_libgcc_default = STATIC; 182 int __gnat_link_max = 2147483647; 183 unsigned char __gnat_objlist_file_supported = 0; 184 const char *__gnat_object_library_extension = ".olb"; 185 unsigned char __gnat_separate_run_path_options = 0; 186 const char *__gnat_default_libgcc_subdir = "lib"; 187 188 #elif defined (__sun__) 189 const char *__gnat_object_file_option = ""; 190 const char *__gnat_run_path_option = "-Wl,-R"; 191 char __gnat_shared_libgnat_default = STATIC; 192 char __gnat_shared_libgcc_default = STATIC; 193 int __gnat_link_max = 2147483647; 194 unsigned char __gnat_objlist_file_supported = 0; 195 const char *__gnat_object_library_extension = ".a"; 196 unsigned char __gnat_separate_run_path_options = 0; 197 #if defined (__sparc_v9__) || defined (__sparcv9) 198 const char *__gnat_default_libgcc_subdir = "lib/sparcv9"; 199 #elif defined (__x86_64) 200 const char *__gnat_default_libgcc_subdir = "lib/amd64"; 201 #else 202 const char *__gnat_default_libgcc_subdir = "lib"; 203 #endif 204 205 #elif defined (__svr4__) && defined (__i386__) 206 const char *__gnat_object_file_option = ""; 207 const char *__gnat_run_path_option = ""; 208 char __gnat_shared_libgnat_default = STATIC; 209 char __gnat_shared_libgcc_default = STATIC; 210 int __gnat_link_max = 2147483647; 211 unsigned char __gnat_objlist_file_supported = 0; 212 const char *__gnat_object_library_extension = ".a"; 213 unsigned char __gnat_separate_run_path_options = 0; 214 const char *__gnat_default_libgcc_subdir = "lib"; 215 216 #else 217 218 /* These are the default settings for all other systems. No response file 219 is supported, the shared library default is STATIC. */ 220 const char *__gnat_run_path_option = ""; 221 const char *__gnat_object_file_option = ""; 222 char __gnat_shared_libgnat_default = STATIC; 223 char __gnat_shared_libgcc_default = STATIC; 224 int __gnat_link_max = 2147483647; 225 unsigned char __gnat_objlist_file_supported = 0; 226 const char *__gnat_object_library_extension = ".a"; 227 unsigned char __gnat_separate_run_path_options = 0; 228 const char *__gnat_default_libgcc_subdir = "lib"; 229 #endif 230 231 #ifdef __cplusplus 232 } 233 #endif 234