binutils.patch 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. Use the platform specific ELF branding expected under FreeBSD.
  2. This is similar to what the vendor ld(1) does on this platform.
  3. Index: bfd/elf.c
  4. --- bfd/elf.c.orig 2002-07-30 20:19:42.000000000 +0200
  5. +++ bfd/elf.c 2002-08-22 17:41:47.000000000 +0200
  6. @@ -4235,6 +4235,12 @@
  7. else
  8. i_ehdrp->e_type = ET_REL;
  9. + /* OpenPKG platform branding BEGIN */
  10. +#if defined(OPENPKG_OS_FREEBSD)
  11. + i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
  12. +#endif
  13. + /* OpenPKG platform branding END */
  14. +
  15. switch (bfd_get_arch (abfd))
  16. {
  17. case bfd_arch_unknown:
  18. -----------------------------------------------------------------------------
  19. Fix the linker under Solaris/SPARC.
  20. Index: bfd/elf64-sparc.c
  21. --- bfd/elf64-sparc.c.orig 2003-06-20 09:42:19.000000000 +0200
  22. +++ bfd/elf64-sparc.c 2003-06-20 09:42:40.000000000 +0200
  23. @@ -2684,7 +2684,7 @@
  24. overflows. We don't, but this breaks stabs debugging
  25. info, whose relocations are only 32-bits wide. Ignore
  26. overflows for discarded entries. */
  27. - if (r_type == R_SPARC_32
  28. + if ((r_type == R_SPARC_32 || r_type == R_SPARC_DISP32)
  29. && _bfd_elf_section_offset (output_bfd, info, input_section,
  30. rel->r_offset) == (bfd_vma) -1)
  31. break;
  32. -----------------------------------------------------------------------------
  33. Support FreeBSD 4.10 by fixing platform detection.
  34. Index: bfd/configure
  35. --- bfd/configure.orig 2003-06-12 16:25:46.000000000 +0200
  36. +++ bfd/configure 2004-04-30 22:01:31.000000000 +0200
  37. @@ -5133,6 +5133,10 @@
  38. i[3456]86-*-bsdi)
  39. COREFILE=
  40. ;;
  41. + i[3456]86-*-freebsd4.1[0-9]*)
  42. + COREFILE=''
  43. + TRAD_HEADER='"hosts/i386bsd.h"'
  44. + ;;
  45. i[3456]86-*-bsd* | i[34567]86-*-freebsd[123] | i[34567]86-*-freebsd[123]\.* | i[34567]86-*-freebsd4\.[01234]* | i[34567]86-*-freebsd*aout*)
  46. COREFILE=trad-core.lo
  47. TRAD_HEADER='"hosts/i386bsd.h"'
  48. -----------------------------------------------------------------------------
  49. Accept (and ignore) --as-needed/--no-as-needed options from GNU binutils
  50. 2.15 in our GNU binutils 2.14 to resolve a chicken and egg problem under
  51. platforms (like Fedora Core 2) which already run GNU binutils 2.15: the
  52. vendor cc(1) knows that it has ld(1) from GNU binutils 2.15 and hence
  53. always uses the --as-needed option when calling ld(1). Unfortunately,
  54. between having built "binutils" and "gcc" packages, this will break
  55. OpenPKG because the vendor cc(1) would run the OpenPKG ld(1) with an
  56. option is (still) does not understand. The only workaround is to let our
  57. ld(1) accept and ignore this option. Once our cc(1) from "gcc" package
  58. is installed, the problem is gone, because our "gcc" package correctly
  59. detects that our ld(1) still does ot understand --as-needed.
  60. Index: ld/lexsup.c
  61. --- ld/lexsup.c.orig 2003-03-31 20:12:52.000000000 +0200
  62. +++ ld/lexsup.c 2004-05-05 16:52:46.000000000 +0200
  63. @@ -112,7 +112,9 @@
  64. #define OPTION_SPLIT_BY_RELOC (OPTION_WARN_SECTION_ALIGN + 1)
  65. #define OPTION_SPLIT_BY_FILE (OPTION_SPLIT_BY_RELOC + 1)
  66. #define OPTION_WHOLE_ARCHIVE (OPTION_SPLIT_BY_FILE + 1)
  67. -#define OPTION_WRAP (OPTION_WHOLE_ARCHIVE + 1)
  68. +#define OPTION_AS_NEEDED (OPTION_WHOLE_ARCHIVE + 1)
  69. +#define OPTION_NO_AS_NEEDED (OPTION_AS_NEEDED + 1)
  70. +#define OPTION_WRAP (OPTION_NO_AS_NEEDED + 1)
  71. #define OPTION_FORCE_EXE_SUFFIX (OPTION_WRAP + 1)
  72. #define OPTION_GC_SECTIONS (OPTION_FORCE_EXE_SUFFIX + 1)
  73. #define OPTION_NO_GC_SECTIONS (OPTION_GC_SECTIONS + 1)
  74. @@ -423,6 +425,10 @@
  75. TWO_DASHES },
  76. { {"whole-archive", no_argument, NULL, OPTION_WHOLE_ARCHIVE},
  77. '\0', NULL, N_("Include all objects from following archives"), TWO_DASHES },
  78. + { {"as-needed", no_argument, NULL, OPTION_AS_NEEDED},
  79. + '\0', NULL, N_("Only set DT_NEEDED for following dynamic libs if used"), TWO_DASHES },
  80. + { {"no-as-needed", no_argument, NULL, OPTION_NO_AS_NEEDED},
  81. + '\0', NULL, N_("Always set DT_NEEDED for following dynamic libs"), TWO_DASHES },
  82. { {"wrap", required_argument, NULL, OPTION_WRAP},
  83. '\0', N_("SYMBOL"), N_("Use wrapper functions for SYMBOL"), TWO_DASHES },
  84. { {"mpc860c0", optional_argument, NULL, OPTION_MPC860C0},
  85. @@ -823,6 +829,10 @@
  86. case OPTION_NO_WHOLE_ARCHIVE:
  87. whole_archive = FALSE;
  88. break;
  89. + case OPTION_AS_NEEDED:
  90. + case OPTION_NO_AS_NEEDED:
  91. + einfo("%P: warning: options --as-needed and --no-as-needed still not supported\n");
  92. + break;
  93. case 'O':
  94. /* FIXME "-O<non-digits> <value>" used to set the address of
  95. section <non-digits>. Was this for compatibility with