Commit Graph

44 Commits

Author SHA1 Message Date
Alan Modra dc810e3900 Touches most files in bfd/, so likely will be blamed for everything..
o  bfd_read and bfd_write lose an unnecessary param and become
   bfd_bread and bfd_bwrite.

o  bfd_*alloc now all take a bfd_size_type arg, and will error if
   size_t is too small.  eg. 32 bit host, 64 bit bfd, verrry big files
   or bugs in linker scripts etc.

o  file_ptr becomes a bfd_signed_vma.  Besides matching sizes with
   various other types involved in handling sections, this should make
   it easier for bfd to support a 64 bit off_t on 32 bit hosts that
   provide it.

o  I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
   generally available.  They now cast their args to bfd_vma and
   bfd_byte * as appropriate, which removes a swag of casts from the
   source.

o  Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
   aout-encap.c.

o  Zillions of formatting and -Wconversion fixes.
2001-09-18 09:57:26 +00:00
Alan Modra 56882138c5 * elf32-i386.c (elf_i386_relocate_section): Check !DEF_REGULAR
as well as DEF_DYNAMIC in test for avoided copy relocs.
	(allocate_plt_and_got_and_discard_relocs): Likewise.
	* elf32-i386.c (elf_i386_relocate_section): Likewise.
	(allocate_plt_and_got_and_discard_relocs): Likewise.
2001-09-08 05:47:01 +00:00
Alan Modra 8e1d4bbbc0 * elf32-i386.c (allocate_plt_and_got_and_discard_relocs): Don't
keep relocs for undefined syms if there are no dynamic sections in
	executable.
	* elf32-hppa.c (allocate_plt_and_got_and_discard_relocs): Likewise.
2001-08-03 05:10:39 +00:00
H.J. Lu b64977c5ff 2001-06-29 H.J. Lu <hjl@gnu.org>
* elf32-hppa.c (elf32_hppa_finish_dynamic_sections): Check if
	hplink->sgot is NULL before filling GOT. Checck if hplink->splt
	is NULL before filling PLT.
2001-06-30 00:34:10 +00:00
Alan Modra 446f286313 Avoid creating COPY relocs.
* elf32-hppa.c (elf32_hppa_check_relocs): Don't make syms dynamic
	here..
	(elf32_hppa_adjust_dynamic_symbol): ..nor here..
	(allocate_plt_and_got_and_discard_relocs): .. instead do so here
	after gc has run.
	* elf32-hppa.c (RELATIVE_DYNAMIC_RELOCS): Delete.
	(IS_ABSOLUTE_RELOC): Define.
	(elf32_hppa_link_hash_entry): Always include reloc_entries field.
	(hppa_link_hash_newfunc): Always init it.
	(elf32_hppa_check_relocs): Mark symbols as ELF_LINK_NON_GOT_REF to
	create COPY relocs only when the reloc is in a read-only section.
	Instead, allocate space for a dynamic reloc to reference the
	library symbol directly.  Keep track of space we allocate using
	relocs_entries.
	(hppa_discard_copies): Delete, and move code to..
	(allocate_plt_and_got): ..here.  Rename to
	allocate_plt_and_got_and_discard_relocs.  Remove unneeded dynamic
	relocs for non-shared link.
	(elf32_hppa_size_dynamic_sections): Update calls to above.
	(elf32_hppa_relocate_section): Write out the dynamic relocs used
	in lieu of COPY relocs.
2001-06-27 02:42:09 +00:00
Alan Modra 68fb2e56a3 * elf32-hppa.c (elf32_hppa_size_dynamic_sections): Always
allocate local .got space.  Use shortcuts from hash table for .got
	and .plt rather than comparing section names.
	(elf32_hppa_check_relocs): Use local_plt_refcounts var rather than
	adjusting index into local_got_refcounts to document what we are
	really doing.
	(elf32_hppa_relocate_section): Similarly for local_plt_offsets.
	Tidy .got and .plt error checking.
2001-06-21 05:47:12 +00:00
Alan Modra 73a74a624e * elf32-hppa.c (allocate_plt_and_got): Skip indirect and warning syms. 2001-06-05 04:39:31 +00:00
H.J. Lu 24a5e75166 2001-06-02 H.J. Lu <hjl@gnu.org>
* elf32-hppa.c (elf32_hppa_object_p): Check ELFOSABI_LINUX
	and ELFOSABI_HPUX.
	* elf64-hppa.c (elf64_hppa_object_p): Likewise.
2001-06-03 02:41:58 +00:00
Alan Modra 4dc8668677 * elf32-hppa.c (elf32_hppa_check_relocs): Don't NEED_PLT for
millicode.  Don't allocate .got and .rela.got space here..
	(elf32_hppa_gc_sweep_hook): ..and no need to deallocate here..
	(elf32_hppa_adjust_dynamic_symbol): ..and don't allocate .plt and
	.rela.plt here..
	(hppa_handle_PIC_calls): ..nor here..
	(allocate_plt_and_got): ..instead do it all here.  New function.
	(elf32_hppa_size_dynamic_sections): Allocate local .got space and
	call allocate_plt_and_got.  No need to zap .got if not dynamic.
	(elf32_hppa_final_link): Call regular bfd_final_link instead of
	gc_common_final_link.
	(WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define.
	(elf32_hppa_relocate_section): Use it here.
	(elf32_hppa_finish_dynamic_symbol): Remove superfluous test of
	dynamic_sections_created.
	(hppa_type_of_stub): Don't LONG_BRANCH_VIA_PLT if millicode sym.
2001-05-30 14:30:33 +00:00
Alan Modra 8dea12685e * elf32-hppa.c (elf32_hppa_relocate_section): Set up .plt entries
for symbols forced local that need plabels.
	(elf32_hppa_adjust_dynamic_symbol): Don't allocate space in
	.plt.rela for local syms if non-shared.
	(hppa_build_one_stub): Mask lsb of plt.offset.
	(elf32_hppa_finish_dynamic_symbol): Abort if lsb of plt.offset set.
	(clobber_millicode_symbols): Correct comment.
	(elf32_hppa_relocate_section): Likewise.
	(elf32_hppa_finish_dynamic_symbol): Likewise.
2001-05-28 10:12:04 +00:00
Alan Modra 49e9d0d3b6 * elf32-hppa.c (elf32_hppa_relocate_section): Don't allow
undefined millicode syms in shared libs.
	(hppa_build_one_stub): Turn BFD_ASSERTs into aborts.
	(elf32_hppa_check_relocs): Likewise.
	(elf32_hppa_adjust_dynamic_symbol): Likewise.
	(elf32_hppa_size_dynamic_sections): Likewise.
	(elf32_hppa_relocate_section): Likewise.
	(elf32_hppa_finish_dynamic_symbol): Likewise.
	(elf32_hppa_finish_dynamic_sections): Likewise.
2001-05-25 03:46:49 +00:00
Alan Modra e0522e891a * elf32-hppa.c (clobber_millicode_symbols): Temporarily set
ELF_LINK_FORCED_LOCAL to suit 2001-04-30 change.
	(hppa_build_one_stub): Add an assert to check plt.offset.
2001-05-18 03:11:13 +00:00
H.J. Lu 5fba655aed 2000-04-27 H.J. Lu <hjl@gnu.org>
* elf.c (_bfd_elf_link_hash_hide_symbol): Set dynindx to -1
	only for ELF_LINK_FORCED_LOCAL.
	* elf32-hppa.c (elf32_hppa_hide_symbol): Likewise.
	* elf32-mips.c (_bfd_mips_elf_hide_symbol): Likewise.
	* elfxx-ia64.c (elfNN_ia64_hash_hide_symbol): Likewise.

	* elflink.h (elf_fix_symbol_flags): Set ELF_LINK_FORCED_LOCAL
	if the symbol has hidden or internal visibility.
2001-04-30 16:13:26 +00:00
Alan Modra db20fd7654 * elf32-hppa.c (final_link_relocate): Branch to .+8 for
calls to undefined weak symbols.
2001-04-30 13:34:41 +00:00
Alan Modra b32b5d6e64 Prevent NULL pointer dereference. 2001-03-21 08:09:25 +00:00
Alan Modra 12cca0d293 Don't assume non-PIC to PIC call stubs are unneeded just because
the function happens to have a plabel.
2001-03-15 13:47:56 +00:00
Nick Clifton 7898dedac0 Update copyright notices 2001-03-08 21:04:02 +00:00
Alan Modra 3ee1d8549f Fix some comments, and a formatting error. 2001-02-27 07:11:41 +00:00
Alan Modra df8634e34b (elf32_hppa_set_gp): Handle weak $global$.
If $global$ referenced but not defined, set its value here.
2001-02-13 10:14:14 +00:00
Alan Modra d952f17a9d Linux target variants for elfxx-hppa. 2001-01-14 11:12:53 +00:00
Alan Modra c46b75158b Use SEGREL32 relocs for elf32-hppa unwind. 2001-01-14 07:03:49 +00:00
Alan Modra 150ccafb7a Correct DT_INIT/DT_FINI ABI violation 2001-01-14 05:58:15 +00:00
Kazu Hirata 6609fa7475 2000-12-05 Kazu Hirata <kazu@hxi.com>
* elf32-fr30.c: Fix formatting.
	* elf32-hppa.c: Likewise.
	* elf32-i370.c: Likewise.
	* elf32-i386.c: Likewise.
	* elf32-i860.c: Likewise.
	* elf32-i960.c: Likewise.
2000-12-05 13:20:10 +00:00
Alan Modra 36605136d4 Correct call to _bfd_elf32_gc_record_vtable. 2000-10-02 09:09:27 +00:00
Alan Modra 47d89dba5e .plt stub for lazy linking, --stub-group-size=N ld switch,
import stub fix, extra DIR14F reloc to fix abort in tc_gen_reloc
2000-09-27 17:30:19 +00:00
Alan Modra 1badb539a7 Correct comments. Don't check non-code output sections for stub
grouping.  (In the process, partly revert and fix bugs introduced
with the last change.  Oops.)
2000-09-21 13:40:00 +00:00
Alan Modra a017a7241d Fix a segfault caused by under-allocating an array. 2000-09-21 10:13:18 +00:00
Alan Modra 25f7275229 Group stub sections. 2000-09-18 12:22:43 +00:00
Alan Modra d5c73c2f38 Find the first .init and .fini sections correctly.
Clobber millicode syms via a hash traversal here.  elf_adjust_dynamic_symbol
really ought to let us look at all dynamic symbols, but it doesn't.
2000-09-15 10:24:50 +00:00
Alan Modra 74d1c347e9 Lots of bug fixes. .plt entries for DT_INIT, DT_FINI, and any
local function that has a plabel.  Size the stub reloc sections
as we size the stubs.
2000-09-14 12:55:45 +00:00
Alan Modra 30667bf3fc Shared lib support. 2000-09-05 05:03:43 +00:00
Alan Modra edd21acadc Restore hppa-elf32 to working order. 2000-07-09 07:23:07 +00:00
Alan Modra 3f9b03b5da Assorted code cleanup and fixes for hppa. Re-enable elf32-hppa as
it now compiles even if it doesn't work too well.
2000-05-02 00:12:52 +00:00
Alan Modra 43cbcf2859 Fit 64-bit nits. 2000-04-11 13:07:56 +00:00
H.J. Lu 5cc7c785d2 2000-03-01 H.J. Lu <hjl@gnu.org>
* aoutx.h (aout_link_input_section_std): Pass "true" to
	the undefined_symbol callback.
	(aout_link_input_section_ext): Likewise.
	* bout.c (get_value): Likewise.
	* coff-a29k.c (coff_a29k_relocate_section): Likewise.
	* coff-alpha.c (alpha_ecoff_get_relocated_section_conten):
	Likewise.
	(alpha_relocate_section): Likewise.
	* coff-arm.c (coff_arm_relocate_section): Likewise.
	* coff-i960.c (coff_i960_relocate_section): Likewise.
	* coff-mcore.c (coff_mcore_relocate_section): Likewise.
	* coff-mips.c (mips_relocate_section): Likewise.
	* coff-ppc.c (coff_ppc_relocate_section): Likewise.
	* coff-sh.c (sh_relocate_section): Likewise.
	* coff-tic80.c (coff_tic80_relocate_section): Likewise.
	* cofflink.c (_bfd_coff_generic_relocate_section): Likewise.
	* elf-m10200.c (mn10200_elf_relocate_section): Likewise.
	* elf-m10300.c (mn10300_elf_relocate_section): Likewise.
	* elf32-d10v.c (elf32_d10v_relocate_section): Likewise.
	* elf32-fr30.c (fr30_elf_relocate_section): Likewise.
	* elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
	* elf32-i370.c (i370_elf_relocate_section): Likewise.
	* elf32-m32r.c (m32r_elf_relocate_section): Likewise.
	* elf32-mcore.c (mcore_elf_relocate_section): Likewise.
	* elf32-sh.c (sh_elf_relocate_section): Likewise.
	* elf32-v850.c (v850_elf_relocate_section): Likewise.
	* elflink.c (_bfd_elf_link_record_dynamic_symbol): Likewise.
	* elflink.h (elf_link_output_extsym): Likewise.
	* pe-mips.c (coff_pe_mips_relocate_section): Likewise.
	* reloc.c (bfd_generic_get_relocated_section_conten): Likewise.
	* reloc16.c (_bfd_ppc_xcoff_relocate_section): Likewise.

	* elf-hppa.h (elf_hppa_relocate_section): Pass "false" to the
	undefined_symbol callback when building shared library with
	-Bsymbolic and undefined symbols are allowed. Otherwise, pass
	"true".
	* elf32-arm.h (elf32_arm_relocate_section): Likewise.
	* elf32-i386.c (elf_i386_relocate_section): Likewise.
	* elf32-m68k.c (elf_m68k_relocate_section): Likewise.
	* elf32-mips.c (mips_elf_calculate_relocation): Likewise.
	(elf32_mips_get_relocated_section_content): Likewise.
	* elf32-ppc.c (ppc_elf_relocate_section): Likewise.
	* elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
	* elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
	* elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
2000-03-01 19:40:54 +00:00
Ian Lance Taylor 1396cd2d7f 1999-08-17 H.J. Lu <hjl@gnu.org>
* elf32-hppa.c (bfd_elf32_bfd_is_local_label_name): Fix typo in
	macro definition.
1999-08-17 07:53:37 +00:00
Jeff Law 052e120f44 * elf-hppa.h (elf_hppa_fake_sections): New function.
* elf32-hppa.c (elf_backend_fake_sections): Define.
1999-08-11 09:30:20 +00:00
Jeff Law 432bdd91dd * elf-hppa.h (_bfd_elf_hppa_gen_reloc_type, case 32): When in
64bit mode, generate a section relative relocation for a 32bit
        wide relocation.
        (elf_hppa_is_local_label_name): New function.
        * elf32-hppa.c (elf_hppa_is_local_label_name): Deleted.  To be
        shared between 32bit and 64bit port.
1999-08-09 23:47:04 +00:00
Ian Lance Taylor 5f771d47c7 * Many files: Changes to avoid gcc warnings: Add ATTRIBUTE_UNUSED
as appropriate.  Use EMPTY_HOWTO as appropriate.  Fill in
	structure initializations.  Add casts.
	* reloc.c (EMPTY_HOWTO): Define.
	* bfd-in2.h: Rebuild.
	* coff-h8300.c (h8300_reloc16_extra_cases): Remove useless
	comparisons against 0.
	* elf32-sparc.c (elf32_sparc_merge_private_bfd_data): Change
	previous_ibfd_e_flags to unsigned long.
	* vms.h (struct vms_private_data_struct): Change section_count to
	unsigned.
	* vms-gsd.c (_bfd_vms_slurp_gsd): Change psect_idx to unsigned.
	(_bfd_vms_write_gsd): Change symnum to unsigned.
	* vms-hdr.c (_bfd_vms_write_hdr): Change symnum to unsigned.
	* vms-tir.c (etir_sta): Change psect to unsigned.
	(alloc_section): Change idx to unsigned.
	(tir_sta, tir_ctl): Change psect to unsigned.
	(_bfd_vms_write_tir): Change len and before to bfd_size_type.
	* vms.c (priv_section_count): Change to unsigned.
1999-07-12 10:30:21 +00:00
Ian Lance Taylor e049a0de5a * Many files: Changes to avoid gcc warnings: Remove unused local
variables.  Add default case to enum switches.
	* coff-arm.c (bfd_arm_allocate_interworking_sections): Only
	compile if not COFF_IMAGE_WITH_PE.
	(record_arm_to_thumb_glue, record_thumb_to_arm_glue): Likewise.
	(bfd_arm_get_bfd_for_interworking): Likewise.
	(bfd_arm_process_before_allocation): Likewise.
	* epoc-pei-arm.c: Don't rename bfd_arm functions.
	* pei-arm.c: Likewise.
	* elf32-mips.c (mips_elf_link_hash_table_create): Don't declare.
	(MIPS_ELF_ADD_DYNAMIC_ENTRY): Correct last change.
	(mips_elf_got16_entry): Put parens around & in body of ==.
	(mips_elf_calculate_relocation): Correct test for empty string.
	* vms-gsd.c: Use _bfd_error_handler rather than fprintf to
	stderr.
	* vms-misc.c (_bfd_vms_length_hash_symbol): Correct sprintf
	format.
1999-07-12 07:35:20 +00:00
Jeff Law 9acc3dfe89 °
* elf-hppa.c (elf_hppa_howto_table): Use bfd_elf_generic_reloc as
        relocation function.
        * elf32-hppa.c (hppa_elf_reloc): Kill unused/unwanted function.
1999-06-29 01:28:26 +00:00
Jeff Law 31bd8f254f ð
* elf-hppa.c (elf_hppa_final_write_processing): New function.
        * elf32-hppa.c: Remove everything related to symbol extension
        sections & records.  Use the common elf_hppa_final_write_processing.
1999-06-24 20:01:44 +00:00
Jeff Law 9e103c9cd2 * elf-hppa.h: New file. Common stuff for elf32 and elf64 PA
support.
        * elf32-hppa.c: Include elf-hppa.h.
        (ARCH_SIZE): Define.
        (elf_hppa_reloc_type_lookup): Delete.  Found in the common code
        now.
        (elf32_hppa_info_to_howto): Similarly.
        (elf_hppa_howto_table): Similarly.
        (elf_hppa_reloc_type_lookup): Similarly.
        (hppa_elf_gen_reloc_type): Similarly.
        * elf32-hppa.h (ELF_HOWTO_TALBE, N_PARISC_RELOCS): Delete.
1999-06-22 12:20:30 +00:00
Richard Henderson 252b5132c7 19990502 sourceware import 1999-05-03 07:29:11 +00:00