elf32.em (38890) | elf32.em (42372) |
---|---|
1# This shell script emits a C file. -*- C -*- 2# It does some substitutions. 3# This file is now misnamed, because it supports both 32 bit and 64 bit 4# ELF emulations. 5test -z "${ELFSIZE}" && ELFSIZE=32 6cat >e${EMULATION_NAME}.c <<EOF 7/* This file is is generated by a shell script. DO NOT EDIT! */ 8 --- 125 unchanged lines hidden (view full) --- 134 } 135 136 return true; 137} 138 139EOF 140if [ "x${host}" = "x${target}" ] ; then 141 if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then | 1# This shell script emits a C file. -*- C -*- 2# It does some substitutions. 3# This file is now misnamed, because it supports both 32 bit and 64 bit 4# ELF emulations. 5test -z "${ELFSIZE}" && ELFSIZE=32 6cat >e${EMULATION_NAME}.c <<EOF 7/* This file is is generated by a shell script. DO NOT EDIT! */ 8 --- 125 unchanged lines hidden (view full) --- 134 } 135 136 return true; 137} 138 139EOF 140if [ "x${host}" = "x${target}" ] ; then 141 if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then |
142cat >>e${EMULATION_NAME}.c <<EOF | 142 case ${target} in 143 *-*-freebsd*) 144 cat >>e${EMULATION_NAME}.c <<EOF 145/* 146 * Read the system search path the FreeBSD way rather than like Linux. 147 */ 148#include <elf.h> |
143 | 149 |
150static boolean gld${EMULATION_NAME}_check_ld_elf_hints 151 PARAMS ((const char *, int)); 152 153static boolean 154gld${EMULATION_NAME}_check_ld_elf_hints (name, force) 155 const char *name; 156 int force; 157{ 158 static boolean initialized; 159 static char *ld_elf_hints; 160 161 if (! initialized) 162 { 163 FILE *f; 164 165 f = fopen (_PATH_ELF_HINTS, FOPEN_RB); 166 if (f != NULL) 167 { 168 struct elfhints_hdr hdr; 169 170 if (fread(&hdr, 1, sizeof(hdr), f) == sizeof(hdr) && 171 hdr.magic == ELFHINTS_MAGIC && 172 hdr.version == 1) 173 { 174 if (fseek(f, hdr.strtab + hdr.dirlist, SEEK_SET) != -1) 175 { 176 char *b; 177 178 b = (char *) xmalloc (hdr.dirlistlen + 1); 179 if (fread(b, 1, hdr.dirlistlen + 1, f) != 180 hdr.dirlistlen + 1) 181 { 182 free(b); 183 } 184 else 185 { 186 ld_elf_hints = b; 187 } 188 } 189 } 190 fclose (f); 191 } 192 193 initialized = true; 194 } 195 196 if (ld_elf_hints == NULL) 197 return false; 198 199 return gld${EMULATION_NAME}_search_needed (ld_elf_hints, name, force); 200} 201EOF 202 ;; 203 *) 204 cat >>e${EMULATION_NAME}.c <<EOF |
|
144/* For a native linker, check the file /etc/ld.so.conf for directories 145 in which we may find shared libraries. /etc/ld.so.conf is really 146 only meaningful on Linux, but we check it on other systems anyhow. */ 147 148static boolean gld${EMULATION_NAME}_check_ld_so_conf 149 PARAMS ((const char *, int)); 150 151static boolean --- 64 unchanged lines hidden (view full) --- 216 initialized = true; 217 } 218 219 if (ld_so_conf == NULL) 220 return false; 221 222 return gld${EMULATION_NAME}_search_needed (ld_so_conf, name, force); 223} | 205/* For a native linker, check the file /etc/ld.so.conf for directories 206 in which we may find shared libraries. /etc/ld.so.conf is really 207 only meaningful on Linux, but we check it on other systems anyhow. */ 208 209static boolean gld${EMULATION_NAME}_check_ld_so_conf 210 PARAMS ((const char *, int)); 211 212static boolean --- 64 unchanged lines hidden (view full) --- 277 initialized = true; 278 } 279 280 if (ld_so_conf == NULL) 281 return false; 282 283 return gld${EMULATION_NAME}_search_needed (ld_so_conf, name, force); 284} |
224 | |
225EOF | 285EOF |
286 esac |
|
226 fi 227fi 228cat >>e${EMULATION_NAME}.c <<EOF 229 230/* These variables are required to pass information back and forth 231 between after_open and check_needed and stat_needed and vercheck. */ 232 233static struct bfd_link_needed_list *global_needed; --- 96 unchanged lines hidden (view full) --- 330 break; 331 free (filename); 332 } 333 if (search != NULL) 334 break; 335EOF 336if [ "x${host}" = "x${target}" ] ; then 337 if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then | 287 fi 288fi 289cat >>e${EMULATION_NAME}.c <<EOF 290 291/* These variables are required to pass information back and forth 292 between after_open and check_needed and stat_needed and vercheck. */ 293 294static struct bfd_link_needed_list *global_needed; --- 96 unchanged lines hidden (view full) --- 391 break; 392 free (filename); 393 } 394 if (search != NULL) 395 break; 396EOF 397if [ "x${host}" = "x${target}" ] ; then 398 if [ "x${DEFAULT_EMULATION}" = "x${EMULATION_NAME}" ] ; then |
338cat >>e${EMULATION_NAME}.c <<EOF | 399 case ${target} in 400 *-*-freebsd*) 401 cat >>e${EMULATION_NAME}.c <<EOF 402 if (gld${EMULATION_NAME}_check_ld_elf_hints (l->name, force)) 403 break; 404EOF 405 ;; 406 *) 407 cat >>e${EMULATION_NAME}.c <<EOF |
339 if (gld${EMULATION_NAME}_check_ld_so_conf (l->name, force)) 340 break; 341EOF | 408 if (gld${EMULATION_NAME}_check_ld_so_conf (l->name, force)) 409 break; 410EOF |
411 ;; 412 esac |
|
342 fi 343fi 344cat >>e${EMULATION_NAME}.c <<EOF 345 } 346 347 if (force < 2) 348 continue; 349 --- 814 unchanged lines hidden --- | 413 fi 414fi 415cat >>e${EMULATION_NAME}.c <<EOF 416 } 417 418 if (force < 2) 419 continue; 420 --- 814 unchanged lines hidden --- |