Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 123496 | Differences between
and this patch

Collapse All | Expand All

(-)binutils-2.16.1/ld/Makefile.in (+4 lines)
Lines 347-352 ALL_EMULATIONS = \ Link Here
347
	ei386beos.o \
347
	ei386beos.o \
348
	ei386bsd.o \
348
	ei386bsd.o \
349
	ei386coff.o \
349
	ei386coff.o \
350
	ei386freebsd.o \
350
	ei386go32.o \
351
	ei386go32.o \
351
	ei386linux.o \
352
	ei386linux.o \
352
	ei386lynx.o \
353
	ei386lynx.o \
Lines 1711-1716 ei386bsd.c: $(srcdir)/emulparams/i386bsd Link Here
1711
ei386coff.c: $(srcdir)/emulparams/i386coff.sh \
1712
ei386coff.c: $(srcdir)/emulparams/i386coff.sh \
1712
  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386coff.sc ${GEN_DEPENDS}
1713
  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386coff.sc ${GEN_DEPENDS}
1713
	${GENSCRIPTS} i386coff "$(tdir_i386coff)"
1714
	${GENSCRIPTS} i386coff "$(tdir_i386coff)"
1715
ei386freebsd.c: $(srcdir)/emulparams/i386freebsd.sh \
1716
  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
1717
	${GENSCRIPTS} i386freebsd "$(tdir_i386freebsd)"
1714
ei386go32.c: $(srcdir)/emulparams/i386go32.sh \
1718
ei386go32.c: $(srcdir)/emulparams/i386go32.sh \
1715
  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386go32.sc ${GEN_DEPENDS}
1719
  $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386go32.sc ${GEN_DEPENDS}
1716
	${GENSCRIPTS} i386go32 "$(tdir_i386go32)"
1720
	${GENSCRIPTS} i386go32 "$(tdir_i386go32)"
(-)binutils-2.16.1/ld/emulparams/i386freebsd.sh (+6 lines)
Line 0 Link Here
1
SCRIPT_NAME=aout
2
TEXT_START_ADDR=0x1020
3
OUTPUT_FORMAT="a.out-i386-freebsd"
4
TARGET_PAGE_SIZE=0x1000
5
ARCH=i386
6
EXECUTABLE_SYMBOLS='__DYNAMIC = 0;'
(-)binutils-2.16.1/ld/emultempl/elf32.em (+97 lines)
Lines 522-527 gld${EMULATION_NAME}_add_sysroot (const Link Here
522
522
523
EOF
523
EOF
524
  case ${target} in
524
  case ${target} in
525
    *-*-freebsd*)
526
      cat >>e${EMULATION_NAME}.c <<EOF
527
/*
528
 * Read the system search path the FreeBSD way rather than like Linux.
529
 */
530
#ifdef HAVE_ELF_HINTS_H
531
#include <elf-hints.h>
532
#else
533
 /*
534
  * Fallback code took from FreeBSD's libc
535
  * Copyright (c) 1997 John D. Polstra.
536
  *
537
  * This works only if the hints file is generated with a compatible version
538
  * of ldconfig (most FreeBSD up to 6.1 and DragonFly at least up to 1.4),
539
  * and with the same endianness.
540
  */
541
542
  struct elfhints_hdr {
543
        u_int32_t       magic;          /* Magic number */
544
        u_int32_t       version;        /* File version (1) */
545
        u_int32_t       strtab;         /* Offset of string table in file */
546
        u_int32_t       strsize;        /* Size of string table */
547
        u_int32_t       dirlist;        /* Offset of directory list in
548
                                           string table */
549
        u_int32_t       dirlistlen;     /* strlen(dirlist) */
550
        u_int32_t       spare[26];      /* Room for expansion */
551
  };
552
553
  #define ELFHINTS_MAGIC  0x746e6845
554
555
  #define _PATH_ELF_HINTS "/var/run/ld-elf.so.hints"
556
#endif
557
558
static bfd_boolean
559
gld${EMULATION_NAME}_check_ld_elf_hints (struct dt_needed *n, int force)
560
{
561
  const char *name = n->name;
562
  static bfd_boolean initialized;
563
  static char *ld_elf_hints;
564
565
  if (! initialized)
566
    {
567
      FILE *f;
568
      char *tmppath;
569
570
      tmppath = concat (ld_sysroot, _PATH_ELF_HINTS, NULL);
571
      f = fopen (tmppath, FOPEN_RB);
572
      free (tmppath);
573
      if (f != NULL)
574
	{
575
	  struct elfhints_hdr hdr;
576
577
	  if (fread(&hdr, 1, sizeof(hdr), f) == sizeof(hdr) &&
578
	      hdr.magic == ELFHINTS_MAGIC &&
579
	      hdr.version == 1)
580
	    {
581
	      if (fseek(f, hdr.strtab + hdr.dirlist, SEEK_SET) != -1)
582
		{
583
		  char *b;
584
585
		  b = (char *) xmalloc (hdr.dirlistlen + 1);
586
		  if (fread(b, 1, hdr.dirlistlen + 1, f) !=
587
		      hdr.dirlistlen + 1)
588
		    {
589
		      free(b);
590
		      b = NULL;
591
		    }
592
		  else
593
		    {
594
		      ld_elf_hints = gld${EMULATION_NAME}_add_sysroot (b);
595
		      free (b);
596
		    }
597
		}
598
	    }
599
	  fclose (f);
600
	}
601
602
      initialized = TRUE;
603
    }
604
605
  if (ld_elf_hints == NULL)
606
    return FALSE;
607
608
  return gld${EMULATION_NAME}_search_needed (ld_elf_hints, n, force);
609
}
610
EOF
611
    # FreeBSD
612
    ;;
613
525
    *-*-linux-gnu*)
614
    *-*-linux-gnu*)
526
      cat >>e${EMULATION_NAME}.c <<EOF
615
      cat >>e${EMULATION_NAME}.c <<EOF
527
/* For a native linker, check the file /etc/ld.so.conf for directories
616
/* For a native linker, check the file /etc/ld.so.conf for directories
Lines 932-937 cat >>e${EMULATION_NAME}.c <<EOF Link Here
932
EOF
1021
EOF
933
if [ "x${USE_LIBPATH}" = xyes ] ; then
1022
if [ "x${USE_LIBPATH}" = xyes ] ; then
934
  case ${target} in
1023
  case ${target} in
1024
    *-*-freebsd*)
1025
      cat >>e${EMULATION_NAME}.c <<EOF
1026
	  if (gld${EMULATION_NAME}_check_ld_elf_hints (&n, force))
1027
	    break;
1028
EOF
1029
    # FreeBSD
1030
    ;;
1031
935
    *-*-linux-gnu*)
1032
    *-*-linux-gnu*)
936
      cat >>e${EMULATION_NAME}.c <<EOF
1033
      cat >>e${EMULATION_NAME}.c <<EOF
937
	  if (gld${EMULATION_NAME}_check_ld_so_conf (l->name, force))
1034
	  if (gld${EMULATION_NAME}_check_ld_so_conf (l->name, force))
(-)binutils-2.16.1/ld/configure.in (-1 / +1 lines)
Lines 118-124 AC_SUBST(HOSTING_CRT0) Link Here
118
AC_SUBST(HOSTING_LIBS)
118
AC_SUBST(HOSTING_LIBS)
119
AC_SUBST(NATIVE_LIB_DIRS)
119
AC_SUBST(NATIVE_LIB_DIRS)
120
120
121
AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h)
121
AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h elf-hints.h)
122
AC_CHECK_FUNCS(sbrk realpath glob)
122
AC_CHECK_FUNCS(sbrk realpath glob)
123
AC_HEADER_DIRENT
123
AC_HEADER_DIRENT
124
124

Return to bug 123496