diff options
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 63 | ||||
-rw-r--r-- | bfd/Makefile.am | 6 | ||||
-rw-r--r-- | bfd/Makefile.in | 6 | ||||
-rw-r--r-- | bfd/aclocal.m4 | 18 | ||||
-rw-r--r-- | bfd/archures.c | 2 | ||||
-rw-r--r-- | bfd/bfd-in2.h | 486 | ||||
-rw-r--r-- | bfd/config.bfd | 7 | ||||
-rw-r--r-- | bfd/config.in | 9 | ||||
-rwxr-xr-x | bfd/configure | 992 | ||||
-rw-r--r-- | bfd/configure.in | 1 | ||||
-rw-r--r-- | bfd/cpu-i386.c | 35 | ||||
-rw-r--r-- | bfd/elf.c | 3 | ||||
-rw-r--r-- | bfd/elf64-ia64.c | 4201 | ||||
-rw-r--r-- | bfd/elf64-x86-64.c | 353 | ||||
-rw-r--r-- | bfd/libbfd.h | 10 | ||||
-rw-r--r-- | bfd/libcoff.h | 4 | ||||
-rw-r--r-- | bfd/po/POTFILES.in | 1 | ||||
-rw-r--r-- | bfd/po/bfd.pot | 371 | ||||
-rw-r--r-- | bfd/reloc.c | 19 | ||||
-rw-r--r-- | bfd/targets.c | 4 |
20 files changed, 5665 insertions, 926 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b6514303d21..7436c269ea0 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,20 @@ +2000-11-30 Jan Hubicka <jh@suse.cz> + + * Makefile.am (BFD64_BACKENDS): Add elf64-x86-64.lo + BFD64_BACKENDS_CFILES): Add elf64-x86-64.c + (elf64-x86-64.lo): Add dependencies. + * archures.c (DESCRIPTION): Add bfd_mach_x86_64, + bfd_mach_x86_64_intel_syntax. + * elf.c (prep_headers): Use EM_x86_64 for 64bit output. + * config.bfd (x86_64): Add. + * configure.in: Add support for bfd_elf64_x86_64_vec. + * cpu-i386.c (bfd_x86_64_arch_intel_syntax, bfd_x86_64_arch): Add. + (bfd_i386_arch, i8086_ar): Link in. + * elf64-x86-64.c: New file. + * reloc.c (ENUMDOC): Add BFD_RELOC_X86_64*. + * targets.c (bfd_elf64_x86_64_vec): Add. + (bfd_target_vect): Add bfd_elf64_x86_64_vec. + 2000-11-30 Kazu Hirata <kazu@hxi.com> * xcofflink.c: Fix formatting. @@ -306,7 +323,7 @@ if a relocation for an undefined symbol also results in an overflow. -Mon Nov 6 13:35:07 2000 Christopher Faylor <cgf@cygnus.com> +2000-11-06 Christopher Faylor <cgf@cygnus.com> * config.bfd: Add support for Sun Chorus. @@ -762,7 +779,7 @@ Mon Nov 6 13:35:07 2000 Christopher Faylor <cgf@cygnus.com> * elf32-mips.c (_bfd_mips_elf_final_write_processing): Return E_MIPS_ARCH_2 for bfd_mach_mips4K. -Wed Sep 13 19:31:39 2000 Marco Franzen <marcof@thyron.com> +2000-09-13 Marco Franzen <marcof@thyron.com> * som.c (som_write_symbol_strings): Do not used fixed buffers, use size_t as a counter. @@ -1062,7 +1079,7 @@ Wed Sep 13 19:31:39 2000 Marco Franzen <marcof@thyron.com> * elf32-i386.c (elf_i386_finish_dynamic_symbol): Revert 2000-08-27 change. -Thu Aug 31 22:49:30 2000 J"orn Rennecke <amylaar@cygnus.co.uk> +2000-08-31 J"orn Rennecke <amylaar@cygnus.co.uk> * elf32-sh.c (sh_elf_merge_private_data): If ibfd's elf header flags not initialized, set them to indicate the SH1 instruction set. @@ -1450,7 +1467,7 @@ Thu Aug 31 22:49:30 2000 J"orn Rennecke <amylaar@cygnus.co.uk> DT_PLTPAD, DT_MOVETAB, DT_SYMINFO, DT_RELACOUNT, DT_RELCOUNT, DT_FLAGS_1, DT_USED and DT_CHECKSUM. -Tue Jul 18 13:11:54 2000 Andrew Cagney <cagney@b1.cygnus.com> +2000-07-18 Andrew Cagney <cagney@b1.cygnus.com> * elf.c (bfd_elf_get_sign_extend_vma, bfd_elf_get_arch_size): Move renamed functions from here... @@ -1518,14 +1535,14 @@ Tue Jul 18 13:11:54 2000 Andrew Cagney <cagney@b1.cygnus.com> * elf64-hppa.c (elf64_hppa_check_relocs): Fix some warnings. (elf64_hppa_modify_segment_map): Likewise. -Tue Jul 11 17:21:52 2000 Andrew Cagney <cagney@b1.cygnus.com> +2000-07-11 Andrew Cagney <cagney@b1.cygnus.com> * elf.c (bfd_elf_get_sign_extend_vma): Return tendency of VMA addresses to be "naturally" sign extended. Return -1 if unknown. * bfd-in.h (bfd_elf_get_sign_extend_vma): Add declaration. * bfd-in2.h: Regenerate. -Tue Jul 11 16:25:52 2000 Andrew Cagney <cagney@b1.cygnus.com> +2000-07-11 Andrew Cagney <cagney@b1.cygnus.com> * ecoffswap.h (ecoff_get_off, ecoff_put_off): Add ECOFF_SIGNED_32 and ECOF_SIGNED_64 to list ways to extract an offset. @@ -1535,7 +1552,7 @@ Tue Jul 11 16:25:52 2000 Andrew Cagney <cagney@b1.cygnus.com> * elf64-mips.c (ECOFF_SIGNED_64): Define instead of ECOFF_64. * elf32-mips.c (ECOFF_SIGNED_32): Define instead of ECOFF_32. -Tue Jul 11 16:03:04 2000 Andrew Cagney <cagney@b1.cygnus.com> +2000-07-11 Andrew Cagney <cagney@b1.cygnus.com> * elfcode.h (elf_object_p): Use bfd_set_start_address and not bfd_get_start_address. @@ -2045,7 +2062,7 @@ Tue Jul 11 16:03:04 2000 Andrew Cagney <cagney@b1.cygnus.com> * configure: Regenerate. -Tue Jun 13 01:28:57 2000 J"orn Rennecke <amylaar@cygnus.co.uk> +2000-06-13 J"orn Rennecke <amylaar@cygnus.co.uk> * peicode.h (pe_ILF_object_p): Use TARGET_LITTLE_SYM instead of armpei_little_vec. @@ -2098,7 +2115,7 @@ Tue Jun 13 01:28:57 2000 J"orn Rennecke <amylaar@cygnus.co.uk> (i[3456]86-*-netbsd*): Add bfd_elf32_i386_vec to targ_selvecs. (i[3456]86-*-openbsd*): Likewise. -Tue May 30 15:39:04 2000 Andrew Cagney <cagney@b1.cygnus.com> +2000-05-30 Andrew Cagney <cagney@b1.cygnus.com> * trad-core.c: From hpux-core.c, include <dirent.h> or <sys/ndir.h> when possible. @@ -2271,7 +2288,7 @@ Tue May 30 15:39:04 2000 Andrew Cagney <cagney@b1.cygnus.com> * elflink.h (elf_bfd_final_link, elf_link_input_bfd): When emiting relocs for an executable, ensure that they are virtual addresses. -Thu May 18 10:55:47 2000 Jeffrey A Law (law@cygnus.com) +2000-05-18 Jeffrey A Law (law@cygnus.com) * config.bfd (hppa*64*-*-hpux11*): New target triplet. @@ -2295,7 +2312,7 @@ Thu May 18 10:55:47 2000 Jeffrey A Law (law@cygnus.com) read idata section only from dataoff. (pe_print_edata): Correctly check for valid eat_member. -Tue May 16 00:04:11 2000 J"orn Rennecke <amylaar@cygnus.co.uk> +2000-05-16 J"orn Rennecke <amylaar@cygnus.co.uk> * elf32-sh.c (sh_elf_relax_delete_bytes): Handle R_SH_SWITCH8. @@ -2349,7 +2366,7 @@ Tue May 16 00:04:11 2000 J"orn Rennecke <amylaar@cygnus.co.uk> (_bfd_pe_print_private_bfd_data_common): Print Reserved1 field as Win32Version. -Fri May 5 20:44:40 2000 Clinton Popetz <cpopetz@cygnus.com> +2000-05-05 Clinton Popetz <cpopetz@cygnus.com> * xcoff.h: Rename to xcoff-target.h * Makefile.am: Change all instances of xcoff.h to xcoff-target.h @@ -2358,7 +2375,7 @@ Fri May 5 20:44:40 2000 Clinton Popetz <cpopetz@cygnus.com> * coff-pmac.c: Ditto. * Makefile.in: Regenerate. -Fri May 5 16:51:03 2000 Clinton Popetz <cpopetz@cygnus.com> +2000-05-05 Clinton Popetz <cpopetz@cygnus.com> * coffcode.h (coff_set_arch_mach_hook, coff_set_flags): Change U802TOC64MAGIC to U803XTOCMAGIC. @@ -2401,7 +2418,7 @@ Fri May 5 16:51:03 2000 Clinton Popetz <cpopetz@cygnus.com> dependencies. * Makefile.in: Regenerate. -Mon May 1 16:56:47 2000 Jim Wilson <wilson@cygnus.com> +2000-05-01 Jim Wilson <wilson@cygnus.com> * Makefile.am (BFD32_BACKENDS): Add efi-app-ia32.lo. (BFD32_BACKENDS_CFILES): Add efi-app-ia32.c. @@ -2492,7 +2509,7 @@ Mon May 1 16:56:47 2000 Jim Wilson <wilson@cygnus.com> * coff-sh.c (bfd_coff_small_swap_table): Fix Fri Apr 28 change. * vms.c (vms_openr_next_archived_file): Return NULL. -Fri Apr 28 21:34:44 2000 Clinton Popetz <cpopetz@cygnus.com> +2000-04-28 Clinton Popetz <cpopetz@cygnus.com> * coffcode.h Copy changes mistakenly done to libcoff.h in 4/24/2000 patch. @@ -2505,7 +2522,7 @@ Fri Apr 28 21:34:44 2000 Clinton Popetz <cpopetz@cygnus.com> * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. -Fri Apr 28 14:58:37 2000 Clinton Popetz <cpopetz@cygnus.com> +2000-04-28 Clinton Popetz <cpopetz@cygnus.com> * Makefile.am (BFD64_BACKENDS, BFD64_BACKENDS_CFILES): Add coffdu-rs6000.{lo,c}. @@ -2518,14 +2535,14 @@ Fri Apr 28 14:58:37 2000 Clinton Popetz <cpopetz@cygnus.com> common to the xcoff backends into xcoff.h * coff64-rs6000.c: Ditto, -Fri Apr 28 08:35:21 2000 Clinton Popetz <cpopetz@cygnus.com> +2000-04-28 Clinton Popetz <cpopetz@cygnus.com> * coff-mips.c (mips_ecoff_backend_data): Add initialization of _bfd_coff_force_symnames in strings and _bfd_coff_debug_string_prefix_length to their default values. * coff-sh.c: (bfd_coff_small_swap_table): Ditto. -Fri Apr 28 08:05:12 2000 Clinton Popetz <cpopetz@cygnus.com> +2000-04-28 Clinton Popetz <cpopetz@cygnus.com> * coff-alpha.c (alpha_ecoff_backend_data): Add initialization of _bfd_coff_force_symnames in strings and @@ -2552,11 +2569,11 @@ Fri Apr 28 08:05:12 2000 Clinton Popetz <cpopetz@cygnus.com> can use a relative reloc for got as elf_i386_relocate_section. (bfd_elf32_bfd_final_link): Define to use gc form of final link. -Wed Apr 26 16:31:28 2000 Clinton Popetz <cpopetz@cygnus.com> +2000-04-26 Clinton Popetz <cpopetz@cygnus.com> * config.bfd: Remove extraneous bfd_powerpc_64_arch. -Mon Apr 24 15:20:35 2000 Clinton Popetz <cpopetz@cygnus.com> +2000-04-24 Clinton Popetz <cpopetz@cygnus.com> * Makefile.am (coff64-rs6000.lo): New rule. * Makefile.in: Regenerate. @@ -2616,7 +2633,7 @@ Mon Apr 24 15:20:35 2000 Clinton Popetz <cpopetz@cygnus.com> * configure.in: Add rs6000coff64_vec case. * cpu-powerpc.c: New bfd_arch_info_type. -Mon Apr 24 02:17:31 2000 Jeffrey A Law (law@cygnus.com) +2000-04-24 Jeffrey A Law (law@cygnus.com) * config.bfd: Only disable elf32-hppa vectors, not all of the BSD and OSF configuration support. Provide (disabled) clauses @@ -2634,12 +2651,12 @@ Mon Apr 24 02:17:31 2000 Jeffrey A Law (law@cygnus.com) * elf64-hppa.c, elf64-hppa.h: New files with PA64 support. -Mon Apr 24 02:14:29 2000 Jason Eckhardt <jle@cygnus.com> +2000-04-24 Jason Eckhardt <jle@cygnus.com> * libhppa.h (dis_assemble_16): New function. (pa_arch): Added pa20w element. -Mon Apr 24 01:49:03 2000 Ulrich Drepper <drepper@cygnus.com> +2000-04-24 Ulrich Drepper <drepper@cygnus.com> * elf-bfd.h: Add prototypes for bfd_elf32_write_relocs, bfd_elf32_slurp_reloc_table, bfd_elf64_write_relocs, and diff --git a/bfd/Makefile.am b/bfd/Makefile.am index 35ca54dae9a..0b23247d4a5 100644 --- a/bfd/Makefile.am +++ b/bfd/Makefile.am @@ -411,6 +411,7 @@ BFD64_BACKENDS = \ coff64-rs6000.lo \ demo64.lo \ efi-app-ia64.lo \ + elf64-x86-64.lo \ elf64-alpha.lo \ elf64-hppa.lo \ elf64-ia64.lo \ @@ -427,6 +428,7 @@ BFD64_BACKENDS_CFILES = \ coff64-rs6000.c \ demo64.c \ efi-app-ia64.c \ + elf64-x86-64.c \ elf64-alpha.c \ elf64-hppa.c \ elf64-ia64.c \ @@ -1254,6 +1256,10 @@ elf64-ia64.lo: elf64-ia64.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h \ $(INCDIR)/elf/reloc-macros.h elf64-target.h +elf64-x86-64.lo: elf64-x86-64.c $(INCDIR)/filenames.h elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/opcode/i386.h $(INCDIR)/elf/x86-64.h \ + $(INCDIR)/elf/reloc-macros.h elf64-target.h elf64-gen.lo: elf64-gen.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h elf64-target.h diff --git a/bfd/Makefile.in b/bfd/Makefile.in index e4e1efb2b92..e8779b8cc19 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -536,6 +536,7 @@ BFD64_BACKENDS = \ coff64-rs6000.lo \ demo64.lo \ efi-app-ia64.lo \ + elf64-x86-64.lo \ elf64-alpha.lo \ elf64-hppa.lo \ elf64-ia64.lo \ @@ -553,6 +554,7 @@ BFD64_BACKENDS_CFILES = \ coff64-rs6000.c \ demo64.c \ efi-app-ia64.c \ + elf64-x86-64.c \ elf64-alpha.c \ elf64-hppa.c \ elf64-ia64.c \ @@ -1794,6 +1796,10 @@ elf64-ia64.lo: elf64-ia64.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h $(INCDIR)/opcode/ia64.h $(INCDIR)/elf/ia64.h \ $(INCDIR)/elf/reloc-macros.h elf64-target.h +elf64-x86-64.lo: elf64-x86-64.c $(INCDIR)/filenames.h elf-bfd.h \ + $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ + $(INCDIR)/bfdlink.h $(INCDIR)/opcode/i386.h $(INCDIR)/elf/x86-64.h \ + $(INCDIR)/elf/reloc-macros.h elf64-target.h elf64-gen.lo: elf64-gen.c $(INCDIR)/filenames.h elf-bfd.h \ $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \ $(INCDIR)/bfdlink.h elf64-target.h diff --git a/bfd/aclocal.m4 b/bfd/aclocal.m4 index 9f18aaf7290..45cc33930d9 100644 --- a/bfd/aclocal.m4 +++ b/bfd/aclocal.m4 @@ -136,6 +136,24 @@ AC_DEFUN([CY_WITH_NLS],) AC_SUBST(INTLLIBS) ]) +#serial 1 +# This test replaces the one in autoconf. +# Currently this macro should have the same name as the autoconf macro +# because gettext's gettext.m4 (distributed in the automake package) +# still uses it. Otherwise, the use in gettext.m4 makes autoheader +# give these diagnostics: +# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX +# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX + +undefine([AC_ISC_POSIX]) + +AC_DEFUN(AC_ISC_POSIX, + [ + dnl This test replaces the obsolescent AC_ISC_POSIX kludge. + AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"]) + ] +) + # Do all the work for Automake. This macro actually does too much -- # some checks are only needed if your package does certain things. # But this isn't really a big deal. diff --git a/bfd/archures.c b/bfd/archures.c index f494d88fc0d..27a41b3cd4e 100644 --- a/bfd/archures.c +++ b/bfd/archures.c @@ -136,6 +136,8 @@ DESCRIPTION .#define bfd_mach_i386_i386 0 .#define bfd_mach_i386_i8086 1 .#define bfd_mach_i386_i386_intel_syntax 2 +.#define bfd_mach_x86_64 3 +.#define bfd_mach_x86_64_intel_syntax 4 . bfd_arch_we32k, {* AT&T WE32xxx *} . bfd_arch_tahoe, {* CCI/Harris Tahoe *} . bfd_arch_i860, {* Intel 860 *} diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 8bb9d0060bc..8120e24c4bb 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -774,7 +774,7 @@ extern int bfd_ticoff_get_section_load_page PARAMS ((struct sec *)); /* And more from the source. */ -void +void bfd_init PARAMS ((void)); bfd * @@ -789,31 +789,32 @@ bfd_openstreamr PARAMS ((const char *, const char *, PTR)); bfd * bfd_openw PARAMS ((CONST char *filename, CONST char *target)); -boolean +boolean bfd_close PARAMS ((bfd *abfd)); -boolean +boolean bfd_close_all_done PARAMS ((bfd *)); bfd * bfd_create PARAMS ((CONST char *filename, bfd *templ)); -boolean +boolean bfd_make_writable PARAMS ((bfd *abfd)); -boolean +boolean bfd_make_readable PARAMS ((bfd *abfd)); + /* Byte swapping macros for user section data. */ #define bfd_put_8(abfd, val, ptr) \ - ((void) (*((unsigned char *) (ptr)) = (unsigned char) (val))) + ((void) (*((unsigned char *)(ptr)) = (unsigned char)(val))) #define bfd_put_signed_8 \ bfd_put_8 #define bfd_get_8(abfd, ptr) \ - (*(unsigned char *) (ptr)) + (*(unsigned char *)(ptr)) #define bfd_get_signed_8(abfd, ptr) \ - ((*(unsigned char *) (ptr) ^ 0x80) - 0x80) + ((*(unsigned char *)(ptr) ^ 0x80) - 0x80) #define bfd_put_16(abfd, val, ptr) \ BFD_SEND(abfd, bfd_putx16, ((val),(ptr))) @@ -856,6 +857,7 @@ bfd_make_readable PARAMS ((bfd *abfd)); : (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \ : (abort (), (void) 0)) + /* Byte swapping macros for file header data. */ #define bfd_h_put_8(abfd, val, ptr) \ @@ -1127,7 +1129,7 @@ typedef struct sec /* The load address of the section - where it would be in a rom image; really only used for writing section header - information. */ + information. */ bfd_vma lma; @@ -1296,20 +1298,20 @@ bfd_make_section_anyway PARAMS ((bfd *abfd, const char *name)); asection * bfd_make_section PARAMS ((bfd *, const char *name)); -boolean +boolean bfd_set_section_flags PARAMS ((bfd *abfd, asection *sec, flagword flags)); -void +void bfd_map_over_sections PARAMS ((bfd *abfd, - void (*func) (bfd *abfd, + void (*func)(bfd *abfd, asection *sect, PTR obj), PTR obj)); -boolean +boolean bfd_set_section_size PARAMS ((bfd *abfd, asection *sec, bfd_size_type val)); -boolean +boolean bfd_set_section_contents PARAMS ((bfd *abfd, asection *section, @@ -1317,18 +1319,18 @@ bfd_set_section_contents file_ptr offset, bfd_size_type count)); -boolean +boolean bfd_get_section_contents PARAMS ((bfd *abfd, asection *section, PTR location, file_ptr offset, bfd_size_type count)); -boolean +boolean bfd_copy_private_section_data PARAMS ((bfd *ibfd, asection *isec, bfd *obfd, asection *osec)); #define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \ BFD_SEND (obfd, _bfd_copy_private_section_data, \ (ibfd, isection, obfd, osection)) -void +void _bfd_strip_section_from_output PARAMS ((struct bfd_link_info *info, asection *section)); @@ -1353,7 +1355,7 @@ enum bfd_architecture available to machines with higher numbers. The exception is the "ca", which is incompatible with all other machines except - "core". */ + "core". */ #define bfd_mach_i960_core 1 #define bfd_mach_i960_ka_sa 2 @@ -1402,6 +1404,8 @@ enum bfd_architecture #define bfd_mach_i386_i386 0 #define bfd_mach_i386_i8086 1 #define bfd_mach_i386_i386_intel_syntax 2 +#define bfd_mach_x86_64 3 +#define bfd_mach_x86_64_intel_syntax 4 bfd_arch_we32k, /* AT&T WE32xxx */ bfd_arch_tahoe, /* CCI/Harris Tahoe */ bfd_arch_i860, /* Intel 860 */ @@ -1542,22 +1546,22 @@ bfd_arch_get_compatible PARAMS (( const bfd *abfd, const bfd *bbfd)); -void +void bfd_set_arch_info PARAMS ((bfd *abfd, const bfd_arch_info_type *arg)); -enum bfd_architecture +enum bfd_architecture bfd_get_arch PARAMS ((bfd *abfd)); -unsigned long +unsigned long bfd_get_mach PARAMS ((bfd *abfd)); -unsigned int +unsigned int bfd_arch_bits_per_byte PARAMS ((bfd *abfd)); -unsigned int +unsigned int bfd_arch_bits_per_address PARAMS ((bfd *abfd)); -const bfd_arch_info_type * +const bfd_arch_info_type * bfd_get_arch_info PARAMS ((bfd *abfd)); const bfd_arch_info_type * @@ -1570,10 +1574,10 @@ const char * bfd_printable_arch_mach PARAMS ((enum bfd_architecture arch, unsigned long machine)); -unsigned int +unsigned int bfd_octets_per_byte PARAMS ((bfd *abfd)); -unsigned int +unsigned int bfd_arch_mach_octets_per_byte PARAMS ((enum bfd_architecture arch, unsigned long machine)); @@ -1582,22 +1586,22 @@ typedef enum bfd_reloc_status /* No errors detected */ bfd_reloc_ok, - /* The relocation was performed, but there was an overflow. */ + /* The relocation was performed, but there was an overflow. */ bfd_reloc_overflow, - /* The address to relocate was not within the section supplied. */ + /* The address to relocate was not within the section supplied. */ bfd_reloc_outofrange, /* Used by special functions */ bfd_reloc_continue, - /* Unsupported relocation size requested. */ + /* Unsupported relocation size requested. */ bfd_reloc_notsupported, /* Unused */ bfd_reloc_other, - /* The symbol to relocate against was undefined. */ + /* The symbol to relocate against was undefined. */ bfd_reloc_undefined, /* The relocation was performed, but may not be ok - presently @@ -1608,6 +1612,7 @@ typedef enum bfd_reloc_status } bfd_reloc_status_type; + typedef struct reloc_cache_entry { /* A pointer into the canonical table of pointers */ @@ -1625,19 +1630,19 @@ typedef struct reloc_cache_entry } arelent; enum complain_overflow { - /* Do not complain on overflow. */ + /* Do not complain on overflow. */ complain_overflow_dont, /* Complain if the bitfield overflows, whether it is considered - as signed or unsigned. */ + as signed or unsigned. */ complain_overflow_bitfield, /* Complain if the value overflows when considered as signed - number. */ + number. */ complain_overflow_signed, /* Complain if the value overflows when considered as an - unsigned number. */ + unsigned number. */ complain_overflow_unsigned }; @@ -1648,7 +1653,7 @@ struct reloc_howto_struct external idea of what a reloc number is stored in this field. For example, a PC relative word relocation in a coff environment has the type 023 - because that's - what the outside world calls a R_PCRWORD reloc. */ + what the outside world calls a R_PCRWORD reloc. */ unsigned int type; /* The value the final relocation is shifted right by. This drops @@ -1667,21 +1672,21 @@ struct reloc_howto_struct /* Notes that the relocation is relative to the location in the data section of the addend. The relocation function will subtract from the relocation value the address of the location - being relocated. */ + being relocated. */ boolean pc_relative; /* The bit position of the reloc value in the destination. - The relocated value is left shifted by this amount. */ + The relocated value is left shifted by this amount. */ unsigned int bitpos; /* What type of overflow error should be checked for when - relocating. */ + relocating. */ enum complain_overflow complain_on_overflow; /* If this field is non null, then the supplied function is called rather than the normal function. This allows really strange relocation methods to be accomodated (e.g., i960 callj - instructions). */ + instructions). */ bfd_reloc_status_type (*special_function) PARAMS ((bfd *abfd, arelent *reloc_entry, @@ -1691,7 +1696,7 @@ struct reloc_howto_struct bfd *output_bfd, char **error_message)); - /* The textual name of the relocation type. */ + /* The textual name of the relocation type. */ char *name; /* Some formats record a relocation addend in the section contents @@ -1717,7 +1722,7 @@ struct reloc_howto_struct 0x000000ff. When we have relocs which have an addend, such as sun4 extended relocs, the value in the offset part of a relocating field is garbage so we never use it. In this case - the mask would be 0x00000000. */ + the mask would be 0x00000000. */ bfd_vma src_mask; /* The dst_mask selects which parts of the instruction are replaced @@ -1753,7 +1758,7 @@ struct reloc_howto_struct } \ } \ } -unsigned int +unsigned int bfd_get_reloc_size PARAMS ((reloc_howto_type *)); typedef struct relent_chain { @@ -1791,7 +1796,8 @@ bfd_install_relocation enum bfd_reloc_code_real { _dummy_first_bfd_reloc_code_real, -/* Basic absolute relocations of N bits. */ + +/* Basic absolute relocations of N bits. */ BFD_RELOC_64, BFD_RELOC_32, BFD_RELOC_26, @@ -1804,7 +1810,7 @@ enum bfd_reloc_code_real { of the relocation itself; sometimes they are relative to the start of the section containing the relocation. It depends on the specific target. -The 24-bit relocation is used in some Intel 960 configurations. */ +The 24-bit relocation is used in some Intel 960 configurations. */ BFD_RELOC_64_PCREL, BFD_RELOC_32_PCREL, BFD_RELOC_24_PCREL, @@ -1812,7 +1818,7 @@ The 24-bit relocation is used in some Intel 960 configurations. */ BFD_RELOC_12_PCREL, BFD_RELOC_8_PCREL, -/* For ELF. */ +/* For ELF. */ BFD_RELOC_32_GOT_PCREL, BFD_RELOC_16_GOT_PCREL, BFD_RELOC_8_GOT_PCREL, @@ -1833,12 +1839,12 @@ The 24-bit relocation is used in some Intel 960 configurations. */ BFD_RELOC_HI16_S_PLTOFF, BFD_RELOC_8_PLTOFF, -/* Relocations used by 68K ELF. */ +/* Relocations used by 68K ELF. */ BFD_RELOC_68K_GLOB_DAT, BFD_RELOC_68K_JMP_SLOT, BFD_RELOC_68K_RELATIVE, -/* Linkage-table relative. */ +/* Linkage-table relative. */ BFD_RELOC_32_BASEREL, BFD_RELOC_16_BASEREL, BFD_RELOC_LO16_BASEREL, @@ -1847,7 +1853,7 @@ The 24-bit relocation is used in some Intel 960 configurations. */ BFD_RELOC_8_BASEREL, BFD_RELOC_RVA, -/* Absolute 8-bit relocation, but used to form an address like 0xFFnn. */ +/* Absolute 8-bit relocation, but used to form an address like 0xFFnn. */ BFD_RELOC_8_FFnn, /* These PC-relative relocations are stored as word displacements -- @@ -1855,28 +1861,28 @@ i.e., byte displacements shifted right two bits. The 30-bit word displacement (<<32_PCREL_S2>> -- 32 bits, shifted 2) is used on the SPARC. (SPARC tools generally refer to this as <<WDISP30>>.) The signed 16-bit displacement is used on the MIPS, and the 23-bit -displacement is used on the Alpha. */ +displacement is used on the Alpha. */ BFD_RELOC_32_PCREL_S2, BFD_RELOC_16_PCREL_S2, BFD_RELOC_23_PCREL_S2, /* High 22 bits and low 10 bits of 32-bit value, placed into lower bits of -the target word. These are used on the SPARC. */ +the target word. These are used on the SPARC. */ BFD_RELOC_HI22, BFD_RELOC_LO10, /* For systems that allocate a Global Pointer register, these are displacements off that register. These relocation types are handled specially, because the value the register will have is -decided relatively late. */ +decided relatively late. */ BFD_RELOC_GPREL16, BFD_RELOC_GPREL32, -/* Reloc types used for i960/b.out. */ +/* Reloc types used for i960/b.out. */ BFD_RELOC_I960_CALLJ, /* SPARC ELF relocations. There is probably some overlap with other -relocation types already defined. */ +relocation types already defined. */ BFD_RELOC_NONE, BFD_RELOC_SPARC_WDISP22, BFD_RELOC_SPARC22, @@ -1893,7 +1899,7 @@ relocation types already defined. */ BFD_RELOC_SPARC_RELATIVE, BFD_RELOC_SPARC_UA32, -/* I think these are specific to SPARC a.out (e.g., Sun 4). */ +/* I think these are specific to SPARC a.out (e.g., Sun 4). */ BFD_RELOC_SPARC_BASE13, BFD_RELOC_SPARC_BASE22, @@ -1930,18 +1936,18 @@ relocation types already defined. */ For GPDISP_HI16 ("gpdisp") relocations, the symbol is ignored when writing; when reading, it will be the absolute section symbol. The addend is the displacement in bytes of the "lda" instruction from -the "ldah" instruction (which is at the address of this reloc). */ +the "ldah" instruction (which is at the address of this reloc). */ BFD_RELOC_ALPHA_GPDISP_HI16, /* For GPDISP_LO16 ("ignore") relocations, the symbol is handled as with GPDISP_HI16 relocs. The addend is ignored when writing the relocations out, and is filled in with the file's GP value on -reading, for convenience. */ +reading, for convenience. */ BFD_RELOC_ALPHA_GPDISP_LO16, /* The ELF GPDISP relocation is exactly the same as the GPDISP_HI16 relocation except that there is no accompanying GPDISP_LO16 -relocation. */ +relocation. */ BFD_RELOC_ALPHA_GPDISP, /* The Alpha LITERAL/LITUSE relocs are produced by a symbol reference; @@ -1968,14 +1974,14 @@ of instruction using the register: 2 - byte-manipulation (byte offset reg) 3 - jsr (target of branch) -The GNU linker currently doesn't do any of this optimizing. */ +The GNU linker currently doesn't do any of this optimizing. */ BFD_RELOC_ALPHA_LITERAL, BFD_RELOC_ALPHA_ELF_LITERAL, BFD_RELOC_ALPHA_LITUSE, /* The BFD_RELOC_ALPHA_USER_* relocations are used by the assembler to process the explicit !<reloc>!sequence relocations, and are mapped -into the normal relocations at the end of processing. */ +into the normal relocations at the end of processing. */ BFD_RELOC_ALPHA_USER_LITERAL, BFD_RELOC_ALPHA_USER_LITUSE_BASE, BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF, @@ -1986,52 +1992,52 @@ into the normal relocations at the end of processing. */ /* The HINT relocation indicates a value that should be filled into the "hint" field of a jmp/jsr/ret instruction, for possible branch- -prediction logic which may be provided on some processors. */ +prediction logic which may be provided on some processors. */ BFD_RELOC_ALPHA_HINT, /* The LINKAGE relocation outputs a linkage pair in the object file, -which is filled by the linker. */ +which is filled by the linker. */ BFD_RELOC_ALPHA_LINKAGE, /* The CODEADDR relocation outputs a STO_CA in the object file, -which is filled by the linker. */ +which is filled by the linker. */ BFD_RELOC_ALPHA_CODEADDR, /* Bits 27..2 of the relocation address shifted right 2 bits; -simple reloc otherwise. */ +simple reloc otherwise. */ BFD_RELOC_MIPS_JMP, -/* The MIPS16 jump instruction. */ +/* The MIPS16 jump instruction. */ BFD_RELOC_MIPS16_JMP, -/* MIPS16 GP relative reloc. */ +/* MIPS16 GP relative reloc. */ BFD_RELOC_MIPS16_GPREL, -/* High 16 bits of 32-bit value; simple reloc. */ +/* High 16 bits of 32-bit value; simple reloc. */ BFD_RELOC_HI16, /* High 16 bits of 32-bit value but the low 16 bits will be sign extended and added to form the final result. If the low 16 bits form a negative number, we need to add one to the high value -to compensate for the borrow when the low bits are added. */ +to compensate for the borrow when the low bits are added. */ BFD_RELOC_HI16_S, -/* Low 16 bits. */ +/* Low 16 bits. */ BFD_RELOC_LO16, -/* Like BFD_RELOC_HI16_S, but PC relative. */ +/* Like BFD_RELOC_HI16_S, but PC relative. */ BFD_RELOC_PCREL_HI16_S, -/* Like BFD_RELOC_LO16, but PC relative. */ +/* Like BFD_RELOC_LO16, but PC relative. */ BFD_RELOC_PCREL_LO16, -/* Relocation relative to the global pointer. */ +/* Relocation relative to the global pointer. */ #define BFD_RELOC_MIPS_GPREL BFD_RELOC_GPREL16 -/* Relocation against a MIPS literal section. */ +/* Relocation against a MIPS literal section. */ BFD_RELOC_MIPS_LITERAL, -/* MIPS ELF relocations. */ +/* MIPS ELF relocations. */ BFD_RELOC_MIPS_GOT16, BFD_RELOC_MIPS_CALL16, #define BFD_RELOC_MIPS_GPREL32 BFD_RELOC_GPREL32 @@ -2044,6 +2050,7 @@ to compensate for the borrow when the low bits are added. */ BFD_RELOC_MIPS_GOT_OFST, BFD_RELOC_MIPS_GOT_DISP, + /* i386/elf relocations */ BFD_RELOC_386_GOT32, BFD_RELOC_386_PLT32, @@ -2054,6 +2061,16 @@ to compensate for the borrow when the low bits are added. */ BFD_RELOC_386_GOTOFF, BFD_RELOC_386_GOTPC, +/* x86-64/elf relocations */ + BFD_RELOC_X86_64_GOT32, + BFD_RELOC_X86_64_PLT32, + BFD_RELOC_X86_64_COPY, + BFD_RELOC_X86_64_GLOB_DAT, + BFD_RELOC_X86_64_JUMP_SLOT, + BFD_RELOC_X86_64_RELATIVE, + BFD_RELOC_X86_64_GOTPCREL, + BFD_RELOC_X86_64_32S, + /* ns32k relocations */ BFD_RELOC_NS32K_IMM_8, BFD_RELOC_NS32K_IMM_16, @@ -2068,7 +2085,7 @@ to compensate for the borrow when the low bits are added. */ BFD_RELOC_NS32K_DISP_16_PCREL, BFD_RELOC_NS32K_DISP_32_PCREL, -/* Picojava relocs. Not all of these appear in object files. */ +/* Picojava relocs. Not all of these appear in object files. */ BFD_RELOC_PJ_CODE_HI16, BFD_RELOC_PJ_CODE_LO16, BFD_RELOC_PJ_CODE_DIR16, @@ -2076,7 +2093,7 @@ to compensate for the borrow when the low bits are added. */ BFD_RELOC_PJ_CODE_REL16, BFD_RELOC_PJ_CODE_REL32, -/* Power(rs6000) and PowerPC relocations. */ +/* Power(rs6000) and PowerPC relocations. */ BFD_RELOC_PPC_B26, BFD_RELOC_PPC_BA26, BFD_RELOC_PPC_TOC16, @@ -2113,25 +2130,25 @@ to compensate for the borrow when the low bits are added. */ /* The type of reloc used to build a contructor table - at the moment probably a 32 bit wide absolute relocation, but the target can choose. -It generally does map to one of the other relocation types. */ +It generally does map to one of the other relocation types. */ BFD_RELOC_CTOR, /* ARM 26 bit pc-relative branch. The lowest two bits must be zero and are -not stored in the instruction. */ +not stored in the instruction. */ BFD_RELOC_ARM_PCREL_BRANCH, /* ARM 26 bit pc-relative branch. The lowest bit must be zero and is not stored in the instruction. The 2nd lowest bit comes from a 1 bit -field in the instruction. */ +field in the instruction. */ BFD_RELOC_ARM_PCREL_BLX, /* Thumb 22 bit pc-relative branch. The lowest bit must be zero and is not stored in the instruction. The 2nd lowest bit comes from a 1 bit -field in the instruction. */ +field in the instruction. */ BFD_RELOC_THUMB_PCREL_BLX, /* These relocs are only used within the ARM assembler. They are not -(at present) written to any object files. */ +(at present) written to any object files. */ BFD_RELOC_ARM_IMMEDIATE, BFD_RELOC_ARM_ADRL_IMMEDIATE, BFD_RELOC_ARM_OFFSET_IMM, @@ -2159,7 +2176,7 @@ field in the instruction. */ BFD_RELOC_ARM_GOTOFF, BFD_RELOC_ARM_GOTPC, -/* Hitachi SH relocs. Not all of these appear in object files. */ +/* Hitachi SH relocs. Not all of these appear in object files. */ BFD_RELOC_SH_PCDISP8BY2, BFD_RELOC_SH_PCDISP12BY2, BFD_RELOC_SH_IMM4, @@ -2187,7 +2204,7 @@ field in the instruction. */ BFD_RELOC_SH_GOTPC, /* Thumb 23-, 12- and 9-bit pc-relative branches. The lowest bit must -be zero and is not stored in the instruction. */ +be zero and is not stored in the instruction. */ BFD_RELOC_THUMB_PCREL_BRANCH9, BFD_RELOC_THUMB_PCREL_BRANCH12, BFD_RELOC_THUMB_PCREL_BRANCH23, @@ -2195,108 +2212,108 @@ be zero and is not stored in the instruction. */ /* Argonaut RISC Core (ARC) relocs. ARC 22 bit pc-relative branch. The lowest two bits must be zero and are not stored in the instruction. The high 20 bits are installed in bits 26 -through 7 of the instruction. */ +through 7 of the instruction. */ BFD_RELOC_ARC_B22_PCREL, /* ARC 26 bit absolute branch. The lowest two bits must be zero and are not stored in the instruction. The high 24 bits are installed in bits 23 -through 0. */ +through 0. */ BFD_RELOC_ARC_B26, /* Mitsubishi D10V relocs. This is a 10-bit reloc with the right 2 bits -assumed to be 0. */ +assumed to be 0. */ BFD_RELOC_D10V_10_PCREL_R, /* Mitsubishi D10V relocs. This is a 10-bit reloc with the right 2 bits assumed to be 0. This is the same as the previous reloc except it is in the left container, i.e., -shifted left 15 bits. */ +shifted left 15 bits. */ BFD_RELOC_D10V_10_PCREL_L, /* This is an 18-bit reloc with the right 2 bits -assumed to be 0. */ +assumed to be 0. */ BFD_RELOC_D10V_18, /* This is an 18-bit reloc with the right 2 bits -assumed to be 0. */ +assumed to be 0. */ BFD_RELOC_D10V_18_PCREL, /* Mitsubishi D30V relocs. -This is a 6-bit absolute reloc. */ +This is a 6-bit absolute reloc. */ BFD_RELOC_D30V_6, /* This is a 6-bit pc-relative reloc with -the right 3 bits assumed to be 0. */ +the right 3 bits assumed to be 0. */ BFD_RELOC_D30V_9_PCREL, /* This is a 6-bit pc-relative reloc with the right 3 bits assumed to be 0. Same as the previous reloc but on the right side -of the container. */ +of the container. */ BFD_RELOC_D30V_9_PCREL_R, /* This is a 12-bit absolute reloc with the -right 3 bitsassumed to be 0. */ +right 3 bitsassumed to be 0. */ BFD_RELOC_D30V_15, /* This is a 12-bit pc-relative reloc with -the right 3 bits assumed to be 0. */ +the right 3 bits assumed to be 0. */ BFD_RELOC_D30V_15_PCREL, /* This is a 12-bit pc-relative reloc with the right 3 bits assumed to be 0. Same as the previous reloc but on the right side -of the container. */ +of the container. */ BFD_RELOC_D30V_15_PCREL_R, /* This is an 18-bit absolute reloc with -the right 3 bits assumed to be 0. */ +the right 3 bits assumed to be 0. */ BFD_RELOC_D30V_21, /* This is an 18-bit pc-relative reloc with -the right 3 bits assumed to be 0. */ +the right 3 bits assumed to be 0. */ BFD_RELOC_D30V_21_PCREL, /* This is an 18-bit pc-relative reloc with the right 3 bits assumed to be 0. Same as the previous reloc but on the right side -of the container. */ +of the container. */ BFD_RELOC_D30V_21_PCREL_R, -/* This is a 32-bit absolute reloc. */ +/* This is a 32-bit absolute reloc. */ BFD_RELOC_D30V_32, -/* This is a 32-bit pc-relative reloc. */ +/* This is a 32-bit pc-relative reloc. */ BFD_RELOC_D30V_32_PCREL, /* Mitsubishi M32R relocs. -This is a 24 bit absolute address. */ +This is a 24 bit absolute address. */ BFD_RELOC_M32R_24, -/* This is a 10-bit pc-relative reloc with the right 2 bits assumed to be 0. */ +/* This is a 10-bit pc-relative reloc with the right 2 bits assumed to be 0. */ BFD_RELOC_M32R_10_PCREL, -/* This is an 18-bit reloc with the right 2 bits assumed to be 0. */ +/* This is an 18-bit reloc with the right 2 bits assumed to be 0. */ BFD_RELOC_M32R_18_PCREL, -/* This is a 26-bit reloc with the right 2 bits assumed to be 0. */ +/* This is a 26-bit reloc with the right 2 bits assumed to be 0. */ BFD_RELOC_M32R_26_PCREL, /* This is a 16-bit reloc containing the high 16 bits of an address -used when the lower 16 bits are treated as unsigned. */ +used when the lower 16 bits are treated as unsigned. */ BFD_RELOC_M32R_HI16_ULO, /* This is a 16-bit reloc containing the high 16 bits of an address -used when the lower 16 bits are treated as signed. */ +used when the lower 16 bits are treated as signed. */ BFD_RELOC_M32R_HI16_SLO, -/* This is a 16-bit reloc containing the lower 16 bits of an address. */ +/* This is a 16-bit reloc containing the lower 16 bits of an address. */ BFD_RELOC_M32R_LO16, /* This is a 16-bit reloc containing the small data area offset for use in -add3, load, and store instructions. */ +add3, load, and store instructions. */ BFD_RELOC_M32R_SDA16, /* This is a 9-bit reloc */ @@ -2305,123 +2322,124 @@ add3, load, and store instructions. */ /* This is a 22-bit reloc */ BFD_RELOC_V850_22_PCREL, -/* This is a 16 bit offset from the short data area pointer. */ +/* This is a 16 bit offset from the short data area pointer. */ BFD_RELOC_V850_SDA_16_16_OFFSET, /* This is a 16 bit offset (of which only 15 bits are used) from the -short data area pointer. */ +short data area pointer. */ BFD_RELOC_V850_SDA_15_16_OFFSET, -/* This is a 16 bit offset from the zero data area pointer. */ +/* This is a 16 bit offset from the zero data area pointer. */ BFD_RELOC_V850_ZDA_16_16_OFFSET, /* This is a 16 bit offset (of which only 15 bits are used) from the -zero data area pointer. */ +zero data area pointer. */ BFD_RELOC_V850_ZDA_15_16_OFFSET, /* This is an 8 bit offset (of which only 6 bits are used) from the -tiny data area pointer. */ +tiny data area pointer. */ BFD_RELOC_V850_TDA_6_8_OFFSET, /* This is an 8bit offset (of which only 7 bits are used) from the tiny -data area pointer. */ +data area pointer. */ BFD_RELOC_V850_TDA_7_8_OFFSET, -/* This is a 7 bit offset from the tiny data area pointer. */ +/* This is a 7 bit offset from the tiny data area pointer. */ BFD_RELOC_V850_TDA_7_7_OFFSET, -/* This is a 16 bit offset from the tiny data area pointer. */ +/* This is a 16 bit offset from the tiny data area pointer. */ BFD_RELOC_V850_TDA_16_16_OFFSET, /* This is a 5 bit offset (of which only 4 bits are used) from the tiny -data area pointer. */ +data area pointer. */ BFD_RELOC_V850_TDA_4_5_OFFSET, -/* This is a 4 bit offset from the tiny data area pointer. */ +/* This is a 4 bit offset from the tiny data area pointer. */ BFD_RELOC_V850_TDA_4_4_OFFSET, /* This is a 16 bit offset from the short data area pointer, with the -bits placed non-contigously in the instruction. */ +bits placed non-contigously in the instruction. */ BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET, /* This is a 16 bit offset from the zero data area pointer, with the -bits placed non-contigously in the instruction. */ +bits placed non-contigously in the instruction. */ BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET, -/* This is a 6 bit offset from the call table base pointer. */ +/* This is a 6 bit offset from the call table base pointer. */ BFD_RELOC_V850_CALLT_6_7_OFFSET, -/* This is a 16 bit offset from the call table base pointer. */ +/* This is a 16 bit offset from the call table base pointer. */ BFD_RELOC_V850_CALLT_16_16_OFFSET, + /* This is a 32bit pcrel reloc for the mn10300, offset by two bytes in the -instruction. */ +instruction. */ BFD_RELOC_MN10300_32_PCREL, /* This is a 16bit pcrel reloc for the mn10300, offset by two bytes in the -instruction. */ +instruction. */ BFD_RELOC_MN10300_16_PCREL, /* This is a 8bit DP reloc for the tms320c30, where the most significant 8 bits of a 24 bit word are placed into the least -significant 8 bits of the opcode. */ +significant 8 bits of the opcode. */ BFD_RELOC_TIC30_LDP, /* This is a 7bit reloc for the tms320c54x, where the least significant 7 bits of a 16 bit word are placed into the least -significant 7 bits of the opcode. */ +significant 7 bits of the opcode. */ BFD_RELOC_TIC54X_PARTLS7, /* This is a 9bit DP reloc for the tms320c54x, where the most significant 9 bits of a 16 bit word are placed into the least -significant 9 bits of the opcode. */ +significant 9 bits of the opcode. */ BFD_RELOC_TIC54X_PARTMS9, -/* This is an extended address 23-bit reloc for the tms320c54x. */ +/* This is an extended address 23-bit reloc for the tms320c54x. */ BFD_RELOC_TIC54X_23, -/* This is a 16-bit reloc for the tms320c54x, where the least -significant 16 bits of a 23-bit extended address are placed into -the opcode. */ +/* This is a 16-bit reloc for the tms320c54x, where the least +significant 16 bits of a 23-bit extended address are placed into +the opcode. */ BFD_RELOC_TIC54X_16_OF_23, /* This is a reloc for the tms320c54x, where the most -significant 7 bits of a 23-bit extended address are placed into -the opcode. */ +significant 7 bits of a 23-bit extended address are placed into +the opcode. */ BFD_RELOC_TIC54X_MS7_OF_23, -/* This is a 48 bit reloc for the FR30 that stores 32 bits. */ +/* This is a 48 bit reloc for the FR30 that stores 32 bits. */ BFD_RELOC_FR30_48, /* This is a 32 bit reloc for the FR30 that stores 20 bits split up into -two sections. */ +two sections. */ BFD_RELOC_FR30_20, /* This is a 16 bit reloc for the FR30 that stores a 6 bit word offset in -4 bits. */ +4 bits. */ BFD_RELOC_FR30_6_IN_4, /* This is a 16 bit reloc for the FR30 that stores an 8 bit byte offset -into 8 bits. */ +into 8 bits. */ BFD_RELOC_FR30_8_IN_8, /* This is a 16 bit reloc for the FR30 that stores a 9 bit short offset -into 8 bits. */ +into 8 bits. */ BFD_RELOC_FR30_9_IN_8, /* This is a 16 bit reloc for the FR30 that stores a 10 bit word offset -into 8 bits. */ +into 8 bits. */ BFD_RELOC_FR30_10_IN_8, /* This is a 16 bit reloc for the FR30 that stores a 9 bit pc relative -short offset into 8 bits. */ +short offset into 8 bits. */ BFD_RELOC_FR30_9_PCREL, /* This is a 16 bit reloc for the FR30 that stores a 12 bit pc relative -short offset into 11 bits. */ +short offset into 11 bits. */ BFD_RELOC_FR30_12_PCREL, -/* Motorola Mcore relocations. */ +/* Motorola Mcore relocations. */ BFD_RELOC_MCORE_PCREL_IMM8BY4, BFD_RELOC_MCORE_PCREL_IMM11BY2, BFD_RELOC_MCORE_PCREL_IMM4BY2, @@ -2430,71 +2448,71 @@ short offset into 11 bits. */ BFD_RELOC_MCORE_RVA, /* This is a 16 bit reloc for the AVR that stores 8 bit pc relative -short offset into 7 bits. */ +short offset into 7 bits. */ BFD_RELOC_AVR_7_PCREL, /* This is a 16 bit reloc for the AVR that stores 13 bit pc relative -short offset into 12 bits. */ +short offset into 12 bits. */ BFD_RELOC_AVR_13_PCREL, /* This is a 16 bit reloc for the AVR that stores 17 bit value (usually -program memory address) into 16 bits. */ +program memory address) into 16 bits. */ BFD_RELOC_AVR_16_PM, /* This is a 16 bit reloc for the AVR that stores 8 bit value (usually -data memory address) into 8 bit immediate value of LDI insn. */ +data memory address) into 8 bit immediate value of LDI insn. */ BFD_RELOC_AVR_LO8_LDI, /* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit -of data memory address) into 8 bit immediate value of LDI insn. */ +of data memory address) into 8 bit immediate value of LDI insn. */ BFD_RELOC_AVR_HI8_LDI, /* This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit -of program memory address) into 8 bit immediate value of LDI insn. */ +of program memory address) into 8 bit immediate value of LDI insn. */ BFD_RELOC_AVR_HH8_LDI, /* This is a 16 bit reloc for the AVR that stores negated 8 bit value -(usually data memory address) into 8 bit immediate value of SUBI insn. */ +(usually data memory address) into 8 bit immediate value of SUBI insn. */ BFD_RELOC_AVR_LO8_LDI_NEG, /* This is a 16 bit reloc for the AVR that stores negated 8 bit value (high 8 bit of data memory address) into 8 bit immediate value of -SUBI insn. */ +SUBI insn. */ BFD_RELOC_AVR_HI8_LDI_NEG, /* This is a 16 bit reloc for the AVR that stores negated 8 bit value (most high 8 bit of program memory address) into 8 bit immediate value -of LDI or SUBI insn. */ +of LDI or SUBI insn. */ BFD_RELOC_AVR_HH8_LDI_NEG, /* This is a 16 bit reloc for the AVR that stores 8 bit value (usually -command address) into 8 bit immediate value of LDI insn. */ +command address) into 8 bit immediate value of LDI insn. */ BFD_RELOC_AVR_LO8_LDI_PM, /* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit -of command address) into 8 bit immediate value of LDI insn. */ +of command address) into 8 bit immediate value of LDI insn. */ BFD_RELOC_AVR_HI8_LDI_PM, /* This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit -of command address) into 8 bit immediate value of LDI insn. */ +of command address) into 8 bit immediate value of LDI insn. */ BFD_RELOC_AVR_HH8_LDI_PM, /* This is a 16 bit reloc for the AVR that stores negated 8 bit value -(usually command address) into 8 bit immediate value of SUBI insn. */ +(usually command address) into 8 bit immediate value of SUBI insn. */ BFD_RELOC_AVR_LO8_LDI_PM_NEG, /* This is a 16 bit reloc for the AVR that stores negated 8 bit value (high 8 bit of 16 bit command address) into 8 bit immediate value -of SUBI insn. */ +of SUBI insn. */ BFD_RELOC_AVR_HI8_LDI_PM_NEG, /* This is a 16 bit reloc for the AVR that stores negated 8 bit value (high 6 bit of 22 bit command address) into 8 bit immediate -value of SUBI insn. */ +value of SUBI insn. */ BFD_RELOC_AVR_HH8_LDI_PM_NEG, /* This is a 32 bit reloc for the AVR that stores 23 bit value -into 22 bits. */ +into 22 bits. */ BFD_RELOC_AVR_CALL, /* These two relocations are used by the linker to determine which of @@ -2513,11 +2531,11 @@ virtual function table entry. The reloc's symbol should refer to the table of the class mentioned in the code. Off of that base, an offset describes the entry that is being used. For Rela hosts, this offset is stored in the reloc's addend. For Rel hosts, we are forced to put -this offset in the reloc's section offset. */ +this offset in the reloc's section offset. */ BFD_RELOC_VTABLE_INHERIT, BFD_RELOC_VTABLE_ENTRY, -/* Intel IA64 Relocations. */ +/* Intel IA64 Relocations. */ BFD_RELOC_IA64_IMM14, BFD_RELOC_IA64_IMM22, BFD_RELOC_IA64_IMM64, @@ -2584,26 +2602,26 @@ this offset in the reloc's section offset. */ BFD_RELOC_IA64_LDXMOV, /* Motorola 68HC11 reloc. -This is the 8 bits high part of an absolute address. */ +This is the 8 bits high part of an absolute address. */ BFD_RELOC_M68HC11_HI8, /* Motorola 68HC11 reloc. -This is the 8 bits low part of an absolute address. */ +This is the 8 bits low part of an absolute address. */ BFD_RELOC_M68HC11_LO8, /* Motorola 68HC11 reloc. -This is the 3 bits of a value. */ +This is the 3 bits of a value. */ BFD_RELOC_M68HC11_3B, /* These relocs are only used within the CRIS assembler. They are not -(at present) written to any object files. */ +(at present) written to any object files. */ BFD_RELOC_CRIS_BDISP8, BFD_RELOC_CRIS_UNSIGNED_5, BFD_RELOC_CRIS_SIGNED_6, BFD_RELOC_CRIS_UNSIGNED_6, BFD_RELOC_CRIS_UNSIGNED_4, -/* Intel i860 Relocations. */ +/* Intel i860 Relocations. */ BFD_RELOC_860_COPY, BFD_RELOC_860_GLOB_DAT, BFD_RELOC_860_JUMP_SLOT, @@ -2645,6 +2663,7 @@ bfd_reloc_type_lookup PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); const char * bfd_get_reloc_code_name PARAMS ((bfd_reloc_code_real_type code)); + typedef struct symbol_cache_entry { /* A pointer to the BFD which owns the symbol. This information @@ -2655,12 +2674,12 @@ typedef struct symbol_cache_entry This field is *almost* redundant, since you can use section->owner instead, except that some symbols point to the global sections bfd_{abs,com,und}_section. This could be fixed by making - these globals be per-bfd (or per-target-flavor). FIXME. */ + these globals be per-bfd (or per-target-flavor). FIXME. */ - struct _bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field. */ + struct _bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field. */ /* The text of the symbol. The name is left alone, and not copied; the - application may not alter it. */ + application may not alter it. */ CONST char *name; /* The value of the symbol. This really should be a union of a @@ -2673,15 +2692,15 @@ typedef struct symbol_cache_entry #define BSF_NO_FLAGS 0x00 /* The symbol has local scope; <<static>> in <<C>>. The value - is the offset into the section of the data. */ + is the offset into the section of the data. */ #define BSF_LOCAL 0x01 /* The symbol has global scope; initialized data in <<C>>. The - value is the offset into the section of the data. */ + value is the offset into the section of the data. */ #define BSF_GLOBAL 0x02 /* The symbol has global scope and is exported. The value is - the offset into the section of the data. */ + the offset into the section of the data. */ #define BSF_EXPORT BSF_GLOBAL /* no real difference */ /* A normal C symbol would be one of: @@ -2696,7 +2715,7 @@ typedef struct symbol_cache_entry perhaps others someday. */ #define BSF_FUNCTION 0x10 - /* Used by the linker. */ + /* Used by the linker. */ #define BSF_KEEP 0x20 #define BSF_KEEP_G 0x40 @@ -2709,31 +2728,31 @@ typedef struct symbol_cache_entry #define BSF_SECTION_SYM 0x100 /* The symbol used to be a common symbol, but now it is - allocated. */ + allocated. */ #define BSF_OLD_COMMON 0x200 - /* The default value for common data. */ + /* The default value for common data. */ #define BFD_FORT_COMM_DEFAULT_VALUE 0 /* In some files the type of a symbol sometimes alters its location in an output file - ie in coff a <<ISFCN>> symbol which is also <<C_EXT>> symbol appears where it was declared and not at the end of a section. This bit is set - by the target BFD part to convey this information. */ + by the target BFD part to convey this information. */ #define BSF_NOT_AT_END 0x400 - /* Signal that the symbol is the label of constructor section. */ + /* Signal that the symbol is the label of constructor section. */ #define BSF_CONSTRUCTOR 0x800 /* Signal that the symbol is a warning symbol. The name is a warning. The name of the next symbol is the one to warn about; if a reference is made to a symbol with the same name as the next - symbol, a warning is issued by the linker. */ + symbol, a warning is issued by the linker. */ #define BSF_WARNING 0x1000 /* Signal that the symbol is indirect. This symbol is an indirect - pointer to the symbol with the same name as the next symbol. */ + pointer to the symbol with the same name as the next symbol. */ #define BSF_INDIRECT 0x2000 /* BSF_FILE marks symbols that contain a file name. This is used @@ -2769,10 +2788,10 @@ typedef struct symbol_cache_entry } asymbol; #define bfd_get_symtab_upper_bound(abfd) \ BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd)) -boolean +boolean bfd_is_local_label PARAMS ((bfd *abfd, asymbol *sym)); -boolean +boolean bfd_is_local_label_name PARAMS ((bfd *abfd, const char *name)); #define bfd_is_local_label_name(abfd, name) \ @@ -2780,26 +2799,26 @@ bfd_is_local_label_name PARAMS ((bfd *abfd, const char *name)); #define bfd_canonicalize_symtab(abfd, location) \ BFD_SEND (abfd, _bfd_canonicalize_symtab,\ (abfd, location)) -boolean +boolean bfd_set_symtab PARAMS ((bfd *abfd, asymbol **location, unsigned int count)); -void +void bfd_print_symbol_vandf PARAMS ((PTR file, asymbol *symbol)); #define bfd_make_empty_symbol(abfd) \ BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd)) #define bfd_make_debug_symbol(abfd,ptr,size) \ BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size)) -int +int bfd_decode_symclass PARAMS ((asymbol *symbol)); -boolean +boolean bfd_is_undefined_symclass PARAMS ((int symclass)); -void +void bfd_symbol_info PARAMS ((asymbol *symbol, symbol_info *ret)); -boolean +boolean bfd_copy_private_symbol_data PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym)); #define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \ @@ -2829,7 +2848,7 @@ struct _bfd /* Marks whether there was a default target specified when the BFD was opened. This is used to select which matching algorithm - to use to choose the back end. */ + to use to choose the back end. */ boolean target_defaulted; @@ -2882,7 +2901,7 @@ struct _bfd file_ptr origin; /* Remember when output has begun, to stop strange things - from happening. */ + from happening. */ boolean output_has_begun; /* Pointer to linked list of sections*/ @@ -2892,7 +2911,7 @@ struct _bfd unsigned int section_count; /* Stuff only useful for object files: - The start address. */ + The start address. */ bfd_vma start_address; /* Used for input and output*/ @@ -2918,7 +2937,7 @@ struct _bfd be used only for archive elements. */ int archive_pass; - /* Used by the back end to hold private data. */ + /* Used by the back end to hold private data. */ union { @@ -2985,85 +3004,85 @@ typedef enum bfd_error bfd_error_invalid_error_code } bfd_error_type; -bfd_error_type +bfd_error_type bfd_get_error PARAMS ((void)); -void +void bfd_set_error PARAMS ((bfd_error_type error_tag)); CONST char * bfd_errmsg PARAMS ((bfd_error_type error_tag)); -void +void bfd_perror PARAMS ((CONST char *message)); typedef void (*bfd_error_handler_type) PARAMS ((const char *, ...)); -bfd_error_handler_type +bfd_error_handler_type bfd_set_error_handler PARAMS ((bfd_error_handler_type)); -void +void bfd_set_error_program_name PARAMS ((const char *)); -bfd_error_handler_type +bfd_error_handler_type bfd_get_error_handler PARAMS ((void)); -long +long bfd_get_reloc_upper_bound PARAMS ((bfd *abfd, asection *sect)); -long +long bfd_canonicalize_reloc PARAMS ((bfd *abfd, asection *sec, arelent **loc, asymbol **syms)); -void +void bfd_set_reloc PARAMS ((bfd *abfd, asection *sec, arelent **rel, unsigned int count) - + ); -boolean +boolean bfd_set_file_flags PARAMS ((bfd *abfd, flagword flags)); -int +int bfd_get_arch_size PARAMS ((bfd *abfd)); -int +int bfd_get_sign_extend_vma PARAMS ((bfd *abfd)); -boolean +boolean bfd_set_start_address PARAMS ((bfd *abfd, bfd_vma vma)); -long +long bfd_get_mtime PARAMS ((bfd *abfd)); -long +long bfd_get_size PARAMS ((bfd *abfd)); -int +int bfd_get_gp_size PARAMS ((bfd *abfd)); -void +void bfd_set_gp_size PARAMS ((bfd *abfd, int i)); -bfd_vma +bfd_vma bfd_scan_vma PARAMS ((CONST char *string, CONST char **end, int base)); -boolean +boolean bfd_copy_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd)); #define bfd_copy_private_bfd_data(ibfd, obfd) \ BFD_SEND (obfd, _bfd_copy_private_bfd_data, \ (ibfd, obfd)) -boolean +boolean bfd_merge_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd)); #define bfd_merge_private_bfd_data(ibfd, obfd) \ BFD_SEND (obfd, _bfd_merge_private_bfd_data, \ (ibfd, obfd)) -boolean +boolean bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags)); #define bfd_set_private_flags(abfd, flags) \ @@ -3085,6 +3104,7 @@ bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags)); #define bfd_debug_info_accumulate(abfd, section) \ BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section)) + #define bfd_stat_arch_elt(abfd, stat) \ BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat)) @@ -3132,10 +3152,10 @@ extern bfd_byte *bfd_get_relocated_section_contents struct bfd_link_order *, bfd_byte *, boolean, asymbol **)); -symindex +symindex bfd_get_next_mapent PARAMS ((bfd *abfd, symindex previous, carsym **sym)); -boolean +boolean bfd_set_archive_head PARAMS ((bfd *output, bfd *new_head)); bfd * @@ -3144,10 +3164,10 @@ bfd_openr_next_archived_file PARAMS ((bfd *archive, bfd *previous)); CONST char * bfd_core_file_failing_command PARAMS ((bfd *abfd)); -int +int bfd_core_file_failing_signal PARAMS ((bfd *abfd)); -boolean +boolean core_file_matches_executable_p PARAMS ((bfd *core_bfd, bfd *exec_bfd)); @@ -3162,13 +3182,13 @@ core_file_matches_executable_p (bfd_assert (__FILE__,__LINE__), NULL)) #endif #define BFD_SEND_FMT(bfd, message, arglist) \ - (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) + (((bfd)->xvec->message[(int)((bfd)->format)]) arglist) #ifdef DEBUG_BFD_SEND #undef BFD_SEND_FMT #define BFD_SEND_FMT(bfd, message, arglist) \ (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \ - (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \ + (((bfd)->xvec->message[(int)((bfd)->format)]) arglist) : \ (bfd_assert (__FILE__,__LINE__), NULL)) #endif enum bfd_flavour { @@ -3203,10 +3223,10 @@ typedef struct bfd_target enum bfd_flavour flavour; enum bfd_endian byteorder; enum bfd_endian header_byteorder; - flagword object_flags; + flagword object_flags; flagword section_flags; char symbol_leading_char; - char ar_pad_char; + char ar_pad_char; unsigned short ar_max_namelen; bfd_vma (*bfd_getx64) PARAMS ((const bfd_byte *)); bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *)); @@ -3245,7 +3265,7 @@ CAT(NAME,_get_section_contents_in_window) /* Called when a new section is created. */ boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr)); /* Read the contents of a section. */ - boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR, + boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type)); boolean (*_bfd_get_section_contents_in_window) PARAMS ((bfd *, sec_ptr, bfd_window *, @@ -3269,7 +3289,7 @@ CAT(NAME,_bfd_print_private_bfd_data)\ to another. */ boolean (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr, bfd *, sec_ptr)); - /* Called to copy BFD private symbol data from one symbol + /* Called to copy BFD private symbol data from one symbol to another. */ boolean (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *, bfd *, asymbol *)); @@ -3305,10 +3325,10 @@ CAT(NAME,_update_armap_timestamp) boolean (*_bfd_construct_extended_name_table) PARAMS ((bfd *, char **, bfd_size_type *, const char **)); void (*_bfd_truncate_arname) PARAMS ((bfd *, CONST char *, char *)); - boolean (*write_armap) PARAMS ((bfd *arch, + boolean (*write_armap) PARAMS ((bfd *arch, unsigned int elength, struct orl *map, - unsigned int orl_count, + unsigned int orl_count, int stridx)); PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *)); bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev)); @@ -3430,7 +3450,7 @@ CAT(NAME,_get_dynamic_symtab_upper_bound),\ CAT(NAME,_canonicalize_dynamic_symtab),\ CAT(NAME,_get_dynamic_reloc_upper_bound),\ CAT(NAME,_canonicalize_dynamic_reloc) - /* Get the amount of memory required to hold the dynamic symbols. */ + /* Get the amount of memory required to hold the dynamic symbols. */ long (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *)); /* Read in the dynamic symbols. */ long (*_bfd_canonicalize_dynamic_symtab) @@ -3441,13 +3461,13 @@ CAT(NAME,_canonicalize_dynamic_reloc) long (*_bfd_canonicalize_dynamic_reloc) PARAMS ((bfd *, arelent **, struct symbol_cache_entry **)); - /* Opposite endian version of this target. */ + /* Opposite endian version of this target. */ const struct bfd_target * alternative_target; - + PTR backend_data; - + } bfd_target; -boolean +boolean bfd_set_default_target PARAMS ((const char *name)); const bfd_target * @@ -3456,16 +3476,16 @@ bfd_find_target PARAMS ((CONST char *target_name, bfd *abfd)); const char ** bfd_target_list PARAMS ((void)); -const bfd_target * -bfd_search_for_target PARAMS ((int (* search_func) (const bfd_target *, void *), void *)); +const bfd_target * +bfd_search_for_target PARAMS ((int (* search_func)(const bfd_target *, void *), void *)); -boolean +boolean bfd_check_format PARAMS ((bfd *abfd, bfd_format format)); -boolean +boolean bfd_check_format_matches PARAMS ((bfd *abfd, bfd_format format, char ***matching)); -boolean +boolean bfd_set_format PARAMS ((bfd *abfd, bfd_format format)); CONST char * diff --git a/bfd/config.bfd b/bfd/config.bfd index 5deb6cc349d..ab9a0ec161f 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -36,6 +36,7 @@ xscale*) targ_archs=bfd_arm_arch ;; c30*) targ_archs=bfd_tic30_arch ;; c54x*) targ_archs=bfd_tic54x_arch ;; hppa*) targ_archs=bfd_hppa_arch ;; +x86_64) targ_archs=bfd_i386_arch ;; i[3456]86) targ_archs=bfd_i386_arch ;; i370) targ_archs=bfd_i370_arch ;; m6811*|m68hc11*) targ_archs="bfd_m68hc11_arch bfd_m68hc12_arch" ;; @@ -351,6 +352,12 @@ case "${targ}" in targ_defvec=bfd_elf32_i386_vec targ_selvecs="i386linux_vec bfd_efi_app_ia32_vec" ;; +#ifdef BFD64 + x86_64-*-linux-gnu*) + targ_defvec=bfd_elf64_x86_64_vec + targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec" + ;; +#endif i[3456]86-*-lynxos*) targ_defvec=i386lynx_coff_vec targ_selvecs=i386lynx_aout_vec diff --git a/bfd/config.in b/bfd/config.in index 60338a8c9fa..74af3d376ba 100644 --- a/bfd/config.in +++ b/bfd/config.in @@ -25,9 +25,6 @@ /* Define to `long' if <sys/types.h> doesn't define. */ #undef off_t -/* Define if you need to in order for stat and other things to work. */ -#undef _POSIX_SOURCE - /* Define to `unsigned' if <sys/types.h> doesn't define. */ #undef size_t @@ -223,6 +220,9 @@ /* Define if <sys/procfs.h> has pstatus_t. */ #undef HAVE_PSTATUS_T +/* Define if <sys/procfs.h> has pxstatus_t. */ +#undef HAVE_PXSTATUS_T + /* Define if <sys/procfs.h> has pstatus32_t. */ #undef HAVE_PSTATUS32_T @@ -241,6 +241,9 @@ /* Define if <sys/procfs.h> has lwpstatus_t. */ #undef HAVE_LWPSTATUS_T +/* Define if <sys/procfs.h> has lwpxstatus_t. */ +#undef HAVE_LWPXSTATUS_T + /* Define if <sys/procfs.h> has lwpstatus_t.pr_context. */ #undef HAVE_LWPSTATUS_T_PR_CONTEXT diff --git a/bfd/configure b/bfd/configure index ecfae03b27c..a06155e1263 100755 --- a/bfd/configure +++ b/bfd/configure @@ -57,6 +57,7 @@ program_suffix=NONE program_transform_name=s,x,x, silent= site= +sitefile= srcdir= target=NONE verbose= @@ -171,6 +172,7 @@ Configuration: --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages + --site-file=FILE use FILE as the site file --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX @@ -341,6 +343,11 @@ EOF -site=* | --site=* | --sit=*) site="$ac_optarg" ;; + -site-file | --site-file | --site-fil | --site-fi | --site-f) + ac_prev=sitefile ;; + -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*) + sitefile="$ac_optarg" ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) @@ -506,12 +513,16 @@ fi srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" +if test -z "$sitefile"; then + if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi fi +else + CONFIG_SITE="$sitefile" fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then @@ -550,12 +561,12 @@ else fi echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:554: checking for Cygwin environment" >&5 +echo "configure:565: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 559 "configure" +#line 570 "configure" #include "confdefs.h" int main() { @@ -566,7 +577,7 @@ int main() { return __CYGWIN__; ; return 0; } EOF -if { (eval echo configure:570: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:581: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -583,19 +594,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6 CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:587: checking for mingw32 environment" >&5 +echo "configure:598: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 592 "configure" +#line 603 "configure" #include "confdefs.h" int main() { return __MINGW32__; ; return 0; } EOF -if { (eval echo configure:599: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:610: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -660,7 +671,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:664: checking host system type" >&5 +echo "configure:675: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -681,7 +692,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:685: checking target system type" >&5 +echo "configure:696: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -699,7 +710,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:703: checking build system type" >&5 +echo "configure:714: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -721,249 +732,49 @@ test "$host_alias" != "$target_alias" && NONENONEs,x,x, && program_prefix=${target_alias}- -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:728: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:758: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" - fi -fi -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:809: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "checking for strerror in -lcposix""... $ac_c" 1>&6 +echo "configure:738: checking for strerror in -lcposix" >&5 +ac_lib_var=`echo cposix'_'strerror | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - ;; - esac - fi - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } -fi - -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:841: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext << EOF - -#line 852 "configure" + ac_save_LIBS="$LIBS" +LIBS="-lcposix $LIBS" +cat > conftest.$ac_ext <<EOF +#line 746 "configure" #include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strerror(); -main(){return(0);} +int main() { +strerror() +; return 0; } EOF -if { (eval echo configure:857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi +if { (eval echo configure:757: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:883: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:888: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <<EOF -#ifdef __GNUC__ - yes; -#endif -EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:897: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes -else - GCC= -fi - -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:916: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_cc_g=yes -else - ac_cv_prog_cc_g=no + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* +LIBS="$ac_save_LIBS" fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi - -echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:948: checking for POSIXized ISC" >&5 -if test -d /etc/conf/kconfig.d && - grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 -then +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 - ISC=yes # If later tests want to check for ISC. - cat >> confdefs.h <<\EOF -#define _POSIX_SOURCE 1 -EOF - - if test "$GCC" = yes; then - CC="$CC -posix" - else - CC="$CC -Xp" - fi + LIBS="$LIBS -lcposix" else echo "$ac_t""no" 1>&6 - ISC= fi + + # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -977,7 +788,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:981: checking for a BSD compatible install" >&5 +echo "configure:792: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1030,7 +841,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:1034: checking whether build environment is sane" >&5 +echo "configure:845: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -1087,7 +898,7 @@ test "$program_suffix" != NONE && test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1091: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:902: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1133,7 +944,7 @@ EOF missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:1137: checking for working aclocal" >&5 +echo "configure:948: checking for working aclocal" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1146,7 +957,7 @@ else fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:1150: checking for working autoconf" >&5 +echo "configure:961: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1159,7 +970,7 @@ else fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:1163: checking for working automake" >&5 +echo "configure:974: checking for working automake" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1172,7 +983,7 @@ else fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:1176: checking for working autoheader" >&5 +echo "configure:987: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1185,7 +996,7 @@ else fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:1189: checking for working makeinfo" >&5 +echo "configure:1000: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1208,7 +1019,7 @@ fi # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1212: checking for $ac_word" >&5 +echo "configure:1023: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1240,7 +1051,7 @@ fi # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1244: checking for $ac_word" >&5 +echo "configure:1055: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1272,7 +1083,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1276: checking for $ac_word" >&5 +echo "configure:1087: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1375,6 +1186,228 @@ else enable_fast_install=yes fi +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1193: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1223: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1274: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:1306: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 1317 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:1322: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:1348: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:1353: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1362: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:1381: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then withval="$with_gnu_ld" @@ -1387,7 +1420,7 @@ ac_prog=ld if test "$ac_cv_prog_gcc" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 -echo "configure:1391: checking for ld used by GCC" >&5 +echo "configure:1424: checking for ld used by GCC" >&5 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw @@ -1417,10 +1450,10 @@ echo "configure:1391: checking for ld used by GCC" >&5 esac elif test "$with_gnu_ld" = yes; then echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 -echo "configure:1421: checking for GNU ld" >&5 +echo "configure:1454: checking for GNU ld" >&5 else echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 -echo "configure:1424: checking for non-GNU ld" >&5 +echo "configure:1457: checking for non-GNU ld" >&5 fi if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1455,7 +1488,7 @@ else fi test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 -echo "configure:1459: checking if the linker ($LD) is GNU ld" >&5 +echo "configure:1492: checking if the linker ($LD) is GNU ld" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1472,7 +1505,7 @@ with_gnu_ld=$ac_cv_prog_gnu_ld echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6 -echo "configure:1476: checking for $LD option to reload object files" >&5 +echo "configure:1509: checking for $LD option to reload object files" >&5 if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1484,7 +1517,7 @@ reload_flag=$lt_cv_ld_reload_flag test -n "$reload_flag" && reload_flag=" $reload_flag" echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 -echo "configure:1488: checking for BSD-compatible nm" >&5 +echo "configure:1521: checking for BSD-compatible nm" >&5 if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1522,7 +1555,7 @@ NM="$ac_cv_path_NM" echo "$ac_t""$NM" 1>&6 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1526: checking whether ln -s works" >&5 +echo "configure:1559: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1543,7 +1576,7 @@ else fi echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6 -echo "configure:1547: checking how to recognise dependant libraries" >&5 +echo "configure:1580: checking how to recognise dependant libraries" >&5 if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1686,13 +1719,13 @@ file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method echo $ac_n "checking for object suffix""... $ac_c" 1>&6 -echo "configure:1690: checking for object suffix" >&5 +echo "configure:1723: checking for object suffix" >&5 if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else rm -f conftest* echo 'int i = 1;' > conftest.$ac_ext -if { (eval echo configure:1696: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1729: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then for ac_file in conftest.*; do case $ac_file in *.c) ;; @@ -1712,7 +1745,7 @@ ac_objext=$ac_cv_objext echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:1716: checking for executable suffix" >&5 +echo "configure:1749: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1722,10 +1755,10 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:1726: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:1759: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in - *.c | *.o | *.obj) ;; + *.c | *.o | *.obj | *.ilk | *.pdb) ;; *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; esac done @@ -1749,7 +1782,7 @@ case "$deplibs_check_method" in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6 -echo "configure:1753: checking for ${ac_tool_prefix}file" >&5 +echo "configure:1786: checking for ${ac_tool_prefix}file" >&5 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1811,7 +1844,7 @@ fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then echo $ac_n "checking for file""... $ac_c" 1>&6 -echo "configure:1815: checking for file" >&5 +echo "configure:1848: checking for file" >&5 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1882,7 +1915,7 @@ esac # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1886: checking for $ac_word" >&5 +echo "configure:1919: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1914,7 +1947,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1918: checking for $ac_word" >&5 +echo "configure:1951: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1949,7 +1982,7 @@ fi # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1953: checking for $ac_word" >&5 +echo "configure:1986: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1981,7 +2014,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1985: checking for $ac_word" >&5 +echo "configure:2018: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2048,8 +2081,8 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" case "$host" in *-*-irix6*) # Find out which ABI we are using. - echo '#line 2052 "configure"' > conftest.$ac_ext - if { (eval echo configure:2053: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + echo '#line 2085 "configure"' > conftest.$ac_ext + if { (eval echo configure:2086: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then case "`/usr/bin/file conftest.o`" in *32-bit*) LD="${LD-ld} -32" @@ -2070,7 +2103,7 @@ case "$host" in SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 -echo "configure:2074: checking whether the C compiler needs -belf" >&5 +echo "configure:2107: checking whether the C compiler needs -belf" >&5 if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2083,14 +2116,14 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <<EOF -#line 2087 "configure" +#line 2120 "configure" #include "confdefs.h" int main() { ; return 0; } EOF -if { (eval echo configure:2094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2127: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* lt_cv_cc_needs_belf=yes else @@ -2300,7 +2333,7 @@ test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:2304: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:2337: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" @@ -2325,7 +2358,7 @@ fi echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:2329: checking for executable suffix" >&5 +echo "configure:2362: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2335,10 +2368,10 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:2339: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:2372: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in - *.c | *.o | *.obj) ;; + *.c | *.o | *.obj | *.ilk | *.pdb) ;; *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; esac done @@ -2364,7 +2397,7 @@ target64=false # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2368: checking for $ac_word" >&5 +echo "configure:2401: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2394,7 +2427,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2398: checking for $ac_word" >&5 +echo "configure:2431: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2445,7 +2478,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2449: checking for $ac_word" >&5 +echo "configure:2482: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2477,7 +2510,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2481: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:2514: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -2488,12 +2521,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 2492 "configure" +#line 2525 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2497: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2530: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2519,12 +2552,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2523: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2556: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:2528: checking whether we are using GNU C" >&5 +echo "configure:2561: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2533,7 +2566,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2537: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2570: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -2552,7 +2585,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2556: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:2589: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2586,7 +2619,7 @@ fi ALL_LINGUAS= echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2590: checking how to run the C preprocessor" >&5 +echo "configure:2623: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -2601,13 +2634,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 2605 "configure" +#line 2638 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2611: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2644: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2618,13 +2651,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 2622 "configure" +#line 2655 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2628: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2661: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2635,13 +2668,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 2639 "configure" +#line 2672 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2645: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2678: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2668,7 +2701,7 @@ echo "$ac_t""$CPP" 1>&6 # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2672: checking for $ac_word" >&5 +echo "configure:2705: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2696,12 +2729,12 @@ else fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2700: checking for ANSI C header files" >&5 +echo "configure:2733: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2705 "configure" +#line 2738 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -2709,7 +2742,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2713: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2746: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2726,7 +2759,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 2730 "configure" +#line 2763 "configure" #include "confdefs.h" #include <string.h> EOF @@ -2744,7 +2777,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 2748 "configure" +#line 2781 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -2765,7 +2798,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 2769 "configure" +#line 2802 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -2776,7 +2809,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:2780: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2813: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -2800,12 +2833,12 @@ EOF fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2804: checking for working const" >&5 +echo "configure:2837: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2809 "configure" +#line 2842 "configure" #include "confdefs.h" int main() { @@ -2854,7 +2887,7 @@ ccp = (char const *const *) p; ; return 0; } EOF -if { (eval echo configure:2858: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2891: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -2875,21 +2908,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:2879: checking for inline" >&5 +echo "configure:2912: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <<EOF -#line 2886 "configure" +#line 2919 "configure" #include "confdefs.h" int main() { } $ac_kw foo() { ; return 0; } EOF -if { (eval echo configure:2893: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2926: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -2915,12 +2948,12 @@ EOF esac echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:2919: checking for off_t" >&5 +echo "configure:2952: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2924 "configure" +#line 2957 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -2948,12 +2981,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:2952: checking for size_t" >&5 +echo "configure:2985: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2957 "configure" +#line 2990 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -2983,19 +3016,19 @@ fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:2987: checking for working alloca.h" >&5 +echo "configure:3020: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2992 "configure" +#line 3025 "configure" #include "confdefs.h" #include <alloca.h> int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:2999: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -3016,12 +3049,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:3020: checking for alloca" >&5 +echo "configure:3053: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3025 "configure" +#line 3058 "configure" #include "confdefs.h" #ifdef __GNUC__ @@ -3049,7 +3082,7 @@ int main() { char *p = (char *) alloca(1); ; return 0; } EOF -if { (eval echo configure:3053: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3086: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -3081,12 +3114,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:3085: checking whether alloca needs Cray hooks" >&5 +echo "configure:3118: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3090 "configure" +#line 3123 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -3111,12 +3144,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3115: checking for $ac_func" >&5 +echo "configure:3148: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3120 "configure" +#line 3153 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3139,7 +3172,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3143: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3176: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3166,7 +3199,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:3170: checking stack direction for C alloca" >&5 +echo "configure:3203: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3174,7 +3207,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 3178 "configure" +#line 3211 "configure" #include "confdefs.h" find_stack_direction () { @@ -3193,7 +3226,7 @@ main () exit (find_stack_direction() < 0); } EOF -if { (eval echo configure:3197: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3230: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -3218,17 +3251,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3222: checking for $ac_hdr" >&5 +echo "configure:3255: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3227 "configure" +#line 3260 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3232: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3265: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3257,12 +3290,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3261: checking for $ac_func" >&5 +echo "configure:3294: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3266 "configure" +#line 3299 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3285,7 +3318,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3289: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3322: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3310,7 +3343,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:3314: checking for working mmap" >&5 +echo "configure:3347: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3318,7 +3351,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <<EOF -#line 3322 "configure" +#line 3355 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. @@ -3458,7 +3491,7 @@ main() } EOF -if { (eval echo configure:3462: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3495: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -3486,17 +3519,17 @@ unistd.h values.h sys/param.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3490: checking for $ac_hdr" >&5 +echo "configure:3523: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3495 "configure" +#line 3528 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3500: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3533: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3526,12 +3559,12 @@ done __argz_count __argz_stringify __argz_next do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3530: checking for $ac_func" >&5 +echo "configure:3563: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3535 "configure" +#line 3568 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3554,7 +3587,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3558: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3583,12 +3616,12 @@ done for ac_func in stpcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3587: checking for $ac_func" >&5 +echo "configure:3620: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3592 "configure" +#line 3625 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3611,7 +3644,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3615: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3648: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3645,19 +3678,19 @@ EOF if test $ac_cv_header_locale_h = yes; then echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:3649: checking for LC_MESSAGES" >&5 +echo "configure:3682: checking for LC_MESSAGES" >&5 if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3654 "configure" +#line 3687 "configure" #include "confdefs.h" #include <locale.h> int main() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:3661: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3694: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_val_LC_MESSAGES=yes else @@ -3678,7 +3711,7 @@ EOF fi fi echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:3682: checking whether NLS is requested" >&5 +echo "configure:3715: checking whether NLS is requested" >&5 # Check whether --enable-nls or --disable-nls was given. if test "${enable_nls+set}" = set; then enableval="$enable_nls" @@ -3698,7 +3731,7 @@ fi EOF echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:3702: checking whether included gettext is requested" >&5 +echo "configure:3735: checking whether included gettext is requested" >&5 # Check whether --with-included-gettext or --without-included-gettext was given. if test "${with_included_gettext+set}" = set; then withval="$with_included_gettext" @@ -3717,17 +3750,17 @@ fi ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:3721: checking for libintl.h" >&5 +echo "configure:3754: checking for libintl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3726 "configure" +#line 3759 "configure" #include "confdefs.h" #include <libintl.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3731: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3764: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3744,19 +3777,19 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6 -echo "configure:3748: checking for gettext in libc" >&5 +echo "configure:3781: checking for gettext in libc" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3753 "configure" +#line 3786 "configure" #include "confdefs.h" #include <libintl.h> int main() { return (int) gettext ("") ; return 0; } EOF -if { (eval echo configure:3760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3793: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libc=yes else @@ -3772,7 +3805,7 @@ echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6 if test "$gt_cv_func_gettext_libc" != "yes"; then echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 -echo "configure:3776: checking for bindtextdomain in -lintl" >&5 +echo "configure:3809: checking for bindtextdomain in -lintl" >&5 ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3780,7 +3813,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <<EOF -#line 3784 "configure" +#line 3817 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3791,7 +3824,7 @@ int main() { bindtextdomain() ; return 0; } EOF -if { (eval echo configure:3795: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3807,19 +3840,19 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6 -echo "configure:3811: checking for gettext in libintl" >&5 +echo "configure:3844: checking for gettext in libintl" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3816 "configure" +#line 3849 "configure" #include "confdefs.h" int main() { return (int) gettext ("") ; return 0; } EOF -if { (eval echo configure:3823: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3856: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libintl=yes else @@ -3847,7 +3880,7 @@ EOF # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3851: checking for $ac_word" >&5 +echo "configure:3884: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3881,12 +3914,12 @@ fi for ac_func in dcgettext do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3885: checking for $ac_func" >&5 +echo "configure:3918: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3890 "configure" +#line 3923 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3909,7 +3942,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3913: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3946: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3936,7 +3969,7 @@ done # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3940: checking for $ac_word" >&5 +echo "configure:3973: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3972,7 +4005,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3976: checking for $ac_word" >&5 +echo "configure:4009: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4004,7 +4037,7 @@ else fi cat > conftest.$ac_ext <<EOF -#line 4008 "configure" +#line 4041 "configure" #include "confdefs.h" int main() { @@ -4012,7 +4045,7 @@ extern int _nl_msg_cat_cntr; return _nl_msg_cat_cntr ; return 0; } EOF -if { (eval echo configure:4016: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4049: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* CATOBJEXT=.gmo DATADIRNAME=share @@ -4044,7 +4077,7 @@ fi # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4048: checking for $ac_word" >&5 +echo "configure:4081: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4078,7 +4111,7 @@ fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4082: checking for $ac_word" >&5 +echo "configure:4115: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4114,7 +4147,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4118: checking for $ac_word" >&5 +echo "configure:4151: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4204,7 +4237,7 @@ fi LINGUAS= else echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:4208: checking for catalogs to be installed" >&5 +echo "configure:4241: checking for catalogs to be installed" >&5 NEW_LINGUAS= for lang in ${LINGUAS=$ALL_LINGUAS}; do case "$ALL_LINGUAS" in @@ -4232,17 +4265,17 @@ echo "configure:4208: checking for catalogs to be installed" >&5 if test "$CATOBJEXT" = ".cat"; then ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6 -echo "configure:4236: checking for linux/version.h" >&5 +echo "configure:4269: checking for linux/version.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4241 "configure" +#line 4274 "configure" #include "confdefs.h" #include <linux/version.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4246: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4279: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4320,7 +4353,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:4324: checking for a BSD compatible install" >&5 +echo "configure:4357: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4403,7 +4436,7 @@ if test "x$cross_compiling" = "xno"; then EXEEXT_FOR_BUILD='$(EXEEXT)' else echo $ac_n "checking for build system executable suffix""... $ac_c" 1>&6 -echo "configure:4407: checking for build system executable suffix" >&5 +echo "configure:4440: checking for build system executable suffix" >&5 if eval "test \"`echo '$''{'bfd_cv_build_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4431,17 +4464,17 @@ for ac_hdr in stddef.h string.h strings.h stdlib.h time.h unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4435: checking for $ac_hdr" >&5 +echo "configure:4468: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4440 "configure" +#line 4473 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4445: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4478: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4471,17 +4504,17 @@ for ac_hdr in fcntl.h sys/file.h sys/time.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4475: checking for $ac_hdr" >&5 +echo "configure:4508: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4480 "configure" +#line 4513 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4485: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4518: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4508,12 +4541,12 @@ fi done echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:4512: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:4545: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4517 "configure" +#line 4550 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/time.h> @@ -4522,7 +4555,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:4526: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4559: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -4547,12 +4580,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:4551: checking for $ac_hdr that defines DIR" >&5 +echo "configure:4584: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4556 "configure" +#line 4589 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_hdr> @@ -4560,7 +4593,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:4564: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4597: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -4585,7 +4618,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:4589: checking for opendir in -ldir" >&5 +echo "configure:4622: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4593,7 +4626,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <<EOF -#line 4597 "configure" +#line 4630 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4604,7 +4637,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:4608: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4641: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4626,7 +4659,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:4630: checking for opendir in -lx" >&5 +echo "configure:4663: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4634,7 +4667,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <<EOF -#line 4638 "configure" +#line 4671 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4645,7 +4678,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:4649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4682: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4670,12 +4703,12 @@ fi for ac_func in fcntl getpagesize setitimer sysconf fdopen getuid getgid do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4674: checking for $ac_func" >&5 +echo "configure:4707: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4679 "configure" +#line 4712 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4698,7 +4731,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4733,12 +4766,12 @@ EOF esac echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6 -echo "configure:4737: checking whether strstr must be declared" >&5 +echo "configure:4770: checking whether strstr must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strstr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4742 "configure" +#line 4775 "configure" #include "confdefs.h" #include <stdio.h> @@ -4759,7 +4792,7 @@ int main() { char *(*pfn) = (char *(*)) strstr ; return 0; } EOF -if { (eval echo configure:4763: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4796: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strstr=no else @@ -4780,12 +4813,12 @@ EOF fi echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6 -echo "configure:4784: checking whether malloc must be declared" >&5 +echo "configure:4817: checking whether malloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_malloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4789 "configure" +#line 4822 "configure" #include "confdefs.h" #include <stdio.h> @@ -4806,7 +4839,7 @@ int main() { char *(*pfn) = (char *(*)) malloc ; return 0; } EOF -if { (eval echo configure:4810: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4843: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_malloc=no else @@ -4827,12 +4860,12 @@ EOF fi echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6 -echo "configure:4831: checking whether realloc must be declared" >&5 +echo "configure:4864: checking whether realloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_realloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4836 "configure" +#line 4869 "configure" #include "confdefs.h" #include <stdio.h> @@ -4853,7 +4886,7 @@ int main() { char *(*pfn) = (char *(*)) realloc ; return 0; } EOF -if { (eval echo configure:4857: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4890: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_realloc=no else @@ -4874,12 +4907,12 @@ EOF fi echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6 -echo "configure:4878: checking whether free must be declared" >&5 +echo "configure:4911: checking whether free must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4883 "configure" +#line 4916 "configure" #include "confdefs.h" #include <stdio.h> @@ -4900,7 +4933,7 @@ int main() { char *(*pfn) = (char *(*)) free ; return 0; } EOF -if { (eval echo configure:4904: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4937: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_free=no else @@ -4921,12 +4954,12 @@ EOF fi echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6 -echo "configure:4925: checking whether getenv must be declared" >&5 +echo "configure:4958: checking whether getenv must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_getenv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4930 "configure" +#line 4963 "configure" #include "confdefs.h" #include <stdio.h> @@ -4947,7 +4980,7 @@ int main() { char *(*pfn) = (char *(*)) getenv ; return 0; } EOF -if { (eval echo configure:4951: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4984: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_getenv=no else @@ -5160,17 +5193,17 @@ if test "${target}" = "${host}"; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5164: checking for $ac_hdr" >&5 +echo "configure:5197: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5169 "configure" +#line 5202 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5174: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5207: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5198,12 +5231,12 @@ done if test "$ac_cv_header_sys_procfs_h" = yes; then echo $ac_n "checking for prstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5202: checking for prstatus_t in sys/procfs.h" >&5 +echo "configure:5235: checking for prstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5207 "configure" +#line 5240 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5212,7 +5245,7 @@ int main() { prstatus_t avar ; return 0; } EOF -if { (eval echo configure:5216: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5249: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prstatus_t=yes else @@ -5234,12 +5267,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus_t" 1>&6 echo $ac_n "checking for prstatus32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5238: checking for prstatus32_t in sys/procfs.h" >&5 +echo "configure:5271: checking for prstatus32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prstatus32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5243 "configure" +#line 5276 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5248,7 +5281,7 @@ int main() { prstatus32_t avar ; return 0; } EOF -if { (eval echo configure:5252: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5285: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prstatus32_t=yes else @@ -5270,12 +5303,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prstatus32_t" 1>&6 echo $ac_n "checking for prstatus_t.pr_who in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5274: checking for prstatus_t.pr_who in sys/procfs.h" >&5 +echo "configure:5307: checking for prstatus_t.pr_who in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5279 "configure" +#line 5312 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5284,7 +5317,7 @@ int main() { prstatus_t avar; void* aref = (void*) &avar.pr_who ; return 0; } EOF -if { (eval echo configure:5288: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5321: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who=yes else @@ -5306,12 +5339,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus_t_pr_who" 1>&6 echo $ac_n "checking for prstatus32_t.pr_who in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5310: checking for prstatus32_t.pr_who in sys/procfs.h" >&5 +echo "configure:5343: checking for prstatus32_t.pr_who in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5315 "configure" +#line 5348 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5320,7 +5353,7 @@ int main() { prstatus32_t avar; void* aref = (void*) &avar.pr_who ; return 0; } EOF -if { (eval echo configure:5324: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5357: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who=yes else @@ -5342,12 +5375,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_prstatus32_t_pr_who" 1>&6 echo $ac_n "checking for pstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5346: checking for pstatus_t in sys/procfs.h" >&5 +echo "configure:5379: checking for pstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5351 "configure" +#line 5384 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5356,7 +5389,7 @@ int main() { pstatus_t avar ; return 0; } EOF -if { (eval echo configure:5360: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5393: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus_t=yes else @@ -5378,12 +5411,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus_t" 1>&6 echo $ac_n "checking for pxstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5382: checking for pxstatus_t in sys/procfs.h" >&5 +echo "configure:5415: checking for pxstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pxstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5387 "configure" +#line 5420 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5392,7 +5425,7 @@ int main() { pxstatus_t avar ; return 0; } EOF -if { (eval echo configure:5396: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5429: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pxstatus_t=yes else @@ -5414,12 +5447,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pxstatus_t" 1>&6 echo $ac_n "checking for pstatus32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5418: checking for pstatus32_t in sys/procfs.h" >&5 +echo "configure:5451: checking for pstatus32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5423 "configure" +#line 5456 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5428,7 +5461,7 @@ int main() { pstatus32_t avar ; return 0; } EOF -if { (eval echo configure:5432: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5465: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus32_t=yes else @@ -5450,12 +5483,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus32_t" 1>&6 echo $ac_n "checking for prpsinfo_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5454: checking for prpsinfo_t in sys/procfs.h" >&5 +echo "configure:5487: checking for prpsinfo_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5459 "configure" +#line 5492 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5464,7 +5497,7 @@ int main() { prpsinfo_t avar ; return 0; } EOF -if { (eval echo configure:5468: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5501: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prpsinfo_t=yes else @@ -5486,12 +5519,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo_t" 1>&6 echo $ac_n "checking for prpsinfo32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5490: checking for prpsinfo32_t in sys/procfs.h" >&5 +echo "configure:5523: checking for prpsinfo32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prpsinfo32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5495 "configure" +#line 5528 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5500,7 +5533,7 @@ int main() { prpsinfo32_t avar ; return 0; } EOF -if { (eval echo configure:5504: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5537: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prpsinfo32_t=yes else @@ -5522,12 +5555,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prpsinfo32_t" 1>&6 echo $ac_n "checking for psinfo_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5526: checking for psinfo_t in sys/procfs.h" >&5 +echo "configure:5559: checking for psinfo_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5531 "configure" +#line 5564 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5536,7 +5569,7 @@ int main() { psinfo_t avar ; return 0; } EOF -if { (eval echo configure:5540: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5573: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psinfo_t=yes else @@ -5558,12 +5591,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo_t" 1>&6 echo $ac_n "checking for psinfo32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5562: checking for psinfo32_t in sys/procfs.h" >&5 +echo "configure:5595: checking for psinfo32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psinfo32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5567 "configure" +#line 5600 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5572,7 +5605,7 @@ int main() { psinfo32_t avar ; return 0; } EOF -if { (eval echo configure:5576: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5609: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psinfo32_t=yes else @@ -5594,12 +5627,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_psinfo32_t" 1>&6 echo $ac_n "checking for lwpstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5598: checking for lwpstatus_t in sys/procfs.h" >&5 +echo "configure:5631: checking for lwpstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5603 "configure" +#line 5636 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5608,7 +5641,7 @@ int main() { lwpstatus_t avar ; return 0; } EOF -if { (eval echo configure:5612: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5645: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpstatus_t=yes else @@ -5630,12 +5663,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpstatus_t" 1>&6 echo $ac_n "checking for lwpxstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5634: checking for lwpxstatus_t in sys/procfs.h" >&5 +echo "configure:5667: checking for lwpxstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpxstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5639 "configure" +#line 5672 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5644,7 +5677,7 @@ int main() { lwpxstatus_t avar ; return 0; } EOF -if { (eval echo configure:5648: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5681: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpxstatus_t=yes else @@ -5666,12 +5699,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpxstatus_t" 1>&6 echo $ac_n "checking for lwpstatus_t.pr_context in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5670: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5 +echo "configure:5703: checking for lwpstatus_t.pr_context in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5675 "configure" +#line 5708 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5680,7 +5713,7 @@ int main() { lwpstatus_t avar; void* aref = (void*) &avar.pr_context ; return 0; } EOF -if { (eval echo configure:5684: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5717: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context=yes else @@ -5702,12 +5735,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_context" 1>&6 echo $ac_n "checking for lwpstatus_t.pr_reg in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5706: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5 +echo "configure:5739: checking for lwpstatus_t.pr_reg in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5711 "configure" +#line 5744 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5716,7 +5749,7 @@ int main() { lwpstatus_t avar; void* aref = (void*) &avar.pr_reg ; return 0; } EOF -if { (eval echo configure:5720: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5753: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg=yes else @@ -5738,12 +5771,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_member_lwpstatus_t_pr_reg" 1>&6 echo $ac_n "checking for win32_pstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:5742: checking for win32_pstatus_t in sys/procfs.h" >&5 +echo "configure:5775: checking for win32_pstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_win32_pstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5747 "configure" +#line 5780 "configure" #include "confdefs.h" #define _SYSCALL32 @@ -5752,7 +5785,7 @@ int main() { win32_pstatus_t avar ; return 0; } EOF -if { (eval echo configure:5756: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5789: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_win32_pstatus_t=yes else @@ -5925,6 +5958,7 @@ do bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;; bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;; bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;; + bfd_elf64_x86_64_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf" ;; bfd_elf32_i860_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;; bfd_elf32_i860_little_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;; bfd_elf32_i960_vec) tb="$tb elf32-i960.lo elf32.lo $elf" ;; @@ -6142,17 +6176,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6146: checking for $ac_hdr" >&5 +echo "configure:6180: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6151 "configure" +#line 6185 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6156: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6190: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6181,12 +6215,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6185: checking for $ac_func" >&5 +echo "configure:6219: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6190 "configure" +#line 6224 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6209,7 +6243,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6213: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6247: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6234,7 +6268,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:6238: checking for working mmap" >&5 +echo "configure:6272: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6242,7 +6276,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <<EOF -#line 6246 "configure" +#line 6280 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. @@ -6382,7 +6416,7 @@ main() } EOF -if { (eval echo configure:6386: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6420: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -6407,12 +6441,12 @@ fi for ac_func in madvise mprotect do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6411: checking for $ac_func" >&5 +echo "configure:6445: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6416 "configure" +#line 6450 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6435,7 +6469,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6439: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6473: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6615,7 +6649,6 @@ s%@build_alias@%$build_alias%g s%@build_cpu@%$build_cpu%g s%@build_vendor@%$build_vendor%g s%@build_os@%$build_os%g -s%@CC@%$CC%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g @@ -6629,6 +6662,7 @@ s%@MAKEINFO@%$MAKEINFO%g s%@SET_MAKE@%$SET_MAKE%g s%@AR@%$AR%g s%@RANLIB@%$RANLIB%g +s%@CC@%$CC%g s%@LN_S@%$LN_S%g s%@OBJEXT@%$OBJEXT%g s%@EXEEXT@%$EXEEXT%g diff --git a/bfd/configure.in b/bfd/configure.in index 7b21088e124..fd8a07622a6 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -507,6 +507,7 @@ do bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;; bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;; bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;; + bfd_elf64_x86_64_vec) tb="$tb elf64-x86-64.lo elf64.lo $elf" ;; bfd_elf32_i860_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;; bfd_elf32_i860_little_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;; bfd_elf32_i960_vec) tb="$tb elf32-i960.lo elf32.lo $elf" ;; diff --git a/bfd/cpu-i386.c b/bfd/cpu-i386.c index a881470208b..4fbf5237503 100644 --- a/bfd/cpu-i386.c +++ b/bfd/cpu-i386.c @@ -36,6 +36,21 @@ const bfd_arch_info_type bfd_i386_arch_intel_syntax = bfd_default_scan , 0, }; +const bfd_arch_info_type bfd_x86_64_arch_intel_syntax = +{ + 64, /* 64 bits in a word */ + 64, /* 64 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_i386, + bfd_mach_x86_64_intel_syntax, + "x86_64:intel", + "x86_64:intel", + 3, + true, + bfd_default_compatible, + bfd_default_scan , + &bfd_i386_arch_intel_syntax, +}; static const bfd_arch_info_type i8086_arch = { 32, /* 32 bits in a word */ @@ -49,7 +64,23 @@ static const bfd_arch_info_type i8086_arch = false, bfd_default_compatible, bfd_default_scan , - &bfd_i386_arch_intel_syntax, + &bfd_x86_64_arch_intel_syntax, +}; + +const bfd_arch_info_type bfd_x86_64_arch = +{ + 64, /* 32 bits in a word */ + 64, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_i386, + bfd_mach_x86_64, + "x86_64", + "x86_64", + 3, + true, + bfd_default_compatible, + bfd_default_scan , + &i8086_arch, }; const bfd_arch_info_type bfd_i386_arch = @@ -65,6 +96,6 @@ const bfd_arch_info_type bfd_i386_arch = true, bfd_default_compatible, bfd_default_scan , - &i8086_arch, + &bfd_x86_64_arch }; diff --git a/bfd/elf.c b/bfd/elf.c index f434fcf29b8..2f81105ed5c 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -3306,6 +3306,9 @@ prep_headers (abfd) i_ehdrp->e_machine = EM_S370; break; case bfd_arch_i386: + if (bfd_get_arch_size (abfd) == 64) + i_ehdrp->e_machine = EM_X86_64; + else i_ehdrp->e_machine = EM_386; break; case bfd_arch_ia64: diff --git a/bfd/elf64-ia64.c b/bfd/elf64-ia64.c new file mode 100644 index 00000000000..45830b8fa51 --- /dev/null +++ b/bfd/elf64-ia64.c @@ -0,0 +1,4201 @@ +/* IA-64 support for 64-bit ELF + Copyright 1998, 1999, 2000 Free Software Foundation, Inc. + Contributed by David Mosberger-Tang <davidm@hpl.hp.com> + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "opcode/ia64.h" +#include "elf/ia64.h" + + +/* + * THE RULES for all the stuff the linker creates -- + * + * GOT Entries created in response to LTOFF or LTOFF_FPTR + * relocations. Dynamic relocs created for dynamic + * symbols in an application; REL relocs for locals + * in a shared library. + * + * FPTR The canonical function descriptor. Created for local + * symbols in applications. Descriptors for dynamic symbols + * and local symbols in shared libraries are created by + * ld.so. Thus there are no dynamic relocs against these + * objects. The FPTR relocs for such _are_ passed through + * to the dynamic relocation tables. + * + * FULL_PLT Created for a PCREL21B relocation against a dynamic symbol. + * Requires the creation of a PLTOFF entry. This does not + * require any dynamic relocations. + * + * PLTOFF Created by PLTOFF relocations. For local symbols, this + * is an alternate function descriptor, and in shared libraries + * requires two REL relocations. Note that this cannot be + * transformed into an FPTR relocation, since it must be in + * range of the GP. For dynamic symbols, this is a function + * descriptor for a MIN_PLT entry, and requires one IPLT reloc. + * + * MIN_PLT Created by PLTOFF entries against dynamic symbols. This + * does not reqire dynamic relocations. + */ + +#define USE_RELA /* we want RELA relocs, not REL */ + +#define NELEMS(a) ((int) (sizeof (a) / sizeof ((a)[0]))) + +typedef struct bfd_hash_entry *(*new_hash_entry_func) + PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); + +/* In dynamically (linker-) created sections, we generally need to keep track + of the place a symbol or expression got allocated to. This is done via hash + tables that store entries of the following type. */ + +struct elf64_ia64_dyn_sym_info +{ + /* The addend for which this entry is relevant. */ + bfd_vma addend; + + /* Next addend in the list. */ + struct elf64_ia64_dyn_sym_info *next; + + bfd_vma got_offset; + bfd_vma fptr_offset; + bfd_vma pltoff_offset; + bfd_vma plt_offset; + bfd_vma plt2_offset; + + /* The symbol table entry, if any, that this was derrived from. */ + struct elf_link_hash_entry *h; + + /* Used to count non-got, non-plt relocations for delayed sizing + of relocation sections. */ + struct elf64_ia64_dyn_reloc_entry + { + struct elf64_ia64_dyn_reloc_entry *next; + asection *srel; + int type; + int count; + } *reloc_entries; + + /* True when the section contents have been updated. */ + unsigned got_done : 1; + unsigned fptr_done : 1; + unsigned pltoff_done : 1; + + /* True for the different kinds of linker data we want created. */ + unsigned want_got : 1; + unsigned want_fptr : 1; + unsigned want_ltoff_fptr : 1; + unsigned want_plt : 1; + unsigned want_plt2 : 1; + unsigned want_pltoff : 1; +}; + +struct elf64_ia64_local_hash_entry +{ + struct bfd_hash_entry root; + struct elf64_ia64_dyn_sym_info *info; +}; + +struct elf64_ia64_local_hash_table +{ + struct bfd_hash_table root; + /* No additional fields for now. */ +}; + +struct elf64_ia64_link_hash_entry +{ + struct elf_link_hash_entry root; + struct elf64_ia64_dyn_sym_info *info; +}; + +struct elf64_ia64_link_hash_table +{ + /* The main hash table */ + struct elf_link_hash_table root; + + asection *got_sec; /* the linkage table section (or NULL) */ + asection *rel_got_sec; /* dynamic relocation section for same */ + asection *fptr_sec; /* function descriptor table (or NULL) */ + asection *plt_sec; /* the primary plt section (or NULL) */ + asection *pltoff_sec; /* private descriptors for plt (or NULL) */ + asection *rel_pltoff_sec; /* dynamic relocation section for same */ + + bfd_size_type minplt_entries; /* number of minplt entries */ + + struct elf64_ia64_local_hash_table loc_hash_table; +}; + +#define elf64_ia64_hash_table(p) \ + ((struct elf64_ia64_link_hash_table *) ((p)->hash)) + +static bfd_reloc_status_type elf64_ia64_reloc + PARAMS ((bfd *abfd, arelent *reloc, asymbol *sym, PTR data, + asection *input_section, bfd *output_bfd, char **error_message)); +static reloc_howto_type * lookup_howto + PARAMS ((unsigned int rtype)); +static reloc_howto_type *elf64_ia64_reloc_type_lookup + PARAMS ((bfd *abfd, bfd_reloc_code_real_type bfd_code)); +static void elf64_ia64_info_to_howto + PARAMS ((bfd *abfd, arelent *bfd_reloc, Elf64_Internal_Rela *elf_reloc)); +static boolean elf64_ia64_relax_section + PARAMS((bfd *abfd, asection *sec, struct bfd_link_info *link_info, + boolean *again)); +static boolean elf64_ia64_section_from_shdr + PARAMS ((bfd *, Elf64_Internal_Shdr *, char *)); +static boolean elf64_ia64_fake_sections + PARAMS ((bfd *abfd, Elf64_Internal_Shdr *hdr, asection *sec)); +static boolean elf64_ia64_add_symbol_hook + PARAMS ((bfd *abfd, struct bfd_link_info *info, const Elf_Internal_Sym *sym, + const char **namep, flagword *flagsp, asection **secp, + bfd_vma *valp)); +static int elf64_ia64_additional_program_headers + PARAMS ((bfd *abfd)); +static boolean elf64_ia64_is_local_label_name + PARAMS ((bfd *abfd, const char *name)); +static boolean elf64_ia64_dynamic_symbol_p + PARAMS ((struct elf_link_hash_entry *h, struct bfd_link_info *info)); +static boolean elf64_ia64_local_hash_table_init + PARAMS ((struct elf64_ia64_local_hash_table *ht, bfd *abfd, + new_hash_entry_func new)); +static struct bfd_hash_entry *elf64_ia64_new_loc_hash_entry + PARAMS ((struct bfd_hash_entry *entry, struct bfd_hash_table *table, + const char *string)); +static struct bfd_hash_entry *elf64_ia64_new_elf_hash_entry + PARAMS ((struct bfd_hash_entry *entry, struct bfd_hash_table *table, + const char *string)); +static struct bfd_link_hash_table *elf64_ia64_hash_table_create + PARAMS ((bfd *abfd)); +static struct elf64_ia64_local_hash_entry *elf64_ia64_local_hash_lookup + PARAMS ((struct elf64_ia64_local_hash_table *table, const char *string, + boolean create, boolean copy)); +static void elf64_ia64_dyn_sym_traverse + PARAMS ((struct elf64_ia64_link_hash_table *ia64_info, + boolean (*func)(struct elf64_ia64_dyn_sym_info *, PTR), + PTR info)); +static boolean elf64_ia64_create_dynamic_sections + PARAMS ((bfd *abfd, struct bfd_link_info *info)); +static struct elf64_ia64_dyn_sym_info * get_dyn_sym_info + PARAMS ((struct elf64_ia64_link_hash_table *ia64_info, + struct elf_link_hash_entry *h, + bfd *abfd, const Elf_Internal_Rela *rel, boolean create)); +static asection *get_got + PARAMS ((bfd *abfd, struct bfd_link_info *info, + struct elf64_ia64_link_hash_table *ia64_info)); +static asection *get_fptr + PARAMS ((bfd *abfd, struct bfd_link_info *info, + struct elf64_ia64_link_hash_table *ia64_info)); +static asection *get_pltoff + PARAMS ((bfd *abfd, struct bfd_link_info *info, + struct elf64_ia64_link_hash_table *ia64_info)); +static asection *get_reloc_section + PARAMS ((bfd *abfd, struct elf64_ia64_link_hash_table *ia64_info, + asection *sec, boolean create)); +static boolean count_dyn_reloc + PARAMS ((bfd *abfd, struct elf64_ia64_dyn_sym_info *dyn_i, + asection *srel, int type)); +static boolean elf64_ia64_check_relocs + PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *sec, + const Elf_Internal_Rela *relocs)); +static boolean elf64_ia64_adjust_dynamic_symbol + PARAMS ((struct bfd_link_info *info, struct elf_link_hash_entry *h)); +static unsigned long global_sym_index + PARAMS ((struct elf_link_hash_entry *h)); +static boolean allocate_fptr + PARAMS ((struct elf64_ia64_dyn_sym_info *dyn_i, PTR data)); +static boolean allocate_global_data_got + PARAMS ((struct elf64_ia64_dyn_sym_info *dyn_i, PTR data)); +static boolean allocate_global_fptr_got + PARAMS ((struct elf64_ia64_dyn_sym_info *dyn_i, PTR data)); +static boolean allocate_local_got + PARAMS ((struct elf64_ia64_dyn_sym_info *dyn_i, PTR data)); +static boolean allocate_pltoff_entries + PARAMS ((struct elf64_ia64_dyn_sym_info *dyn_i, PTR data)); +static boolean allocate_plt_entries + PARAMS ((struct elf64_ia64_dyn_sym_info *dyn_i, PTR data)); +static boolean allocate_plt2_entries + PARAMS ((struct elf64_ia64_dyn_sym_info *dyn_i, PTR data)); +static boolean allocate_dynrel_entries + PARAMS ((struct elf64_ia64_dyn_sym_info *dyn_i, PTR data)); +static boolean elf64_ia64_size_dynamic_sections + PARAMS ((bfd *output_bfd, struct bfd_link_info *info)); +static bfd_reloc_status_type elf64_ia64_install_value + PARAMS ((bfd *abfd, bfd_byte *hit_addr, bfd_vma val, unsigned int r_type)); +static void elf64_ia64_install_dyn_reloc + PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *sec, + asection *srel, bfd_vma offset, unsigned int type, + long dynindx, bfd_vma addend)); +static bfd_vma set_got_entry + PARAMS ((bfd *abfd, struct bfd_link_info *info, + struct elf64_ia64_dyn_sym_info *dyn_i, long dynindx, + bfd_vma addend, bfd_vma value, unsigned int dyn_r_type)); +static bfd_vma set_fptr_entry + PARAMS ((bfd *abfd, struct bfd_link_info *info, + struct elf64_ia64_dyn_sym_info *dyn_i, + bfd_vma value)); +static bfd_vma set_pltoff_entry + PARAMS ((bfd *abfd, struct bfd_link_info *info, + struct elf64_ia64_dyn_sym_info *dyn_i, + bfd_vma value, boolean)); +static boolean elf64_ia64_final_link + PARAMS ((bfd *abfd, struct bfd_link_info *info)); +static boolean elf64_ia64_relocate_section + PARAMS ((bfd *output_bfd, struct bfd_link_info *info, bfd *input_bfd, + asection *input_section, bfd_byte *contents, + Elf_Internal_Rela *relocs, Elf_Internal_Sym *local_syms, + asection **local_sections)); +static boolean elf64_ia64_finish_dynamic_symbol + PARAMS ((bfd *output_bfd, struct bfd_link_info *info, + struct elf_link_hash_entry *h, Elf_Internal_Sym *sym)); +static boolean elf64_ia64_finish_dynamic_sections + PARAMS ((bfd *abfd, struct bfd_link_info *info)); +static boolean elf64_ia64_set_private_flags + PARAMS ((bfd *abfd, flagword flags)); +static boolean elf64_ia64_copy_private_bfd_data + PARAMS ((bfd *ibfd, bfd *obfd)); +static boolean elf64_ia64_merge_private_bfd_data + PARAMS ((bfd *ibfd, bfd *obfd)); +static boolean elf64_ia64_print_private_bfd_data + PARAMS ((bfd *abfd, PTR ptr)); + + +/* ia64-specific relocation */ + +/* Perform a relocation. Not much to do here as all the hard work is + done in elf64_ia64_final_link_relocate. */ +static bfd_reloc_status_type +elf64_ia64_reloc (abfd, reloc, sym, data, input_section, + output_bfd, error_message) + bfd *abfd; + arelent *reloc; + asymbol *sym; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + if (output_bfd) + { + reloc->address += input_section->output_offset; + return bfd_reloc_ok; + } + *error_message = "Unsupported call to elf64_ia64_reloc"; + return bfd_reloc_notsupported; +} + +#define IA64_HOWTO(TYPE, NAME, SIZE, PCREL, IN) \ + HOWTO (TYPE, 0, SIZE, 0, PCREL, 0, complain_overflow_signed, \ + elf64_ia64_reloc, NAME, false, 0, 0, IN) + +/* This table has to be sorted according to increasing number of the + TYPE field. */ +static reloc_howto_type ia64_howto_table[] = + { + IA64_HOWTO (R_IA64_NONE, "NONE", 0, false, true), + + IA64_HOWTO (R_IA64_IMM14, "IMM14", 0, false, true), + IA64_HOWTO (R_IA64_IMM22, "IMM22", 0, false, true), + IA64_HOWTO (R_IA64_IMM64, "IMM64", 0, false, true), + IA64_HOWTO (R_IA64_DIR32MSB, "DIR32MSB", 2, false, true), + IA64_HOWTO (R_IA64_DIR32LSB, "DIR32LSB", 2, false, true), + IA64_HOWTO (R_IA64_DIR64MSB, "DIR64MSB", 4, false, true), + IA64_HOWTO (R_IA64_DIR64LSB, "DIR64LSB", 4, false, true), + + IA64_HOWTO (R_IA64_GPREL22, "GPREL22", 0, false, true), + IA64_HOWTO (R_IA64_GPREL64I, "GPREL64I", 0, false, true), + IA64_HOWTO (R_IA64_GPREL32MSB, "GPREL32MSB", 2, false, true), + IA64_HOWTO (R_IA64_GPREL32LSB, "GPREL32LSB", 2, false, true), + IA64_HOWTO (R_IA64_GPREL64MSB, "GPREL64MSB", 4, false, true), + IA64_HOWTO (R_IA64_GPREL64LSB, "GPREL64LSB", 4, false, true), + + IA64_HOWTO (R_IA64_LTOFF22, "LTOFF22", 0, false, true), + IA64_HOWTO (R_IA64_LTOFF64I, "LTOFF64I", 0, false, true), + + IA64_HOWTO (R_IA64_PLTOFF22, "PLTOFF22", 0, false, true), + IA64_HOWTO (R_IA64_PLTOFF64I, "PLTOFF64I", 0, false, true), + IA64_HOWTO (R_IA64_PLTOFF64MSB, "PLTOFF64MSB", 4, false, true), + IA64_HOWTO (R_IA64_PLTOFF64LSB, "PLTOFF64LSB", 4, false, true), + + IA64_HOWTO (R_IA64_FPTR64I, "FPTR64I", 0, false, true), + IA64_HOWTO (R_IA64_FPTR32MSB, "FPTR32MSB", 2, false, true), + IA64_HOWTO (R_IA64_FPTR32LSB, "FPTR32LSB", 2, false, true), + IA64_HOWTO (R_IA64_FPTR64MSB, "FPTR64MSB", 4, false, true), + IA64_HOWTO (R_IA64_FPTR64LSB, "FPTR64LSB", 4, false, true), + + IA64_HOWTO (R_IA64_PCREL60B, "PCREL60B", 0, true, true), + IA64_HOWTO (R_IA64_PCREL21B, "PCREL21B", 0, true, true), + IA64_HOWTO (R_IA64_PCREL21M, "PCREL21M", 0, true, true), + IA64_HOWTO (R_IA64_PCREL21F, "PCREL21F", 0, true, true), + IA64_HOWTO (R_IA64_PCREL32MSB, "PCREL32MSB", 2, true, true), + IA64_HOWTO (R_IA64_PCREL32LSB, "PCREL32LSB", 2, true, true), + IA64_HOWTO (R_IA64_PCREL64MSB, "PCREL64MSB", 4, true, true), + IA64_HOWTO (R_IA64_PCREL64LSB, "PCREL64LSB", 4, true, true), + + IA64_HOWTO (R_IA64_LTOFF_FPTR22, "LTOFF_FPTR22", 0, false, true), + IA64_HOWTO (R_IA64_LTOFF_FPTR64I, "LTOFF_FPTR64I", 0, false, true), + IA64_HOWTO (R_IA64_LTOFF_FPTR64MSB, "LTOFF_FPTR64MSB", 4, false, true), + IA64_HOWTO (R_IA64_LTOFF_FPTR64LSB, "LTOFF_FPTR64LSB", 4, false, true), + + IA64_HOWTO (R_IA64_SEGBASE, "SEGBASE", 4, false, true), + IA64_HOWTO (R_IA64_SEGREL32MSB, "SEGREL32MSB", 2, false, true), + IA64_HOWTO (R_IA64_SEGREL32LSB, "SEGREL32LSB", 2, false, true), + IA64_HOWTO (R_IA64_SEGREL64MSB, "SEGREL64MSB", 4, false, true), + IA64_HOWTO (R_IA64_SEGREL64LSB, "SEGREL64LSB", 4, false, true), + + IA64_HOWTO (R_IA64_SECREL32MSB, "SECREL32MSB", 2, false, true), + IA64_HOWTO (R_IA64_SECREL32LSB, "SECREL32LSB", 2, false, true), + IA64_HOWTO (R_IA64_SECREL64MSB, "SECREL64MSB", 4, false, true), + IA64_HOWTO (R_IA64_SECREL64LSB, "SECREL64LSB", 4, false, true), + + IA64_HOWTO (R_IA64_REL32MSB, "REL32MSB", 2, false, true), + IA64_HOWTO (R_IA64_REL32LSB, "REL32LSB", 2, false, true), + IA64_HOWTO (R_IA64_REL64MSB, "REL64MSB", 4, false, true), + IA64_HOWTO (R_IA64_REL64LSB, "REL64LSB", 4, false, true), + + IA64_HOWTO (R_IA64_LTV32MSB, "LTV32MSB", 2, false, true), + IA64_HOWTO (R_IA64_LTV32LSB, "LTV32LSB", 2, false, true), + IA64_HOWTO (R_IA64_LTV64MSB, "LTV64MSB", 4, false, true), + IA64_HOWTO (R_IA64_LTV64LSB, "LTV64LSB", 4, false, true), + + IA64_HOWTO (R_IA64_PCREL21BI, "PCREL21BI", 0, true, true), + IA64_HOWTO (R_IA64_PCREL22, "PCREL22", 0, true, true), + IA64_HOWTO (R_IA64_PCREL64I, "PCREL64I", 0, true, true), + + IA64_HOWTO (R_IA64_IPLTMSB, "IPLTMSB", 4, false, true), + IA64_HOWTO (R_IA64_IPLTLSB, "IPLTLSB", 4, false, true), + IA64_HOWTO (R_IA64_EPLTMSB, "EPLTMSB", 4, false, true), + IA64_HOWTO (R_IA64_EPLTLSB, "EPLTLSB", 4, false, true), + IA64_HOWTO (R_IA64_COPY, "COPY", 4, false, true), + IA64_HOWTO (R_IA64_LTOFF22X, "LTOFF22X", 0, false, true), + IA64_HOWTO (R_IA64_LDXMOV, "LDXMOV", 0, false, true), + + IA64_HOWTO (R_IA64_TPREL22, "TPREL22", 0, false, false), + IA64_HOWTO (R_IA64_TPREL64MSB, "TPREL64MSB", 8, false, false), + IA64_HOWTO (R_IA64_TPREL64LSB, "TPREL64LSB", 8, false, false), + IA64_HOWTO (R_IA64_LTOFF_TP22, "LTOFF_TP22", 0, false, false), + }; + +static unsigned char elf_code_to_howto_index[R_IA64_MAX_RELOC_CODE + 1]; + +/* Given a BFD reloc type, return the matching HOWTO structure. */ + +static reloc_howto_type* +lookup_howto (rtype) + unsigned int rtype; +{ + static int inited = 0; + int i; + + if (!inited) + { + inited = 1; + + memset (elf_code_to_howto_index, 0xff, sizeof (elf_code_to_howto_index)); + for (i = 0; i < NELEMS (ia64_howto_table); ++i) + elf_code_to_howto_index[ia64_howto_table[i].type] = i; + } + + BFD_ASSERT (rtype <= R_IA64_MAX_RELOC_CODE); + i = elf_code_to_howto_index[rtype]; + if (i >= NELEMS (ia64_howto_table)) + return 0; + return ia64_howto_table + i; +} + +static reloc_howto_type* +elf64_ia64_reloc_type_lookup (abfd, bfd_code) + bfd *abfd; + bfd_reloc_code_real_type bfd_code; +{ + unsigned int rtype; + + switch (bfd_code) + { + case BFD_RELOC_NONE: rtype = R_IA64_NONE; break; + + case BFD_RELOC_IA64_IMM14: rtype = R_IA64_IMM14; break; + case BFD_RELOC_IA64_IMM22: rtype = R_IA64_IMM22; break; + case BFD_RELOC_IA64_IMM64: rtype = R_IA64_IMM64; break; + + case BFD_RELOC_IA64_DIR32MSB: rtype = R_IA64_DIR32MSB; break; + case BFD_RELOC_IA64_DIR32LSB: rtype = R_IA64_DIR32LSB; break; + case BFD_RELOC_IA64_DIR64MSB: rtype = R_IA64_DIR64MSB; break; + case BFD_RELOC_IA64_DIR64LSB: rtype = R_IA64_DIR64LSB; break; + + case BFD_RELOC_IA64_GPREL22: rtype = R_IA64_GPREL22; break; + case BFD_RELOC_IA64_GPREL64I: rtype = R_IA64_GPREL64I; break; + case BFD_RELOC_IA64_GPREL32MSB: rtype = R_IA64_GPREL32MSB; break; + case BFD_RELOC_IA64_GPREL32LSB: rtype = R_IA64_GPREL32LSB; break; + case BFD_RELOC_IA64_GPREL64MSB: rtype = R_IA64_GPREL64MSB; break; + case BFD_RELOC_IA64_GPREL64LSB: rtype = R_IA64_GPREL64LSB; break; + + case BFD_RELOC_IA64_LTOFF22: rtype = R_IA64_LTOFF22; break; + case BFD_RELOC_IA64_LTOFF64I: rtype = R_IA64_LTOFF64I; break; + + case BFD_RELOC_IA64_PLTOFF22: rtype = R_IA64_PLTOFF22; break; + case BFD_RELOC_IA64_PLTOFF64I: rtype = R_IA64_PLTOFF64I; break; + case BFD_RELOC_IA64_PLTOFF64MSB: rtype = R_IA64_PLTOFF64MSB; break; + case BFD_RELOC_IA64_PLTOFF64LSB: rtype = R_IA64_PLTOFF64LSB; break; + case BFD_RELOC_IA64_FPTR64I: rtype = R_IA64_FPTR64I; break; + case BFD_RELOC_IA64_FPTR32MSB: rtype = R_IA64_FPTR32MSB; break; + case BFD_RELOC_IA64_FPTR32LSB: rtype = R_IA64_FPTR32LSB; break; + case BFD_RELOC_IA64_FPTR64MSB: rtype = R_IA64_FPTR64MSB; break; + case BFD_RELOC_IA64_FPTR64LSB: rtype = R_IA64_FPTR64LSB; break; + + case BFD_RELOC_IA64_PCREL21B: rtype = R_IA64_PCREL21B; break; + case BFD_RELOC_IA64_PCREL21BI: rtype = R_IA64_PCREL21BI; break; + case BFD_RELOC_IA64_PCREL21M: rtype = R_IA64_PCREL21M; break; + case BFD_RELOC_IA64_PCREL21F: rtype = R_IA64_PCREL21F; break; + case BFD_RELOC_IA64_PCREL22: rtype = R_IA64_PCREL22; break; + case BFD_RELOC_IA64_PCREL60B: rtype = R_IA64_PCREL60B; break; + case BFD_RELOC_IA64_PCREL64I: rtype = R_IA64_PCREL64I; break; + case BFD_RELOC_IA64_PCREL32MSB: rtype = R_IA64_PCREL32MSB; break; + case BFD_RELOC_IA64_PCREL32LSB: rtype = R_IA64_PCREL32LSB; break; + case BFD_RELOC_IA64_PCREL64MSB: rtype = R_IA64_PCREL64MSB; break; + case BFD_RELOC_IA64_PCREL64LSB: rtype = R_IA64_PCREL64LSB; break; + + case BFD_RELOC_IA64_LTOFF_FPTR22: rtype = R_IA64_LTOFF_FPTR22; break; + case BFD_RELOC_IA64_LTOFF_FPTR64I: rtype = R_IA64_LTOFF_FPTR64I; break; + case BFD_RELOC_IA64_LTOFF_FPTR64MSB: rtype = R_IA64_LTOFF_FPTR64MSB; break; + case BFD_RELOC_IA64_LTOFF_FPTR64LSB: rtype = R_IA64_LTOFF_FPTR64LSB; break; + + case BFD_RELOC_IA64_SEGBASE: rtype = R_IA64_SEGBASE; break; + case BFD_RELOC_IA64_SEGREL32MSB: rtype = R_IA64_SEGREL32MSB; break; + case BFD_RELOC_IA64_SEGREL32LSB: rtype = R_IA64_SEGREL32LSB; break; + case BFD_RELOC_IA64_SEGREL64MSB: rtype = R_IA64_SEGREL64MSB; break; + case BFD_RELOC_IA64_SEGREL64LSB: rtype = R_IA64_SEGREL64LSB; break; + + case BFD_RELOC_IA64_SECREL32MSB: rtype = R_IA64_SECREL32MSB; break; + case BFD_RELOC_IA64_SECREL32LSB: rtype = R_IA64_SECREL32LSB; break; + case BFD_RELOC_IA64_SECREL64MSB: rtype = R_IA64_SECREL64MSB; break; + case BFD_RELOC_IA64_SECREL64LSB: rtype = R_IA64_SECREL64LSB; break; + + case BFD_RELOC_IA64_REL32MSB: rtype = R_IA64_REL32MSB; break; + case BFD_RELOC_IA64_REL32LSB: rtype = R_IA64_REL32LSB; break; + case BFD_RELOC_IA64_REL64MSB: rtype = R_IA64_REL64MSB; break; + case BFD_RELOC_IA64_REL64LSB: rtype = R_IA64_REL64LSB; break; + + case BFD_RELOC_IA64_LTV32MSB: rtype = R_IA64_LTV32MSB; break; + case BFD_RELOC_IA64_LTV32LSB: rtype = R_IA64_LTV32LSB; break; + case BFD_RELOC_IA64_LTV64MSB: rtype = R_IA64_LTV64MSB; break; + case BFD_RELOC_IA64_LTV64LSB: rtype = R_IA64_LTV64LSB; break; + + case BFD_RELOC_IA64_IPLTMSB: rtype = R_IA64_IPLTMSB; break; + case BFD_RELOC_IA64_IPLTLSB: rtype = R_IA64_IPLTLSB; break; + case BFD_RELOC_IA64_EPLTMSB: rtype = R_IA64_EPLTMSB; break; + case BFD_RELOC_IA64_EPLTLSB: rtype = R_IA64_EPLTLSB; break; + case BFD_RELOC_IA64_COPY: rtype = R_IA64_COPY; break; + case BFD_RELOC_IA64_LTOFF22X: rtype = R_IA64_LTOFF22X; break; + case BFD_RELOC_IA64_LDXMOV: rtype = R_IA64_LDXMOV; break; + + case BFD_RELOC_IA64_TPREL22: rtype = R_IA64_TPREL22; break; + case BFD_RELOC_IA64_TPREL64MSB: rtype = R_IA64_TPREL64MSB; break; + case BFD_RELOC_IA64_TPREL64LSB: rtype = R_IA64_TPREL64LSB; break; + case BFD_RELOC_IA64_LTOFF_TP22: rtype = R_IA64_LTOFF_TP22; break; + + default: return 0; + } + return lookup_howto (rtype); +} + +/* Given a ELF reloc, return the matching HOWTO structure. */ + +static void +elf64_ia64_info_to_howto (abfd, bfd_reloc, elf_reloc) + bfd *abfd; + arelent *bfd_reloc; + Elf64_Internal_Rela *elf_reloc; +{ + bfd_reloc->howto = lookup_howto (ELF64_R_TYPE (elf_reloc->r_info)); +} + +#define PLT_HEADER_SIZE (3 * 16) +#define PLT_MIN_ENTRY_SIZE (1 * 16) +#define PLT_FULL_ENTRY_SIZE (2 * 16) +#define PLT_RESERVED_WORDS 3 + +static const bfd_byte plt_header[PLT_HEADER_SIZE] = +{ + 0x0b, 0x10, 0x00, 0x1c, 0x00, 0x21, /* [MMI] mov r2=r14;; */ + 0xe0, 0x00, 0x08, 0x00, 0x48, 0x00, /* addl r14=0,r2 */ + 0x00, 0x00, 0x04, 0x00, /* nop.i 0x0;; */ + 0x0b, 0x80, 0x20, 0x1c, 0x18, 0x14, /* [MMI] ld8 r16=[r14],8;; */ + 0x10, 0x41, 0x38, 0x30, 0x28, 0x00, /* ld8 r17=[r14],8 */ + 0x00, 0x00, 0x04, 0x00, /* nop.i 0x0;; */ + 0x11, 0x08, 0x00, 0x1c, 0x18, 0x10, /* [MIB] ld8 r1=[r14] */ + 0x60, 0x88, 0x04, 0x80, 0x03, 0x00, /* mov b6=r17 */ + 0x60, 0x00, 0x80, 0x00 /* br.few b6;; */ +}; + +static const bfd_byte plt_min_entry[PLT_MIN_ENTRY_SIZE] = +{ + 0x11, 0x78, 0x00, 0x00, 0x00, 0x24, /* [MIB] mov r15=0 */ + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, /* nop.i 0x0 */ + 0x00, 0x00, 0x00, 0x40 /* br.few 0 <PLT0>;; */ +}; + +static const bfd_byte plt_full_entry[PLT_FULL_ENTRY_SIZE] = +{ + 0x0b, 0x78, 0x00, 0x02, 0x00, 0x24, /* [MMI] addl r15=0,r1;; */ + 0x00, 0x41, 0x3c, 0x30, 0x28, 0xc0, /* ld8 r16=[r15],8 */ + 0x01, 0x08, 0x00, 0x84, /* mov r14=r1;; */ + 0x11, 0x08, 0x00, 0x1e, 0x18, 0x10, /* [MIB] ld8 r1=[r15] */ + 0x60, 0x80, 0x04, 0x80, 0x03, 0x00, /* mov b6=r16 */ + 0x60, 0x00, 0x80, 0x00 /* br.few b6;; */ +}; + +#define ELF_DYNAMIC_INTERPRETER "/usr/lib/ld.so.1" + +/* Select out of range branch fixup type. Note that Itanium does + not support brl, and so it gets emulated by the kernel. */ +#undef USE_BRL + +static const bfd_byte oor_brl[16] = +{ + 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, /* [MLX] nop.m 0 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* brl.sptk.few tgt;; */ + 0x00, 0x00, 0x00, 0xc0 +}; + +static const bfd_byte oor_ip[48] = +{ + 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, /* [MLX] nop.m 0 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, /* movl r15=0 */ + 0x01, 0x00, 0x00, 0x60, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, /* [MII] nop.m 0 */ + 0x00, 0x01, 0x00, 0x60, 0x00, 0x00, /* mov r16=ip;; */ + 0xf2, 0x80, 0x00, 0x80, /* add r16=r15,r16;; */ + 0x11, 0x00, 0x00, 0x00, 0x01, 0x00, /* [MIB] nop.m 0 */ + 0x60, 0x80, 0x04, 0x80, 0x03, 0x00, /* mov b6=r16 */ + 0x60, 0x00, 0x80, 0x00 /* br b6;; */ +}; + +/* These functions do relaxation for IA-64 ELF. + + This is primarily to support branches to targets out of range; + relaxation of R_IA64_LTOFF22X and R_IA64_LDXMOV not yet supported. */ + +static boolean +elf64_ia64_relax_section (abfd, sec, link_info, again) + bfd *abfd; + asection *sec; + struct bfd_link_info *link_info; + boolean *again; +{ + struct one_fixup + { + struct one_fixup *next; + asection *tsec; + bfd_vma toff; + bfd_vma trampoff; + }; + + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Rela *internal_relocs; + Elf_Internal_Rela *free_relocs; + Elf_Internal_Rela *irel, *irelend; + bfd_byte *contents; + bfd_byte *free_contents; + Elf64_External_Sym *extsyms; + Elf64_External_Sym *free_extsyms; + struct elf64_ia64_link_hash_table *ia64_info; + struct one_fixup *fixups = NULL; + boolean changed_contents = false; + boolean changed_relocs = false; + + /* Assume we're not going to change any sizes, and we'll only need + one pass. */ + *again = false; + + /* Nothing to do if there are no relocations. */ + if ((sec->flags & SEC_RELOC) == 0 + || sec->reloc_count == 0) + return true; + + /* If this is the first time we have been called for this section, + initialize the cooked size. */ + if (sec->_cooked_size == 0) + sec->_cooked_size = sec->_raw_size; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + + /* Load the relocations for this section. */ + internal_relocs = (_bfd_elf64_link_read_relocs + (abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL, + link_info->keep_memory)); + if (internal_relocs == NULL) + goto error_return; + free_relocs = NULL; + if (! link_info->keep_memory) + free_relocs = internal_relocs; + + ia64_info = elf64_ia64_hash_table (link_info); + irelend = internal_relocs + sec->reloc_count; + + for (irel = internal_relocs; irel < irelend; irel++) + if (ELF64_R_TYPE (irel->r_info) == (int) R_IA64_PCREL21B) + break; + + /* No branch-type relocations. */ + if (irel == irelend) + { + if (free_relocs != NULL) + free (free_relocs); + return true; + } + + /* Get the section contents. */ + free_contents = NULL; + if (elf_section_data (sec)->this_hdr.contents != NULL) + contents = elf_section_data (sec)->this_hdr.contents; + else + { + contents = (bfd_byte *) bfd_malloc (sec->_raw_size); + if (contents == NULL) + goto error_return; + free_contents = contents; + + if (! bfd_get_section_contents (abfd, sec, contents, + (file_ptr) 0, sec->_raw_size)) + goto error_return; + } + + /* Read this BFD's symbols. */ + free_extsyms = NULL; + if (symtab_hdr->contents != NULL) + extsyms = (Elf64_External_Sym *) symtab_hdr->contents; + else + { + extsyms = (Elf64_External_Sym *) bfd_malloc (symtab_hdr->sh_size); + if (extsyms == NULL) + goto error_return; + free_extsyms = extsyms; + if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0 + || (bfd_read (extsyms, 1, symtab_hdr->sh_size, abfd) + != symtab_hdr->sh_size)) + goto error_return; + } + + for (; irel < irelend; irel++) + { + bfd_vma symaddr, reladdr, trampoff, toff, roff; + Elf_Internal_Sym isym; + asection *tsec; + struct one_fixup *f; + + if (ELF64_R_TYPE (irel->r_info) != (int) R_IA64_PCREL21B) + continue; + + /* Get the value of the symbol referred to by the reloc. */ + if (ELF64_R_SYM (irel->r_info) < symtab_hdr->sh_info) + { + /* A local symbol. */ + bfd_elf64_swap_symbol_in (abfd, + extsyms + ELF64_R_SYM (irel->r_info), + &isym); + if (isym.st_shndx == SHN_UNDEF) + continue; /* We can't do anthing with undefined symbols. */ + else if (isym.st_shndx == SHN_ABS) + tsec = bfd_abs_section_ptr; + else if (isym.st_shndx == SHN_COMMON) + tsec = bfd_com_section_ptr; + else if (isym.st_shndx > 0 && isym.st_shndx < SHN_LORESERVE) + tsec = bfd_section_from_elf_index (abfd, isym.st_shndx); + else + continue; /* who knows. */ + + toff = isym.st_value; + } + else + { + unsigned long indx; + struct elf_link_hash_entry *h; + struct elf64_ia64_dyn_sym_info *dyn_i; + + indx = ELF64_R_SYM (irel->r_info) - symtab_hdr->sh_info; + h = elf_sym_hashes (abfd)[indx]; + BFD_ASSERT (h != NULL); + + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + dyn_i = get_dyn_sym_info (ia64_info, h, abfd, irel, false); + + /* For branches to dynamic symbols, we're interested instead + in a branch to the PLT entry. */ + if (dyn_i && dyn_i->want_plt2) + { + tsec = ia64_info->plt_sec; + toff = dyn_i->plt2_offset; + } + else + { + /* We can't do anthing with undefined symbols. */ + if (h->root.type == bfd_link_hash_undefined + || h->root.type == bfd_link_hash_undefweak) + continue; + + tsec = h->root.u.def.section; + toff = h->root.u.def.value; + } + } + + symaddr = (tsec->output_section->vma + + tsec->output_offset + + toff + + irel->r_addend); + + roff = irel->r_offset; + reladdr = (sec->output_section->vma + + sec->output_offset + + roff) & -4; + + /* If the branch is in range, no need to do anything. */ + if ((bfd_signed_vma) (symaddr - reladdr) >= -0x1000000 + && (bfd_signed_vma) (symaddr - reladdr) <= 0x0FFFFF0) + continue; + + /* If the branch and target are in the same section, you've + got one honking big section and we can't help you. You'll + get an error message later. */ + if (tsec == sec) + continue; + + /* Look for an existing fixup to this address. */ + for (f = fixups; f ; f = f->next) + if (f->tsec == tsec && f->toff == toff) + break; + + if (f == NULL) + { + /* Two alternatives: If it's a branch to a PLT entry, we can + make a copy of the FULL_PLT entry. Otherwise, we'll have + to use a `brl' insn to get where we're going. */ + + int size; + + if (tsec == ia64_info->plt_sec) + size = sizeof (plt_full_entry); + else + { +#ifdef USE_BRL + size = sizeof (oor_brl); +#else + size = sizeof (oor_ip); +#endif + } + + /* Resize the current section to make room for the new branch. */ + trampoff = (sec->_cooked_size + 15) & -16; + contents = (bfd_byte *) bfd_realloc (contents, trampoff + size); + if (contents == NULL) + goto error_return; + sec->_cooked_size = trampoff + size; + + if (tsec == ia64_info->plt_sec) + { + memcpy (contents + trampoff, plt_full_entry, size); + + /* Hijack the old relocation for use as the PLTOFF reloc. */ + irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), + R_IA64_PLTOFF22); + irel->r_offset = trampoff; + } + else + { +#ifdef USE_BRL + memcpy (contents + trampoff, oor_brl, size); + irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), + R_IA64_PCREL60B); + irel->r_offset = trampoff + 2; +#else + memcpy (contents + trampoff, oor_ip, size); + irel->r_info = ELF64_R_INFO (ELF64_R_SYM (irel->r_info), + R_IA64_PCREL64I); + irel->r_addend -= 16; + irel->r_offset = trampoff + 2; +#endif + } + + /* Record the fixup so we don't do it again this section. */ + f = (struct one_fixup *) bfd_malloc (sizeof (*f)); + f->next = fixups; + f->tsec = tsec; + f->toff = toff; + f->trampoff = trampoff; + fixups = f; + } + else + { + /* Nop out the reloc, since we're finalizing things here. */ + irel->r_info = ELF64_R_INFO (0, R_IA64_NONE); + } + + /* Fix up the existing branch to hit the trampoline. Hope like + hell this doesn't overflow too. */ + if (elf64_ia64_install_value (abfd, contents + roff, + f->trampoff - (roff & -4), + R_IA64_PCREL21B) != bfd_reloc_ok) + goto error_return; + + changed_contents = true; + changed_relocs = true; + } + + /* Clean up and go home. */ + while (fixups) + { + struct one_fixup *f = fixups; + fixups = fixups->next; + free (f); + } + + if (changed_relocs) + elf_section_data (sec)->relocs = internal_relocs; + else if (free_relocs != NULL) + free (free_relocs); + + if (changed_contents) + elf_section_data (sec)->this_hdr.contents = contents; + else if (free_contents != NULL) + { + if (! link_info->keep_memory) + free (free_contents); + else + { + /* Cache the section contents for elf_link_input_bfd. */ + elf_section_data (sec)->this_hdr.contents = contents; + } + } + + if (free_extsyms != NULL) + { + if (! link_info->keep_memory) + free (free_extsyms); + else + { + /* Cache the symbols for elf_link_input_bfd. */ + symtab_hdr->contents = extsyms; + } + } + + *again = changed_contents || changed_relocs; + return true; + + error_return: + if (free_relocs != NULL) + free (free_relocs); + if (free_contents != NULL) + free (free_contents); + if (free_extsyms != NULL) + free (free_extsyms); + return false; +} + +/* Handle an IA-64 specific section when reading an object file. This + is called when elfcode.h finds a section with an unknown type. */ + +static boolean +elf64_ia64_section_from_shdr (abfd, hdr, name) + bfd *abfd; + Elf64_Internal_Shdr *hdr; + char *name; +{ + asection *newsect; + + /* There ought to be a place to keep ELF backend specific flags, but + at the moment there isn't one. We just keep track of the + sections by their name, instead. Fortunately, the ABI gives + suggested names for all the MIPS specific sections, so we will + probably get away with this. */ + switch (hdr->sh_type) + { + case SHT_IA_64_UNWIND: + if (strcmp (name, ELF_STRING_ia64_unwind) != 0) + return false; + break; + + case SHT_IA_64_EXT: + if (strcmp (name, ELF_STRING_ia64_archext) != 0) + return false; + break; + + default: + return false; + } + + if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name)) + return false; + newsect = hdr->bfd_section; + + return true; +} + +/* Convert IA-64 specific section flags to bfd internal section flags. */ + +/* ??? There is no bfd internal flag equivalent to the SHF_IA_64_NORECOV + flag. */ + +static boolean +elf64_ia64_section_flags (flags, hdr) + flagword *flags; + Elf64_Internal_Shdr *hdr; +{ + if (hdr->sh_flags & SHF_IA_64_SHORT) + *flags |= SEC_SMALL_DATA; + + return true; +} + +/* Set the correct type for an IA-64 ELF section. We do this by the + section name, which is a hack, but ought to work. */ + +static boolean +elf64_ia64_fake_sections (abfd, hdr, sec) + bfd *abfd; + Elf64_Internal_Shdr *hdr; + asection *sec; +{ + register const char *name; + + name = bfd_get_section_name (abfd, sec); + + if (strcmp (name, ELF_STRING_ia64_unwind) == 0) + hdr->sh_type = SHT_IA_64_UNWIND; + else if (strcmp (name, ELF_STRING_ia64_archext) == 0) + hdr->sh_type = SHT_IA_64_EXT; + else if (strcmp (name, ".reloc") == 0) + /* + * This is an ugly, but unfortunately necessary hack that is + * needed when producing EFI binaries on IA-64. It tells + * elf.c:elf_fake_sections() not to consider ".reloc" as a section + * containing ELF relocation info. We need this hack in order to + * be able to generate ELF binaries that can be translated into + * EFI applications (which are essentially COFF objects). Those + * files contain a COFF ".reloc" section inside an ELF64 object, + * which would normally cause BFD to segfault because it would + * attempt to interpret this section as containing relocation + * entries for section "oc". With this hack enabled, ".reloc" + * will be treated as a normal data section, which will avoid the + * segfault. However, you won't be able to create an ELF64 binary + * with a section named "oc" that needs relocations, but that's + * the kind of ugly side-effects you get when detecting section + * types based on their names... In practice, this limitation is + * unlikely to bite. + */ + hdr->sh_type = SHT_PROGBITS; + + if (sec->flags & SEC_SMALL_DATA) + hdr->sh_flags |= SHF_IA_64_SHORT; + + return true; +} + +/* Hook called by the linker routine which adds symbols from an object + file. We use it to put .comm items in .sbss, and not .bss. */ + +static boolean +elf64_ia64_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) + bfd *abfd; + struct bfd_link_info *info; + const Elf_Internal_Sym *sym; + const char **namep; + flagword *flagsp; + asection **secp; + bfd_vma *valp; +{ + if (sym->st_shndx == SHN_COMMON + && !info->relocateable + && sym->st_size <= bfd_get_gp_size (abfd)) + { + /* Common symbols less than or equal to -G nn bytes are + automatically put into .sbss. */ + + asection *scomm = bfd_get_section_by_name (abfd, ".scommon"); + + if (scomm == NULL) + { + scomm = bfd_make_section (abfd, ".scommon"); + if (scomm == NULL + || !bfd_set_section_flags (abfd, scomm, (SEC_ALLOC + | SEC_IS_COMMON + | SEC_LINKER_CREATED))) + return false; + } + + *secp = scomm; + *valp = sym->st_size; + } + + return true; +} + +/* Return the number of additional phdrs we will need. */ + +static int +elf64_ia64_additional_program_headers (abfd) + bfd *abfd; +{ + asection *s; + int ret = 0; + + /* See if we need a PT_IA_64_ARCHEXT segment. */ + s = bfd_get_section_by_name (abfd, ELF_STRING_ia64_archext); + if (s && (s->flags & SEC_LOAD)) + ++ret; + + /* See if we need a PT_IA_64_UNWIND segment. */ + s = bfd_get_section_by_name (abfd, ELF_STRING_ia64_unwind); + if (s && (s->flags & SEC_LOAD)) + ++ret; + + return ret; +} + +static boolean +elf64_ia64_modify_segment_map (abfd) + bfd *abfd; +{ + struct elf_segment_map *m, **pm; + asection *s; + + /* If we need a PT_IA_64_ARCHEXT segment, it must come before + all PT_LOAD segments. */ + s = bfd_get_section_by_name (abfd, ELF_STRING_ia64_archext); + if (s && (s->flags & SEC_LOAD)) + { + for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next) + if (m->p_type == PT_IA_64_ARCHEXT) + break; + if (m == NULL) + { + m = (struct elf_segment_map *) bfd_zalloc (abfd, sizeof *m); + if (m == NULL) + return false; + + m->p_type = PT_IA_64_ARCHEXT; + m->count = 1; + m->sections[0] = s; + + /* We want to put it after the PHDR and INTERP segments. */ + pm = &elf_tdata (abfd)->segment_map; + while (*pm != NULL + && ((*pm)->p_type == PT_PHDR + || (*pm)->p_type == PT_INTERP)) + pm = &(*pm)->next; + + m->next = *pm; + *pm = m; + } + } + + /* Install the PT_IA_64_UNWIND segment, if needed. */ + s = bfd_get_section_by_name (abfd, ELF_STRING_ia64_unwind); + if (s && (s->flags & SEC_LOAD)) + { + for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next) + if (m->p_type == PT_IA_64_UNWIND) + break; + if (m == NULL) + { + m = (struct elf_segment_map *) bfd_zalloc (abfd, sizeof *m); + if (m == NULL) + return false; + + m->p_type = PT_IA_64_UNWIND; + m->count = 1; + m->sections[0] = s; + m->next = NULL; + + /* We want to put it last. */ + pm = &elf_tdata (abfd)->segment_map; + while (*pm != NULL) + pm = &(*pm)->next; + *pm = m; + } + } + + /* Turn on PF_IA_64_NORECOV if needed. This involves traversing all of + the input sections for each output section in the segment and testing + for SHF_IA_64_NORECOV on each. */ + for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next) + if (m->p_type == PT_LOAD) + { + int i; + for (i = m->count - 1; i >= 0; --i) + { + struct bfd_link_order *order = m->sections[i]->link_order_head; + while (order) + { + if (order->type == bfd_indirect_link_order) + { + asection *is = order->u.indirect.section; + bfd_vma flags = elf_section_data(is)->this_hdr.sh_flags; + if (flags & SHF_IA_64_NORECOV) + { + m->p_flags |= PF_IA_64_NORECOV; + goto found; + } + } + order = order->next; + } + } + found:; + } + + return true; +} + + +/* According to the Tahoe assembler spec, all labels starting with a + '.' are local. */ + +static boolean +elf64_ia64_is_local_label_name (abfd, name) + bfd *abfd; + const char *name; +{ + return name[0] == '.'; +} + +/* Should we do dynamic things to this symbol? */ + +static boolean +elf64_ia64_dynamic_symbol_p (h, info) + struct elf_link_hash_entry *h; + struct bfd_link_info *info; +{ + if (h == NULL) + return false; + + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + if (h->dynindx == -1) + return false; + + if (h->root.type == bfd_link_hash_undefweak + || h->root.type == bfd_link_hash_defweak) + return true; + + if ((info->shared && !info->symbolic) + || ((h->elf_link_hash_flags + & (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR)) + == (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR))) + return true; + + return false; +} + +static boolean +elf64_ia64_local_hash_table_init (ht, abfd, new) + struct elf64_ia64_local_hash_table *ht; + bfd *abfd; + new_hash_entry_func new; +{ + memset (ht, 0, sizeof(*ht)); + return bfd_hash_table_init (&ht->root, new); +} + +static struct bfd_hash_entry* +elf64_ia64_new_loc_hash_entry (entry, table, string) + struct bfd_hash_entry *entry; + struct bfd_hash_table *table; + const char *string; +{ + struct elf64_ia64_local_hash_entry *ret; + ret = (struct elf64_ia64_local_hash_entry *) entry; + + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (!ret) + ret = bfd_hash_allocate (table, sizeof (*ret)); + + if (!ret) + return 0; + + /* Initialize our local data. All zeros, and definitely easier + than setting a handful of bit fields. */ + memset (ret, 0, sizeof(*ret)); + + /* Call the allocation method of the superclass. */ + ret = ((struct elf64_ia64_local_hash_entry *) + bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string)); + + return (struct bfd_hash_entry *) ret; +} + +static struct bfd_hash_entry* +elf64_ia64_new_elf_hash_entry (entry, table, string) + struct bfd_hash_entry *entry; + struct bfd_hash_table *table; + const char *string; +{ + struct elf64_ia64_link_hash_entry *ret; + ret = (struct elf64_ia64_link_hash_entry *) entry; + + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (!ret) + ret = bfd_hash_allocate (table, sizeof (*ret)); + + if (!ret) + return 0; + + /* Initialize our local data. All zeros, and definitely easier + than setting a handful of bit fields. */ + memset (ret, 0, sizeof(*ret)); + + /* Call the allocation method of the superclass. */ + ret = ((struct elf64_ia64_link_hash_entry *) + _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, + table, string)); + + return (struct bfd_hash_entry *) ret; +} + +static void +elf64_ia64_hash_copy_indirect (xdir, xind) + struct elf_link_hash_entry *xdir, *xind; +{ + struct elf64_ia64_link_hash_entry *dir, *ind; + + dir = (struct elf64_ia64_link_hash_entry *)xdir; + ind = (struct elf64_ia64_link_hash_entry *)xind; + + /* Copy down any references that we may have already seen to the + symbol which just became indirect. */ + + dir->root.elf_link_hash_flags |= + (ind->root.elf_link_hash_flags + & (ELF_LINK_HASH_REF_DYNAMIC + | ELF_LINK_HASH_REF_REGULAR + | ELF_LINK_HASH_REF_REGULAR_NONWEAK)); + + /* Copy over the got and plt data. This would have been done + by check_relocs. */ + + if (dir->info == NULL) + { + struct elf64_ia64_dyn_sym_info *dyn_i; + + dir->info = dyn_i = ind->info; + ind->info = NULL; + + /* Fix up the dyn_sym_info pointers to the global symbol. */ + for (; dyn_i; dyn_i = dyn_i->next) + dyn_i->h = &dir->root; + } + BFD_ASSERT (ind->info == NULL); + + /* Copy over the dynindx. */ + + if (dir->root.dynindx == -1) + { + dir->root.dynindx = ind->root.dynindx; + dir->root.dynstr_index = ind->root.dynstr_index; + ind->root.dynindx = -1; + ind->root.dynstr_index = 0; + } + BFD_ASSERT (ind->root.dynindx == -1); +} + +static void +elf64_ia64_hash_hide_symbol (info, xh) + struct bfd_link_info *info ATTRIBUTE_UNUSED; + struct elf_link_hash_entry *xh; +{ + struct elf64_ia64_link_hash_entry *h; + struct elf64_ia64_dyn_sym_info *dyn_i; + + h = (struct elf64_ia64_link_hash_entry *)xh; + + h->root.elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + h->root.dynindx = -1; + + for (dyn_i = h->info; dyn_i; dyn_i = dyn_i->next) + dyn_i->want_plt2 = 0; +} + +/* Create the derived linker hash table. The IA-64 ELF port uses this + derived hash table to keep information specific to the IA-64 ElF + linker (without using static variables). */ + +static struct bfd_link_hash_table* +elf64_ia64_hash_table_create (abfd) + bfd *abfd; +{ + struct elf64_ia64_link_hash_table *ret; + + ret = bfd_alloc (abfd, sizeof (*ret)); + if (!ret) + return 0; + if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, + elf64_ia64_new_elf_hash_entry)) + { + bfd_release (abfd, ret); + return 0; + } + + if (!elf64_ia64_local_hash_table_init (&ret->loc_hash_table, abfd, + elf64_ia64_new_loc_hash_entry)) + return 0; + return &ret->root.root; +} + +/* Look up an entry in a Alpha ELF linker hash table. */ + +static INLINE struct elf64_ia64_local_hash_entry * +elf64_ia64_local_hash_lookup(table, string, create, copy) + struct elf64_ia64_local_hash_table *table; + const char *string; + boolean create, copy; +{ + return ((struct elf64_ia64_local_hash_entry *) + bfd_hash_lookup (&table->root, string, create, copy)); +} + +/* Traverse both local and global hash tables. */ + +struct elf64_ia64_dyn_sym_traverse_data +{ + boolean (*func) PARAMS ((struct elf64_ia64_dyn_sym_info *, PTR)); + PTR data; +}; + +static boolean +elf64_ia64_global_dyn_sym_thunk (xentry, xdata) + struct bfd_hash_entry *xentry; + PTR xdata; +{ + struct elf64_ia64_link_hash_entry *entry + = (struct elf64_ia64_link_hash_entry *) xentry; + struct elf64_ia64_dyn_sym_traverse_data *data + = (struct elf64_ia64_dyn_sym_traverse_data *) xdata; + struct elf64_ia64_dyn_sym_info *dyn_i; + + for (dyn_i = entry->info; dyn_i; dyn_i = dyn_i->next) + if (! (*data->func) (dyn_i, data->data)) + return false; + return true; +} + +static boolean +elf64_ia64_local_dyn_sym_thunk (xentry, xdata) + struct bfd_hash_entry *xentry; + PTR xdata; +{ + struct elf64_ia64_local_hash_entry *entry + = (struct elf64_ia64_local_hash_entry *) xentry; + struct elf64_ia64_dyn_sym_traverse_data *data + = (struct elf64_ia64_dyn_sym_traverse_data *) xdata; + struct elf64_ia64_dyn_sym_info *dyn_i; + + for (dyn_i = entry->info; dyn_i; dyn_i = dyn_i->next) + if (! (*data->func) (dyn_i, data->data)) + return false; + return true; +} + +static void +elf64_ia64_dyn_sym_traverse (ia64_info, func, data) + struct elf64_ia64_link_hash_table *ia64_info; + boolean (*func) PARAMS ((struct elf64_ia64_dyn_sym_info *, PTR)); + PTR data; +{ + struct elf64_ia64_dyn_sym_traverse_data xdata; + + xdata.func = func; + xdata.data = data; + + elf_link_hash_traverse (&ia64_info->root, + elf64_ia64_global_dyn_sym_thunk, &xdata); + bfd_hash_traverse (&ia64_info->loc_hash_table.root, + elf64_ia64_local_dyn_sym_thunk, &xdata); +} + +static boolean +elf64_ia64_create_dynamic_sections (abfd, info) + bfd *abfd; + struct bfd_link_info *info; +{ + struct elf64_ia64_link_hash_table *ia64_info; + struct elf_link_hash_entry *h; + asection *s; + + if (! _bfd_elf_create_dynamic_sections (abfd, info)) + return false; + + ia64_info = elf64_ia64_hash_table (info); + + ia64_info->plt_sec = bfd_get_section_by_name (abfd, ".plt"); + ia64_info->got_sec = bfd_get_section_by_name (abfd, ".got"); + + { + flagword flags = bfd_get_section_flags (abfd, ia64_info->got_sec); + bfd_set_section_flags (abfd, ia64_info->got_sec, SEC_SMALL_DATA | flags); + } + + if (!get_pltoff (abfd, info, ia64_info)) + return false; + + s = bfd_make_section(abfd, ".rela.IA_64.pltoff"); + if (s == NULL + || !bfd_set_section_flags (abfd, s, (SEC_ALLOC | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)) + || !bfd_set_section_alignment (abfd, s, 3)) + return false; + ia64_info->rel_pltoff_sec = s; + + s = bfd_make_section(abfd, ".rela.got"); + if (s == NULL + || !bfd_set_section_flags (abfd, s, (SEC_ALLOC | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)) + || !bfd_set_section_alignment (abfd, s, 3)) + return false; + ia64_info->rel_got_sec = s; + + return true; +} + +/* Find and/or create a descriptor for dynamic symbol info. This will + vary based on global or local symbol, and the addend to the reloc. */ + +static struct elf64_ia64_dyn_sym_info * +get_dyn_sym_info (ia64_info, h, abfd, rel, create) + struct elf64_ia64_link_hash_table *ia64_info; + struct elf_link_hash_entry *h; + bfd *abfd; + const Elf_Internal_Rela *rel; + boolean create; +{ + struct elf64_ia64_dyn_sym_info **pp; + struct elf64_ia64_dyn_sym_info *dyn_i; + bfd_vma addend = rel ? rel->r_addend : 0; + + if (h) + pp = &((struct elf64_ia64_link_hash_entry *)h)->info; + else + { + struct elf64_ia64_local_hash_entry *loc_h; + char *addr_name; + size_t len; + + /* Construct a string for use in the elf64_ia64_local_hash_table. + The name describes what was once anonymous memory. */ + + len = sizeof(void*)*2 + 1 + sizeof(bfd_vma)*4 + 1 + 1; + len += 10; /* %p slop */ + + addr_name = alloca (len); + sprintf (addr_name, "%p:%lx", abfd, ELF64_R_SYM (rel->r_info)); + + /* Collect the canonical entry data for this address. */ + loc_h = elf64_ia64_local_hash_lookup (&ia64_info->loc_hash_table, + addr_name, create, create); + BFD_ASSERT (loc_h); + + pp = &loc_h->info; + } + + for (dyn_i = *pp; dyn_i && dyn_i->addend != addend; dyn_i = *pp) + pp = &dyn_i->next; + + if (dyn_i == NULL && create) + { + dyn_i = (struct elf64_ia64_dyn_sym_info *) + bfd_zalloc (abfd, sizeof *dyn_i); + *pp = dyn_i; + dyn_i->addend = addend; + } + + return dyn_i; +} + +static asection * +get_got (abfd, info, ia64_info) + bfd *abfd; + struct bfd_link_info *info; + struct elf64_ia64_link_hash_table *ia64_info; +{ + asection *got, *srel; + bfd *dynobj; + + got = ia64_info->got_sec; + if (!got) + { + flagword flags; + + dynobj = ia64_info->root.dynobj; + if (!dynobj) + ia64_info->root.dynobj = dynobj = abfd; + if (!_bfd_elf_create_got_section (dynobj, info)) + return 0; + + got = bfd_get_section_by_name (dynobj, ".got"); + BFD_ASSERT (got); + ia64_info->got_sec = got; + + flags = bfd_get_section_flags (abfd, got); + bfd_set_section_flags (abfd, got, SEC_SMALL_DATA | flags); + } + + return got; +} + +/* Create function descriptor section (.opd). This section is called .opd + because it contains "official prodecure descriptors". The "official" + refers to the fact that these descriptors are used when taking the address + of a procedure, thus ensuring a unique address for each procedure. */ + +static asection * +get_fptr (abfd, info, ia64_info) + bfd *abfd; + struct bfd_link_info *info; + struct elf64_ia64_link_hash_table *ia64_info; +{ + asection *fptr; + bfd *dynobj; + + fptr = ia64_info->fptr_sec; + if (!fptr) + { + dynobj = ia64_info->root.dynobj; + if (!dynobj) + ia64_info->root.dynobj = dynobj = abfd; + + fptr = bfd_make_section (dynobj, ".opd"); + if (!fptr + || !bfd_set_section_flags (dynobj, fptr, + (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_READONLY + | SEC_LINKER_CREATED)) + || !bfd_set_section_alignment (abfd, fptr, 4)) + { + BFD_ASSERT (0); + return NULL; + } + + ia64_info->fptr_sec = fptr; + } + + return fptr; +} + +static asection * +get_pltoff (abfd, info, ia64_info) + bfd *abfd; + struct bfd_link_info *info; + struct elf64_ia64_link_hash_table *ia64_info; +{ + asection *pltoff; + bfd *dynobj; + + pltoff = ia64_info->pltoff_sec; + if (!pltoff) + { + dynobj = ia64_info->root.dynobj; + if (!dynobj) + ia64_info->root.dynobj = dynobj = abfd; + + pltoff = bfd_make_section (dynobj, ELF_STRING_ia64_pltoff); + if (!pltoff + || !bfd_set_section_flags (dynobj, pltoff, + (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_SMALL_DATA + | SEC_LINKER_CREATED)) + || !bfd_set_section_alignment (abfd, pltoff, 4)) + { + BFD_ASSERT (0); + return NULL; + } + + ia64_info->pltoff_sec = pltoff; + } + + return pltoff; +} + +static asection * +get_reloc_section (abfd, ia64_info, sec, create) + bfd *abfd; + struct elf64_ia64_link_hash_table *ia64_info; + asection *sec; + boolean create; +{ + const char *srel_name; + asection *srel; + bfd *dynobj; + + srel_name = (bfd_elf_string_from_elf_section + (abfd, elf_elfheader(abfd)->e_shstrndx, + elf_section_data(sec)->rel_hdr.sh_name)); + if (srel_name == NULL) + return NULL; + + BFD_ASSERT ((strncmp (srel_name, ".rela", 5) == 0 + && strcmp (bfd_get_section_name (abfd, sec), + srel_name+5) == 0) + || (strncmp (srel_name, ".rel", 4) == 0 + && strcmp (bfd_get_section_name (abfd, sec), + srel_name+4) == 0)); + + dynobj = ia64_info->root.dynobj; + if (!dynobj) + ia64_info->root.dynobj = dynobj = abfd; + + srel = bfd_get_section_by_name (dynobj, srel_name); + if (srel == NULL && create) + { + srel = bfd_make_section (dynobj, srel_name); + if (srel == NULL + || !bfd_set_section_flags (dynobj, srel, + (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY + | SEC_LINKER_CREATED + | SEC_READONLY)) + || !bfd_set_section_alignment (dynobj, srel, 3)) + return NULL; + } + + return srel; +} + +static boolean +count_dyn_reloc (abfd, dyn_i, srel, type) + bfd *abfd; + struct elf64_ia64_dyn_sym_info *dyn_i; + asection *srel; + int type; +{ + struct elf64_ia64_dyn_reloc_entry *rent; + + for (rent = dyn_i->reloc_entries; rent; rent = rent->next) + if (rent->srel == srel && rent->type == type) + break; + + if (!rent) + { + rent = (struct elf64_ia64_dyn_reloc_entry *) + bfd_alloc (abfd, sizeof (*rent)); + if (!rent) + return false; + + rent->next = dyn_i->reloc_entries; + rent->srel = srel; + rent->type = type; + rent->count = 0; + dyn_i->reloc_entries = rent; + } + rent->count++; + + return true; +} + +static boolean +elf64_ia64_check_relocs (abfd, info, sec, relocs) + bfd *abfd; + struct bfd_link_info *info; + asection *sec; + const Elf_Internal_Rela *relocs; +{ + struct elf64_ia64_link_hash_table *ia64_info; + const Elf_Internal_Rela *relend; + Elf_Internal_Shdr *symtab_hdr; + const Elf_Internal_Rela *rel; + asection *got, *fptr, *srel; + + if (info->relocateable) + return true; + + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; + ia64_info = elf64_ia64_hash_table (info); + + got = fptr = srel = NULL; + + relend = relocs + sec->reloc_count; + for (rel = relocs; rel < relend; ++rel) + { + enum { + NEED_GOT = 1, + NEED_FPTR = 2, + NEED_PLTOFF = 4, + NEED_MIN_PLT = 8, + NEED_FULL_PLT = 16, + NEED_DYNREL = 32, + NEED_LTOFF_FPTR = 64, + }; + + struct elf_link_hash_entry *h = NULL; + unsigned long r_symndx = ELF64_R_SYM (rel->r_info); + struct elf64_ia64_dyn_sym_info *dyn_i; + int need_entry; + boolean maybe_dynamic; + int dynrel_type; + + if (r_symndx >= symtab_hdr->sh_info) + { + /* We're dealing with a global symbol -- find its hash entry + and mark it as being referenced. */ + long indx = r_symndx - symtab_hdr->sh_info; + h = elf_sym_hashes (abfd)[indx]; + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + h->elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR; + } + + /* We can only get preliminary data on whether a symbol is + locally or externally defined, as not all of the input files + have yet been processed. Do something with what we know, as + this may help reduce memory usage and processing time later. */ + maybe_dynamic = false; + if (h && ((info->shared && ! info->symbolic) + || ! (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) + || h->root.type == bfd_link_hash_defweak)) + maybe_dynamic = true; + + need_entry = 0; + switch (ELF64_R_TYPE (rel->r_info)) + { + case R_IA64_TPREL22: + case R_IA64_TPREL64MSB: + case R_IA64_TPREL64LSB: + case R_IA64_LTOFF_TP22: + return false; + + case R_IA64_LTOFF_FPTR22: + case R_IA64_LTOFF_FPTR64I: + case R_IA64_LTOFF_FPTR64MSB: + case R_IA64_LTOFF_FPTR64LSB: + need_entry = NEED_FPTR | NEED_GOT | NEED_LTOFF_FPTR; + break; + + case R_IA64_FPTR64I: + case R_IA64_FPTR32MSB: + case R_IA64_FPTR32LSB: + case R_IA64_FPTR64MSB: + case R_IA64_FPTR64LSB: + if (info->shared || h) + need_entry = NEED_FPTR | NEED_DYNREL; + else + need_entry = NEED_FPTR; + dynrel_type = R_IA64_FPTR64LSB; + break; + + case R_IA64_LTOFF22: + case R_IA64_LTOFF22X: + case R_IA64_LTOFF64I: + need_entry = NEED_GOT; + break; + + case R_IA64_PLTOFF22: + case R_IA64_PLTOFF64I: + case R_IA64_PLTOFF64MSB: + case R_IA64_PLTOFF64LSB: + need_entry = NEED_PLTOFF; + if (h) + { + if (maybe_dynamic) + need_entry |= NEED_MIN_PLT; + } + else + { + (*info->callbacks->warning) + (info, _("@pltoff reloc against local symbol"), 0, + abfd, 0, 0); + } + break; + + case R_IA64_PCREL21B: + case R_IA64_PCREL60B: + /* Depending on where this symbol is defined, we may or may not + need a full plt entry. Only skip if we know we'll not need + the entry -- static or symbolic, and the symbol definition + has already been seen. */ + if (maybe_dynamic && rel->r_addend == 0) + need_entry = NEED_FULL_PLT; + break; + + case R_IA64_IMM14: + case R_IA64_IMM22: + case R_IA64_IMM64: + case R_IA64_DIR32MSB: + case R_IA64_DIR32LSB: + case R_IA64_DIR64MSB: + case R_IA64_DIR64LSB: + /* Shared objects will always need at least a REL relocation. */ + if (info->shared || maybe_dynamic) + need_entry = NEED_DYNREL; + dynrel_type = R_IA64_DIR64LSB; + break; + + case R_IA64_PCREL22: + case R_IA64_PCREL64I: + case R_IA64_PCREL32MSB: + case R_IA64_PCREL32LSB: + case R_IA64_PCREL64MSB: + case R_IA64_PCREL64LSB: + if (maybe_dynamic) + need_entry = NEED_DYNREL; + dynrel_type = R_IA64_PCREL64LSB; + break; + } + + if (!need_entry) + continue; + + if ((need_entry & NEED_FPTR) != 0 + && rel->r_addend) + { + (*info->callbacks->warning) + (info, _("non-zero addend in @fptr reloc"), 0, + abfd, 0, 0); + } + + dyn_i = get_dyn_sym_info (ia64_info, h, abfd, rel, true); + + /* Record whether or not this is a local symbol. */ + dyn_i->h = h; + + /* Create what's needed. */ + if (need_entry & NEED_GOT) + { + if (!got) + { + got = get_got (abfd, info, ia64_info); + if (!got) + return false; + } + dyn_i->want_got = 1; + } + if (need_entry & NEED_FPTR) + { + if (!fptr) + { + fptr = get_fptr (abfd, info, ia64_info); + if (!fptr) + return false; + } + + /* FPTRs for shared libraries are allocated by the dynamic + linker. Make sure this local symbol will appear in the + dynamic symbol table. */ + if (!h && (info->shared + )) + { + if (! (_bfd_elf64_link_record_local_dynamic_symbol + (info, abfd, r_symndx))) + return false; + } + + dyn_i->want_fptr = 1; + } + if (need_entry & NEED_LTOFF_FPTR) + dyn_i->want_ltoff_fptr = 1; + if (need_entry & (NEED_MIN_PLT | NEED_FULL_PLT)) + { + if (!ia64_info->root.dynobj) + ia64_info->root.dynobj = abfd; + h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; + dyn_i->want_plt = 1; + } + if (need_entry & NEED_FULL_PLT) + dyn_i->want_plt2 = 1; + if (need_entry & NEED_PLTOFF) + dyn_i->want_pltoff = 1; + if ((need_entry & NEED_DYNREL) && (sec->flags & SEC_ALLOC)) + { + if (!srel) + { + srel = get_reloc_section (abfd, ia64_info, sec, true); + if (!srel) + return false; + } + if (!count_dyn_reloc (abfd, dyn_i, srel, dynrel_type)) + return false; + } + } + + return true; +} + +struct elf64_ia64_allocate_data +{ + struct bfd_link_info *info; + bfd_size_type ofs; +}; + +/* For cleanliness, and potentially faster dynamic loading, allocate + external GOT entries first. */ + +static boolean +allocate_global_data_got (dyn_i, data) + struct elf64_ia64_dyn_sym_info *dyn_i; + PTR data; +{ + struct elf64_ia64_allocate_data *x = (struct elf64_ia64_allocate_data *)data; + + if (dyn_i->want_got + && ! dyn_i->want_fptr + && (elf64_ia64_dynamic_symbol_p (dyn_i->h, x->info) + )) + { + dyn_i->got_offset = x->ofs; + x->ofs += 8; + } + return true; +} + +/* Next, allocate all the GOT entries used by LTOFF_FPTR relocs. */ + +static boolean +allocate_global_fptr_got (dyn_i, data) + struct elf64_ia64_dyn_sym_info *dyn_i; + PTR data; +{ + struct elf64_ia64_allocate_data *x = (struct elf64_ia64_allocate_data *)data; + + if (dyn_i->want_got + && dyn_i->want_fptr + && (elf64_ia64_dynamic_symbol_p (dyn_i->h, x->info) + )) + { + dyn_i->got_offset = x->ofs; + x->ofs += 8; + } + return true; +} + +/* Lastly, allocate all the GOT entries for local data. */ + +static boolean +allocate_local_got (dyn_i, data) + struct elf64_ia64_dyn_sym_info *dyn_i; + PTR data; +{ + struct elf64_ia64_allocate_data *x = (struct elf64_ia64_allocate_data *)data; + + if (dyn_i->want_got + && ! (elf64_ia64_dynamic_symbol_p (dyn_i->h, x->info) + )) + { + dyn_i->got_offset = x->ofs; + x->ofs += 8; + } + return true; +} + +/* Search for the index of a global symbol in it's defining object file. */ + +static unsigned long +global_sym_index (h) + struct elf_link_hash_entry *h; +{ + struct elf_link_hash_entry **p; + bfd *obj; + + BFD_ASSERT (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak); + + obj = h->root.u.def.section->owner; + for (p = elf_sym_hashes (obj); *p != h; ++p) + continue; + + return p - elf_sym_hashes (obj) + elf_tdata (obj)->symtab_hdr.sh_info; +} + +/* Allocate function descriptors. We can do these for every function + in a main executable that is not exported. */ + +static boolean +allocate_fptr (dyn_i, data) + struct elf64_ia64_dyn_sym_info *dyn_i; + PTR data; +{ + struct elf64_ia64_allocate_data *x = (struct elf64_ia64_allocate_data *)data; + + if (dyn_i->want_fptr) + { + struct elf_link_hash_entry *h = dyn_i->h; + + if (h) + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + if (x->info->shared + ) + { + if (h && h->dynindx == -1) + { + BFD_ASSERT ((h->root.type == bfd_link_hash_defined) + || (h->root.type == bfd_link_hash_defweak)); + + if (!_bfd_elf64_link_record_local_dynamic_symbol + (x->info, h->root.u.def.section->owner, + global_sym_index (h))) + return false; + } + + dyn_i->want_fptr = 0; + } + else if (h == NULL || h->dynindx == -1) + { + dyn_i->fptr_offset = x->ofs; + x->ofs += 16; + } + else + dyn_i->want_fptr = 0; + } + return true; +} + +/* Allocate all the minimal PLT entries. */ + +static boolean +allocate_plt_entries (dyn_i, data) + struct elf64_ia64_dyn_sym_info *dyn_i; + PTR data; +{ + struct elf64_ia64_allocate_data *x = (struct elf64_ia64_allocate_data *)data; + + if (dyn_i->want_plt) + { + struct elf_link_hash_entry *h = dyn_i->h; + + if (h) + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + /* ??? Versioned symbols seem to lose ELF_LINK_HASH_NEEDS_PLT. */ + if (elf64_ia64_dynamic_symbol_p (h, x->info)) + { + bfd_size_type offset = x->ofs; + if (offset == 0) + offset = PLT_HEADER_SIZE; + dyn_i->plt_offset = offset; + x->ofs = offset + PLT_MIN_ENTRY_SIZE; + + dyn_i->want_pltoff = 1; + } + else + { + dyn_i->want_plt = 0; + dyn_i->want_plt2 = 0; + } + } + return true; +} + +/* Allocate all the full PLT entries. */ + +static boolean +allocate_plt2_entries (dyn_i, data) + struct elf64_ia64_dyn_sym_info *dyn_i; + PTR data; +{ + struct elf64_ia64_allocate_data *x = (struct elf64_ia64_allocate_data *)data; + + if (dyn_i->want_plt2) + { + struct elf_link_hash_entry *h = dyn_i->h; + bfd_size_type ofs = x->ofs; + + dyn_i->plt2_offset = ofs; + x->ofs = ofs + PLT_FULL_ENTRY_SIZE; + + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + dyn_i->h->plt.offset = ofs; + } + return true; +} + +/* Allocate all the PLTOFF entries requested by relocations and + plt entries. We can't share space with allocated FPTR entries, + because the latter are not necessarily addressable by the GP. + ??? Relaxation might be able to determine that they are. */ + +static boolean +allocate_pltoff_entries (dyn_i, data) + struct elf64_ia64_dyn_sym_info *dyn_i; + PTR data; +{ + struct elf64_ia64_allocate_data *x = (struct elf64_ia64_allocate_data *)data; + + if (dyn_i->want_pltoff) + { + dyn_i->pltoff_offset = x->ofs; + x->ofs += 16; + } + return true; +} + +/* Allocate dynamic relocations for those symbols that turned out + to be dynamic. */ + +static boolean +allocate_dynrel_entries (dyn_i, data) + struct elf64_ia64_dyn_sym_info *dyn_i; + PTR data; +{ + struct elf64_ia64_allocate_data *x = (struct elf64_ia64_allocate_data *)data; + struct elf64_ia64_link_hash_table *ia64_info; + struct elf64_ia64_dyn_reloc_entry *rent; + boolean dynamic_symbol, shared; + + ia64_info = elf64_ia64_hash_table (x->info); + dynamic_symbol = elf64_ia64_dynamic_symbol_p (dyn_i->h, x->info); + shared = x->info->shared; + + /* Take care of the normal data relocations. */ + + for (rent = dyn_i->reloc_entries; rent; rent = rent->next) + { + switch (rent->type) + { + case R_IA64_FPTR64LSB: + /* Allocate one iff !want_fptr, which by this point will + be true only if we're actually allocating one statically + in the main executable. */ + if (dyn_i->want_fptr) + continue; + break; + case R_IA64_PCREL64LSB: + if (!dynamic_symbol + ) + continue; + break; + case R_IA64_DIR64LSB: + if (!dynamic_symbol + && !shared) + continue; + break; + } + rent->srel->_raw_size += sizeof (Elf64_External_Rela) * rent->count; + } + + /* Take care of the GOT and PLT relocations. */ + + if (((dynamic_symbol + || shared) + && dyn_i->want_got) + || (dyn_i->want_ltoff_fptr && dyn_i->h && dyn_i->h->dynindx != -1)) + ia64_info->rel_got_sec->_raw_size += sizeof (Elf64_External_Rela); + + if (dyn_i->want_pltoff) + { + bfd_size_type t = 0; + + /* Dynamic symbols get one IPLT relocation. Local symbols in + shared libraries get two REL relocations. Local symbols in + main applications get nothing. */ + if (dynamic_symbol) + t = sizeof (Elf64_External_Rela); + else if (shared + ) + t = 2 * sizeof (Elf64_External_Rela); + + ia64_info->rel_pltoff_sec->_raw_size += t; + } + + return true; +} + +static boolean +elf64_ia64_adjust_dynamic_symbol (info, h) + struct bfd_link_info *info; + struct elf_link_hash_entry *h; +{ + /* ??? Undefined symbols with PLT entries should be re-defined + to be the PLT entry. */ + + /* If this is a weak symbol, and there is a real definition, the + processor independent code will have arranged for us to see the + real definition first, and we can just use the same value. */ + if (h->weakdef != NULL) + { + BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined + || h->weakdef->root.type == bfd_link_hash_defweak); + h->root.u.def.section = h->weakdef->root.u.def.section; + h->root.u.def.value = h->weakdef->root.u.def.value; + return true; + } + + /* If this is a reference to a symbol defined by a dynamic object which + is not a function, we might allocate the symbol in our .dynbss section + and allocate a COPY dynamic relocation. + + But IA-64 code is canonically PIC, so as a rule we can avoid this sort + of hackery. */ + + return true; +} + +static boolean +elf64_ia64_size_dynamic_sections (output_bfd, info) + bfd *output_bfd; + struct bfd_link_info *info; +{ + struct elf64_ia64_allocate_data data; + struct elf64_ia64_link_hash_table *ia64_info; + asection *sec; + bfd *dynobj; + boolean reltext = false; + boolean relplt = false; + + dynobj = elf_hash_table(info)->dynobj; + ia64_info = elf64_ia64_hash_table (info); + BFD_ASSERT(dynobj != NULL); + data.info = info; + + /* Set the contents of the .interp section to the interpreter. */ + if (ia64_info->root.dynamic_sections_created + && !info->shared) + { + sec = bfd_get_section_by_name (dynobj, ".interp"); + BFD_ASSERT (sec != NULL); + sec->contents = (bfd_byte *) ELF_DYNAMIC_INTERPRETER; + sec->_raw_size = strlen (ELF_DYNAMIC_INTERPRETER) + 1; + } + + /* DT_INIT and DT_FINI get function descriptors not raw code addresses. + Force their symbols to have pltoff entries so we can use those. */ + if (ia64_info->root.dynamic_sections_created) + { + struct elf_link_hash_entry *h; + struct elf64_ia64_dyn_sym_info *dyn_i; + + if (info->init_function + && (h = elf_link_hash_lookup (elf_hash_table (info), + info->init_function, false, + false, false)) + && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR + | ELF_LINK_HASH_DEF_REGULAR)) != 0) + { + dyn_i = get_dyn_sym_info (ia64_info, h, output_bfd, NULL, true); + dyn_i->want_pltoff = 1; + } + + if (info->fini_function + && (h = elf_link_hash_lookup (elf_hash_table (info), + info->fini_function, false, + false, false)) + && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR + | ELF_LINK_HASH_DEF_REGULAR)) != 0) + { + dyn_i = get_dyn_sym_info (ia64_info, h, output_bfd, NULL, true); + dyn_i->want_pltoff = 1; + } + } + + /* Allocate the GOT entries. */ + + if (ia64_info->got_sec) + { + data.ofs = 0; + elf64_ia64_dyn_sym_traverse (ia64_info, allocate_global_data_got, &data); + elf64_ia64_dyn_sym_traverse (ia64_info, allocate_global_fptr_got, &data); + elf64_ia64_dyn_sym_traverse (ia64_info, allocate_local_got, &data); + ia64_info->got_sec->_raw_size = data.ofs; + } + + /* Allocate the FPTR entries. */ + + if (ia64_info->fptr_sec) + { + data.ofs = 0; + elf64_ia64_dyn_sym_traverse (ia64_info, allocate_fptr, &data); + ia64_info->fptr_sec->_raw_size = data.ofs; + } + + /* Now that we've seen all of the input files, we can decide which + symbols need plt entries. Allocate the minimal PLT entries first. + We do this even though dynamic_sections_created may be false, because + this has the side-effect of clearing want_plt and want_plt2. */ + + data.ofs = 0; + elf64_ia64_dyn_sym_traverse (ia64_info, allocate_plt_entries, &data); + + ia64_info->minplt_entries = 0; + if (data.ofs) + { + ia64_info->minplt_entries + = (data.ofs - PLT_HEADER_SIZE) / PLT_MIN_ENTRY_SIZE; + } + + /* Align the pointer for the plt2 entries. */ + data.ofs = (data.ofs + 31) & -32; + + elf64_ia64_dyn_sym_traverse (ia64_info, allocate_plt2_entries, &data); + if (data.ofs != 0) + { + BFD_ASSERT (ia64_info->root.dynamic_sections_created); + + ia64_info->plt_sec->_raw_size = data.ofs; + + /* If we've got a .plt, we need some extra memory for the dynamic + linker. We stuff these in .got.plt. */ + sec = bfd_get_section_by_name (dynobj, ".got.plt"); + sec->_raw_size = 8 * PLT_RESERVED_WORDS; + } + + /* Allocate the PLTOFF entries. */ + + if (ia64_info->pltoff_sec) + { + data.ofs = 0; + elf64_ia64_dyn_sym_traverse (ia64_info, allocate_pltoff_entries, &data); + ia64_info->pltoff_sec->_raw_size = data.ofs; + } + + if (ia64_info->root.dynamic_sections_created) + { + /* Allocate space for the dynamic relocations that turned out to be + required. */ + + elf64_ia64_dyn_sym_traverse (ia64_info, allocate_dynrel_entries, &data); + } + + /* We have now determined the sizes of the various dynamic sections. + Allocate memory for them. */ + for (sec = dynobj->sections; sec != NULL; sec = sec->next) + { + boolean strip; + + if (!(sec->flags & SEC_LINKER_CREATED)) + continue; + + /* If we don't need this section, strip it from the output file. + There were several sections primarily related to dynamic + linking that must be create before the linker maps input + sections to output sections. The linker does that before + bfd_elf_size_dynamic_sections is called, and it is that + function which decides whether anything needs to go into + these sections. */ + + strip = (sec->_raw_size == 0); + + if (sec == ia64_info->got_sec) + strip = false; + else if (sec == ia64_info->rel_got_sec) + { + if (strip) + ia64_info->rel_got_sec = NULL; + else + /* We use the reloc_count field as a counter if we need to + copy relocs into the output file. */ + sec->reloc_count = 0; + } + else if (sec == ia64_info->fptr_sec) + { + if (strip) + ia64_info->fptr_sec = NULL; + } + else if (sec == ia64_info->plt_sec) + { + if (strip) + ia64_info->plt_sec = NULL; + } + else if (sec == ia64_info->pltoff_sec) + { + if (strip) + ia64_info->pltoff_sec = NULL; + } + else if (sec == ia64_info->rel_pltoff_sec) + { + if (strip) + ia64_info->rel_pltoff_sec = NULL; + else + { + relplt = true; + /* We use the reloc_count field as a counter if we need to + copy relocs into the output file. */ + sec->reloc_count = 0; + } + } + else + { + const char *name; + + /* It's OK to base decisions on the section name, because none + of the dynobj section names depend upon the input files. */ + name = bfd_get_section_name (dynobj, sec); + + if (strcmp (name, ".got.plt") == 0) + strip = false; + else if (strncmp (name, ".rel", 4) == 0) + { + if (!strip) + { + const char *outname; + asection *target; + + /* If this relocation section applies to a read only + section, then we probably need a DT_TEXTREL entry. */ + outname = bfd_get_section_name (output_bfd, + sec->output_section); + if (outname[4] == 'a') + outname += 5; + else + outname += 4; + + target = bfd_get_section_by_name (output_bfd, outname); + if (target != NULL + && (target->flags & SEC_READONLY) != 0 + && (target->flags & SEC_ALLOC) != 0) + reltext = true; + + /* We use the reloc_count field as a counter if we need to + copy relocs into the output file. */ + sec->reloc_count = 0; + } + } + else + continue; + } + + if (strip) + _bfd_strip_section_from_output (info, sec); + else + { + /* Allocate memory for the section contents. */ + sec->contents = (bfd_byte *) bfd_zalloc(dynobj, sec->_raw_size); + if (sec->contents == NULL && sec->_raw_size != 0) + return false; + } + } + + if (elf_hash_table (info)->dynamic_sections_created) + { + /* Add some entries to the .dynamic section. We fill in the values + later (in finish_dynamic_sections) but we must add the entries now + so that we get the correct size for the .dynamic section. */ + + if (!info->shared) + { + /* The DT_DEBUG entry is filled in by the dynamic linker and used + by the debugger. */ + if (!bfd_elf64_add_dynamic_entry (info, DT_DEBUG, 0)) + return false; + } + + if (! bfd_elf64_add_dynamic_entry (info, DT_IA_64_PLT_RESERVE, 0)) + return false; + if (! bfd_elf64_add_dynamic_entry (info, DT_PLTGOT, 0)) + return false; + + if (relplt) + { + if (! bfd_elf64_add_dynamic_entry (info, DT_PLTRELSZ, 0) + || ! bfd_elf64_add_dynamic_entry (info, DT_PLTREL, DT_RELA) + || ! bfd_elf64_add_dynamic_entry (info, DT_JMPREL, 0)) + return false; + } + + if (! bfd_elf64_add_dynamic_entry (info, DT_RELA, 0) + || ! bfd_elf64_add_dynamic_entry (info, DT_RELASZ, 0) + || ! bfd_elf64_add_dynamic_entry (info, DT_RELAENT, + sizeof(Elf64_External_Rela))) + return false; + + if (reltext) + { + if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0)) + return false; + info->flags |= DF_TEXTREL; + } + } + + /* ??? Perhaps force __gp local. */ + + return true; +} + +static bfd_reloc_status_type +elf64_ia64_install_value (abfd, hit_addr, val, r_type) + bfd *abfd; + bfd_byte *hit_addr; + bfd_vma val; + unsigned int r_type; +{ + const struct ia64_operand *op; + int bigendian = 0, shift = 0; + bfd_vma t0, t1, insn, dword; + enum ia64_opnd opnd; + const char *err; + size_t size = 8; + + opnd = IA64_OPND_NIL; + switch (r_type) + { + case R_IA64_NONE: + case R_IA64_LDXMOV: + return bfd_reloc_ok; + + /* Instruction relocations. */ + + case R_IA64_IMM14: opnd = IA64_OPND_IMM14; break; + + case R_IA64_PCREL21F: opnd = IA64_OPND_TGT25; break; + case R_IA64_PCREL21M: opnd = IA64_OPND_TGT25b; break; + case R_IA64_PCREL60B: opnd = IA64_OPND_TGT64; break; + case R_IA64_PCREL21B: + case R_IA64_PCREL21BI: + opnd = IA64_OPND_TGT25c; + break; + + case R_IA64_IMM22: + case R_IA64_GPREL22: + case R_IA64_LTOFF22: + case R_IA64_LTOFF22X: + case R_IA64_PLTOFF22: + case R_IA64_PCREL22: + case R_IA64_LTOFF_FPTR22: + opnd = IA64_OPND_IMM22; + break; + + case R_IA64_IMM64: + case R_IA64_GPREL64I: + case R_IA64_LTOFF64I: + case R_IA64_PLTOFF64I: + case R_IA64_PCREL64I: + case R_IA64_FPTR64I: + case R_IA64_LTOFF_FPTR64I: + opnd = IA64_OPND_IMMU64; + break; + + /* Data relocations. */ + + case R_IA64_DIR32MSB: + case R_IA64_GPREL32MSB: + case R_IA64_FPTR32MSB: + case R_IA64_PCREL32MSB: + case R_IA64_SEGREL32MSB: + case R_IA64_SECREL32MSB: + case R_IA64_LTV32MSB: + size = 4; bigendian = 1; + break; + + case R_IA64_DIR32LSB: + case R_IA64_GPREL32LSB: + case R_IA64_FPTR32LSB: + case R_IA64_PCREL32LSB: + case R_IA64_SEGREL32LSB: + case R_IA64_SECREL32LSB: + case R_IA64_LTV32LSB: + size = 4; bigendian = 0; + break; + + case R_IA64_DIR64MSB: + case R_IA64_GPREL64MSB: + case R_IA64_PLTOFF64MSB: + case R_IA64_FPTR64MSB: + case R_IA64_PCREL64MSB: + case R_IA64_LTOFF_FPTR64MSB: + case R_IA64_SEGREL64MSB: + case R_IA64_SECREL64MSB: + case R_IA64_LTV64MSB: + size = 8; bigendian = 1; + break; + + case R_IA64_DIR64LSB: + case R_IA64_GPREL64LSB: + case R_IA64_PLTOFF64LSB: + case R_IA64_FPTR64LSB: + case R_IA64_PCREL64LSB: + case R_IA64_LTOFF_FPTR64LSB: + case R_IA64_SEGREL64LSB: + case R_IA64_SECREL64LSB: + case R_IA64_LTV64LSB: + size = 8; bigendian = 0; + break; + + /* Unsupported / Dynamic relocations. */ + + case R_IA64_REL32MSB: + case R_IA64_REL32LSB: + case R_IA64_REL64MSB: + case R_IA64_REL64LSB: + + case R_IA64_IPLTMSB: + case R_IA64_IPLTLSB: + case R_IA64_EPLTMSB: + case R_IA64_EPLTLSB: + case R_IA64_COPY: + + case R_IA64_SEGBASE: + + case R_IA64_TPREL22: + case R_IA64_TPREL64MSB: + case R_IA64_TPREL64LSB: + case R_IA64_LTOFF_TP22: + + default: + return bfd_reloc_notsupported; + } + + switch (opnd) + { + case IA64_OPND_IMMU64: + hit_addr -= (long) hit_addr & 0x3; + t0 = bfd_get_64 (abfd, hit_addr); + t1 = bfd_get_64 (abfd, hit_addr + 8); + + /* tmpl/s: bits 0.. 5 in t0 + slot 0: bits 5..45 in t0 + slot 1: bits 46..63 in t0, bits 0..22 in t1 + slot 2: bits 23..63 in t1 */ + + /* First, clear the bits that form the 64 bit constant. */ + t0 &= ~(0x3ffffLL << 46); + t1 &= ~(0x7fffffLL + | (( (0x07fLL << 13) | (0x1ffLL << 27) + | (0x01fLL << 22) | (0x001LL << 21) + | (0x001LL << 36)) << 23)); + + t0 |= ((val >> 22) & 0x03ffffLL) << 46; /* 18 lsbs of imm41 */ + t1 |= ((val >> 40) & 0x7fffffLL) << 0; /* 23 msbs of imm41 */ + t1 |= ( (((val >> 0) & 0x07f) << 13) /* imm7b */ + | (((val >> 7) & 0x1ff) << 27) /* imm9d */ + | (((val >> 16) & 0x01f) << 22) /* imm5c */ + | (((val >> 21) & 0x001) << 21) /* ic */ + | (((val >> 63) & 0x001) << 36)) << 23; /* i */ + + bfd_put_64 (abfd, t0, hit_addr); + bfd_put_64 (abfd, t1, hit_addr + 8); + break; + + case IA64_OPND_TGT64: + hit_addr -= (long) hit_addr & 0x3; + t0 = bfd_get_64 (abfd, hit_addr); + t1 = bfd_get_64 (abfd, hit_addr + 8); + + /* tmpl/s: bits 0.. 5 in t0 + slot 0: bits 5..45 in t0 + slot 1: bits 46..63 in t0, bits 0..22 in t1 + slot 2: bits 23..63 in t1 */ + + /* First, clear the bits that form the 64 bit constant. */ + t0 &= ~(0x3ffffLL << 46); + t1 &= ~(0x7fffffLL + | ((1LL << 36 | 0xfffffLL << 13) << 23)); + + val >>= 4; + t0 |= ((val >> 20) & 0xffffLL) << 2 << 46; /* 16 lsbs of imm39 */ + t1 |= ((val >> 36) & 0x7fffffLL) << 0; /* 23 msbs of imm39 */ + t1 |= ((((val >> 0) & 0xfffffLL) << 13) /* imm20b */ + | (((val >> 59) & 0x1LL) << 36)) << 23; /* i */ + + bfd_put_64 (abfd, t0, hit_addr); + bfd_put_64 (abfd, t1, hit_addr + 8); + break; + + default: + switch ((long) hit_addr & 0x3) + { + case 0: shift = 5; break; + case 1: shift = 14; hit_addr += 3; break; + case 2: shift = 23; hit_addr += 6; break; + case 3: return bfd_reloc_notsupported; /* shouldn't happen... */ + } + dword = bfd_get_64 (abfd, hit_addr); + insn = (dword >> shift) & 0x1ffffffffffLL; + + op = elf64_ia64_operands + opnd; + err = (*op->insert) (op, val, &insn); + if (err) + return bfd_reloc_overflow; + + dword &= ~(0x1ffffffffffLL << shift); + dword |= (insn << shift); + bfd_put_64 (abfd, dword, hit_addr); + break; + + case IA64_OPND_NIL: + /* A data relocation. */ + if (bigendian) + if (size == 4) + bfd_putb32 (val, hit_addr); + else + bfd_putb64 (val, hit_addr); + else + if (size == 4) + bfd_putl32 (val, hit_addr); + else + bfd_putl64 (val, hit_addr); + break; + } + + return bfd_reloc_ok; +} + +static void +elf64_ia64_install_dyn_reloc (abfd, info, sec, srel, offset, type, + dynindx, addend) + bfd *abfd; + struct bfd_link_info *info; + asection *sec; + asection *srel; + bfd_vma offset; + unsigned int type; + long dynindx; + bfd_vma addend; +{ + Elf_Internal_Rela outrel; + + outrel.r_offset = (sec->output_section->vma + + sec->output_offset + + offset); + + BFD_ASSERT (dynindx != -1); + outrel.r_info = ELF64_R_INFO (dynindx, type); + outrel.r_addend = addend; + + if (elf_section_data (sec)->stab_info != NULL) + { + /* This may be NULL for linker-generated relocations, as it is + inconvenient to pass all the bits around. And this shouldn't + happen. */ + BFD_ASSERT (info != NULL); + + offset = (_bfd_stab_section_offset + (abfd, &elf_hash_table (info)->stab_info, sec, + &elf_section_data (sec)->stab_info, offset)); + if (offset == (bfd_vma) -1) + { + /* Run for the hills. We shouldn't be outputting a relocation + for this. So do what everyone else does and output a no-op. */ + outrel.r_info = ELF64_R_INFO (0, R_IA64_NONE); + outrel.r_addend = 0; + offset = 0; + } + outrel.r_offset = offset; + } + + bfd_elf64_swap_reloca_out (abfd, &outrel, + ((Elf64_External_Rela *) srel->contents + + srel->reloc_count++)); + BFD_ASSERT (sizeof(Elf64_External_Rela) * srel->reloc_count + <= srel->_cooked_size); +} + +/* Store an entry for target address TARGET_ADDR in the linkage table + and return the gp-relative address of the linkage table entry. */ + +static bfd_vma +set_got_entry (abfd, info, dyn_i, dynindx, addend, value, dyn_r_type) + bfd *abfd; + struct bfd_link_info *info; + struct elf64_ia64_dyn_sym_info *dyn_i; + long dynindx; + bfd_vma addend; + bfd_vma value; + unsigned int dyn_r_type; +{ + struct elf64_ia64_link_hash_table *ia64_info; + asection *got_sec; + + ia64_info = elf64_ia64_hash_table (info); + got_sec = ia64_info->got_sec; + + BFD_ASSERT ((dyn_i->got_offset & 7) == 0); + + if (! dyn_i->got_done) + { + dyn_i->got_done = true; + + /* Store the target address in the linkage table entry. */ + bfd_put_64 (abfd, value, got_sec->contents + dyn_i->got_offset); + + /* Install a dynamic relocation if needed. */ + if (info->shared + || elf64_ia64_dynamic_symbol_p (dyn_i->h, info) + || (dynindx != -1 && dyn_r_type == R_IA64_FPTR64LSB)) + { + if (dynindx == -1) + { + dyn_r_type = R_IA64_REL64LSB; + dynindx = 0; + addend = value; + } + + if (bfd_big_endian (abfd)) + { + switch (dyn_r_type) + { + case R_IA64_REL64LSB: + dyn_r_type = R_IA64_REL64MSB; + break; + case R_IA64_DIR64LSB: + dyn_r_type = R_IA64_DIR64MSB; + break; + case R_IA64_FPTR64LSB: + dyn_r_type = R_IA64_FPTR64MSB; + break; + default: + BFD_ASSERT (false); + break; + } + } + + elf64_ia64_install_dyn_reloc (abfd, NULL, got_sec, + ia64_info->rel_got_sec, + dyn_i->got_offset, dyn_r_type, + dynindx, addend); + } + } + + /* Return the address of the linkage table entry. */ + value = (got_sec->output_section->vma + + got_sec->output_offset + + dyn_i->got_offset); + + return value; +} + +/* Fill in a function descriptor consisting of the function's code + address and its global pointer. Return the descriptor's address. */ + +static bfd_vma +set_fptr_entry (abfd, info, dyn_i, value) + bfd *abfd; + struct bfd_link_info *info; + struct elf64_ia64_dyn_sym_info *dyn_i; + bfd_vma value; +{ + struct elf64_ia64_link_hash_table *ia64_info; + asection *fptr_sec; + + ia64_info = elf64_ia64_hash_table (info); + fptr_sec = ia64_info->fptr_sec; + + if (!dyn_i->fptr_done) + { + dyn_i->fptr_done = 1; + + /* Fill in the function descriptor. */ + bfd_put_64 (abfd, value, fptr_sec->contents + dyn_i->fptr_offset); + bfd_put_64 (abfd, _bfd_get_gp_value (abfd), + fptr_sec->contents + dyn_i->fptr_offset + 8); + } + + /* Return the descriptor's address. */ + value = (fptr_sec->output_section->vma + + fptr_sec->output_offset + + dyn_i->fptr_offset); + + return value; +} + +/* Fill in a PLTOFF entry consisting of the function's code address + and its global pointer. Return the descriptor's address. */ + +static bfd_vma +set_pltoff_entry (abfd, info, dyn_i, value, is_plt) + bfd *abfd; + struct bfd_link_info *info; + struct elf64_ia64_dyn_sym_info *dyn_i; + bfd_vma value; + boolean is_plt; +{ + struct elf64_ia64_link_hash_table *ia64_info; + asection *pltoff_sec; + + ia64_info = elf64_ia64_hash_table (info); + pltoff_sec = ia64_info->pltoff_sec; + + /* Don't do anything if this symbol uses a real PLT entry. In + that case, we'll fill this in during finish_dynamic_symbol. */ + if ((! dyn_i->want_plt || is_plt) + && !dyn_i->pltoff_done) + { + /* Fill in the function descriptor. */ + bfd_put_64 (abfd, value, pltoff_sec->contents + dyn_i->pltoff_offset); + bfd_put_64 (abfd, _bfd_get_gp_value (abfd), + pltoff_sec->contents + dyn_i->pltoff_offset + 8); + + /* Install dynamic relocations if needed. */ + if (!is_plt && info->shared) + { + unsigned int dyn_r_type; + + if (bfd_big_endian (abfd)) + dyn_r_type = R_IA64_REL64MSB; + else + dyn_r_type = R_IA64_REL64LSB; + + elf64_ia64_install_dyn_reloc (abfd, NULL, pltoff_sec, + ia64_info->rel_pltoff_sec, + dyn_i->pltoff_offset, + dyn_r_type, 0, 0); + elf64_ia64_install_dyn_reloc (abfd, NULL, pltoff_sec, + ia64_info->rel_pltoff_sec, + dyn_i->pltoff_offset + 8, + dyn_r_type, 0, 0); + } + + dyn_i->pltoff_done = 1; + } + + /* Return the descriptor's address. */ + value = (pltoff_sec->output_section->vma + + pltoff_sec->output_offset + + dyn_i->pltoff_offset); + + return value; +} + +/* Called through qsort to sort the .IA_64.unwind section during a + non-relocatable link. Set elf64_ia64_unwind_entry_compare_bfd + to the output bfd so we can do proper endianness frobbing. */ + +static bfd *elf64_ia64_unwind_entry_compare_bfd; + +static int +elf64_ia64_unwind_entry_compare (a, b) + PTR a; + PTR b; +{ + bfd_vma av, bv; + + av = bfd_get_64 (elf64_ia64_unwind_entry_compare_bfd, a); + bv = bfd_get_64 (elf64_ia64_unwind_entry_compare_bfd, b); + + return (av < bv ? -1 : av > bv ? 1 : 0); +} + +static boolean +elf64_ia64_final_link (abfd, info) + bfd *abfd; + struct bfd_link_info *info; +{ + struct elf64_ia64_link_hash_table *ia64_info; + ia64_info = elf64_ia64_hash_table (info); + + /* Make sure we've got ourselves a nice fat __gp value. */ + if (!info->relocateable) + { + bfd_vma min_vma = (bfd_vma) -1, max_vma = 0; + bfd_vma min_short_vma = min_vma, max_short_vma = 0; + struct elf_link_hash_entry *gp; + bfd_vma gp_val; + asection *os; + + /* Find the min and max vma of all sections marked short. Also + collect min and max vma of any type, for use in selecting a + nice gp. */ + for (os = abfd->sections; os ; os = os->next) + { + bfd_vma lo, hi; + + if ((os->flags & SEC_ALLOC) == 0) + continue; + + lo = os->vma; + hi = os->vma + os->_raw_size; + if (hi < lo) + hi = (bfd_vma) -1; + + if (min_vma > lo) + min_vma = lo; + if (max_vma < hi) + max_vma = hi; + if (os->flags & SEC_SMALL_DATA) + { + if (min_short_vma > lo) + min_short_vma = lo; + if (max_short_vma < hi) + max_short_vma = hi; + } + } + + /* See if the user wants to force a value. */ + gp = elf_link_hash_lookup (elf_hash_table (info), "__gp", false, + false, false); + + if (gp + && (gp->root.type == bfd_link_hash_defined + || gp->root.type == bfd_link_hash_defweak)) + { + asection *gp_sec = gp->root.u.def.section; + gp_val = (gp->root.u.def.value + + gp_sec->output_section->vma + + gp_sec->output_offset); + } + else + { + /* Pick a sensible value. */ + + asection *got_sec = ia64_info->got_sec; + + /* Start with just the address of the .got. */ + if (got_sec) + gp_val = got_sec->output_section->vma; + else if (max_short_vma != 0) + gp_val = min_short_vma; + else + gp_val = min_vma; + + /* If it is possible to address the entire image, but we + don't with the choice above, adjust. */ + if (max_vma - min_vma < 0x400000 + && max_vma - gp_val <= 0x200000 + && gp_val - min_vma > 0x200000) + gp_val = min_vma + 0x200000; + else if (max_short_vma != 0) + { + /* If we don't cover all the short data, adjust. */ + if (max_short_vma - gp_val >= 0x200000) + gp_val = min_short_vma + 0x200000; + + /* If we're addressing stuff past the end, adjust back. */ + if (gp_val > max_vma) + gp_val = max_vma - 0x200000 + 8; + } + } + + /* Validate whether all SHF_IA_64_SHORT sections are within + range of the chosen GP. */ + + if (max_short_vma != 0) + { + if (max_short_vma - min_short_vma >= 0x400000) + { + (*_bfd_error_handler) + (_("%s: short data segment overflowed (0x%lx >= 0x400000)"), + bfd_get_filename (abfd), + (unsigned long)(max_short_vma - min_short_vma)); + return false; + } + else if ((gp_val > min_short_vma + && gp_val - min_short_vma > 0x200000) + || (gp_val < max_short_vma + && max_short_vma - gp_val >= 0x200000)) + { + (*_bfd_error_handler) + (_("%s: __gp does not cover short data segment"), + bfd_get_filename (abfd)); + return false; + } + } + + _bfd_set_gp_value (abfd, gp_val); + } + + /* Tricky bits. DT_INIT and DT_FINI use a pltoff entry, which is + normally initialized in finish_dynamic_sections. Except that + we need all non-plt pltoff entries to be initialized before + finish_dynamic_symbols. This because the array of relocations + used for plt entries (aka DT_JMPREL) begins after all the + non-plt pltoff relocations. If the order gets confused, we + munge either the array or the array base. */ + if (ia64_info->root.dynamic_sections_created) + { + struct elf_link_hash_entry *h; + struct elf64_ia64_dyn_sym_info *dyn_i; + bfd_vma addr; + + if (info->init_function + && (h = elf_link_hash_lookup (elf_hash_table (info), + info->init_function, false, + false, false)) + && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR + | ELF_LINK_HASH_DEF_REGULAR)) != 0) + { + dyn_i = get_dyn_sym_info (ia64_info, h, NULL, NULL, false); + addr = (h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset + + h->root.u.def.value); + (void) set_pltoff_entry (abfd, info, dyn_i, addr, false); + } + + if (info->fini_function + && (h = elf_link_hash_lookup (elf_hash_table (info), + info->fini_function, false, + false, false)) + && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR + | ELF_LINK_HASH_DEF_REGULAR)) != 0) + { + dyn_i = get_dyn_sym_info (ia64_info, h, NULL, NULL, false); + addr = (h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset + + h->root.u.def.value); + (void) set_pltoff_entry (abfd, info, dyn_i, addr, false); + } + } + + /* Invoke the regular ELF backend linker to do all the work. */ + if (!bfd_elf64_bfd_final_link (abfd, info)) + return false; + + /* If we're producing a final executable, we need to sort the contents + of the .IA_64.unwind section. */ + if (!info->relocateable) + { + asection *s = bfd_get_section_by_name (abfd, ELF_STRING_ia64_unwind); + if (s) + { + bfd_size_type size = s->output_section->_raw_size; + char *contents = bfd_malloc (size); + + if (contents == NULL) + return false; + if (! bfd_get_section_contents (abfd, s->output_section, + contents, (file_ptr) 0, size)) + return false; + + elf64_ia64_unwind_entry_compare_bfd = abfd; + qsort (contents, size / 24, 24, elf64_ia64_unwind_entry_compare); + + if (! bfd_set_section_contents (abfd, s->output_section, + contents, (file_ptr) 0, size)) + return false; + } + } + + return true; +} + +static boolean +elf64_ia64_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, local_syms, local_sections) + bfd *output_bfd; + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + Elf_Internal_Rela *relocs; + Elf_Internal_Sym *local_syms; + asection **local_sections; +{ + struct elf64_ia64_link_hash_table *ia64_info; + Elf_Internal_Shdr *symtab_hdr; + Elf_Internal_Rela *rel; + Elf_Internal_Rela *relend; + asection *srel; + boolean ret_val = true; /* for non-fatal errors */ + bfd_vma gp_val; + + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + ia64_info = elf64_ia64_hash_table (info); + + /* Infect various flags from the input section to the output section. */ + if (info->relocateable) + { + bfd_vma flags; + + flags = elf_section_data(input_section)->this_hdr.sh_flags; + flags &= SHF_IA_64_NORECOV; + + elf_section_data(input_section->output_section) + ->this_hdr.sh_flags |= flags; + } + + gp_val = _bfd_get_gp_value (output_bfd); + srel = get_reloc_section (input_bfd, ia64_info, input_section, false); + + rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; ++rel) + { + struct elf_link_hash_entry *h; + struct elf64_ia64_dyn_sym_info *dyn_i; + bfd_reloc_status_type r; + reloc_howto_type *howto; + unsigned long r_symndx; + Elf_Internal_Sym *sym; + unsigned int r_type; + bfd_vma value; + asection *sym_sec; + bfd_byte *hit_addr; + boolean dynamic_symbol_p; + boolean undef_weak_ref; + + r_type = ELF64_R_TYPE (rel->r_info); + if (r_type > R_IA64_MAX_RELOC_CODE) + { + (*_bfd_error_handler) + (_("%s: unknown relocation type %d"), + bfd_get_filename (input_bfd), (int)r_type); + bfd_set_error (bfd_error_bad_value); + ret_val = false; + continue; + } + howto = lookup_howto (r_type); + r_symndx = ELF64_R_SYM (rel->r_info); + + if (info->relocateable) + { + /* This is a relocateable link. We don't have to change + anything, unless the reloc is against a section symbol, + in which case we have to adjust according to where the + section symbol winds up in the output section. */ + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) + { + sym_sec = local_sections[r_symndx]; + rel->r_addend += sym_sec->output_offset; + } + } + continue; + } + + /* This is a final link. */ + + h = NULL; + sym = NULL; + sym_sec = NULL; + undef_weak_ref = false; + + if (r_symndx < symtab_hdr->sh_info) + { + /* Reloc against local symbol. */ + sym = local_syms + r_symndx; + sym_sec = local_sections[r_symndx]; + value = (sym_sec->output_section->vma + + sym_sec->output_offset + + sym->st_value); + } + else + { + long indx; + + /* Reloc against global symbol. */ + indx = r_symndx - symtab_hdr->sh_info; + h = elf_sym_hashes (input_bfd)[indx]; + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + value = 0; + if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { + sym_sec = h->root.u.def.section; + + /* Detect the cases that sym_sec->output_section is + expected to be NULL -- all cases in which the symbol + is defined in another shared module. This includes + PLT relocs for which we've created a PLT entry and + other relocs for which we're prepared to create + dynamic relocations. */ + /* ??? Just accept it NULL and continue. */ + + if (sym_sec->output_section != NULL) + { + value = (h->root.u.def.value + + sym_sec->output_section->vma + + sym_sec->output_offset); + } + } + else if (h->root.type == bfd_link_hash_undefweak) + undef_weak_ref = true; + else if (info->shared && !info->symbolic + && !info->no_undefined + && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) + ; + else + { + if (! ((*info->callbacks->undefined_symbol) + (info, h->root.root.string, input_bfd, + input_section, rel->r_offset, + (!info->shared || info->no_undefined + || ELF_ST_VISIBILITY (h->other))))) + return false; + ret_val = false; + continue; + } + } + + hit_addr = contents + rel->r_offset; + value += rel->r_addend; + dynamic_symbol_p = elf64_ia64_dynamic_symbol_p (h, info); + + switch (r_type) + { + case R_IA64_NONE: + case R_IA64_LDXMOV: + continue; + + case R_IA64_IMM14: + case R_IA64_IMM22: + case R_IA64_IMM64: + case R_IA64_DIR32MSB: + case R_IA64_DIR32LSB: + case R_IA64_DIR64MSB: + case R_IA64_DIR64LSB: + /* Install a dynamic relocation for this reloc. */ + if ((dynamic_symbol_p + || info->shared) + && (input_section->flags & SEC_ALLOC) != 0) + { + unsigned int dyn_r_type; + long dynindx; + + BFD_ASSERT (srel != NULL); + + /* If we don't need dynamic symbol lookup, find a + matching RELATIVE relocation. */ + dyn_r_type = r_type; + if (dynamic_symbol_p) + dynindx = h->dynindx; + else + { + switch (r_type) + { + case R_IA64_DIR32MSB: + dyn_r_type = R_IA64_REL32MSB; + break; + case R_IA64_DIR32LSB: + dyn_r_type = R_IA64_REL32LSB; + break; + case R_IA64_DIR64MSB: + dyn_r_type = R_IA64_REL64MSB; + break; + case R_IA64_DIR64LSB: + dyn_r_type = R_IA64_REL64LSB; + break; + + default: + /* We can't represent this without a dynamic symbol. + Adjust the relocation to be against an output + section symbol, which are always present in the + dynamic symbol table. */ + /* ??? People shouldn't be doing non-pic code in + shared libraries. Hork. */ + (*_bfd_error_handler) + (_("%s: linking non-pic code in a shared library"), + bfd_get_filename (input_bfd)); + ret_val = false; + continue; + } + dynindx = 0; + } + + elf64_ia64_install_dyn_reloc (output_bfd, info, input_section, + srel, rel->r_offset, dyn_r_type, + dynindx, rel->r_addend); + } + /* FALLTHRU */ + + case R_IA64_LTV32MSB: + case R_IA64_LTV32LSB: + case R_IA64_LTV64MSB: + case R_IA64_LTV64LSB: + r = elf64_ia64_install_value (output_bfd, hit_addr, value, r_type); + break; + + case R_IA64_GPREL22: + case R_IA64_GPREL64I: + case R_IA64_GPREL32MSB: + case R_IA64_GPREL32LSB: + case R_IA64_GPREL64MSB: + case R_IA64_GPREL64LSB: + if (dynamic_symbol_p) + { + (*_bfd_error_handler) + (_("%s: @gprel relocation against dynamic symbol %s"), + bfd_get_filename (input_bfd), h->root.root.string); + ret_val = false; + continue; + } + value -= gp_val; + r = elf64_ia64_install_value (output_bfd, hit_addr, value, r_type); + break; + + case R_IA64_LTOFF22: + case R_IA64_LTOFF22X: + case R_IA64_LTOFF64I: + dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, false); + value = set_got_entry (input_bfd, info, dyn_i, (h ? h->dynindx : -1), + rel->r_addend, value, R_IA64_DIR64LSB); + value -= gp_val; + r = elf64_ia64_install_value (output_bfd, hit_addr, value, r_type); + break; + + case R_IA64_PLTOFF22: + case R_IA64_PLTOFF64I: + case R_IA64_PLTOFF64MSB: + case R_IA64_PLTOFF64LSB: + dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, false); + value = set_pltoff_entry (output_bfd, info, dyn_i, value, false); + value -= gp_val; + r = elf64_ia64_install_value (output_bfd, hit_addr, value, r_type); + break; + + case R_IA64_FPTR64I: + case R_IA64_FPTR32MSB: + case R_IA64_FPTR32LSB: + case R_IA64_FPTR64MSB: + case R_IA64_FPTR64LSB: + dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, false); + if (dyn_i->want_fptr) + { + if (!undef_weak_ref) + value = set_fptr_entry (output_bfd, info, dyn_i, value); + } + else + { + long dynindx; + + /* Otherwise, we expect the dynamic linker to create + the entry. */ + + if (h) + { + if (h->dynindx != -1) + dynindx = h->dynindx; + else + dynindx = (_bfd_elf_link_lookup_local_dynindx + (info, h->root.u.def.section->owner, + global_sym_index (h))); + } + else + { + dynindx = (_bfd_elf_link_lookup_local_dynindx + (info, input_bfd, r_symndx)); + } + + elf64_ia64_install_dyn_reloc (output_bfd, info, input_section, + srel, rel->r_offset, r_type, + dynindx, rel->r_addend); + value = 0; + } + + r = elf64_ia64_install_value (output_bfd, hit_addr, value, r_type); + break; + + case R_IA64_LTOFF_FPTR22: + case R_IA64_LTOFF_FPTR64I: + case R_IA64_LTOFF_FPTR64MSB: + case R_IA64_LTOFF_FPTR64LSB: + { + long dynindx; + + dyn_i = get_dyn_sym_info (ia64_info, h, input_bfd, rel, false); + if (dyn_i->want_fptr) + { + BFD_ASSERT (h == NULL || h->dynindx == -1) + if (!undef_weak_ref) + value = set_fptr_entry (output_bfd, info, dyn_i, value); + dynindx = -1; + } + else + { + /* Otherwise, we expect the dynamic linker to create + the entry. */ + if (h) + { + if (h->dynindx != -1) + dynindx = h->dynindx; + else + dynindx = (_bfd_elf_link_lookup_local_dynindx + (info, h->root.u.def.section->owner, + global_sym_index (h))); + } + else + dynindx = (_bfd_elf_link_lookup_local_dynindx + (info, input_bfd, r_symndx)); + value = 0; + } + + value = set_got_entry (output_bfd, info, dyn_i, dynindx, + rel->r_addend, value, R_IA64_FPTR64LSB); + value -= gp_val; + r = elf64_ia64_install_value (output_bfd, hit_addr, value, r_type); + } + break; + + case R_IA64_PCREL32MSB: + case R_IA64_PCREL32LSB: + case R_IA64_PCREL64MSB: + case R_IA64_PCREL64LSB: + /* Install a dynamic relocation for this reloc. */ + if (dynamic_symbol_p + ) + { + BFD_ASSERT (srel != NULL); + + elf64_ia64_install_dyn_reloc (output_bfd, info, input_section, + srel, rel->r_offset, r_type, + h->dynindx, rel->r_addend); + } + goto finish_pcrel; + + case R_IA64_PCREL21BI: + case R_IA64_PCREL21F: + case R_IA64_PCREL21M: + /* ??? These two are only used for speculation fixup code. + They should never be dynamic. */ + if (dynamic_symbol_p) + { + (*_bfd_error_handler) + (_("%s: dynamic relocation against speculation fixup"), + bfd_get_filename (input_bfd)); + ret_val = false; + continue; + } + if (undef_weak_ref) + { + (*_bfd_error_handler) + (_("%s: speculation fixup against undefined weak symbol"), + bfd_get_filename (input_bfd)); + ret_val = false; + continue; + } + goto finish_pcrel; + + case R_IA64_PCREL21B: + case R_IA64_PCREL60B: + /* We should have created a PLT entry for any dynamic symbol. */ + dyn_i = NULL; + if (h) + dyn_i = get_dyn_sym_info (ia64_info, h, NULL, NULL, false); + + if (dyn_i && dyn_i->want_plt2) + { + /* Should have caught this earlier. */ + BFD_ASSERT (rel->r_addend == 0); + + value = (ia64_info->plt_sec->output_section->vma + + ia64_info->plt_sec->output_offset + + dyn_i->plt2_offset); + } + else + { + /* Since there's no PLT entry, Validate that this is + locally defined. */ + BFD_ASSERT (undef_weak_ref || sym_sec->output_section != NULL); + + /* If the symbol is undef_weak, we shouldn't be trying + to call it. There's every chance that we'd wind up + with an out-of-range fixup here. Don't bother setting + any value at all. */ + if (undef_weak_ref) + continue; + } + goto finish_pcrel; + + case R_IA64_PCREL22: + case R_IA64_PCREL64I: + finish_pcrel: + /* Make pc-relative. */ + value -= (input_section->output_section->vma + + input_section->output_offset + + rel->r_offset) & ~ (bfd_vma) 0x3; + r = elf64_ia64_install_value (output_bfd, hit_addr, value, r_type); + break; + + case R_IA64_SEGREL32MSB: + case R_IA64_SEGREL32LSB: + case R_IA64_SEGREL64MSB: + case R_IA64_SEGREL64LSB: + { + struct elf_segment_map *m; + Elf_Internal_Phdr *p; + + /* Find the segment that contains the output_section. */ + for (m = elf_tdata (output_bfd)->segment_map, + p = elf_tdata (output_bfd)->phdr; + m != NULL; + m = m->next, p++) + { + int i; + for (i = m->count - 1; i >= 0; i--) + if (m->sections[i] == sym_sec->output_section) + break; + if (i >= 0) + break; + } + + if (m == NULL) + { + /* If the input section was discarded from the output, then + do nothing. */ + + if (bfd_is_abs_section (sym_sec->output_section)) + r = bfd_reloc_ok; + else + r = bfd_reloc_notsupported; + } + else + { + /* The VMA of the segment is the vaddr of the associated + program header. */ + if (value > p->p_vaddr) + value -= p->p_vaddr; + else + value = 0; + r = elf64_ia64_install_value (output_bfd, hit_addr, value, + r_type); + } + break; + } + + case R_IA64_SECREL32MSB: + case R_IA64_SECREL32LSB: + case R_IA64_SECREL64MSB: + case R_IA64_SECREL64LSB: + /* Make output-section relative. */ + if (value > input_section->output_section->vma) + value -= input_section->output_section->vma; + else + value = 0; + r = elf64_ia64_install_value (output_bfd, hit_addr, value, r_type); + break; + + case R_IA64_SEGBASE: + + case R_IA64_REL32MSB: + case R_IA64_REL32LSB: + case R_IA64_REL64MSB: + case R_IA64_REL64LSB: + + case R_IA64_IPLTMSB: + case R_IA64_IPLTLSB: + case R_IA64_EPLTMSB: + case R_IA64_EPLTLSB: + case R_IA64_COPY: + + case R_IA64_TPREL22: + case R_IA64_TPREL64MSB: + case R_IA64_TPREL64LSB: + case R_IA64_LTOFF_TP22: + default: + r = bfd_reloc_notsupported; + break; + } + + switch (r) + { + case bfd_reloc_ok: + break; + + case bfd_reloc_undefined: + /* This can happen for global table relative relocs if + __gp is undefined. This is a panic situation so we + don't try to continue. */ + (*info->callbacks->undefined_symbol) + (info, "__gp", input_bfd, input_section, rel->r_offset, 1); + return false; + + case bfd_reloc_notsupported: + { + const char *name; + + if (h) + name = h->root.root.string; + else + { + name = bfd_elf_string_from_elf_section (input_bfd, + symtab_hdr->sh_link, + sym->st_name); + if (name == NULL) + return false; + if (*name == '\0') + name = bfd_section_name (input_bfd, input_section); + } + if (!(*info->callbacks->warning) (info, _("unsupported reloc"), + name, input_bfd, + input_section, rel->r_offset)) + return false; + ret_val = false; + } + break; + + case bfd_reloc_dangerous: + case bfd_reloc_outofrange: + case bfd_reloc_overflow: + default: + { + const char *name; + + if (h) + name = h->root.root.string; + else + { + name = bfd_elf_string_from_elf_section (input_bfd, + symtab_hdr->sh_link, + sym->st_name); + if (name == NULL) + return false; + if (*name == '\0') + name = bfd_section_name (input_bfd, input_section); + } + if (!(*info->callbacks->reloc_overflow) (info, name, + howto->name, 0, + input_bfd, + input_section, + rel->r_offset)) + return false; + ret_val = false; + } + break; + } + } + + return ret_val; +} + +static boolean +elf64_ia64_finish_dynamic_symbol (output_bfd, info, h, sym) + bfd *output_bfd; + struct bfd_link_info *info; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; +{ + struct elf64_ia64_link_hash_table *ia64_info; + struct elf64_ia64_dyn_sym_info *dyn_i; + + ia64_info = elf64_ia64_hash_table (info); + dyn_i = get_dyn_sym_info (ia64_info, h, NULL, NULL, false); + + /* Fill in the PLT data, if required. */ + if (dyn_i && dyn_i->want_plt) + { + Elf_Internal_Rela outrel; + bfd_byte *loc; + asection *plt_sec; + bfd_vma plt_addr, pltoff_addr, gp_val, index; + Elf64_External_Rela *rel; + + gp_val = _bfd_get_gp_value (output_bfd); + + /* Initialize the minimal PLT entry. */ + + index = (dyn_i->plt_offset - PLT_HEADER_SIZE) / PLT_MIN_ENTRY_SIZE; + plt_sec = ia64_info->plt_sec; + loc = plt_sec->contents + dyn_i->plt_offset; + + memcpy (loc, plt_min_entry, PLT_MIN_ENTRY_SIZE); + elf64_ia64_install_value (output_bfd, loc, index, R_IA64_IMM22); + elf64_ia64_install_value (output_bfd, loc+2, -dyn_i->plt_offset, + R_IA64_PCREL21B); + + plt_addr = (plt_sec->output_section->vma + + plt_sec->output_offset + + dyn_i->plt_offset); + pltoff_addr = set_pltoff_entry (output_bfd, info, dyn_i, plt_addr, true); + + /* Initialize the FULL PLT entry, if needed. */ + if (dyn_i->want_plt2) + { + loc = plt_sec->contents + dyn_i->plt2_offset; + + memcpy (loc, plt_full_entry, PLT_FULL_ENTRY_SIZE); + elf64_ia64_install_value (output_bfd, loc, pltoff_addr - gp_val, + R_IA64_IMM22); + + /* Mark the symbol as undefined, rather than as defined in the + plt section. Leave the value alone. */ + /* ??? We didn't redefine it in adjust_dynamic_symbol in the + first place. But perhaps elflink.h did some for us. */ + if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) + sym->st_shndx = SHN_UNDEF; + } + + /* Create the dynamic relocation. */ + outrel.r_offset = pltoff_addr; + if (bfd_little_endian (output_bfd)) + outrel.r_info = ELF64_R_INFO (h->dynindx, R_IA64_IPLTLSB); + else + outrel.r_info = ELF64_R_INFO (h->dynindx, R_IA64_IPLTMSB); + outrel.r_addend = 0; + + /* This is fun. In the .IA_64.pltoff section, we've got entries + that correspond both to real PLT entries, and those that + happened to resolve to local symbols but need to be created + to satisfy @pltoff relocations. The .rela.IA_64.pltoff + relocations for the real PLT should come at the end of the + section, so that they can be indexed by plt entry at runtime. + + We emitted all of the relocations for the non-PLT @pltoff + entries during relocate_section. So we can consider the + existing sec->reloc_count to be the base of the array of + PLT relocations. */ + + rel = (Elf64_External_Rela *)ia64_info->rel_pltoff_sec->contents; + rel += ia64_info->rel_pltoff_sec->reloc_count; + + bfd_elf64_swap_reloca_out (output_bfd, &outrel, rel + index); + } + + /* Mark some specially defined symbols as absolute. */ + if (strcmp (h->root.root.string, "_DYNAMIC") == 0 + || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0 + || strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0) + sym->st_shndx = SHN_ABS; + + return true; +} + +static boolean +elf64_ia64_finish_dynamic_sections (abfd, info) + bfd *abfd; + struct bfd_link_info *info; +{ + struct elf64_ia64_link_hash_table *ia64_info; + bfd *dynobj; + + ia64_info = elf64_ia64_hash_table (info); + dynobj = ia64_info->root.dynobj; + + if (elf_hash_table (info)->dynamic_sections_created) + { + Elf64_External_Dyn *dyncon, *dynconend; + asection *sdyn, *sgotplt; + bfd_vma gp_val; + + sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); + sgotplt = bfd_get_section_by_name (dynobj, ".got.plt"); + BFD_ASSERT (sdyn != NULL); + dyncon = (Elf64_External_Dyn *) sdyn->contents; + dynconend = (Elf64_External_Dyn *) (sdyn->contents + sdyn->_raw_size); + + gp_val = _bfd_get_gp_value (abfd); + + for (; dyncon < dynconend; dyncon++) + { + Elf_Internal_Dyn dyn; + const char *name; + asection *s; + + bfd_elf64_swap_dyn_in (dynobj, dyncon, &dyn); + + switch (dyn.d_tag) + { + case DT_PLTGOT: + dyn.d_un.d_ptr = gp_val; + break; + + case DT_PLTRELSZ: + dyn.d_un.d_val = (ia64_info->minplt_entries + * sizeof (Elf64_External_Rela)); + break; + + case DT_JMPREL: + /* See the comment above in finish_dynamic_symbol. */ + dyn.d_un.d_ptr = (ia64_info->rel_pltoff_sec->output_section->vma + + ia64_info->rel_pltoff_sec->output_offset + + (ia64_info->rel_pltoff_sec->reloc_count + * sizeof (Elf64_External_Rela))); + break; + + case DT_IA_64_PLT_RESERVE: + dyn.d_un.d_ptr = (sgotplt->output_section->vma + + sgotplt->output_offset); + break; + + case DT_RELASZ: + /* Do not have RELASZ include JMPREL. This makes things + easier on ld.so. This is not what the rest of BFD set up. */ + dyn.d_un.d_val -= (ia64_info->minplt_entries + * sizeof (Elf64_External_Rela)); + break; + + case DT_INIT: + case DT_FINI: + { + struct elf_link_hash_entry *h; + struct elf64_ia64_dyn_sym_info *dyn_i; + const char *which; + + if (dyn.d_tag == DT_INIT) + which = info->init_function; + else + which = info->fini_function; + + h = elf_link_hash_lookup (elf_hash_table (info), which, + false, false, false); + dyn_i = get_dyn_sym_info (ia64_info, h, NULL, NULL, false); + dyn.d_un.d_ptr = set_pltoff_entry (abfd, info, dyn_i, + dyn.d_un.d_ptr, 0); + } + } + + bfd_elf64_swap_dyn_out (abfd, &dyn, dyncon); + } + + /* Initialize the PLT0 entry */ + if (ia64_info->plt_sec) + { + bfd_byte *loc = ia64_info->plt_sec->contents; + bfd_vma pltres; + + memcpy (loc, plt_header, PLT_HEADER_SIZE); + + pltres = (sgotplt->output_section->vma + + sgotplt->output_offset + - gp_val); + + elf64_ia64_install_value (abfd, loc+1, pltres, R_IA64_GPREL22); + } + } + + return true; +} + +/* ELF file flag handling: */ + +/* Function to keep IA-64 specific file flags. */ +static boolean +elf64_ia64_set_private_flags (abfd, flags) + bfd *abfd; + flagword flags; +{ + BFD_ASSERT (!elf_flags_init (abfd) + || elf_elfheader (abfd)->e_flags == flags); + + elf_elfheader (abfd)->e_flags = flags; + elf_flags_init (abfd) = true; + return true; +} + +/* Copy backend specific data from one object module to another */ +static boolean +elf64_ia64_copy_private_bfd_data (ibfd, obfd) + bfd *ibfd, *obfd; +{ + if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return true; + + BFD_ASSERT (!elf_flags_init (obfd) + || (elf_elfheader (obfd)->e_flags + == elf_elfheader (ibfd)->e_flags)); + + elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags; + elf_flags_init (obfd) = true; + return true; +} + +/* Merge backend specific data from an object file to the output + object file when linking. */ +static boolean +elf64_ia64_merge_private_bfd_data (ibfd, obfd) + bfd *ibfd, *obfd; +{ + flagword out_flags; + flagword in_flags; + boolean ok = true; + + /* Don't even pretend to support mixed-format linking. */ + if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour + || bfd_get_flavour (obfd) != bfd_target_elf_flavour) + return false; + + in_flags = elf_elfheader (ibfd)->e_flags; + out_flags = elf_elfheader (obfd)->e_flags; + + if (! elf_flags_init (obfd)) + { + elf_flags_init (obfd) = true; + elf_elfheader (obfd)->e_flags = in_flags; + + if (bfd_get_arch (obfd) == bfd_get_arch (ibfd) + && bfd_get_arch_info (obfd)->the_default) + { + return bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), + bfd_get_mach (ibfd)); + } + + return true; + } + + /* Check flag compatibility. */ + if (in_flags == out_flags) + return true; + + /* Output has EF_IA_64_REDUCEDFP set only if all inputs have it set. */ + if (!(in_flags & EF_IA_64_REDUCEDFP) && (out_flags & EF_IA_64_REDUCEDFP)) + elf_elfheader (obfd)->e_flags &= ~EF_IA_64_REDUCEDFP; + + if ((in_flags & EF_IA_64_TRAPNIL) != (out_flags & EF_IA_64_TRAPNIL)) + { + (*_bfd_error_handler) + (_("%s: linking trap-on-NULL-dereference with non-trapping files"), + bfd_get_filename (ibfd)); + + bfd_set_error (bfd_error_bad_value); + ok = false; + } + if ((in_flags & EF_IA_64_BE) != (out_flags & EF_IA_64_BE)) + { + (*_bfd_error_handler) + (_("%s: linking big-endian files with little-endian files"), + bfd_get_filename (ibfd)); + + bfd_set_error (bfd_error_bad_value); + ok = false; + } + if ((in_flags & EF_IA_64_ABI64) != (out_flags & EF_IA_64_ABI64)) + { + (*_bfd_error_handler) + (_("%s: linking 64-bit files with 32-bit files"), + bfd_get_filename (ibfd)); + + bfd_set_error (bfd_error_bad_value); + ok = false; + } + if ((in_flags & EF_IA_64_CONS_GP) != (out_flags & EF_IA_64_CONS_GP)) + { + (*_bfd_error_handler) + (_("%s: linking constant-gp files with non-constant-gp files"), + bfd_get_filename (ibfd)); + + bfd_set_error (bfd_error_bad_value); + ok = false; + } + if ((in_flags & EF_IA_64_NOFUNCDESC_CONS_GP) + != (out_flags & EF_IA_64_NOFUNCDESC_CONS_GP)) + { + (*_bfd_error_handler) + (_("%s: linking auto-pic files with non-auto-pic files"), + bfd_get_filename (ibfd)); + + bfd_set_error (bfd_error_bad_value); + ok = false; + } + + return ok; +} + +static boolean +elf64_ia64_print_private_bfd_data (abfd, ptr) + bfd *abfd; + PTR ptr; +{ + FILE *file = (FILE *) ptr; + flagword flags = elf_elfheader (abfd)->e_flags; + + BFD_ASSERT (abfd != NULL && ptr != NULL); + + fprintf (file, "private flags = %s%s%s%s%s%s%s%s\n", + (flags & EF_IA_64_TRAPNIL) ? "TRAPNIL, " : "", + (flags & EF_IA_64_EXT) ? "EXT, " : "", + (flags & EF_IA_64_BE) ? "BE, " : "LE, ", + (flags & EF_IA_64_REDUCEDFP) ? "REDUCEDFP, " : "", + (flags & EF_IA_64_CONS_GP) ? "CONS_GP, " : "", + (flags & EF_IA_64_NOFUNCDESC_CONS_GP) ? "NOFUNCDESC_CONS_GP, " : "", + (flags & EF_IA_64_ABSOLUTE) ? "ABSOLUTE, " : "", + (flags & EF_IA_64_ABI64) ? "ABI64" : "ABI32"); + + _bfd_elf_print_private_bfd_data (abfd, ptr); + return true; +} + +#define TARGET_LITTLE_SYM bfd_elf64_ia64_little_vec +#define TARGET_LITTLE_NAME "elf64-ia64-little" +#define TARGET_BIG_SYM bfd_elf64_ia64_big_vec +#define TARGET_BIG_NAME "elf64-ia64-big" +#define ELF_ARCH bfd_arch_ia64 +#define ELF_MACHINE_CODE EM_IA_64 +#define ELF_MACHINE_ALT1 1999 /* EAS2.3 */ +#define ELF_MACHINE_ALT2 1998 /* EAS2.2 */ +#define ELF_MAXPAGESIZE 0x10000 /* 64KB */ + +#define elf_backend_section_from_shdr \ + elf64_ia64_section_from_shdr +#define elf_backend_section_flags \ + elf64_ia64_section_flags +#define elf_backend_fake_sections \ + elf64_ia64_fake_sections +#define elf_backend_add_symbol_hook \ + elf64_ia64_add_symbol_hook +#define elf_backend_additional_program_headers \ + elf64_ia64_additional_program_headers +#define elf_backend_modify_segment_map \ + elf64_ia64_modify_segment_map +#define elf_info_to_howto \ + elf64_ia64_info_to_howto + +#define bfd_elf64_bfd_reloc_type_lookup \ + elf64_ia64_reloc_type_lookup +#define bfd_elf64_bfd_is_local_label_name \ + elf64_ia64_is_local_label_name +#define bfd_elf64_bfd_relax_section \ + elf64_ia64_relax_section + +/* Stuff for the BFD linker: */ +#define bfd_elf64_bfd_link_hash_table_create \ + elf64_ia64_hash_table_create +#define elf_backend_create_dynamic_sections \ + elf64_ia64_create_dynamic_sections +#define elf_backend_check_relocs \ + elf64_ia64_check_relocs +#define elf_backend_adjust_dynamic_symbol \ + elf64_ia64_adjust_dynamic_symbol +#define elf_backend_size_dynamic_sections \ + elf64_ia64_size_dynamic_sections +#define elf_backend_relocate_section \ + elf64_ia64_relocate_section +#define elf_backend_finish_dynamic_symbol \ + elf64_ia64_finish_dynamic_symbol +#define elf_backend_finish_dynamic_sections \ + elf64_ia64_finish_dynamic_sections +#define bfd_elf64_bfd_final_link \ + elf64_ia64_final_link + +#define bfd_elf64_bfd_copy_private_bfd_data \ + elf64_ia64_copy_private_bfd_data +#define bfd_elf64_bfd_merge_private_bfd_data \ + elf64_ia64_merge_private_bfd_data +#define bfd_elf64_bfd_set_private_flags \ + elf64_ia64_set_private_flags +#define bfd_elf64_bfd_print_private_bfd_data \ + elf64_ia64_print_private_bfd_data + +#define elf_backend_plt_readonly 1 +#define elf_backend_want_plt_sym 0 +#define elf_backend_plt_alignment 5 +#define elf_backend_got_header_size 0 +#define elf_backend_plt_header_size PLT_HEADER_SIZE +#define elf_backend_want_got_plt 1 +#define elf_backend_may_use_rel_p 1 +#define elf_backend_may_use_rela_p 1 +#define elf_backend_default_use_rela_p 1 +#define elf_backend_want_dynbss 0 +#define elf_backend_copy_indirect_symbol elf64_ia64_hash_copy_indirect +#define elf_backend_hide_symbol elf64_ia64_hash_hide_symbol + +#include "elf64-target.h" diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c new file mode 100644 index 00000000000..09aecf9ec15 --- /dev/null +++ b/bfd/elf64-x86-64.c @@ -0,0 +1,353 @@ +/* X86-64 specific support for 64-bit ELF + Copyright 2000 Free Software Foundation, Inc. + Contributed by Jan Hubicka <jh@suse.cz>. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" + +#include "elf/x86-64.h" + +/* We use only the RELA entries. */ +#define USE_RELA + +/* In case we're on a 32-bit machine, construct a 64-bit "-1" value. */ +#define MINUS_ONE (~ (bfd_vma) 0) + +/* The relocation "howto" table. Order of fields: + type, size, bitsize, pc_relative, complain_on_overflow, special_function, + name, partial_inplace, src_mask, dst_pack, pcrel_offset */ +static reloc_howto_type x86_64_elf_howto_table[] = +{ + HOWTO(R_X86_64_NONE, 0,0, 0,false,0,complain_overflow_dont, 0, "R_X86_64_NONE", false,0x00000000,0x00000000,false), + HOWTO(R_X86_64_64, 0,4,64,false,0,complain_overflow_bitfield,0, "R_X86_64_64", false,MINUS_ONE ,MINUS_ONE ,false), + HOWTO(R_X86_64_PC32, 0,4,32,true ,0,complain_overflow_signed ,0, "R_X86_64_PC32", false,0xffffffff,0xffffffff,true), + HOWTO(R_X86_64_GOT32, 0,4,32,false,0,complain_overflow_signed ,0, "R_X86_64_GOT32", false,0xffffffff,0xffffffff,false), + HOWTO(R_X86_64_PLT32, 0,4,32,true ,0,complain_overflow_signed ,0, "R_X86_64_PLT32", false,0xffffffff,0xffffffff,true), + HOWTO(R_X86_64_COPY, 0,4,32,false,0,complain_overflow_bitfield,0, "R_X86_64_COPY", false,0xffffffff,0xffffffff,false), + HOWTO(R_X86_64_GLOB_DAT, 0,4,64,false,0,complain_overflow_bitfield,0,"R_X86_64_GLOB_DAT",false,MINUS_ONE ,MINUS_ONE ,false), + HOWTO(R_X86_64_RELATIVE ,0,4,64,false,0,complain_overflow_bitfield,0,"R_X86_64_RELATIVE",false,MINUS_ONE ,MINUS_ONE ,false), + HOWTO(R_X86_64_JUMP_SLOT,0,4,64,false,0,complain_overflow_bitfield,0,"R_X86_64_JUMP_SLOT",false,MINUS_ONE,MINUS_ONE ,false), + HOWTO(R_X86_64_GOTPCREL, 0,4,32,true, 0,complain_overflow_signed ,0, "R_X86_64_PCREL", false,0xffffffff,0xffffffff,true), + HOWTO(R_X86_64_32, 0,4,32,false,0,complain_overflow_unsigned,0, "R_X86_64_32", false,0xffffffff,0xffffffff,false), + HOWTO(R_X86_64_32S, 0,4,32,false,0,complain_overflow_signed, 0, "R_X86_64_32S", false,0xffffffff,0xffffffff,false), + HOWTO(R_X86_64_16, 0,1,16,false,0,complain_overflow_bitfield,0, "R_X86_64_16", false,0xffff ,0xffff, false), + HOWTO(R_X86_64_PC16, 0,1,16,true ,0,complain_overflow_bitfield,0, "R_X86_64_PC16", false,0xffff ,0xffff, true), + HOWTO(R_X86_64_8, 0,0, 8,false,0,complain_overflow_signed ,0, "R_X86_64_8", false,0xff ,0xff, false), + HOWTO(R_X86_64_PC8, 0,0, 8,true ,0,complain_overflow_signed ,0, "R_X86_64_PC8", false,0xff ,0xff, true), +}; + +/* Map BFD relocs to the x86_64 elf relocs. */ +struct elf_reloc_map { + bfd_reloc_code_real_type bfd_reloc_val; + unsigned char elf_reloc_val; +}; + +static CONST struct elf_reloc_map x86_64_reloc_map[] = +{ + { BFD_RELOC_NONE, R_X86_64_NONE, }, + { BFD_RELOC_64, R_X86_64_64, }, + { BFD_RELOC_32_PCREL, R_X86_64_PC32, }, + { BFD_RELOC_X86_64_GOT32, R_X86_64_GOT32,}, + { BFD_RELOC_X86_64_PLT32, R_X86_64_PLT32,}, + { BFD_RELOC_X86_64_COPY, R_X86_64_COPY, }, + { BFD_RELOC_X86_64_GLOB_DAT, R_X86_64_GLOB_DAT, }, + { BFD_RELOC_X86_64_JUMP_SLOT, R_X86_64_JUMP_SLOT, }, + { BFD_RELOC_X86_64_RELATIVE, R_X86_64_RELATIVE, }, + { BFD_RELOC_X86_64_GOTPCREL, R_X86_64_GOTPCREL, }, + { BFD_RELOC_32, R_X86_64_32, }, + { BFD_RELOC_X86_64_32S, R_X86_64_32S, }, + { BFD_RELOC_16, R_X86_64_16, }, + { BFD_RELOC_16_PCREL, R_X86_64_PC16, }, + { BFD_RELOC_8, R_X86_64_8, }, + { BFD_RELOC_8_PCREL, R_X86_64_PC8, }, +}; + + +static reloc_howto_type *elf64_x86_64_reloc_type_lookup + PARAMS ((bfd *, bfd_reloc_code_real_type)); +static void elf64_x86_64_info_to_howto + PARAMS ((bfd *, arelent *, Elf64_Internal_Rela *)); +static struct bfd_link_hash_table *elf64_x86_64_link_hash_table_create + PARAMS ((bfd *)); +static boolean elf64_x86_64_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); + +/* Given a BFD reloc type, return a HOWTO structure. */ +static reloc_howto_type * +elf64_x86_64_reloc_type_lookup (abfd, code) + bfd *abfd ATTRIBUTE_UNUSED; + bfd_reloc_code_real_type code; +{ + unsigned int i; + for (i = 0; i < sizeof (x86_64_reloc_map) / sizeof (struct elf_reloc_map); + i++) + { + if (x86_64_reloc_map[i].bfd_reloc_val == code) + return &x86_64_elf_howto_table[(int) + x86_64_reloc_map[i].elf_reloc_val]; + } + return 0; +} + + +/* Given an x86_64 ELF reloc type, fill in an arelent structure. */ +static void +elf64_x86_64_info_to_howto (abfd, cache_ptr, dst) + bfd *abfd ATTRIBUTE_UNUSED; + arelent *cache_ptr; + Elf64_Internal_Rela *dst; +{ + unsigned r_type; + + r_type = ELF64_R_TYPE (dst->r_info); + BFD_ASSERT (r_type < (unsigned int) R_X86_64_max); + cache_ptr->howto = &x86_64_elf_howto_table[r_type]; + BFD_ASSERT (r_type == cache_ptr->howto->type); +} + +/* Hash table functions - these will be used by dynamic linking code and + right now they are needed to keep ld happy. */ + +/* x86_64 ELF linker hash table. */ + +struct elf64_x86_64_link_hash_table +{ + struct elf_link_hash_table root; +}; + + +/* Get the X86-64 ELF linker hash table from a link_info structure. */ + +#define elf64_x86_64_hash_table(p) \ + ((struct elf64_x86_64_link_hash_table *) ((p)->hash)) + +/* Create an X86-64 ELF linker hash table. */ + +static struct bfd_link_hash_table * +elf64_x86_64_link_hash_table_create (abfd) + bfd *abfd; +{ + struct elf64_x86_64_link_hash_table *ret; + + ret = ((struct elf64_x86_64_link_hash_table *) + bfd_alloc (abfd, sizeof (struct elf64_x86_64_link_hash_table))); + if (ret == (struct elf64_x86_64_link_hash_table *) NULL) + return NULL; + + if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, + _bfd_elf_link_hash_newfunc)) + { + bfd_release (abfd, ret); + return NULL; + } + + return &ret->root.root; +} + +boolean +elf64_x86_64_elf_object_p (abfd) + bfd *abfd; +{ + /* Set the right machine number for an x86-64 elf64 file. */ + bfd_default_set_arch_mach (abfd, bfd_arch_i386, bfd_mach_x86_64); + return true; +} + +/* Relocate an x86_64 ELF section. */ + +static boolean +elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section, + contents, relocs, local_syms, local_sections) + bfd *output_bfd; + struct bfd_link_info *info; + bfd *input_bfd; + asection *input_section; + bfd_byte *contents; + Elf_Internal_Rela *relocs; + Elf_Internal_Sym *local_syms; + asection **local_sections; +{ + bfd *dynobj; + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + bfd_vma *local_got_offsets; + asection *sreloc; + Elf_Internal_Rela *rel; + Elf_Internal_Rela *relend; + + dynobj = elf_hash_table (info)->dynobj; + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + sym_hashes = elf_sym_hashes (input_bfd); + local_got_offsets = elf_local_got_offsets (input_bfd); + + sreloc = NULL; + if (dynobj != NULL) + abort (); + + rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) + { + int r_type; + reloc_howto_type *howto; + unsigned long r_symndx; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; + asection *sec; + bfd_vma relocation; + bfd_reloc_status_type r; + unsigned int indx; + + r_type = ELF64_R_TYPE (rel->r_info); + + if ((indx = (unsigned) r_type) >= R_X86_64_max) + { + bfd_set_error (bfd_error_bad_value); + return false; + } + howto = x86_64_elf_howto_table + indx; + + r_symndx = ELF64_R_SYM (rel->r_info); + + if (info->relocateable) + { + /* This is a relocateable link. We don't have to change + anything, unless the reloc is against a section symbol, + in which case we have to adjust according to where the + section symbol winds up in the output section. */ + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) + { + sec = local_sections[r_symndx]; + rel->r_addend += sec->output_offset + sym->st_value; + } + } + + continue; + } + + /* This is a final link. */ + h = NULL; + sym = NULL; + sec = NULL; + if (r_symndx < symtab_hdr->sh_info) + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; + relocation = (sec->output_section->vma + + sec->output_offset + + sym->st_value); + } + else + { + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { + sec = h->root.u.def.section; + if (sec->output_section == NULL) + { + (*_bfd_error_handler) + (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"), + bfd_get_filename (input_bfd), h->root.root.string, + bfd_get_section_name (input_bfd, input_section)); + relocation = 0; + } + else + relocation = (h->root.u.def.value + + sec->output_section->vma + + sec->output_offset); + } + else if (h->root.type == bfd_link_hash_undefweak) + relocation = 0; + else + { + if (! ((*info->callbacks->undefined_symbol) + (info, h->root.root.string, input_bfd, + input_section, rel->r_offset, + (!info->shared || info->no_undefined + || ELF_ST_VISIBILITY (h->other))))) + return false; + relocation = 0; + } + } + /* This function should support shared objects, but don't. */ + if (info->shared) + abort(); + + r = _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, + relocation, rel->r_addend); + + if (r != bfd_reloc_ok) + { + switch (r) + { + default: + case bfd_reloc_outofrange: + abort (); + case bfd_reloc_overflow: + { + const char *name; + + if (h != NULL) + name = h->root.root.string; + else + { + name = bfd_elf_string_from_elf_section (input_bfd, + symtab_hdr->sh_link, + sym->st_name); + if (name == NULL) + return false; + if (*name == '\0') + name = bfd_section_name (input_bfd, sec); + } + if (! ((*info->callbacks->reloc_overflow) + (info, name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset))) + return false; + } + break; + } + } + } + return true; +} + + +#define TARGET_LITTLE_SYM bfd_elf64_x86_64_vec +#define TARGET_LITTLE_NAME "elf64-x86-64" +#define ELF_ARCH bfd_arch_i386 +#define ELF_MACHINE_CODE EM_X86_64 +#define ELF_MAXPAGESIZE 0x100000 +#define elf_info_to_howto elf64_x86_64_info_to_howto +#define bfd_elf64_bfd_reloc_type_lookup elf64_x86_64_reloc_type_lookup +#define elf_backend_object_p elf64_x86_64_elf_object_p +#define elf_backend_relocate_section elf64_x86_64_relocate_section +#define bfd_elf64_bfd_link_hash_table_create elf64_x86_64_link_hash_table_create + +#include "elf64-target.h" diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 273937a03ab..eea5661804e 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -562,7 +562,7 @@ extern bfd *bfd_last_cache; #define bfd_cache_lookup(x) \ ((x)==bfd_last_cache? \ - (FILE*)(bfd_last_cache->iostream): \ + (FILE*) (bfd_last_cache->iostream): \ bfd_cache_lookup_worker(x)) boolean bfd_cache_init PARAMS ((bfd *abfd)); @@ -714,6 +714,14 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_386_RELATIVE", "BFD_RELOC_386_GOTOFF", "BFD_RELOC_386_GOTPC", + "BFD_RELOC_X86_64_GOT32", + "BFD_RELOC_X86_64_PLT32", + "BFD_RELOC_X86_64_COPY", + "BFD_RELOC_X86_64_GLOB_DAT", + "BFD_RELOC_X86_64_JUMP_SLOT", + "BFD_RELOC_X86_64_RELATIVE", + "BFD_RELOC_X86_64_GOTPCREL", + "BFD_RELOC_X86_64_32S", "BFD_RELOC_NS32K_IMM_8", "BFD_RELOC_NS32K_IMM_16", "BFD_RELOC_NS32K_IMM_32", diff --git a/bfd/libcoff.h b/bfd/libcoff.h index e66b1cdd17d..cf2e99fc377 100644 --- a/bfd/libcoff.h +++ b/bfd/libcoff.h @@ -823,12 +823,12 @@ typedef struct struct bfd_link_info *info, bfd *abfd, const char *name, - flagword flags, + flagword flags, asection *section, bfd_vma value, const char *string, boolean copy, - boolean collect, + boolean collect, struct bfd_link_hash_entry **hashp)); boolean (*_bfd_coff_link_output_has_begun) PARAMS (( diff --git a/bfd/po/POTFILES.in b/bfd/po/POTFILES.in index 36f62af9a3e..313422570b8 100644 --- a/bfd/po/POTFILES.in +++ b/bfd/po/POTFILES.in @@ -139,6 +139,7 @@ elf64-hppa.h elf64-ia64.c elf64-mips.c elf64-sparc.c +elf64-x86-64.c elfarm-nabi.c elfarm-oabi.c elf-bfd.h diff --git a/bfd/po/bfd.pot b/bfd/po/bfd.pot index 23e2baf5c0a..9f84596713e 100644 --- a/bfd/po/bfd.pot +++ b/bfd/po/bfd.pot @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2000-11-02 14:43-0800\n" +"POT-Creation-Date: 2000-11-30 11:08-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -14,151 +14,151 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: ENCODING\n" -#: aout-adobe.c:183 +#: aout-adobe.c:189 #, c-format msgid "%s: Unknown section type in a.out.adobe file: %x\n" msgstr "" -#: aout-cris.c:207 +#: aout-cris.c:205 #, c-format msgid "%s: Invalid relocation type exported: %d" msgstr "" -#: aout-cris.c:252 +#: aout-cris.c:249 #, c-format msgid "%s: Invalid relocation type imported: %d" msgstr "" -#: aout-cris.c:263 +#: aout-cris.c:260 #, c-format msgid "%s: Bad relocation record imported: %d" msgstr "" -#: aoutx.h:1258 aoutx.h:1672 +#: aoutx.h:1254 aoutx.h:1668 #, c-format msgid "%s: can not represent section `%s' in a.out object file format" msgstr "" -#: aoutx.h:1642 +#: aoutx.h:1638 #, c-format msgid "" "%s: can not represent section for symbol `%s' in a.out object file format" msgstr "" -#: aoutx.h:1644 +#: aoutx.h:1640 msgid "*unknown*" msgstr "" -#: aoutx.h:3691 +#: aoutx.h:3679 #, c-format msgid "%s: relocateable link from %s to %s not supported" msgstr "" -#: archive.c:1808 +#: archive.c:1820 msgid "Warning: writing archive was slow: rewriting timestamp\n" msgstr "" -#: archive.c:2074 +#: archive.c:2086 msgid "Reading archive file mod timestamp" msgstr "" #. FIXME: bfd can't call perror. -#: archive.c:2098 +#: archive.c:2113 msgid "Writing updated armap timestamp" msgstr "" -#: bfd.c:274 +#: bfd.c:273 msgid "No error" msgstr "" -#: bfd.c:275 +#: bfd.c:274 msgid "System call error" msgstr "" -#: bfd.c:276 +#: bfd.c:275 msgid "Invalid bfd target" msgstr "" -#: bfd.c:277 +#: bfd.c:276 msgid "File in wrong format" msgstr "" -#: bfd.c:278 +#: bfd.c:277 msgid "Invalid operation" msgstr "" -#: bfd.c:279 +#: bfd.c:278 msgid "Memory exhausted" msgstr "" -#: bfd.c:280 +#: bfd.c:279 msgid "No symbols" msgstr "" -#: bfd.c:281 +#: bfd.c:280 msgid "Archive has no index; run ranlib to add one" msgstr "" -#: bfd.c:282 +#: bfd.c:281 msgid "No more archived files" msgstr "" -#: bfd.c:283 +#: bfd.c:282 msgid "Malformed archive" msgstr "" -#: bfd.c:284 +#: bfd.c:283 msgid "File format not recognized" msgstr "" -#: bfd.c:285 +#: bfd.c:284 msgid "File format is ambiguous" msgstr "" -#: bfd.c:286 +#: bfd.c:285 msgid "Section has no contents" msgstr "" -#: bfd.c:287 +#: bfd.c:286 msgid "Nonrepresentable section on output" msgstr "" -#: bfd.c:288 +#: bfd.c:287 msgid "Symbol needs debug section which does not exist" msgstr "" -#: bfd.c:289 +#: bfd.c:288 msgid "Bad value" msgstr "" -#: bfd.c:290 +#: bfd.c:289 msgid "File truncated" msgstr "" -#: bfd.c:291 +#: bfd.c:290 msgid "File too big" msgstr "" -#: bfd.c:292 +#: bfd.c:291 msgid "#<Invalid error code>" msgstr "" -#: bfd.c:679 +#: bfd.c:675 #, c-format msgid "bfd assertion fail %s:%d" msgstr "" -#: bfd.c:697 +#: bfd.c:693 #, c-format msgid "BFD internal error, aborting at %s line %d in %s\n" msgstr "" -#: bfd.c:701 +#: bfd.c:697 #, c-format msgid "BFD internal error, aborting at %s line %d\n" msgstr "" -#: bfd.c:703 +#: bfd.c:699 msgid "Please report this bug.\n" msgstr "" @@ -171,19 +171,19 @@ msgstr "" msgid "Missing IHCONST" msgstr "" -#: coff-a29k.c:182 +#: coff-a29k.c:181 msgid "Missing IHIHALF" msgstr "" -#: coff-a29k.c:214 +#: coff-a29k.c:213 msgid "Unrecognized reloc" msgstr "" -#: coff-a29k.c:427 +#: coff-a29k.c:425 msgid "missing IHCONST reloc" msgstr "" -#: coff-a29k.c:518 +#: coff-a29k.c:516 msgid "missing IHIHALF reloc" msgstr "" @@ -191,142 +191,142 @@ msgstr "" msgid "GP relative relocation used when GP not defined" msgstr "" -#: coff-alpha.c:1486 elf64-alpha.c:4003 +#: coff-alpha.c:1486 elf64-alpha.c:4004 msgid "using multiple gp values" msgstr "" -#: coff-alpha.c:1992 coff-mips.c:1435 +#: coff-alpha.c:1992 coff-mips.c:1434 msgid "GP relative relocation when GP not defined" msgstr "" -#: coff-arm.c:1017 elf32-arm.h:248 +#: coff-arm.c:1018 elf32-arm.h:248 #, c-format msgid "%s: unable to find THUMB glue '%s' for `%s'" msgstr "" -#: coff-arm.c:1046 elf32-arm.h:283 +#: coff-arm.c:1047 elf32-arm.h:283 #, c-format msgid "%s: unable to find ARM glue '%s' for `%s'" msgstr "" -#: coff-arm.c:1334 coff-arm.c:1429 elf32-arm.h:843 elf32-arm.h:948 +#: coff-arm.c:1335 coff-arm.c:1430 elf32-arm.h:843 elf32-arm.h:948 #, c-format msgid "%s(%s): warning: interworking not enabled." msgstr "" -#: coff-arm.c:1338 elf32-arm.h:951 +#: coff-arm.c:1339 elf32-arm.h:951 #, c-format msgid " first occurrence: %s: arm call to thumb" msgstr "" -#: coff-arm.c:1433 elf32-arm.h:846 +#: coff-arm.c:1434 elf32-arm.h:846 #, c-format msgid " first occurrence: %s: thumb call to arm" msgstr "" -#: coff-arm.c:1436 +#: coff-arm.c:1437 msgid " consider relinking with --support-old-code enabled" msgstr "" -#: coff-arm.c:1725 coff-tic80.c:682 cofflink.c:2988 +#: coff-arm.c:1726 coff-tic80.c:682 cofflink.c:2991 #, c-format msgid "%s: bad reloc address 0x%lx in section `%s'" msgstr "" -#: coff-arm.c:2062 +#: coff-arm.c:2063 #, c-format msgid "%s: illegal symbol index in reloc: %d" msgstr "" -#: coff-arm.c:2190 +#: coff-arm.c:2191 #, c-format msgid "%s: ERROR: compiled for APCS-%d whereas target %s uses APCS-%d" msgstr "" -#: coff-arm.c:2205 +#: coff-arm.c:2206 #, c-format msgid "" "%s: ERROR: passes floats in float registers whereas target %s uses integer " "registers" msgstr "" -#: coff-arm.c:2208 +#: coff-arm.c:2209 #, c-format msgid "" "%s: ERROR: passes floats in integer registers whereas target %s uses float " "registers" msgstr "" -#: coff-arm.c:2223 +#: coff-arm.c:2224 #, c-format msgid "" "%s: ERROR: compiled as position independent code, whereas target %s is " "absolute position" msgstr "" -#: coff-arm.c:2226 +#: coff-arm.c:2227 #, c-format msgid "" "%s: ERROR: compiled as absolute position code, whereas target %s is position " "independent" msgstr "" -#: coff-arm.c:2255 +#: coff-arm.c:2256 #, c-format msgid "Warning: input file %s supports interworking, whereas %s does not." msgstr "" -#: coff-arm.c:2258 +#: coff-arm.c:2259 #, c-format msgid "Warning: input file %s does not support interworking, whereas %s does." msgstr "" -#: coff-arm.c:2285 +#: coff-arm.c:2286 #, c-format msgid "private flags = %x:" msgstr "" -#: coff-arm.c:2293 elf32-arm.h:2189 +#: coff-arm.c:2294 elf32-arm.h:2212 msgid " [floats passed in float registers]" msgstr "" -#: coff-arm.c:2295 +#: coff-arm.c:2296 msgid " [floats passed in integer registers]" msgstr "" -#: coff-arm.c:2298 elf32-arm.h:2192 +#: coff-arm.c:2299 elf32-arm.h:2215 msgid " [position independent]" msgstr "" -#: coff-arm.c:2300 +#: coff-arm.c:2301 msgid " [absolute position]" msgstr "" -#: coff-arm.c:2304 +#: coff-arm.c:2305 msgid " [interworking flag not initialised]" msgstr "" -#: coff-arm.c:2306 +#: coff-arm.c:2307 msgid " [interworking supported]" msgstr "" -#: coff-arm.c:2308 +#: coff-arm.c:2309 msgid " [interworking not supported]" msgstr "" -#: coff-arm.c:2356 +#: coff-arm.c:2357 #, c-format msgid "" "Warning: Not setting interworking flag of %s, since it has already been " "specified as non-interworking" msgstr "" -#: coff-arm.c:2360 +#: coff-arm.c:2361 #, c-format msgid "Warning: Clearing the interworking flag of %s due to outside request" msgstr "" -#: coffcode.h:2118 +#: coffcode.h:2116 #, c-format msgid "Unrecognized TI COFF target id '0x%x'" msgstr "" @@ -351,22 +351,22 @@ msgstr "" msgid "warning: %s: local symbol `%s' has no section" msgstr "" -#: coff-tic54x.c:377 coffcode.h:4792 +#: coff-tic54x.c:376 coffcode.h:4790 #, c-format msgid "%s: warning: illegal symbol index %ld in relocs" msgstr "" -#: coffcode.h:4830 +#: coffcode.h:4828 #, c-format msgid "%s: illegal relocation type %d at address 0x%lx" msgstr "" -#: coffgen.c:1635 +#: coffgen.c:1633 #, c-format msgid "%s: bad string table size %lu" msgstr "" -#: coffgen.c:2098 +#: coffgen.c:2096 #, c-format msgid "AUX tagndx %ld ttlsiz 0x%lx lnnos %ld next %ld" msgstr "" @@ -380,45 +380,45 @@ msgstr "" msgid "Warning: type of symbol `%s' changed from %d to %d in %s" msgstr "" -#: cofflink.c:2288 +#: cofflink.c:2289 #, c-format msgid "%s: relocs in section `%s', but it has no contents" msgstr "" -#: cofflink.c:2627 coffswap.h:897 +#: cofflink.c:2628 coffswap.h:894 #, c-format msgid "%s: %s: reloc overflow: 0x%lx > 0xffff" msgstr "" -#: cofflink.c:2636 coffswap.h:883 +#: cofflink.c:2637 coffswap.h:880 #, c-format msgid "%s: warning: %s: line number overflow: 0x%lx > 0xffff" msgstr "" -#: coff-m68k.c:477 coff-mips.c:2433 elf32-m68k.c:2267 +#: coff-m68k.c:475 coff-mips.c:2432 elf32-m68k.c:2267 msgid "unsupported reloc type" msgstr "" -#: coff-mips.c:875 elf32-mips.c:1416 +#: coff-mips.c:875 elf32-mips.c:1405 msgid "GP relative relocation when _gp not defined" msgstr "" #. No other sections should appear in -membedded-pic #. code. -#: coff-mips.c:2470 +#: coff-mips.c:2469 msgid "reloc against unsupported section" msgstr "" -#: coff-mips.c:2478 +#: coff-mips.c:2477 msgid "reloc not properly aligned" msgstr "" -#: coff-tic54x.c:264 coff-tic80.c:445 +#: coff-tic54x.c:263 coff-tic80.c:445 #, c-format msgid "Unrecognized reloc type 0x%x" msgstr "" -#: coff-w65.c:383 +#: coff-w65.c:369 #, c-format msgid "ignoring reloc %s\n" msgstr "" @@ -478,61 +478,61 @@ msgstr "" msgid "Dwarf Error: Bad abbrev number: %d." msgstr "" -#: ecoff.c:1325 +#: ecoff.c:1323 #, c-format msgid "Unknown basic type %d" msgstr "" -#: ecoff.c:1597 +#: ecoff.c:1592 #, c-format msgid "" "\n" " End+1 symbol: %ld" msgstr "" -#: ecoff.c:1604 ecoff.c:1607 +#: ecoff.c:1599 ecoff.c:1602 #, c-format msgid "" "\n" " First symbol: %ld" msgstr "" -#: ecoff.c:1619 +#: ecoff.c:1614 #, c-format msgid "" "\n" " End+1 symbol: %-7ld Type: %s" msgstr "" -#: ecoff.c:1626 +#: ecoff.c:1621 #, c-format msgid "" "\n" " Local symbol: %ld" msgstr "" -#: ecoff.c:1634 +#: ecoff.c:1629 #, c-format msgid "" "\n" " struct; End+1 symbol: %ld" msgstr "" -#: ecoff.c:1639 +#: ecoff.c:1634 #, c-format msgid "" "\n" " union; End+1 symbol: %ld" msgstr "" -#: ecoff.c:1644 +#: ecoff.c:1639 #, c-format msgid "" "\n" " enum; End+1 symbol: %ld" msgstr "" -#: ecoff.c:1650 +#: ecoff.c:1645 #, c-format msgid "" "\n" @@ -550,170 +550,170 @@ msgid "%s: Warning: Thumb BLX instruction targets thumb function '%s'." msgstr "" #: elf-hppa.h:1374 elf-hppa.h:1407 elf32-arm.h:1855 elf32-i386.c:1430 -#: elf32-ppc.c:3106 elf32-sh.c:2997 +#: elf32-ppc.c:3106 elf32-sh.c:2999 elf64-x86-64.c:275 #, c-format msgid "" "%s: warning: unresolvable relocation against symbol `%s' from %s section" msgstr "" -#: elf-m10200.c:455 elf-m10300.c:670 elf32-arm.h:1924 elf32-avr.c:844 +#: elf-m10200.c:455 elf-m10300.c:670 elf32-arm.h:1929 elf32-avr.c:844 #: elf32-cris.c:431 elf32-d10v.c:479 elf32-fr30.c:651 elf32-i860.c:1062 #: elf32-m32r.c:1265 elf32-v850.c:1677 msgid "internal error: out of range error" msgstr "" -#: elf-m10200.c:459 elf-m10300.c:674 elf32-arm.h:1928 elf32-avr.c:848 +#: elf-m10200.c:459 elf-m10300.c:674 elf32-arm.h:1933 elf32-avr.c:848 #: elf32-cris.c:435 elf32-d10v.c:483 elf32-fr30.c:655 elf32-i860.c:1066 #: elf32-m32r.c:1269 elf32-v850.c:1681 msgid "internal error: unsupported relocation error" msgstr "" -#: elf-m10200.c:463 elf-m10300.c:678 elf32-arm.h:1932 elf32-d10v.c:487 +#: elf-m10200.c:463 elf-m10300.c:678 elf32-arm.h:1937 elf32-d10v.c:487 #: elf32-m32r.c:1273 msgid "internal error: dangerous error" msgstr "" -#: elf-m10200.c:467 elf-m10300.c:682 elf32-arm.h:1936 elf32-avr.c:856 +#: elf-m10200.c:467 elf-m10300.c:682 elf32-arm.h:1941 elf32-avr.c:856 #: elf32-cris.c:443 elf32-d10v.c:491 elf32-fr30.c:663 elf32-i860.c:1074 #: elf32-m32r.c:1277 elf32-v850.c:1701 msgid "internal error: unknown error" msgstr "" -#: elf32-arm.h:1964 +#: elf32-arm.h:1969 #, c-format msgid "" "Warning: Not setting interwork flag of %s since it has already been " "specified as non-interworking" msgstr "" -#: elf32-arm.h:1968 +#: elf32-arm.h:1973 #, c-format msgid "Warning: Clearing the interwork flag of %s due to outside request" msgstr "" -#: elf32-arm.h:2016 +#: elf32-arm.h:2021 #, c-format msgid "" "Warning: Clearing the interwork flag in %s because non-interworking code in " "%s has been linked with it" msgstr "" -#: elf32-arm.h:2092 +#: elf32-arm.h:2115 #, c-format msgid "" "Error: %s compiled for EABI version %d, whereas %s is compiled for version %d" msgstr "" -#: elf32-arm.h:2106 +#: elf32-arm.h:2129 #, c-format msgid "Error: %s compiled for APCS-%d, whereas %s is compiled for APCS-%d" msgstr "" -#: elf32-arm.h:2117 +#: elf32-arm.h:2140 #, c-format msgid "" "Error: %s passes floats in %s registers, whereas %s passes them in %s " "registers" msgstr "" -#: elf32-arm.h:2120 elf32-arm.h:2122 +#: elf32-arm.h:2143 elf32-arm.h:2145 msgid "float" msgstr "" -#: elf32-arm.h:2120 elf32-arm.h:2122 +#: elf32-arm.h:2143 elf32-arm.h:2145 msgid "integer" msgstr "" -#: elf32-arm.h:2129 +#: elf32-arm.h:2152 #, c-format msgid "Error: %s uses %s floating point, whereas %s uses %s floating point" msgstr "" -#: elf32-arm.h:2132 elf32-arm.h:2134 +#: elf32-arm.h:2155 elf32-arm.h:2157 msgid "soft" msgstr "" -#: elf32-arm.h:2132 elf32-arm.h:2134 +#: elf32-arm.h:2155 elf32-arm.h:2157 msgid "hard" msgstr "" -#: elf32-arm.h:2141 +#: elf32-arm.h:2164 #, c-format msgid "Warning: %s %s interworking, whereas %s %s" msgstr "" -#: elf32-arm.h:2144 +#: elf32-arm.h:2167 msgid "supports" msgstr "" -#: elf32-arm.h:2144 +#: elf32-arm.h:2167 msgid "does not support" msgstr "" -#: elf32-arm.h:2146 +#: elf32-arm.h:2169 msgid "does not" msgstr "" -#: elf32-arm.h:2146 +#: elf32-arm.h:2169 msgid "does" msgstr "" #. Ignore init flag - it may not be set, despite the flags field #. containing valid data. -#: elf32-arm.h:2172 elf32-cris.c:615 elf32-m68k.c:430 elf32-mips.c:2638 +#: elf32-arm.h:2195 elf32-cris.c:615 elf32-m68k.c:430 elf32-mips.c:2623 #, c-format msgid "private flags = %lx:" msgstr "" -#: elf32-arm.h:2181 +#: elf32-arm.h:2204 msgid " [interworking enabled]" msgstr "" -#: elf32-arm.h:2184 +#: elf32-arm.h:2207 msgid " [APCS-26]" msgstr "" -#: elf32-arm.h:2186 +#: elf32-arm.h:2209 msgid " [APCS-32]" msgstr "" -#: elf32-arm.h:2195 +#: elf32-arm.h:2218 msgid " [new ABI]" msgstr "" -#: elf32-arm.h:2198 +#: elf32-arm.h:2221 msgid " [old ABI]" msgstr "" -#: elf32-arm.h:2201 +#: elf32-arm.h:2224 msgid " [software FP]" msgstr "" -#: elf32-arm.h:2208 +#: elf32-arm.h:2231 msgid " [Version1 EABI]" msgstr "" -#: elf32-arm.h:2211 +#: elf32-arm.h:2234 msgid " [sorted symbol table]" msgstr "" -#: elf32-arm.h:2213 +#: elf32-arm.h:2236 msgid " [unsorted symbol table]" msgstr "" -#: elf32-arm.h:2219 +#: elf32-arm.h:2242 msgid " <EABI version unrecognised>" msgstr "" -#: elf32-arm.h:2226 +#: elf32-arm.h:2249 msgid " [relocatable executable]" msgstr "" -#: elf32-arm.h:2229 +#: elf32-arm.h:2252 msgid " [has entry point]" msgstr "" -#: elf32-arm.h:2234 +#: elf32-arm.h:2257 msgid "<Unrecognised flag bits set>" msgstr "" @@ -845,129 +845,129 @@ msgstr "" msgid "%s: Unknown relocation type %d\n" msgstr "" -#: elf32-mips.c:1575 +#: elf32-mips.c:1564 msgid "32bits gp relative relocation occurs for an external symbol" msgstr "" -#: elf32-mips.c:1724 +#: elf32-mips.c:1713 #, c-format msgid "Linking mips16 objects into %s format is not supported" msgstr "" -#: elf32-mips.c:2524 +#: elf32-mips.c:2509 #, c-format msgid "%s: linking PIC files with non-PIC files" msgstr "" -#: elf32-mips.c:2534 +#: elf32-mips.c:2519 #, c-format msgid "%s: linking abicalls files with non-abicalls files" msgstr "" -#: elf32-mips.c:2564 +#: elf32-mips.c:2549 #, c-format msgid "%s: ISA mismatch (-mips%d) with previous modules (-mips%d)" msgstr "" -#: elf32-mips.c:2573 +#: elf32-mips.c:2558 #, c-format msgid "%s: ISA mismatch (%d) with previous modules (%d)" msgstr "" -#: elf32-mips.c:2596 +#: elf32-mips.c:2581 #, c-format msgid "%s: ABI mismatch: linking %s module with previous %s modules" msgstr "" -#: elf32-mips.c:2610 elf32-ppc.c:1481 elf64-sparc.c:2974 +#: elf32-mips.c:2595 elf32-ppc.c:1481 elf64-sparc.c:2974 #, c-format msgid "%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)" msgstr "" -#: elf32-mips.c:2641 +#: elf32-mips.c:2626 msgid " [abi=O32]" msgstr "" -#: elf32-mips.c:2643 +#: elf32-mips.c:2628 msgid " [abi=O64]" msgstr "" -#: elf32-mips.c:2645 +#: elf32-mips.c:2630 msgid " [abi=EABI32]" msgstr "" -#: elf32-mips.c:2647 +#: elf32-mips.c:2632 msgid " [abi=EABI64]" msgstr "" -#: elf32-mips.c:2649 +#: elf32-mips.c:2634 msgid " [abi unknown]" msgstr "" -#: elf32-mips.c:2651 +#: elf32-mips.c:2636 msgid " [abi=N32]" msgstr "" -#: elf32-mips.c:2653 +#: elf32-mips.c:2638 msgid " [abi=64]" msgstr "" -#: elf32-mips.c:2655 +#: elf32-mips.c:2640 msgid " [no abi set]" msgstr "" -#: elf32-mips.c:2658 +#: elf32-mips.c:2643 msgid " [mips1]" msgstr "" -#: elf32-mips.c:2660 +#: elf32-mips.c:2645 msgid " [mips2]" msgstr "" -#: elf32-mips.c:2662 +#: elf32-mips.c:2647 msgid " [mips3]" msgstr "" -#: elf32-mips.c:2664 +#: elf32-mips.c:2649 msgid " [mips4]" msgstr "" -#: elf32-mips.c:2666 +#: elf32-mips.c:2651 msgid " [unknown ISA]" msgstr "" -#: elf32-mips.c:2669 +#: elf32-mips.c:2654 msgid " [32bitmode]" msgstr "" -#: elf32-mips.c:2671 +#: elf32-mips.c:2656 msgid " [not 32bitmode]" msgstr "" -#: elf32-mips.c:4325 +#: elf32-mips.c:4305 msgid "static procedure (no name)" msgstr "" -#: elf32-mips.c:4937 elf64-alpha.c:4377 +#: elf32-mips.c:4920 elf64-alpha.c:4378 #, c-format msgid "%s: illegal section name `%s'" msgstr "" -#: elf32-mips.c:5502 +#: elf32-mips.c:5484 msgid "not enough GOT space for local GOT entries" msgstr "" -#: elf32-mips.c:6619 +#: elf32-mips.c:6601 #, c-format msgid "%s: %s+0x%lx: jump to stub routine which is not jal" msgstr "" -#: elf32-mips.c:7607 +#: elf32-mips.c:7588 #, c-format msgid "Malformed reloc detected for section %s" msgstr "" -#: elf32-mips.c:7684 +#: elf32-mips.c:7665 #, c-format msgid "%s: CALL16 reloc at 0x%lx not against global symbol" msgstr "" @@ -1136,7 +1136,7 @@ msgstr "" msgid "GPDISP relocation did not find ldah and lda instructions" msgstr "" -#: elf64-alpha.c:3013 +#: elf64-alpha.c:3014 #, c-format msgid "%s: .got subsegment exceeds 64K (size %d)" msgstr "" @@ -1309,24 +1309,24 @@ msgstr "" msgid "%s: warning: allocated section `%s' not in segment" msgstr "" -#: elf.c:3613 +#: elf.c:3616 #, c-format msgid "%s: symbol `%s' required but not present" msgstr "" -#: elf.c:3622 +#: elf.c:3625 #, c-format msgid "" "elf_symbol_from_bfd_symbol 0x%.8lx, name = %s, sym num = %d, flags = " "0x%.8lx%s\n" msgstr "" -#: elf.c:3863 +#: elf.c:3866 #, c-format msgid "%s: warning: Empty loadable segment detected\n" msgstr "" -#: elf.c:5209 +#: elf.c:5212 #, c-format msgid "%s: unsupported relocation type %s" msgstr "" @@ -1847,6 +1847,16 @@ msgstr "" msgid "%s: `ld -r' not supported with PE MIPS objects\n" msgstr "" +#. OK, at this point the following variables are set up: +#. src = VMA of the memory we're fixing up +#. mem = pointer to memory we're fixing up +#. val = VMA of what we need to refer to +#. +#: pe-mips.c:794 +#, c-format +msgid "%s: unimplemented %s\n" +msgstr "" + #: pe-mips.c:820 #, c-format msgid "%s: jump too far away\n" @@ -1905,16 +1915,11 @@ msgstr "" msgid "Partition[%d] length = 0x%.8lx (%ld)\n" msgstr "" -#: reloc16.c:308 -#, c-format -msgid "Badly formatted relocs detected in '%s'" -msgstr "" - #: som.c:5370 msgid "som_sizeof_headers unimplemented" msgstr "" -#: srec.c:290 +#: srec.c:301 #, c-format msgid "%s:%d: Unexpected character `%s' in S-record file\n" msgstr "" @@ -2165,97 +2170,97 @@ msgstr "" msgid "Unhandled relocation %s" msgstr "" -#: xcofflink.c:1653 +#: xcofflink.c:1634 #, c-format msgid "%s: `%s' has line numbers but no enclosing section" msgstr "" -#: xcofflink.c:1705 +#: xcofflink.c:1686 #, c-format msgid "%s: class %d symbol `%s' has no aux entries" msgstr "" -#: xcofflink.c:1728 +#: xcofflink.c:1709 #, c-format msgid "%s: symbol `%s' has unrecognized csect type %d" msgstr "" -#: xcofflink.c:1740 +#: xcofflink.c:1721 #, c-format msgid "%s: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d" msgstr "" -#: xcofflink.c:1779 +#: xcofflink.c:1760 #, c-format msgid "%s: XMC_TC0 symbol `%s' is class %d scnlen %d" msgstr "" -#: xcofflink.c:1903 +#: xcofflink.c:1883 #, c-format msgid "%s: symbol `%s' has unrecognized smclas %d" msgstr "" -#: xcofflink.c:1922 +#: xcofflink.c:1902 #, c-format msgid "%s: csect `%s' not in enclosing section" msgstr "" -#: xcofflink.c:2026 +#: xcofflink.c:2006 #, c-format msgid "%s: misplaced XTY_LD `%s'" msgstr "" -#: xcofflink.c:2337 +#: xcofflink.c:2317 #, c-format msgid "%s: reloc %s:%d not in csect" msgstr "" -#: xcofflink.c:2472 +#: xcofflink.c:2452 #, c-format msgid "%s: XCOFF shared object when not producing XCOFF output" msgstr "" -#: xcofflink.c:2493 +#: xcofflink.c:2473 #, c-format msgid "%s: dynamic object with no .loader section" msgstr "" -#: xcofflink.c:3133 +#: xcofflink.c:3113 #, c-format msgid "%s: no such symbol" msgstr "" -#: xcofflink.c:3725 +#: xcofflink.c:3704 #, c-format msgid "warning: attempt to export undefined symbol `%s'" msgstr "" -#: xcofflink.c:4719 +#: xcofflink.c:4698 #, c-format msgid "TOC overflow: 0x%lx > 0x10000; try -mminimal-toc when compiling" msgstr "" -#: xcofflink.c:5544 xcofflink.c:5900 xcofflink.c:5937 xcofflink.c:6254 +#: xcofflink.c:5523 xcofflink.c:5879 xcofflink.c:5916 xcofflink.c:6233 #, c-format msgid "%s: loader reloc in unrecognized section `%s'" msgstr "" -#: xcofflink.c:5566 xcofflink.c:6265 +#: xcofflink.c:5545 xcofflink.c:6244 #, c-format msgid "%s: `%s' in loader reloc but not loader sym" msgstr "" -#: xcofflink.c:5581 +#: xcofflink.c:5560 #, c-format msgid "%s: loader reloc in read-only section %s" msgstr "" -#: xcofflink.c:6461 +#: xcofflink.c:6440 #, c-format msgid "%s: unsupported relocation type 0x%02x" msgstr "" -#: xcofflink.c:6507 +#: xcofflink.c:6486 #, c-format msgid "%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry" msgstr "" diff --git a/bfd/reloc.c b/bfd/reloc.c index ee660013b4c..ed02c63046b 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -2078,6 +2078,25 @@ ENUMDOC i386/elf relocations ENUM + BFD_RELOC_X86_64_GOT32 +ENUMX + BFD_RELOC_X86_64_PLT32 +ENUMX + BFD_RELOC_X86_64_COPY +ENUMX + BFD_RELOC_X86_64_GLOB_DAT +ENUMX + BFD_RELOC_X86_64_JUMP_SLOT +ENUMX + BFD_RELOC_X86_64_RELATIVE +ENUMX + BFD_RELOC_X86_64_GOTPCREL +ENUMX + BFD_RELOC_X86_64_32S +ENUMDOC + x86-64/elf relocations + +ENUM BFD_RELOC_NS32K_IMM_8 ENUMX BFD_RELOC_NS32K_IMM_16 diff --git a/bfd/targets.c b/bfd/targets.c index 0a3e2cf20f0..94e3e9f41a0 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -552,6 +552,7 @@ extern const bfd_target bfd_elf32_shl_vec; extern const bfd_target bfd_elf32_shlin_vec; extern const bfd_target bfd_elf32_shblin_vec; extern const bfd_target bfd_elf32_sparc_vec; +extern const bfd_target bfd_elf64_x86_64_vec; extern const bfd_target bfd_elf32_tradbigmips_vec; extern const bfd_target bfd_elf32_tradlittlemips_vec; extern const bfd_target bfd_elf32_v850_vec; @@ -738,6 +739,9 @@ const bfd_target * const bfd_target_vector[] = { &bfd_elf32_hppa_vec, &bfd_elf32_i370_vec, &bfd_elf32_i386_vec, +#ifdef BFD64 + &bfd_elf64_x86_64_vec, +#endif &bfd_elf32_i860_vec, &bfd_elf32_i860_little_vec, &bfd_elf32_i960_vec, |