Mon, 12 Jan 2009 14:38:36 +0100
Import package vendor original specs for necessary manipulations.
1 Use the platform specific ELF branding expected under FreeBSD.
2 This is similar to what the vendor ld(1) does on this platform.
4 Additionally, recognize and ignore Solaris 10's "Solaris Cryptographic
5 Framework" ELF header type "SUNW_signature", Solaris 10 "Symbol
6 information" ELF header type "SUNW_syminfo" and Solaris 10 "DTrace
7 Object Format" ELF header type. Also, fix the path to the dynamic
8 linker under Solaris 10/amd64.
10 Index: include/elf/common.h
11 --- include/elf/common.h.orig 2007-08-28 19:19:40 +0200
12 +++ include/elf/common.h 2007-08-29 09:30:04 +0200
13 @@ -353,6 +353,9 @@
14 #define SHT_SUNW_verdef 0x6ffffffd /* Versions defined by file */
15 #define SHT_SUNW_verneed 0x6ffffffe /* Versions needed by file */
16 #define SHT_SUNW_versym 0x6fffffff /* Symbol versions */
17 +#define SHT_SUNW_syminfo 0x6ffffffc /* Symbol information */
18 +#define SHT_SUNW_signature 0x6ffffff6 /* Solaris Cryptographic Framework: Digital Signature */
19 +#define SHT_SUNW_dof 0x6ffffff4 /* Solaris DTrace Object Format */
21 #define SHT_GNU_verdef SHT_SUNW_verdef
22 #define SHT_GNU_verneed SHT_SUNW_verneed
23 Index: bfd/elf.c
24 --- bfd/elf.c.orig 2007-08-28 19:19:33 +0200
25 +++ bfd/elf.c 2007-08-29 09:30:04 +0200
26 @@ -1793,6 +1793,11 @@
27 elf_tdata (abfd)->dynverref_hdr = *hdr;
28 return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
30 + case SHT_SUNW_syminfo:
31 + /* case SHT_SUNW_signature: conflicts with new SHT_GNU_HASH in Binutils 2.18 */
32 + case SHT_SUNW_dof:
33 + return TRUE;
34 +
35 case SHT_SHLIB:
36 return TRUE;
38 @@ -4682,6 +4687,12 @@
39 else
40 i_ehdrp->e_type = ET_REL;
42 + /* OpenPKG platform branding BEGIN */
43 +#if defined(OPENPKG_OS_FREEBSD)
44 + i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
45 +#endif
46 + /* OpenPKG platform branding END */
47 +
48 switch (bfd_get_arch (abfd))
49 {
50 case bfd_arch_unknown:
51 Index: bfd/elf64-x86-64.c
52 --- bfd/elf64-x86-64.c.orig 2007-08-06 21:59:33 +0200
53 +++ bfd/elf64-x86-64.c 2007-08-29 09:30:04 +0200
54 @@ -345,7 +345,11 @@
55 /* The name of the dynamic interpreter. This is put in the .interp
56 section. */
58 +#if defined(OPENPKG_OS_SOLARIS)
59 +#define ELF_DYNAMIC_INTERPRETER "/lib/amd64/ld.so.1"
60 +#else
61 #define ELF_DYNAMIC_INTERPRETER "/lib/ld64.so.1"
62 +#endif
64 /* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid
65 copying dynamic variables from a shared lib into an app's dynbss
67 -----------------------------------------------------------------------------
69 Support FreeBSD >= 4.10 by fixing platform detection.
71 Index: bfd/configure
72 --- bfd/configure.orig 2007-08-28 22:19:51 +0200
73 +++ bfd/configure 2007-08-29 09:30:04 +0200
74 @@ -17459,6 +17459,10 @@
75 i[3-7]86-*-bsdi)
76 COREFILE=
77 ;;
78 + i[3456]86-*-freebsd4.1[0-9]*)
79 + COREFILE=''
80 + TRAD_HEADER='"hosts/i386bsd.h"'
81 + ;;
82 i[3-7]86-*-bsd* | i[3-7]86-*-freebsd[123] | i[3-7]86-*-freebsd[123]\.* | i[3-7]86-*-freebsd4\.[01234] | i[3-7]86-*-freebsd4\.[01234]\.* | i[3-7]86-*-freebsd*aout*)
83 COREFILE=trad-core.lo
84 TRAD_HEADER='"hosts/i386bsd.h"'
86 -----------------------------------------------------------------------------
88 Fight problems with --disable-nls under Solaris
90 Index: gas/asintl.h
91 --- gas/asintl.h.orig 2007-08-06 21:59:49 +0200
92 +++ gas/asintl.h 2007-08-29 09:30:04 +0200
93 @@ -20,6 +20,11 @@
94 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
95 02110-1301, USA. */
97 +#ifndef ENABLE_NLS
98 +# define _LIBINTL_H
99 +# define _LIBGETTEXT_H
100 +#endif
101 +
102 #ifdef HAVE_LOCALE_H
103 # ifndef ENABLE_NLS
104 /* The Solaris version of locale.h always includes libintl.h. If we have
105 Index: ld/ld.h
106 --- ld/ld.h.orig 2007-08-06 22:00:19 +0200
107 +++ ld/ld.h 2007-08-29 09:30:04 +0200
108 @@ -23,6 +23,11 @@
109 #ifndef LD_H
110 #define LD_H
112 +#ifndef ENABLE_NLS
113 +# define _LIBINTL_H
114 +# define _LIBGETTEXT_H
115 +#endif
116 +
117 #ifdef HAVE_LOCALE_H
118 #endif
119 #ifndef SEEK_CUR
120 Index: ld/Makefile.in
121 --- ld/Makefile.in.orig 2007-08-06 22:29:54 +0200
122 +++ ld/Makefile.in 2007-08-29 09:30:04 +0200
123 @@ -287,7 +287,7 @@
124 # We put the scripts in the directory $(scriptdir)/ldscripts.
125 # We can't put the scripts in $(datadir) because the SEARCH_DIR
126 # directives need to be different for native and cross linkers.
127 -scriptdir = $(tooldir)/lib
128 +scriptdir = $(libdir)
129 BASEDIR = $(srcdir)/..
130 BFDDIR = $(BASEDIR)/bfd
131 INCDIR = $(BASEDIR)/include
133 -----------------------------------------------------------------------------
135 workaround problems under Mac OS X.
137 Index: libiberty/fibheap.c
138 --- libiberty/fibheap.c.orig 2005-05-10 17:33:33 +0200
139 +++ libiberty/fibheap.c 2007-08-29 09:30:04 +0200
140 @@ -34,8 +34,11 @@
141 #include "libiberty.h"
142 #include "fibheap.h"
144 -
145 +#ifdef LONG_MIN
146 #define FIBHEAPKEY_MIN LONG_MIN
147 +#else
148 +#define FIBHEAPKEY_MIN (-0x7fffffffL - 1)
149 +#endif
151 static void fibheap_ins_root (fibheap_t, fibnode_t);
152 static void fibheap_rem_root (fibheap_t, fibnode_t);
154 -----------------------------------------------------------------------------
156 Disable the "error" about "eh_frame_hdr" as it is actually more a
157 warning (the linking is *not* aborted) and it occurs at least under
158 FreeBSD-7.0/amd64 regularily without doing any obvious harm. Seems
159 like the issue itself exists since a longer time, but in recent GNU
160 binutils this additional message was introduced. As we cannot observe
161 any problems and this message really confused, just disable it for now.
163 Index: bfd/elf-eh-frame.c
164 --- bfd/elf-eh-frame.c.orig 2007-08-06 21:59:22 +0200
165 +++ bfd/elf-eh-frame.c 2007-11-11 15:46:44 +0100
166 @@ -970,9 +970,11 @@
167 return offset != sec->rawsize;
169 free_no_table:
170 +#if 0
171 (*info->callbacks->einfo)
172 (_("%P: error in %B(%A); no .eh_frame_hdr table will be created.\n"),
173 abfd, sec);
174 +#endif
175 if (ehbuf)
176 free (ehbuf);
177 if (sec_info)